作者 lihongjuan

1

要显示太多修改。

为保证性能只显示 50 of 50+ 个文件。

@@ -33,7 +33,107 @@ App({ @@ -33,7 +33,107 @@ App({
33 } 33 }
34 }) 34 })
35 }, 35 },
  36 +
  37 + post: function (url, data, headerParams) {
  38 + wx.showNavigationBarLoading()
  39 + var promise = new Promise((resolve, reject) => {
  40 + //init
  41 + let that = this;
  42 + let postData = data;
  43 + let baseUrl = 'http://delicacy.w.brotop.cn/api/';
  44 + //网络请求
  45 + let header = {
  46 + // 'XX-Device-Type': 'wxapp',
  47 + 'token': wx.getStorageSync("token") || ''
  48 + }
  49 + header = Object.assign(header, headerParams)
  50 + //网络请求
  51 + wx.request({
  52 + url: baseUrl + url,
  53 + data: postData,
  54 + method: headerParams,
  55 + header: header,
  56 + success: function (res) { //返回取得的数据
  57 + if (res.data.code == '1') {
  58 + resolve(res.data.data);
  59 + } else if (res.data.code == '201') {
  60 + resolve(res.data);
  61 + } else {
  62 + // wx.showToast({
  63 + // title: res.data.msg,
  64 + // duration: 1200,
  65 + // icon: 'none'
  66 + // })
  67 + reject(res)
  68 + }
  69 +
  70 + // else if (res.data.code == '42002') {
  71 +
  72 + // }
  73 + // setTimeout(function () {
  74 +
  75 + // wx.hideNavigationBarLoading()
  76 + // }, 600)
  77 + },
  78 + fail: function (e) {
  79 + reject('网络出错');
  80 + // wx.hideLoading()
  81 + wx.hideNavigationBarLoading()
  82 + },
  83 + complete: function () {
  84 + wx.hideNavigationBarLoading()
  85 + },
  86 + })
  87 + });
  88 + return promise;
  89 + },
  90 + upload(filetype, file) {
  91 +
  92 + var promise = new Promise((resolve, reject) => {
  93 + wx.showNavigationBarLoading()
  94 + wx.showLoading({
  95 + title: '上传中',
  96 + })
  97 + let url = 'http://delicacy.w.brotop.cn/api/common/upload';
  98 + let head = {
  99 + 'token': wx.getStorageSync('token'),
  100 + 'XX-Device-Type': ''
  101 + }
  102 + let typename = {
  103 + filetype: filetype
  104 + }
  105 + wx.uploadFile({
  106 + url: url, //仅为示例,非真实的接口地址
  107 + filePath: file,
  108 + name: 'file',
  109 + header: head,
  110 + formData: typename,
  111 + success: function (res) {
  112 + console.log('上传文件后', res)
  113 + let temdata = JSON.parse(res.data);
  114 + console.log(temdata)
  115 + let urlobj = {
  116 +
  117 + url: temdata.data.url
  118 + }
  119 + resolve(urlobj);
  120 +
  121 + },
  122 + fail: function (res) {
  123 + reject('网络出错');
  124 + wx.hideNavigationBarLoading()
  125 + wx.hideLoading()
  126 + },
  127 + complete: () => {
  128 + wx.hideNavigationBarLoading()
  129 + wx.hideLoading()
  130 + },
  131 + })
  132 + });
  133 + return promise;
  134 + },
36 globalData: { 135 globalData: {
37 - userInfo: null 136 + userInfo: null,
  137 + baseurl:'http://delicacy.w.brotop.cn'
38 } 138 }
39 }) 139 })
1 { 1 {
2 "pages": [ 2 "pages": [
3 "pages/homepage/homepage", 3 "pages/homepage/homepage",
4 - "pages/personziliao/personziliao",  
5 -  
6 "pages/examine/examine", 4 "pages/examine/examine",
  5 + "pages/index/index",
  6 + "pages/personziliao/personziliao",
7 "pages/comment/comment", 7 "pages/comment/comment",
8 "pages/passPhotos/passPhotos", 8 "pages/passPhotos/passPhotos",
9 "pages/collectlist/collectlist", 9 "pages/collectlist/collectlist",
@@ -14,13 +14,14 @@ @@ -14,13 +14,14 @@
14 "pages/morecomment/morecomment", 14 "pages/morecomment/morecomment",
15 "pages/searchresult/searchresult", 15 "pages/searchresult/searchresult",
16 "pages/searchcity/searchcity", 16 "pages/searchcity/searchcity",
17 - "pages/index/index",  
18 "pages/logs/logs", 17 "pages/logs/logs",
19 "pages/login/login", 18 "pages/login/login",
20 "pages/recommond/recommond", 19 "pages/recommond/recommond",
21 "pages/canting/canting", 20 "pages/canting/canting",
22 - "pages/mycomment/mycomment"  
23 - 21 + "pages/mycomment/mycomment",
  22 + "pages/personpage/personpage",
  23 + "pages/rank/rankpage",
  24 + "pages/morepic/morepic"
24 ], 25 ],
25 "window": { 26 "window": {
26 "backgroundTextStyle": "light", 27 "backgroundTextStyle": "light",
1 -  
2 /* 输入框搜索 */ 1 /* 输入框搜索 */
3 -image{  
4 - width:100%;  
5 - height:100%; 2 +
  3 +image {
  4 + width: 100%;
  5 + height: 100%;
6 } 6 }
  7 +
7 .head { 8 .head {
8 - width: 750rpx;  
9 - display: flex;  
10 - align-items: center;  
11 - justify-content: space-between;  
12 - padding: 24rpx 32rpx;  
13 - box-sizing: border-box;  
14 - }  
15 -  
16 - .headleft {  
17 - display: flex;  
18 -  
19 - align-items: center;  
20 - justify-content: center  
21 - }  
22 -  
23 - .headleftimg {  
24 - width: 31rpx;  
25 - height: 31rpx;  
26 - font-size: 0;  
27 - }  
28 -  
29 - .headmiddle {  
30 - width: 542rpx;  
31 - height: 60rpx;  
32 - background: rgba(249, 249, 249, 1);  
33 - border-radius: 32rpx;  
34 - display: flex;  
35 - align-items: center;  
36 - padding: 16rpx 20rpx;  
37 - box-sizing: border-box;  
38 - }  
39 -  
40 - .headmiddleleft {  
41 - width: 32rpx;  
42 - height: 32rpx;  
43 - font-size: 0;  
44 - }  
45 -  
46 - .headmiddleleft image {  
47 - width: 100%;  
48 - height: 100%;  
49 - }  
50 -  
51 - .headright {  
52 - width: 48rpx;  
53 - height: 48rpx;  
54 - font-size: 0;  
55 - position: relative;  
56 - }  
57 -  
58 - .sizenum {  
59 - width: 32rpx;  
60 - height: 32rpx;  
61 - color: #FF4E14;  
62 - font-size: 20rpx;  
63 - text-align: center;  
64 - line-height: 30rpx;  
65 - position: absolute;  
66 - right: -15rpx;  
67 - top: -5rpx;  
68 - background: #fff;  
69 - border-radius: 50%;  
70 - border: 1rpx solid #FF4E14;  
71 - }  
72 - .headmiddleright{  
73 - width:400rx;  
74 - margin-left:16rpx;  
75 -  
76 - }  
77 -  
78 - .headmiddleright input {  
79 - width: 100%;  
80 - height: 100%;  
81 - color: #BDC4CE;  
82 - font-size: 24rpx;  
83 - padding: 12rpx 0;  
84 - box-sizing: border-box  
85 - }  
86 -  
87 - .cityname {  
88 - color: #fff;  
89 - font-size: 22rpx;  
90 - margin-top: 5rpx;  
91 - }  
92 -  
93 - .headbot {  
94 - height: 256rpx;  
95 - width: 750rpx;  
96 - background: #C29445;  
97 - position: relative;  
98 - }  
99 -.shuru{  
100 - color:#BDC4CE;  
101 - font-size: 28rpx; 9 + width: 750rpx;
  10 + display: flex;
  11 + align-items: center;
  12 + justify-content: space-between;
  13 + padding: 24rpx 32rpx;
  14 + box-sizing: border-box;
  15 +}
  16 +
  17 +.headleft {
  18 + display: flex;
  19 + align-items: center;
  20 + justify-content: center;
  21 +}
  22 +
  23 +.headleftimg {
  24 + width: 31rpx;
  25 + height: 31rpx;
  26 + font-size: 0;
  27 +}
  28 +
  29 +.headmiddle {
  30 + width: 542rpx;
  31 + height: 60rpx;
  32 + background: rgba(249, 249, 249, 1);
  33 + border-radius: 32rpx;
  34 + display: flex;
  35 + align-items: center;
  36 + padding: 16rpx 20rpx;
  37 + box-sizing: border-box;
  38 +}
  39 +
  40 +.headmiddleleft {
  41 + width: 32rpx;
  42 + height: 32rpx;
  43 + font-size: 0;
  44 +}
  45 +
  46 +.headmiddleleft image {
  47 + width: 100%;
  48 + height: 100%;
  49 +}
  50 +
  51 +.headright {
  52 + width: 48rpx;
  53 + height: 48rpx;
  54 + font-size: 0;
  55 + position: relative;
  56 +}
  57 +
  58 +.sizenum {
  59 + width: 32rpx;
  60 + height: 32rpx;
  61 + color: #ff4e14;
  62 + font-size: 20rpx;
  63 + text-align: center;
  64 + line-height: 30rpx;
  65 + position: absolute;
  66 + right: -15rpx;
  67 + top: -5rpx;
  68 + background: #fff;
  69 + border-radius: 50%;
  70 + border: 1rpx solid #ff4e14;
  71 +}
  72 +
  73 +.headmiddleright {
  74 + width: 400rx;
  75 + margin-left: 16rpx;
  76 +}
  77 +
  78 +.headmiddleright input {
  79 + width: 100%;
  80 + height: 100%;
  81 + color: #bdc4ce;
  82 + font-size: 24rpx;
  83 + padding: 12rpx 0;
  84 + box-sizing: border-box;
102 } 85 }
103 86
  87 +.cityname {
  88 + color: #fff;
  89 + font-size: 22rpx;
  90 + margin-top: 5rpx;
  91 +}
104 92
105 -.commonname{  
106 - color:#06121E;  
107 - font-size: 32rpx 93 +.headbot {
  94 + height: 256rpx;
  95 + width: 750rpx;
  96 + background: #c29445;
  97 + position: relative;
108 } 98 }
109 -.commnameone{  
110 - color:#06121E; 99 +
  100 +.shuru {
  101 + color: #bdc4ce;
  102 + font-size: 28rpx;
  103 +}
  104 +
  105 +.commonname {
  106 + color: #06121e;
  107 + font-size: 32rpx;
  108 +}
  109 +
  110 +.commnameone {
  111 + color: #06121e;
111 font-size: 28rpx; 112 font-size: 28rpx;
112 } 113 }
113 114
@@ -131,11 +132,13 @@ image{ @@ -131,11 +132,13 @@ image{
131 align-items: center; 132 align-items: center;
132 justify-content: center; 133 justify-content: center;
133 } 134 }
134 -.commonpadding{ 135 +
  136 +.commonpadding {
135 padding: 32rpx; 137 padding: 32rpx;
136 box-sizing: border-box; 138 box-sizing: border-box;
137 background: #fff; 139 background: #fff;
138 } 140 }
  141 +
139 .yourow { 142 .yourow {
140 width: 15rpx; 143 width: 15rpx;
141 height: 20rpx; 144 height: 20rpx;
@@ -143,12 +146,14 @@ image{ @@ -143,12 +146,14 @@ image{
143 } 146 }
144 147
145 /* 五角星 */ 148 /* 五角星 */
146 -.staritem{  
147 - width:32rpx;  
148 - height:32rpx; 149 +
  150 +.staritem {
  151 + width: 32rpx;
  152 + height: 32rpx;
149 font-size: 0; 153 font-size: 0;
150 - margin-right:4rpx; 154 + margin-right: 4rpx;
151 } 155 }
  156 +
152 .register { 157 .register {
153 width: 100%; 158 width: 100%;
154 height: 100%; 159 height: 100%;
@@ -159,10 +164,46 @@ image{ @@ -159,10 +164,46 @@ image{
159 right: 0; 164 right: 0;
160 z-index: 999; 165 z-index: 999;
161 } 166 }
162 -.nomoer{  
163 - color:#8C9198;  
164 - font-size:24rpx; 167 +
  168 +.nomoer {
  169 + color: #8c9198;
  170 + font-size: 24rpx;
165 text-align: center; 171 text-align: center;
166 - margin-top:26rpx;  
167 - padding-bottom:20rpx; 172 + margin-top: 26rpx;
  173 + padding-bottom: 20rpx;
  174 +}
  175 +
  176 +.nodata {
  177 + color: #999;
  178 + font-size: 32rpx;
  179 + text-align: center;
  180 + margin-top: 100rpx;
  181 +}
  182 +
  183 +.noimg {
  184 + width: 523rpx;
  185 + /* height:215rpx; */
  186 + position: absolute;
  187 + top: 50%;
  188 + left: 50%;
  189 + transform: translate(-50%, -50%);
  190 +}
  191 +
  192 +.nodataimg {
  193 + width: 523rpx;
  194 + height: 315rpx;
  195 + font-size: 0;
  196 +}
  197 +
  198 +
  199 +
  200 +.nomoer {
  201 + color: #8c9198;
  202 + font-size: 24rpx;
  203 + text-align: center;
  204 + margin-top: 26rpx;
  205 + padding-bottom: 20rpx;
  206 +}
  207 +.nomoredata {
  208 + margin-top: 208rpx;
168 } 209 }

734 字节

1 // pages/canting/canting.js 1 // pages/canting/canting.js
  2 +const app=getApp()
2 Page({ 3 Page({
3 4
4 /** 5 /**
5 * 页面的初始数据 6 * 页面的初始数据
6 */ 7 */
7 data: { 8 data: {
8 - 9 + restaurant:[]
9 }, 10 },
10 11
11 /** 12 /**
12 * 生命周期函数--监听页面加载 13 * 生命周期函数--监听页面加载
13 */ 14 */
14 onLoad: function (options) { 15 onLoad: function (options) {
  16 + this.getrestaurant()
  17 + },
  18 + getrestaurant(){
  19 + let that = this;
  20 + var url = '/member/getSign';
  21 + var params = {
  22 + page:that.data.page,
  23 + limit:15
  24 +
  25 + }
  26 + app.post(url, params,"post").then((res) => {
  27 + console.log(res);
  28 + that.setData({
  29 + restaurant:that.data.restaurant.concat(res.data)
  30 + })
  31 +
  32 +
15 33
  34 + }).catch((err) => {
  35 +
  36 + })
  37 + },
  38 +
  39 + goodtail(e) {
  40 + let id = e.currentTarget.dataset.id;
  41 + wx.navigateTo({
  42 + url: '/pages/shopdetail/shopdetail?id=' + id,
  43 + })
16 }, 44 },
17 45
18 /** 46 /**
@@ -54,7 +82,12 @@ Page({ @@ -54,7 +82,12 @@ Page({
54 * 页面上拉触底事件的处理函数 82 * 页面上拉触底事件的处理函数
55 */ 83 */
56 onReachBottom: function () { 84 onReachBottom: function () {
57 - 85 + let newpage=this.data.page;
  86 + newpage++;
  87 + this.setData({
  88 + page:newpage
  89 + })
  90 + this.getrestaurant()
58 }, 91 },
59 92
60 /** 93 /**
1 -<view class="colecttop flextwo"> 1 +<!-- <view class="colecttop flextwo">
2 <view class="comt">(20/34)</view> 2 <view class="comt">(20/34)</view>
3 -</view>  
4 -<view class="collectbox">  
5 - <view class="colectbitem flex"> 3 +</view> -->
  4 + <view class="noimg" wx:if="{{restaurant.length==0}}">
  5 + <view class="nodataimg" >
  6 + <image src="/img/nodataimg.png"></image>
  7 + </view>
  8 + <view class="nomoer nomoredata">没有更多了哦~</view>
  9 + </view>
  10 +
  11 +<view class="collectbox" wx:else>
  12 + <view class="colectbitem flex" wx:for="{{restaurant}}" wx:key="" bindtap="goodtail" data-id="{{item.id}}">
6 <view class="collectbitemleft"> 13 <view class="collectbitemleft">
7 - <image src="/img/photo.png"></image> 14 + <image src="{{item.image}}"></image>
8 </view> 15 </view>
9 <view class="collectbtitemr"> 16 <view class="collectbtitemr">
10 - <view class='goodname'>海贼王寿司店</view> 17 + <view class='goodname'>{{item.name}}</view>
11 18
12 <view class="flexone starbox"> 19 <view class="flexone starbox">
13 - <view class="star flexone"> 20 + <view class="star flexone">
14 <view class="staritem"> 21 <view class="staritem">
15 - <image src="/img/pingfenshi.png"></image> 22 + <image src="/img/pingfenshi.png" wx:if="{{item.level>=1}}"></image>
  23 + <image src="/img/noxing.png" wx:if="{{item.level<0.5}}"></image>
  24 + <image src="/img/banke.png" wx:if="{{item.level>=0.5&&item.level<1}}"></image>
16 </view> 25 </view>
17 <view class="staritem"> 26 <view class="staritem">
18 - <image src="/img/pingfenshi.png"></image> 27 + <image src="/img/pingfenshi.png" wx:if="{{item.level>=2}}"></image>
  28 + <image src="/img/noxing.png" wx:if="{{item.level<1.5}}"></image>
  29 + <image src="/img/banke.png" wx:if="{{item.level>=1.5&&item.level<2}}"></image>
19 </view> 30 </view>
20 <view class="staritem"> 31 <view class="staritem">
21 - <image src="/img/pingfenshi.png"></image> 32 + <image src="/img/pingfenshi.png" wx:if="{{item.level>=3}}"></image>
  33 + <image src="/img/noxing.png" wx:if="{{item.level<2.5}}"></image>
  34 + <image src="/img/banke.png" wx:if="{{item.level>=2.5&&item.level<3}}"></image>
22 </view> 35 </view>
23 <view class="staritem"> 36 <view class="staritem">
24 - <image src="/img/pingfenshi.png"></image> 37 + <image src="/img/pingfenshi.png" wx:if="{{item.level>=4}}"></image>
  38 + <image src="/img/noxing.png" wx:if="{{item.level<3.5}}"></image>
  39 + <image src="/img/banke.png" wx:if="{{item.level>=3.5&&item.level<4}}"></image>
25 </view> 40 </view>
26 <view class="staritem"> 41 <view class="staritem">
27 - <image src="/img/pingfenshi.png"></image> 42 + <image src="/img/pingfenshi.png" wx:if="{{item.level>=5}}"></image>
  43 + <image src="/img/noxing.png" wx:if="{{item.level<4.5}}"></image>
  44 + <image src="/img/banke.png" wx:if="{{item.level>=4.5&&item.level<5}}"></image>
28 </view> 45 </view>
29 </view> 46 </view>
30 - <view class="shouprice">¥88</view> 47 + <view class="shouprice">¥{{item.price}}</view>
31 </view> 48 </view>
32 <view class="addressbox flexone"> 49 <view class="addressbox flexone">
33 - <view class='asddressitem'>东京街</view>  
34 - <view class='asddressitem'>东京街</view>  
35 - <view class='asddressitem'>东京街</view> 50 + <view class='asddressitem'>{{item.business_name}}</view>
  51 + <view class='asddressitem'>{{item.series_name}}</view>
  52 + <!-- <view class='asddressitem'>东京街</view> -->
36 </view> 53 </view>
37 </view> 54 </view>
38 55
39 </view> 56 </view>
40 - <view class="colectbitem flex"> 57 + <!-- <view class="colectbitem flex">
41 <view class="collectbitemleft"> 58 <view class="collectbitemleft">
42 <image src="/img/photo.png"></image> 59 <image src="/img/photo.png"></image>
43 </view> 60 </view>
@@ -71,7 +88,7 @@ @@ -71,7 +88,7 @@
71 </view> 88 </view>
72 </view> 89 </view>
73 90
74 - </view> 91 + </view> -->
75 </view> 92 </view>
76 93
77 -<view class="nomoer">没有更多了哦~</view>  
  94 +<!-- <view class="nomoer">没有更多了哦~</view> -->
@@ -6,4 +6,7 @@ @@ -6,4 +6,7 @@
6 .colecttop{ 6 .colecttop{
7 padding: 10rpx 32rpx; 7 padding: 10rpx 32rpx;
8 box-sizing: border-box 8 box-sizing: border-box
  9 +}
  10 +.collectbox{
  11 + margin-top:20rpx;
9 } 12 }
1 // pages/collectlist/collectlist.js 1 // pages/collectlist/collectlist.js
  2 +const app=getApp()
2 Page({ 3 Page({
3 4
4 /** 5 /**
@@ -7,14 +8,32 @@ Page({ @@ -7,14 +8,32 @@ Page({
7 data: { 8 data: {
8 nav: 1, 9 nav: 1,
9 delBtnWidth: 160, 10 delBtnWidth: 160,
10 - data: [{ content: "1", right: 0 }, { content: "2", right: 0 }, { content: "3", right: 0 }, { content: "4", right: 0 }, { content: "5", right: 0 }, { content: "6", right: 0 }, { content: "7", right: 0 }, { content: "8", right: 0 }, { content: "9", right: 0 }, { content: "10", right: 0 }], 11 + data: [],
11 isScroll: true, 12 isScroll: true,
12 windowHeight: 0, 13 windowHeight: 0,
  14 + page:1,
  15 + colectlist:[],
  16 + dianpinglist:[],
  17 + pagek:1,
  18 + nomore:false
13 }, 19 },
14 sel(e) { 20 sel(e) {
15 this.setData({ 21 this.setData({
16 nav: e.currentTarget.dataset.id 22 nav: e.currentTarget.dataset.id
17 }) 23 })
  24 + if(this.data.nav==1){
  25 + this.setData({
  26 + page:1,
  27 + colectlist:[]
  28 + })
  29 + this.getcollect()
  30 + }else{
  31 + this.setData({
  32 + page: 1,
  33 + data:[]
  34 + })
  35 + this.getcommentlist()
  36 + }
18 }, 37 },
19 /** 38 /**
20 * 生命周期函数--监听页面加载 39 * 生命周期函数--监听页面加载
@@ -28,6 +47,15 @@ Page({ @@ -28,6 +47,15 @@ Page({
28 }); 47 });
29 } 48 }
30 }); 49 });
  50 +
  51 + this.getcollect()
  52 + },
  53 +
  54 + goodtail(e) {
  55 + let id = e.currentTarget.dataset.id;
  56 + wx.navigateTo({
  57 + url: '/pages/shopdetail/shopdetail?id=' + id,
  58 + })
31 }, 59 },
32 drawStart: function (e) { 60 drawStart: function (e) {
33 // console.log("drawStart"); 61 // console.log("drawStart");
@@ -83,7 +111,85 @@ Page({ @@ -83,7 +111,85 @@ Page({
83 }, 111 },
84 112
85 delItem: function (e) { 113 delItem: function (e) {
  114 + let that=this;
  115 + let id=e.currentTarget.dataset.id;
  116 + console.log(id)
  117 + wx.showModal({
  118 + title: '提示',
  119 + content: '是否删除此条点评',
  120 + success(res) {
  121 + if (res.confirm) {
  122 + let that = this;
  123 + var url = '/remark/deleteRemark';
  124 + var params = {
  125 + remark_id: id,
  126 +
  127 + }
  128 + app.post(url, params).then((res) => {
  129 + console.log(res);
  130 + wx.showToast({
  131 + title: '删除成功',
  132 + icon:"none"
  133 + })
  134 + that.setData({
  135 + pagek:1,
  136 + data:[]
  137 + })
  138 + that.getcommentlist()
  139 +
  140 +
  141 +
  142 + }).catch((err) => {
  143 +
  144 + })
  145 + } else if (res.cancel) {
  146 + console.log('用户点击取消')
  147 + }
  148 + }
  149 + })
  150 + },
  151 +
  152 + // 获取我的收藏
  153 + getcollect(){
  154 + let that = this;
  155 + var url = 'member/getShopCollect';
  156 + var params = {
  157 + page:that.data.page,
  158 + limit:15
  159 +
  160 + }
  161 + app.post(url, params,"post").then((res) => {
  162 + console.log(res);
  163 + that.setData({
  164 + colectlist: that.data.colectlist.concat(res.data)
  165 + })
  166 +
  167 + console.log(that.data.colectlist)
86 168
  169 + }).catch((err) => {
  170 +
  171 + })
  172 + },
  173 + // 获取我的点评
  174 + getcommentlist(){
  175 + let that = this;
  176 + var url = '/member/getRemarkCollect';
  177 + var params = {
  178 + page: that.data.pagek,
  179 + limit:15
  180 +
  181 + }
  182 + app.post(url, params,"post").then((res) => {
  183 + console.log(res);
  184 + that.setData({
  185 + data:that.data.data.concat(res.data)
  186 + })
  187 +
  188 +
  189 +
  190 + }).catch((err) => {
  191 +
  192 + })
87 }, 193 },
88 /** 194 /**
89 * 生命周期函数--监听页面初次渲染完成 195 * 生命周期函数--监听页面初次渲染完成
@@ -124,6 +230,22 @@ Page({ @@ -124,6 +230,22 @@ Page({
124 * 页面上拉触底事件的处理函数 230 * 页面上拉触底事件的处理函数
125 */ 231 */
126 onReachBottom: function() { 232 onReachBottom: function() {
  233 + if(this.data.nav==1){
  234 + let newpage = this.data.page;
  235 + newpage++;
  236 + this.setData({
  237 + page: newpage
  238 + })
  239 + this.colectlist()
  240 + }else{
  241 + let newpage=this.data.pagek;
  242 + newpage++;
  243 + this.setData({
  244 + pagek:newpage
  245 + })
  246 + this.getcommentlsit()
  247 + }
  248 +
127 249
128 }, 250 },
129 251
@@ -3,112 +3,112 @@ @@ -3,112 +3,112 @@
3 <view class="collectitem {{nav==2?'collectactive':''}}" bindtap="sel" data-id="2">点评</view> 3 <view class="collectitem {{nav==2?'collectactive':''}}" bindtap="sel" data-id="2">点评</view>
4 </view> 4 </view>
5 <view class="collectbox" wx:if="{{nav==1}}"> 5 <view class="collectbox" wx:if="{{nav==1}}">
6 - <view class="colectbitem flex">  
7 - <view class="collectbitemleft">  
8 - <image src="/img/photo.png"></image>  
9 - </view>  
10 - <view class="collectbtitemr">  
11 - <view class='goodname'>海贼王寿司店</view>  
12 6
13 - <view class="flexone starbox">  
14 - <view class="star flexone">  
15 - <view class="staritem">  
16 - <image src="/img/pingfenshi.png"></image>  
17 - </view>  
18 - <view class="staritem">  
19 - <image src="/img/pingfenshi.png"></image>  
20 - </view>  
21 - <view class="staritem">  
22 - <image src="/img/pingfenshi.png"></image>  
23 - </view>  
24 - <view class="staritem">  
25 - <image src="/img/pingfenshi.png"></image>  
26 - </view>  
27 - <view class="staritem">  
28 - <image src="/img/pingfenshi.png"></image>  
29 - </view>  
30 - </view>  
31 - <view class="shouprice">¥88</view>  
32 - </view>  
33 - <view class="addressbox flexone">  
34 - <view class='asddressitem'>东京街</view>  
35 - <view class='asddressitem'>东京街</view>  
36 - <view class='asddressitem'>东京街</view>  
37 - </view> 7 + <view class="noimg" wx:if="{{colectlist.length==0}}">
  8 + <view class="nodataimg" >
  9 + <image src="/img/nodataimg.png"></image>
38 </view> 10 </view>
39 - 11 + <view class="nomoer nomoredata">没有更多了哦~</view>
40 </view> 12 </view>
41 - <view class="colectbitem flex">  
42 - <view class="collectbitemleft">  
43 - <image src="/img/photo.png"></image>  
44 - </view>  
45 - <view class="collectbtitemr">  
46 - <view class='goodname'>海贼王寿司店</view>  
47 13
48 - <view class="flexone starbox">  
49 - <view class="star flexone">  
50 - <view class="staritem">  
51 - <image src="/img/pingfenshi.png"></image>  
52 - </view>  
53 - <view class="staritem">  
54 - <image src="/img/pingfenshi.png"></image>  
55 - </view>  
56 - <view class="staritem">  
57 - <image src="/img/pingfenshi.png"></image>  
58 - </view>  
59 - <view class="staritem">  
60 - <image src="/img/pingfenshi.png"></image>  
61 - </view>  
62 - <view class="staritem">  
63 - <image src="/img/pingfenshi.png"></image> 14 +
  15 + <view wx:else>
  16 + <view class="colectbitem flex" wx:for="{{colectlist}}" wx:key="" bindtap="goodtail" data-id="{{item.id}}">
  17 + <view class="collectbitemleft">
  18 + <image src="{{item.image}}"></image>
  19 + </view>
  20 + <view class="collectbtitemr">
  21 + <view class='goodname'>{{item.name}}</view>
  22 +
  23 + <view class="flexone starbox">
  24 + <view class="star flexone">
  25 + <view class="staritem">
  26 + <image src="/img/pingfenshi.png" wx:if="{{item.level>=1}}"></image>
  27 + <image src="/img/noxing.png" wx:if="{{item.level<0.5}}"></image>
  28 + <image src="/img/banke.png" wx:if="{{item.level>=0.5&&item.level<1}}"></image>
  29 + </view>
  30 + <view class="staritem">
  31 + <image src="/img/pingfenshi.png" wx:if="{{item.level>=2}}"></image>
  32 + <image src="/img/noxing.png" wx:if="{{item.level<1.5}}"></image>
  33 + <image src="/img/banke.png" wx:if="{{item.level>=1.5&&item.level<2}}"></image>
  34 + </view>
  35 + <view class="staritem">
  36 + <image src="/img/pingfenshi.png" wx:if="{{item.level>=3}}"></image>
  37 + <image src="/img/noxing.png" wx:if="{{item.level<2.5}}"></image>
  38 + <image src="/img/banke.png" wx:if="{{item.level>=2.5&&item.level<3}}"></image>
  39 + </view>
  40 + <view class="staritem">
  41 + <image src="/img/pingfenshi.png" wx:if="{{item.level>=4}}"></image>
  42 + <image src="/img/noxing.png" wx:if="{{item.level<3.5}}"></image>
  43 + <image src="/img/banke.png" wx:if="{{item.level>=3.5&&item.level<4}}"></image>
  44 + </view>
  45 + <view class="staritem">
  46 + <image src="/img/pingfenshi.png" wx:if="{{item.level>=5}}"></image>
  47 + <image src="/img/noxing.png" wx:if="{{item.level<4.5}}"></image>
  48 + <image src="/img/banke.png" wx:if="{{item.level>=4.5&&item.level<5}}"></image>
  49 + </view>
64 </view> 50 </view>
  51 + <view class="shouprice">¥{{item.price}}</view>
  52 + </view>
  53 + <view class="addressbox flexone">
  54 + <view class='asddressitem'>{{item.business_name}}</view>
  55 +
65 </view> 56 </view>
66 - <view class="shouprice">¥88</view>  
67 - </view>  
68 - <view class="addressbox flexone">  
69 - <view class='asddressitem'>东京街</view>  
70 - <view class='asddressitem'>东京街</view>  
71 - <view class='asddressitem'>东京街</view>  
72 </view> 57 </view>
73 - </view>  
74 58
  59 + </view>
75 </view> 60 </view>
  61 +
  62 +
76 </view> 63 </view>
77 64
78 -<scroll-view scroll-y="{{isScroll}}" style='height:{{windowHeight}}px' wx:else>  
79 - <block wx:key="item" wx:for="{{data}}">  
80 - <view data-index='{{index}}' class="order-item" bindtouchstart="drawStart" bindtouchmove="drawMove" bindtouchend="drawEnd" style="right:{{item.right}}rpx">  
81 - <view class="colectbitem flex">  
82 - <view class="collectbitemleft">  
83 - <image src="/img/photo.png"></image>  
84 - </view>  
85 - <view class="collectbtitemr"> 65 +<view wx:else>
  66 + <view class="noimg" wx:if="{{data.length==0}}">
  67 + <view class="nodataimg" >
  68 + <image src="/img/nodataimg.png"></image>
  69 + </view>
  70 + <view class="nomoer nomoredata">没有更多了哦~</view>
  71 + </view>
86 72
87 - <view class="userbox flexone">  
88 - <view class="userimg">  
89 - <image src="/img/kele.png"></image>  
90 - </view>  
91 - <view class="username">用户名称</view>  
92 - <view class="userlevel">Lv 20</view> 73 +
  74 + <scroll-view scroll-y="{{isScroll}}" style='height:{{windowHeight}}px' wx:else>
  75 +
  76 +
  77 + <block wx:key="item" wx:for="{{data}}">
  78 + <view data-index='{{index}}' class="order-item" bindtouchstart="drawStart" bindtouchmove="drawMove" bindtouchend="drawEnd" style="right:{{item.right}}rpx">
  79 + <view class="colectbitem flex">
  80 + <view class="collectbitemleft">
  81 + <image src="{{item.image}}"></image>
93 </view> 82 </view>
94 - <view class='goodname goodtext'>海贼王寿司店海贼王寿司店海贼王寿司店海贼王寿司店海贼王寿司店</view>  
95 - <view class="addressbox flexone">  
96 - <view class='asddressitem'>东京街</view>  
97 - <view class='asddressitem'>东京街</view>  
98 - <view class='asddressitem'>东京街</view> 83 + <view class="collectbtitemr">
  84 +
  85 + <view class="userbox flexone">
  86 + <view class="userimg">
  87 + <image src="{{item.avatar}}"></image>
  88 + </view>
  89 + <view class="username">{{item.nickname}}</view>
  90 + <view class="userlevel">Lv {{item.user_level}}</view>
  91 + </view>
  92 + <view class='goodname goodtext'>{{item.content}}</view>
  93 + <view class="addressbox flexone">
  94 + <view class='asddressitem'>{{item.shop_name}}</view>
  95 + <!-- <view class='asddressitem'>东京街</view>
  96 + <view class='asddressitem'>东京街</view> -->
  97 + </view>
99 </view> 98 </view>
  99 +
100 </view> 100 </view>
  101 + <view class="remove" bindtap="delItem" data-id="{{item.id}}">
101 102
102 - </view>  
103 - <view class="remove" bindtap="delItem">  
104 -  
105 <view class="delimg"> 103 <view class="delimg">
106 - <image src="/img/delimg.png"></image> 104 + <image src="/img/delimg.png"></image>
107 </view> 105 </view>
108 - </view>  
109 - </view>  
110 - </block>  
111 -</scroll-view> 106 + </view>
  107 + </view>
  108 + </block>
  109 + </scroll-view>
  110 +</view>
  111 +
112 112
113 -<view class="nomoer">没有更多了哦~</view>  
114 113
  114 +<!-- <view class="nomoer" wx:if="{{nomore}}">没有更多了哦~</view> -->
@@ -86,6 +86,10 @@ page { @@ -86,6 +86,10 @@ page {
86 width: 48rpx; 86 width: 48rpx;
87 height: 48rpx; 87 height: 48rpx;
88 font-size: 0; 88 font-size: 0;
  89 + border-radius: 50%
  90 +}
  91 +.userimg image{
  92 + border-radius: 50%
89 } 93 }
90 94
91 .username { 95 .username {
@@ -134,4 +138,12 @@ page { @@ -134,4 +138,12 @@ page {
134 width:36rpx; 138 width:36rpx;
135 height:36rpx; 139 height:36rpx;
136 font-size: 0 140 font-size: 0
  141 +}
  142 +.nodataimg{
  143 + width:523rpx;
  144 + height:315rpx;
  145 + font-size: 0
  146 +}
  147 +.nomoredata{
  148 + margin-top:208rpx;
137 } 149 }
1 // pages/comment/comment.js 1 // pages/comment/comment.js
  2 +const app=getApp()
2 Page({ 3 Page({
3 4
4 /** 5 /**
5 * 页面的初始数据 6 * 页面的初始数据
6 */ 7 */
7 data: { 8 data: {
8 - 9 + totalstar:0,
  10 + servicestar:0,
  11 + taststar: 0,
  12 + environmentstar:0,
  13 + foodstar:0,
  14 + mark:'',
  15 + image:[],
  16 + cimage:[],
  17 + money:'',
  18 + name:'',
  19 + shopid:''
9 }, 20 },
10 21
11 /** 22 /**
12 * 生命周期函数--监听页面加载 23 * 生命周期函数--监听页面加载
13 */ 24 */
14 onLoad: function (options) { 25 onLoad: function (options) {
  26 + console.log(options)
  27 + this.setData({
  28 + name:options.name,
  29 + shopid:options.shopid
  30 + })
  31 + },
  32 + // 综合评分
  33 + total(e){
  34 + let id=e.currentTarget.dataset.id;
  35 + this.setData({
  36 + totalstar:id
  37 + })
  38 + },
  39 + // 服务评分
  40 +
  41 + service(e){
  42 + let id=e.currentTarget.dataset.id
  43 + this.setData({
  44 + servicestar:id
  45 + })
  46 + },
  47 +
  48 + // 口味评分
  49 + tast(e){
  50 + let id=e.currentTarget.dataset.id
  51 + this.setData({
  52 + taststar:id
  53 + })
  54 + },
  55 +
  56 + // 环境评分
  57 + envirment(e){
  58 + let id = e.currentTarget.dataset.id
  59 + this.setData({
  60 + environmentstar:id
  61 + })
  62 + },
  63 + // 食材评分
  64 + food(e){
  65 + let id=e.currentTarget.dataset.id
  66 + this.setData({
  67 + foodstar:id
  68 + })
  69 + },
  70 +
  71 + //感受
  72 + entermark(e){
  73 + this.setData({
  74 + mark:e.detail.value
  75 + })
  76 +
  77 + console.log(this.data.mark)
  78 + },
  79 +
  80 + chooseImage() {
  81 + let that = this;
  82 + wx.chooseImage({
  83 + count: 1,
  84 + sizeType: ['original', 'compressed'],
  85 + success: function (res) {
  86 + console.log(res.tempFilePaths[0])
  87 + app.upload('image', res.tempFilePaths[0], "post").then((res) => {
  88 + console.log('上传文件', res);
  89 + let url = app.globalData.baseurl+res.url;
  90 + that.data.image.push(url)
  91 + that.data.cimage.push(res.url)
  92 + that.setData({
  93 + image: that.data.image,
  94 + cimage: that.data.cimage
  95 + })
  96 +
  97 + console.log(that.data.image);
  98 + console.log(that.data.cimage)
  99 +
  100 +
  101 + }).catch((err) => {
  102 + console.log(err)
  103 + })
  104 + },
  105 + fail: function (res) { }
  106 + })
  107 + },
  108 +
  109 + // 删除图片
  110 + del(e){
  111 + let that=this;
  112 + let url=e.currentTarget.dataset.url;
  113 + that.data.image.forEach(function(value,index,array){
  114 + if(value==url){
  115 + that.data.image.splice(index,1);
  116 + that.data.cimage.splice(index, 1)
  117 + }
  118 + })
  119 + that.setData({
  120 + image:that.data.image,
  121 + cimage:that.data.cimage
  122 + })
  123 +
  124 + console.log(that.data.image);
  125 + console.log(that.data.cimage)
  126 +
  127 + },
  128 +
  129 + // 输入金额
  130 + entermoney(e){
  131 + this.setData({
  132 + money:e.detail.value
  133 + })
  134 + },
  135 +
  136 + publish(){
  137 + let that = this;
  138 + if (that.data.totalstar==0){
  139 + wx.showToast({
  140 + title: '请选择综合评分',
  141 + icon:"none"
  142 + })
  143 + return false
  144 + }
  145 + if (that.data.servicestar == 0) {
  146 + wx.showToast({
  147 + title: '请选择服务评分',
  148 + icon: "none"
  149 + })
  150 + return false
  151 + }
  152 + if (that.data.taststar == 0) {
  153 + wx.showToast({
  154 + title: '请选择口味评分',
  155 + icon: "none"
  156 + })
  157 + return false
  158 + }
  159 + if (that.data.environmentstar == 0) {
  160 + wx.showToast({
  161 + title: '请选择环境评分',
  162 + icon: "none"
  163 + })
  164 + return false
  165 + }
  166 + if (that.data.mark == '') {
  167 + wx.showToast({
  168 + title: '请输入评论内容',
  169 + icon: "none"
  170 + })
  171 + return false
  172 + }
  173 + if (that.data.mark == '') {
  174 + wx.showToast({
  175 + title: '请输入评论内容',
  176 + icon: "none"
  177 + })
  178 + return false
  179 + }
  180 +
  181 +
  182 + if (that.data.money == '') {
  183 + wx.showToast({
  184 + title: '请输入人均消费',
  185 + icon: "none"
  186 + })
  187 + return false
  188 + }
  189 +
  190 +
  191 + var url = '/remark/addRemark';
  192 + var params = {
  193 + shop_id:that.data.shopid,
  194 + price:that.data.money,
  195 + content:that.data.mark,
  196 + images:that.data.image.join(","),
  197 + score1:that.data.totalstar,
  198 + score2:that.data.servicestar,
  199 + score3:that.data.taststar,
  200 + score4:that.data.environmentstar,
  201 + score5:that.data.foodstar,
  202 + type:1
  203 +
  204 + }
  205 + app.post(url, params,"post").then((res) => {
  206 + console.log(res);
  207 + wx.showToast({
  208 + title: '发表成功',
  209 + icon:'none'
  210 + })
  211 + setTimeout(function(){
  212 + wx.navigateBack({
  213 + checked:true
  214 + })
  215 + },1500)
  216 +
  217 +
  218 +
  219 + }).catch((err) => {
15 220
  221 + })
16 }, 222 },
17 223
18 /** 224 /**
1 <view class="infobox"> 1 <view class="infobox">
2 - <view class="infoTitle">海贼王寿司店</view>  
3 - <view class="evaluateItem">  
4 - <view class="tltle">评价</view>  
5 - <view class="starbox">  
6 - <image class="starItem" src="/img/star.png" />  
7 - <image class="starItem" src="/img/star.png" />  
8 - <image class="starItem" src="/img/star.png" />  
9 - <image class="starItem" src="/img/star.png" />  
10 - <image class="starItem" src="/img/banke.png" />  
11 - </view>  
12 - </view>  
13 - <textarea placeholder="说说此刻的感受吧…" class="wordArea" />  
14 - <view class="labelbox"> 2 + <view class="infoTitle">{{name}}</view>
  3 + <view class="infobox">
  4 + <view class="infoTitle">评分</view>
  5 + <view class="evaluateItem">
  6 + <view class="tltle">综合</view>
  7 + <view class="starbox" bindtap="total" data-id="1">
  8 + <image class="starItem" src="/img/pingfenshi.png" wx:if="{{totalstar>=1}}" />
  9 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  10 + </view>
  11 + <view class="starbox" bindtap="total" data-id="2">
  12 + <image class="starItem" src="/img/pingfenshi.png " wx:if="{{totalstar>=2}}" />
  13 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  14 + </view>
  15 + <view class="starbox" bindtap="total" data-id="3">
  16 + <image class="starItem" src="/img/pingfenshi.png" wx:if="{{totalstar>=3}}" />
  17 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  18 +
  19 + </view>
  20 + <view class="starbox" bindtap="total" data-id="4">
  21 + <image class="starItem" src="/img/pingfenshi.png" wx:if="{{totalstar>=4}}" />
  22 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  23 + </view>
  24 + <view class="starbox" bindtap="total" data-id="5">
  25 + <image class="starItem" src="/img/pingfenshi.png" wx:if="{{totalstar>=5}}" />
  26 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  27 +
  28 + </view>
  29 + </view>
  30 + <view class="evaluateItem">
  31 + <view class="tltle">服务</view>
  32 + <view class="starbox" bindtap="service" data-id="1">
  33 + <image class="starItem" src="/img/pingfenshi.png" wx:if="{{servicestar>=1}}" />
  34 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  35 + </view>
  36 + <view class="starbox" bindtap="service" data-id="2">
  37 + <image class="starItem" src="/img/pingfenshi.png " wx:if="{{servicestar>=2}}" />
  38 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  39 + </view>
  40 + <view class="starbox" bindtap="service" data-id="3">
  41 + <image class="starItem" src="/img/pingfenshi.png" wx:if="{{servicestar>=3}}" />
  42 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  43 +
  44 + </view>
  45 + <view class="starbox" bindtap="service" data-id="4">
  46 + <image class="starItem" src="/img/pingfenshi.png" wx:if="{{servicestar>=4}}" />
  47 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  48 + </view>
  49 + <view class="starbox" bindtap="service" data-id="5">
  50 + <image class="starItem" src="/img/pingfenshi.png" wx:if="{{servicestar>=5}}" />
  51 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  52 +
  53 + </view>
  54 + </view>
  55 + <view class="evaluateItem">
  56 + <view class="tltle">口味</view>
  57 + <view class="starbox" bindtap="tast" data-id="1">
  58 + <image class="starItem" src="/img/pingfenshi.png" wx:if="{{taststar>=1}}" />
  59 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  60 + </view>
  61 + <view class="starbox" bindtap="tast" data-id="2">
  62 + <image class="starItem" src="/img/pingfenshi.png " wx:if="{{taststar>=2}}" />
  63 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  64 + </view>
  65 + <view class="starbox" bindtap="tast" data-id="3">
  66 + <image class="starItem" src="/img/pingfenshi.png" wx:if="{{taststar>=3}}" />
  67 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  68 +
  69 + </view>
  70 + <view class="starbox" bindtap="tast" data-id="4">
  71 + <image class="starItem" src="/img/pingfenshi.png" wx:if="{{taststar>=4}}" />
  72 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  73 + </view>
  74 + <view class="starbox" bindtap="tast" data-id="5">
  75 + <image class="starItem" src="/img/pingfenshi.png" wx:if="{{taststar>=5}}" />
  76 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  77 +
  78 + </view>
  79 + </view>
  80 + <view class="evaluateItem">
  81 + <view class="tltle">环境</view>
  82 + <view class="starbox" bindtap="envirment" data-id="1">
  83 + <image class="starItem" src="/img/pingfenshi.png" wx:if="{{environmentstar>=1}}" />
  84 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  85 + </view>
  86 + <view class="starbox" bindtap="envirment" data-id="2">
  87 + <image class="starItem" src="/img/pingfenshi.png " wx:if="{{environmentstar>=2}}" />
  88 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  89 + </view>
  90 + <view class="starbox" bindtap="envirment" data-id="3">
  91 + <image class="starItem" src="/img/pingfenshi.png" wx:if="{{environmentstar>=3}}" />
  92 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  93 +
  94 + </view>
  95 + <view class="starbox" bindtap="envirment" data-id="4">
  96 + <image class="starItem" src="/img/pingfenshi.png" wx:if="{{environmentstar>=4}}" />
  97 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  98 + </view>
  99 + <view class="starbox" bindtap="envirment" data-id="5">
  100 + <image class="starItem" src="/img/pingfenshi.png" wx:if="{{environmentstar>=5}}" />
  101 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  102 +
  103 + </view>
  104 + </view>
  105 +
  106 + <view class="evaluateItem">
  107 + <view class="tltle">食材</view>
  108 + <view class="starbox" bindtap="food" data-id="1">
  109 + <image class="starItem" src="/img/pingfenshi.png" wx:if="{{foodstar>=1}}" />
  110 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  111 + </view>
  112 + <view class="starbox" bindtap="food" data-id="2">
  113 + <image class="starItem" src="/img/pingfenshi.png " wx:if="{{foodstar>=2}}" />
  114 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  115 + </view>
  116 + <view class="starbox" bindtap="food" data-id="3">
  117 + <image class="starItem" src="/img/pingfenshi.png" wx:if="{{foodstar>=3}}" />
  118 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  119 +
  120 + </view>
  121 + <view class="starbox" bindtap="food" data-id="4">
  122 + <image class="starItem" src="/img/pingfenshi.png" wx:if="{{foodstar>=4}}" />
  123 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  124 + </view>
  125 + <view class="starbox" bindtap="food" data-id="5">
  126 + <image class="starItem" src="/img/pingfenshi.png" wx:if="{{foodstar>=5}}" />
  127 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  128 +
  129 + </view>
  130 + </view>
  131 + </view>
  132 + <textarea placeholder="说说此刻的感受吧…" class="wordArea" bindinput="entermark" />
  133 + <!-- <view class="labelbox">
15 <view class="labelItem"> 134 <view class="labelItem">
16 <text>+</text>标题 135 <text>+</text>标题
17 </view> 136 </view>
  137 + </view> -->
  138 + <view class="imagebox flexone">
  139 + <view class="picbox flexone">
  140 + <view class="imgItem" wx:for="{{image}}" wx:key="">
  141 + <image mode="aspectFill" src="{{item}}" />
  142 + <view class="chahao" bindtap="del" data-url="{{item}}">
  143 + <image src="/img/chahao.png"></image>
  144 + </view>
  145 + </view>
  146 + </view>
  147 +
  148 + <view class="imgItem" bindtap="chooseImage">
  149 + <image mode="aspectFill" src="/img/jiang.png" />
  150 + </view>
18 </view> 151 </view>
19 - <view class="imgarr">  
20 - <image class="imgItem" mode="aspectFill" src="/img/jiang.png" />  
21 - </view> 152 +
  153 +
22 </view> 154 </view>
23 155
24 156
25 - <view class="costbox"> 157 +<view class="costbox">
26 <view class="costTitle">人均</view> 158 <view class="costTitle">人均</view>
27 <view class="fillbox"> 159 <view class="fillbox">
28 <text>¥</text> 160 <text>¥</text>
29 - <input placeholder="请输入消费金额" class="fillCost" type="number"/> 161 + <input placeholder="请输入消费金额" class="fillCost" type="digit" bindinput="entermoney" />
30 </view> 162 </view>
31 - </view> 163 +</view>
32 164
33 - <view class="submit btnActive">发表</view>  
  165 +<view class="submit btnActive" bindtap="publish">发表</view>
@@ -20,8 +20,18 @@ page { @@ -20,8 +20,18 @@ page {
20 .imgItem { 20 .imgItem {
21 width: 176rpx; 21 width: 176rpx;
22 height: 176rpx; 22 height: 176rpx;
23 - margin-right: 24rpx; 23 + margin-right: 20rpx;
24 margin-bottom: 32rpx; 24 margin-bottom: 32rpx;
  25 + position: relative;
  26 +
  27 +}
  28 +.chahao{
  29 + width:50rpx;
  30 + height:50rpx;
  31 + font-size: 0;
  32 + position: absolute;
  33 + top:-10rpx;
  34 + right:-10rpx;
25 } 35 }
26 36
27 .imgItem:nth-child(3n) { 37 .imgItem:nth-child(3n) {
@@ -92,9 +102,10 @@ page { @@ -92,9 +102,10 @@ page {
92 } 102 }
93 103
94 .starItem { 104 .starItem {
95 - width: 24rpx;  
96 - height: 24rpx;  
97 - margin-right: 8rpx; 105 + width: 32rpx;
  106 + height: 32rpx;
  107 + font-size: 0
  108 +
98 } 109 }
99 110
100 .costbox { 111 .costbox {
@@ -156,4 +167,10 @@ page { @@ -156,4 +167,10 @@ page {
156 167
157 .btnActive { 168 .btnActive {
158 background: #FDAA2A; 169 background: #FDAA2A;
  170 +}
  171 +.imagebox{
  172 + display:flex;
  173 + align-items: center;
  174 + width:600rpx;
  175 + flex-wrap: wrap
159 } 176 }
1 // pages/commentdetail/commentdetail.js 1 // pages/commentdetail/commentdetail.js
  2 +const app = getApp()
2 Page({ 3 Page({
3 4
4 /** 5 /**
5 * 页面的初始数据 6 * 页面的初始数据
6 */ 7 */
7 data: { 8 data: {
  9 + commentid: '',
  10 + commentdetail: '',
  11 + sendactive: false,
  12 + comment: '',
  13 + shopid:'',
  14 + ispraise:false,
  15 + iscollect:false,
  16 + sendshow:false
8 17
9 }, 18 },
10 19
11 /** 20 /**
12 * 生命周期函数--监听页面加载 21 * 生命周期函数--监听页面加载
13 */ 22 */
14 - onLoad: function (options) { 23 + onLoad: function(options) {
  24 + this.setData({
  25 + commentid: options.commentid,
  26 + shopid:options.shopid
  27 + })
  28 + this.getcommentdetail()
  29 + },
  30 +
  31 + mycomment(){
  32 + wx.navigateTo({
  33 + url: '/pages/mycomment/mycomment',
  34 + })
  35 + },
  36 +
  37 + getcommentdetail() {
  38 + let that = this;
  39 + var url = 'remark/getRemarkInfo';
  40 + var params = {
  41 + id: that.data.commentid,
  42 +
  43 + }
  44 + app.post(url, params, "post").then((res) => {
  45 + console.log(res);
  46 + that.setData({
  47 + commentdetail: res
  48 + })
  49 +
15 50
  51 +
  52 + }).catch((err) => {
  53 +
  54 + })
  55 + },
  56 + // 输入评论内容
  57 + enterword(e) {
  58 + this.setData({
  59 + comment:e.detail.value
  60 + })
16 }, 61 },
  62 + finish(){
  63 + this.setData({
  64 + sendactive:true
  65 + })
  66 + },
  67 +
  68 + // 发送评论
  69 + send(){
  70 + let that = this;
  71 +
  72 +
  73 + if (that.data.comment==''){
  74 + wx.showToast({
  75 + title: '请输入评论',
  76 + icon:"none"
  77 + })
  78 +
  79 + }else{
  80 + that.setData({
  81 + sendshow: true
  82 + })
  83 + var url = 'remark_comments/addComments';
  84 + var params = {
  85 + remark_id: that.data.commentid,
  86 + content: that.data.comment
  87 + }
  88 + app.post(url, params).then((res) => {
  89 + console.log(res);
  90 + wx.showToast({
  91 + title: '评论成功',
  92 + icon: 'none'
  93 + })
  94 +
  95 + setTimeout(function () {
  96 + wx.navigateBack({
  97 + checked: true
  98 + })
  99 + }, 1500)
  100 +
  101 + app.globalData.shopid = this.data.shopid
  102 +
  103 +
  104 +
  105 + }).catch((err) => {
  106 +
  107 + })
  108 + }
  109 +
  110 + },
  111 +
  112 + // 点赞
  113 + praise(e){
  114 + let that=this;
  115 + let id=e.currentTarget.dataset.id;
  116 + that.setData({
  117 + ispraise:!that.data.ispraise
  118 + })
  119 + if(that.data.ispraise==true){
  120 + wx.showToast({
  121 + title: '点赞成功',
  122 + icon:"none"
  123 + })
  124 +
  125 + that.data.commentdetail.praise_num = that.data.commentdetail.praise_num+1;
  126 + that.setData({
  127 + commentdetail: that.data.commentdetail
  128 + })
  129 + }else{
  130 + wx.showToast({
  131 + title: '取消点赞成功',
  132 + icon: "none"
  133 + })
  134 + that.data.commentdetail.praise_num = that.data.commentdetail.praise_num-1;
  135 + that.setData({
  136 + commentdetail: that.data.commentdetail
  137 + })
  138 + }
  139 +
  140 +
  141 + var url = '/remark/remarkPraise';
  142 + var params = {
  143 + remark_id: id,
  144 +
  145 + }
  146 + app.post(url, params,"post").then((res) => {
  147 + console.log(res);
  148 +
17 149
  150 +
  151 + }).catch((err) => {
  152 +
  153 + })
  154 +
  155 + },
  156 +
  157 + // 收藏
  158 + collect(e) {
  159 + let that = this;
  160 + let id = e.currentTarget.dataset.id;
  161 + that.setData({
  162 + iscollect: !that.data.iscollect
  163 + })
  164 + if (that.data.iscollect == true) {
  165 + wx.showToast({
  166 + title: '收藏成功',
  167 + icon: "none"
  168 + })
  169 +
  170 + that.data.commentdetail.collect_num = that.data.commentdetail.collect_num + 1;
  171 + that.setData({
  172 + commentdetail: that.data.commentdetail
  173 + })
  174 + } else {
  175 + wx.showToast({
  176 + title: '取收藏赞成功',
  177 + icon: "none"
  178 + })
  179 + that.data.commentdetail.collect_num = that.data.commentdetail.collect_num - 1;
  180 + that.setData({
  181 + commentdetail: that.data.commentdetail
  182 + })
  183 + }
  184 +
  185 +
  186 + var url = '/remark/remarkCollect';
  187 + var params = {
  188 + remark_id: id,
  189 +
  190 + }
  191 + app.post(url, params, "post").then((res) => {
  192 + console.log(res);
  193 +
  194 +
  195 +
  196 + }).catch((err) => {
  197 +
  198 + })
  199 +
  200 + },
  201 +
  202 + // 评论列表点赞
  203 + xiaozan(e){
  204 + let that = this;
  205 + let id=e.currentTarget.dataset.id;
  206 + let index=e.currentTarget.dataset.index;
  207 + that.data.commentdetail.comments.forEach(function(value,indexk,array){
  208 + if (indexk==index){
  209 + value.sel=!value.sel;
  210 + if(value.sel==true){
  211 + wx.showToast({
  212 + title: '点赞成功',
  213 + icon:"none"
  214 + })
  215 + }else{
  216 + wx.showToast({
  217 + title: '取消点赞成功',
  218 + icon: "none"
  219 + })
  220 + }
  221 + }
  222 + })
  223 + var url = 'remark_comments/remarkPraise';
  224 + var params = {
  225 + remark_comments_id: id,
  226 +
  227 + }
  228 + app.post(url, params).then((res) => {
  229 + console.log(res);
  230 +
  231 +
  232 +
  233 +
  234 + }).catch((err) => {
  235 +
  236 + })
  237 + },
18 /** 238 /**
19 * 生命周期函数--监听页面初次渲染完成 239 * 生命周期函数--监听页面初次渲染完成
20 */ 240 */
21 - onReady: function () { 241 + onReady: function() {
22 242
23 }, 243 },
24 244
25 /** 245 /**
26 * 生命周期函数--监听页面显示 246 * 生命周期函数--监听页面显示
27 */ 247 */
28 - onShow: function () { 248 + onShow: function() {
29 249
30 }, 250 },
31 251
32 /** 252 /**
33 * 生命周期函数--监听页面隐藏 253 * 生命周期函数--监听页面隐藏
34 */ 254 */
35 - onHide: function () { 255 + onHide: function() {
36 256
37 }, 257 },
38 258
39 /** 259 /**
40 * 生命周期函数--监听页面卸载 260 * 生命周期函数--监听页面卸载
41 */ 261 */
42 - onUnload: function () { 262 + onUnload: function() {
43 263
44 }, 264 },
45 265
46 /** 266 /**
47 * 页面相关事件处理函数--监听用户下拉动作 267 * 页面相关事件处理函数--监听用户下拉动作
48 */ 268 */
49 - onPullDownRefresh: function () { 269 + onPullDownRefresh: function() {
50 270
51 }, 271 },
52 272
53 /** 273 /**
54 * 页面上拉触底事件的处理函数 274 * 页面上拉触底事件的处理函数
55 */ 275 */
56 - onReachBottom: function () { 276 + onReachBottom: function() {
57 277
58 }, 278 },
59 279
60 /** 280 /**
61 * 用户点击右上角分享 281 * 用户点击右上角分享
62 */ 282 */
63 - onShareAppMessage: function () { 283 + onShareAppMessage: function() {
64 284
65 } 285 }
66 }) 286 })
1 -<view class="photo">  
2 - <view class="photobox">  
3 - <view class="comtop flextwo">  
4 - <view class="comleft">  
5 - <image src="/img/kele.png"></image>  
6 - </view>  
7 - <view class="comright">  
8 -  
9 - <view class="comrtop flexone">  
10 - <view class="comrname">一心只想撤撤撤</view>  
11 - <view class="star starone flexone">  
12 - <view class="staritem">  
13 - <image src="/img/fenxing.png"></image>  
14 - </view>  
15 - <view class="staritem">  
16 - <image src="/img/fenxing.png"></image>  
17 - </view>  
18 - <view class="staritem">  
19 - <image src="/img/fenxing.png"></image>  
20 - </view>  
21 - <view class="staritem">  
22 - <image src="/img/fenxing.png"></image>  
23 - </view>  
24 - <view class="staritem">  
25 - <image src="/img/stfenxingr.png"></image>  
26 - </view>  
27 - </view>  
28 - </view>  
29 - <view class="comdate">2019年10月12日</view>  
30 -  
31 - </view>  
32 - </view>  
33 - <view class="comtext flexone">  
34 - <view class="comleft"></view>  
35 -  
36 - <view class="comright">  
37 - <view class="flexone fenxia">  
38 - <view class="star starone flexone">  
39 - <view class="staritem">  
40 - <image src="/img/pingfenshi.png"></image>  
41 - </view>  
42 - <view class="staritem">  
43 - <image src="/img/pingfenshi.png"></image>  
44 - </view>  
45 - <view class="staritem">  
46 - <image src="/img/pingfenshi.png"></image>  
47 - </view>  
48 - <view class="staritem">  
49 - <image src="/img/pingfenshi.png"></image>  
50 - </view>  
51 - <view class="staritem">  
52 - <image src="/img/banke.png"></image>  
53 - </view>  
54 -  
55 - </view>  
56 - <view class="fen">8.5分</view>  
57 - </view>  
58 - <view class="text">  
59 - 掌柜态度很专业热情,有问必答,回复也很快,我问了不少问题,他都不觉得烦,都会认真回答我,这点我向掌柜表示由衷的敬意,这样的好掌柜可不多了。  
60 - </view>  
61 - <view class="textboximg flexone">  
62 - <view class="boxitem">  
63 - <image src="/img/photo.png"></image>  
64 - </view>  
65 - <view class="boxitem">  
66 - <image src="/img/photo.png"></image>  
67 - </view>  
68 - <view class="boxitem">  
69 - <image src="/img/photo.png"></image>  
70 - </view>  
71 - </view>  
72 - </view>  
73 - </view> 1 +<view class="box" wx:if="{{commentdetail.status==1}}">
  2 + <view class="iconbox">
  3 + <image src="/img/chenggong_img.png" class="icon" mode="widthFix" />
74 </view> 4 </view>
75 -</view> 5 + <view class="tipsword">
  6 + <view>点评正在审核中</view>
  7 + <view>可在我的评论中查看审核状态</view>
  8 + </view>
  9 + <view class="btnbox">
76 10
77 -<view class="detailcommentbox">  
78 - <view class="phototopleft flexone">  
79 - <view class="xiang">点评 </view>  
80 - <view class="tiao">(800条)</view> 11 + <view class="btnItem" bindtap="mycomment">我的评论</view>
81 </view> 12 </view>
82 - <view class="commentlist"> 13 +</view>
83 14
84 - <view class="commentitem"> 15 +<view wx:else>
  16 + <view class="photo">
  17 + <view class="photobox">
85 <view class="comtop flextwo"> 18 <view class="comtop flextwo">
86 <view class="comleft"> 19 <view class="comleft">
87 - <image src="/img/kele.png"></image> 20 + <image src="{{commentdetail.avatar}}"></image>
88 </view> 21 </view>
89 <view class="comright"> 22 <view class="comright">
90 - <view class="listtop flextwo">  
91 - <view class="comrtop">  
92 - <view class="comrname">一心只想撤撤撤</view>  
93 - <view class="comdate">2019年10月12日</view>  
94 - </view>  
95 - <view class="listzan flexone">  
96 - <view class="lsitzanleft">  
97 - <image src="/img/xiaozan.png"></image> 23 +
  24 + <view class="comrtop flexone">
  25 + <view class="comrname">{{commentdetail.nickname}}</view>
  26 + <view class="star starone flexone">
  27 + <view class="staritem">
  28 + <image src="/img/star.png" wx:if="{{commentdetail.user_level>=1}}"></image>
  29 + <image src="/img/huangkong.png" wx:if="{{commentdetail.user_level<0.5}}"></image>
  30 + <image src="/img/huangban.png" wx:if="{{commentdetail.user_level>=0.5&&commentdetail.user_level<1}}"></image>
  31 + </view>
  32 + <view class="staritem">
  33 + <image src="/img/star.png" wx:if="{{commentdetail.user_level>=2}}"></image>
  34 + <image src="/img/huangkong.png" wx:if="{{commentdetail.user_level<1.5}}"></image>
  35 + <image src="/img/huangban.png" wx:if="{{commentdetail.user_level>=1.5&&commentdetail.user_level<2}}"></image>
  36 + </view>
  37 + <view class="staritem">
  38 + <image src="/img/star.png" wx:if="{{commentdetail.user_level>=3}}"></image>
  39 + <image src="/img/huangkong.png" wx:if="{{commentdetail.user_level<2.5}}"></image>
  40 + <image src="/img/huangban.png" wx:if="{{commentdetail.user_level>=2.5&&commentdetail.user_level<3}}"></image>
  41 + </view>
  42 + <view class="staritem">
  43 + <image src="/img/star.png" wx:if="{{commentdetail.user_level>=4}}"></image>
  44 + <image src="/img/huangkong.png" wx:if="{{commentdetail.user_level<3.5}}"></image>
  45 + <image src="/img/huangban.png" wx:if="{{commentdetail.user_level>=3.5&&commentdetail.user_level<4}}"></image>
  46 + </view>
  47 + <view class="staritem">
  48 + <image src="/img/star.png" wx:if="{{commentdetail.user_level>=5}}"></image>
  49 + <image src="/img/huangkong.png" wx:if="{{commentdetail.user_level<4.5}}"></image>
  50 + <image src="/img/huangban.png" wx:if="{{commentdetail.user_level>=4.5&&commentdetail.user_level<5}}"></image>
98 </view> 51 </view>
99 - <view class="zannumber">35</view>  
100 </view> 52 </view>
101 </view> 53 </view>
102 - 54 + <view class="comdate">{{commentdetail.createtime}}</view>
103 55
104 </view> 56 </view>
105 </view> 57 </view>
106 -  
107 <view class="comtext flexone"> 58 <view class="comtext flexone">
108 <view class="comleft"></view> 59 <view class="comleft"></view>
  60 +
109 <view class="comright"> 61 <view class="comright">
  62 + <view class="flexone fenxia">
  63 + <view class="star starone flexone">
  64 + <view class="staritem">
  65 + <image src="/img/pingfenshi.png" wx:if="{{commentdetail.score>=1}}"></image>
  66 + <image src="/img/lingfen_icon.png" wx:if="{{commentdetail.score<0.5}}"></image>
  67 + <image src="/img/banke.png" wx:if="{{commentdetail.score>=0.5&&commentdetail.score<1}}"></image>
  68 + </view>
  69 + <view class="staritem">
  70 + <image src="/img/pingfenshi.png" wx:if="{{commentdetail.score>=2}}"></image>
  71 + <image src="/img/lingfen_icon.png" wx:if="{{commentdetail.score<1.5}}"></image>
  72 + <image src="/img/banke.png" wx:if="{{commentdetail.score>=1.5&&commentdetail.score<2}}"></image>
  73 + </view>
  74 + <view class="staritem">
  75 + <image src="/img/pingfenshi.png" wx:if="{{commentdetail.score>=3}}"></image>
  76 + <image src="/img/lingfen_icon.png" wx:if="{{commentdetail.score<2.5}}"></image>
  77 + <image src="/img/banke.png" wx:if="{{commentdetail.score>=2.5&&commentdetail.score<3}}"></image>
  78 + </view>
  79 + <view class="staritem">
  80 + <image src="/img/pingfenshi.png" wx:if="{{commentdetail.score>=4}}"></image>
  81 + <image src="/img/lingfen_icon.png" wx:if="{{commentdetail.score<3.5}}"></image>
  82 + <image src="/img/banke.png" wx:if="{{commentdetail.score>=3.5&&commentdetail.score<4}}"></image>
  83 + </view>
  84 + <view class="staritem">
  85 + <image src="/img/pingfenshi.png" wx:if="{{commentdetail.score>=5}}"></image>
  86 + <image src="/img/lingfen_icon.png" wx:if="{{commentdetail.score<4.5}}"></image>
  87 + <image src="/img/banke.png" wx:if="{{commentdetail.score>=4.5&&commentdetail.score<5}}"></image>
  88 + </view>
  89 + </view>
  90 + <view class="fen">{{commentdetail.score}}分</view>
  91 + </view>
110 <view class="text"> 92 <view class="text">
111 - 掌柜态度很专业热情,有问必答,回复也很快,我问了不少问题,他都不觉得烦,都会认真回答我,这点我向掌柜表示由衷的敬意,这样的好掌柜可不多了。 93 + {{commentdetail.content}}
  94 + </view>
  95 + <view class="textboximg flexone" wx:if="{{commentdetail.images.length!=0}}">
  96 + <view class="boxitem" wx:for="{{commentdetail.images}}" wx:key="">
  97 + <image src="{{item}}"></image>
  98 + </view>
112 </view> 99 </view>
113 </view> 100 </view>
114 </view> 101 </view>
115 </view> 102 </view>
116 - <view class="commentitem">  
117 - <view class="comtop flextwo">  
118 - <view class="comleft">  
119 - <image src="/img/kele.png"></image>  
120 - </view>  
121 - <view class="comright">  
122 - <view class="listtop flextwo">  
123 - <view class="comrtop">  
124 - <view class="comrname">一心只想撤撤撤</view>  
125 - <view class="comdate">2019年10月12日</view>  
126 - </view>  
127 - <view class="listzan flexone">  
128 - <view class="lsitzanleft">  
129 - <image src="/img/xiaozan.png"></image> 103 + </view>
  104 +
  105 + <view class="detailcommentbox" wx:if="{{commentdetail.comments.length!=0}}">
  106 + <view class="phototopleft flexone">
  107 + <view class="xiang">点评 </view>
  108 + <view class="tiao">({{commentdetail.comments.length}}条)</view>
  109 + </view>
  110 + <view class="commentlist">
  111 +
  112 + <view class="commentitem" wx:for="{{commentdetail.comments}}" wx:key="">
  113 + <view class="comtop flextwo">
  114 + <view class="comleft">
  115 + <image src="{{item.avatar}}"></image>
  116 + </view>
  117 + <view class="comright">
  118 + <view class="listtop flextwo">
  119 + <view class="comrtop">
  120 + <view class="comrname">{{item.nickname}}</view>
  121 + <view class="comdate">{{item.createtime}}</view>
  122 + </view>
  123 + <view class="listzan flexone" bindtap="xiaozan" data-id="{{item.id}}" data-index="{{index}}">
  124 + <view class="lsitzanleft">
  125 + <image src="/img/xiaozan.png"></image>
  126 + <image src="/img/yizan.png"></image>
  127 + </view>
  128 + <view class="zannumber">{{item.praise_num}}</view>
130 </view> 129 </view>
131 - <view class="zannumber">35</view>  
132 </view> 130 </view>
133 - </view>  
134 131
135 132
  133 + </view>
136 </view> 134 </view>
137 - </view>  
138 135
139 - <view class="comtext flexone">  
140 - <view class="comleft"></view>  
141 - <view class="comright">  
142 - <view class="text">  
143 - 掌柜态度很专业热情,有问必答,回复也很快,我问了不少问题,他都不觉得烦,都会认真回答我,这点我向掌柜表示由衷的敬意,这样的好掌柜可不多了。 136 + <view class="comtext flexone">
  137 + <view class="comleft"></view>
  138 + <view class="comright">
  139 + <view class="text">
  140 + {{item.content}}
  141 + </view>
144 </view> 142 </view>
145 </view> 143 </view>
146 </view> 144 </view>
147 - </view>  
148 - </view>  
149 145
  146 + </view>
150 147
151 -</view>  
152 148
153 -<!-- 底部评论 -->  
154 -<view class="commentbototm flextwo">  
155 - <view class="commbotleft">  
156 - <input placeholder="写点什么..." placeholder-class="enter"/>  
157 </view> 149 </view>
158 - <view class="combotright flexone">  
159 - <view class="combotitem flexone itemleft">  
160 - <view class="combotitemleft ">  
161 - <image src="/img/dazan.png"></image> 150 +
  151 + <!-- 底部评论 -->
  152 + <view class="commentbototm flextwo">
  153 + <view class="commbotleft {{sendactive==true?'commentleftactive':''}}">
  154 + <input placeholder="写点什么..." placeholder-class="enter" bindinput='enterword' bindblur='finish' />
  155 + </view>
  156 + <view class="combotright flexone" wx:if="{{sendactive==false}}">
  157 + <view class="combotitem flexone itemleft" bindtap="praise" data-id="{{commentdetail.id}}">
  158 + <view class="combotitemleft">
  159 + <image src="/img/dazan.png" wx:if="{{ispraise==false}}"></image>
  160 + <image src="/img/yizan.png" wx:else></image>
  161 + </view>
  162 + <view class="combotzannumber {{ispraise==true?'praiseactive':''}}">{{commentdetail.praise_num}}</view>
  163 + </view>
  164 + <view class="combotitem flexone" bindtap="collect" data-id="{{commentdetail.id}}">
  165 + <view class="combotitemleft">
  166 + <image src="/img/xin.png" wx:if="{{iscollect==false}}"></image>
  167 + <image src="/img/yicollect.png" wx:else></image>
  168 + </view>
  169 + <view class="combotzannumber {{iscollect==true?'praiseactive':''}}">{{commentdetail.collect_num}}</view>
162 </view> 170 </view>
163 - <view class="combotzannumber">23</view>  
164 </view> 171 </view>
165 - <view class="combotitem flexone">  
166 - <view class="combotitemleft">  
167 - <image src="/img/collect.png"></image> 172 +
  173 + <view class="send" bindtap="{{sendshow==false?'send':''}}" wx:else>
  174 + <view class="sendimg">
  175 + <image src="/img/yousend.png"></image>
168 </view> 176 </view>
169 - <view class="combotzannumber">23</view> 177 +
170 </view> 178 </view>
171 </view> 179 </view>
172 </view> 180 </view>
1 @import '../morecomment/morecomment.wxss'; 1 @import '../morecomment/morecomment.wxss';
2 - 2 +@import '../examine/examine.wxss';
3 .photo { 3 .photo {
4 margin-top: 0; 4 margin-top: 0;
5 background: #fff; 5 background: #fff;
@@ -70,29 +70,53 @@ @@ -70,29 +70,53 @@
70 color: #bdc4ce; 70 color: #bdc4ce;
71 font-size: 24rpx; 71 font-size: 24rpx;
72 } 72 }
73 -.commbotleft input{  
74 73
75 - width:100%;  
76 - height:100%; 74 +.commbotleft input {
  75 + width: 100%;
  76 + height: 100%;
77 padding: 12rpx 38rpx; 77 padding: 12rpx 38rpx;
78 box-sizing: border-box; 78 box-sizing: border-box;
79 } 79 }
80 80
81 -  
82 .enter { 81 .enter {
83 color: #bdc4ce; 82 color: #bdc4ce;
84 font-size: 24rpx; 83 font-size: 24rpx;
85 } 84 }
86 -.combotitemleft{  
87 - width:44rpx;  
88 - height:44rpx;  
89 - font-size: 0 85 +
  86 +.combotitemleft {
  87 + width: 44rpx;
  88 + height: 44rpx;
  89 + font-size: 0;
90 } 90 }
91 -.combotzannumber{  
92 - color:#06121E; 91 +
  92 +.combotzannumber {
  93 + color: #06121e;
93 font-size: 24rpx; 94 font-size: 24rpx;
94 - margin-left:6rpx; 95 + margin-left: 6rpx;
  96 +}
  97 +.praiseactive{
  98 + color:#FA8183
  99 +}
  100 +
  101 +.itemleft {
  102 + margin-right: 40rpx;
  103 +}
  104 +
  105 +.send {
  106 + width: 96rpx;
  107 + height: 56rpx;
  108 + background: rgba(253, 170, 42, 1);
  109 + opacity: 1;
  110 + border-radius: 8rpx;
  111 + display:flex;
  112 + justify-content: center;
  113 + align-items: center
  114 +}
  115 +.sendimg{
  116 + width:30rpx;
  117 + height:26rpx;
  118 + font-size:0
95 } 119 }
96 -.itemleft{  
97 - margin-right:40rpx; 120 +.commentleftactive{
  121 + width:560rpx;
98 } 122 }
1 // pages/homepage/homepage.js 1 // pages/homepage/homepage.js
  2 +const app = getApp();
  3 +// var util = require('../../utils/util.js');
  4 +
2 Page({ 5 Page({
3 6
4 /** 7 /**
5 * 页面的初始数据 8 * 页面的初始数据
6 */ 9 */
7 data: { 10 data: {
8 - imgUrls: [  
9 - '../../img/bannerimg.png',  
10 - '../../img/bannerimg.png',  
11 - '../../img/bannerimg.png'  
12 - ], 11 + imgUrls: [],
13 indicatorDots: false, 12 indicatorDots: false,
14 - autoplay: false, 13 + autoplay: true,
15 interval: 2000, 14 interval: 2000,
16 duration: 1000, 15 duration: 1000,
17 currentSwiper: 0, 16 currentSwiper: 0,
18 // 主页导航头部 17 // 主页导航头部
19 navarr: ['商圈', '菜系', '评级', '综合'], 18 navarr: ['商圈', '菜系', '评级', '综合'],
20 sel: 0, 19 sel: 0,
21 - 20 +
22 selk: 0, 21 selk: 0,
23 index: 0, 22 index: 0,
24 - 23 +
25 selarray: ['全部', '银座', '金座'], 24 selarray: ['全部', '银座', '金座'],
26 toparr: ['商圈', '菜系', '评级', '综合'], 25 toparr: ['商圈', '菜系', '评级', '综合'],
27 topindex: 0, 26 topindex: 0,
28 - wrap:false,  
29 - 27 + wrap: false,
  28 + // 国家
  29 + countryname: '',
  30 + countryid: '',
  31 + userinfo: '',
  32 + page: 1,
  33 + goodlist: [],
  34 + business_id: '',
  35 + series_id: '',
  36 + grade_id: '',
  37 + composite_id: '',
  38 + city_id:''
30 }, 39 },
31 40
32 /** 41 /**
33 * 生命周期函数--监听页面加载 42 * 生命周期函数--监听页面加载
34 */ 43 */
35 onLoad: function(options) { 44 onLoad: function(options) {
36 - console.log(this.data.navindex) 45 +
  46 + this.getcountry();
  47 +
  48 + // 获取banner
  49 + this.getbanner()
  50 +
37 }, 51 },
38 - goodtail(){  
39 - wx.navigateTo({  
40 - url: '/pages/shopdetail/shopdetail', 52 +
  53 + // 获取轮播图
  54 + getbanner() {
  55 + let that = this;
  56 + var url = 'sundry/get_slide';
  57 + var params = {
  58 +
  59 + }
  60 + app.post(url, params).then((res) => {
  61 + console.log(res);
  62 + that.setData({
  63 + imgUrls: res
  64 + })
  65 +
  66 +
  67 +
  68 + }).catch((err) => {
  69 +
41 }) 70 })
42 }, 71 },
  72 + goodtail(e) {
  73 + let token = wx.getStorageSync("token");
  74 + if (token == '') {
  75 + wx.showToast({
  76 + title: '请先登录',
  77 + icon: "none"
  78 + })
  79 + setTimeout(function() {
  80 + wx.navigateTo({
  81 + url: '/pages/index/index',
  82 + })
  83 + }, 1500)
  84 + } else {
  85 + let id = e.currentTarget.dataset.id;
  86 + wx.navigateTo({
  87 + url: '/pages/shopdetail/shopdetail?id=' + id,
  88 + })
  89 + }
  90 +
  91 + },
43 // 页面头部切换 92 // 页面头部切换
44 - selnav(e){ 93 + selnav(e) {
45 this.setData({ 94 this.setData({
46 - sel:e.currentTarget.dataset.index,  
47 - wrap:true 95 + sel: e.currentTarget.dataset.index,
  96 + wrap: true
48 }) 97 })
49 - if(this.data.sel==0){  
50 - this.setData({  
51 - selarray: ['全部', '银座', '金座'],  
52 - selt:0,  
53 - selk: ''  
54 - })  
55 - }else if(this.data.sel==1){ 98 + if (this.data.sel == 0) {
  99 + this.setData({
  100 +
  101 + selt: 0,
  102 + selk: '',
  103 + goodlist: []
  104 + })
  105 + this.getshanguqan();
  106 + this.gethomelist()
  107 + } else if (this.data.sel == 1) {
56 this.setData({ 108 this.setData({
57 - selarray: ['东京菜(234)', '神户菜(23)', '大阪菜(45)'], 109 +
58 selt: 1, 110 selt: 1,
59 - selk: '' 111 + selk: '',
  112 + goodlist: []
60 }) 113 })
61 - }else if(this.data.sel==2){ 114 + this.getcai();
  115 + this.gethomelist()
  116 + } else if (this.data.sel == 2) {
62 this.setData({ 117 this.setData({
63 - selarray: ['米其林三星级(123)', '米其林二星级(123)', '米其林一星级(123)'],  
64 selt: 2, 118 selt: 2,
65 - selk: '' 119 + selk: '',
  120 + goodlist: []
66 }) 121 })
  122 +
  123 + this.getrank();
  124 + this.gethomelist()
67 } else if (this.data.sel == 3) { 125 } else if (this.data.sel == 3) {
68 this.setData({ 126 this.setData({
69 - selarray: ['好评优先', '距离优先', '高价优先','低价优先'],  
70 selt: 3, 127 selt: 3,
71 - selk: '' 128 + selk: '',
  129 + goodlist: []
72 }) 130 })
  131 +
  132 + this.gettotal();
  133 + this.gethomelist()
73 } 134 }
74 - 135 +
75 }, 136 },
76 // 遮罩层头部切换 137 // 遮罩层头部切换
77 selnavk(e) { 138 selnavk(e) {
78 this.setData({ 139 this.setData({
79 - selt: e.currentTarget.dataset.index 140 + selt: e.currentTarget.dataset.index,
  141 + sel: e.currentTarget.dataset.index
80 }) 142 })
81 if (this.data.selt == 0) { 143 if (this.data.selt == 0) {
82 this.setData({ 144 this.setData({
83 - selarray: ['全部', '银座', '金座'],  
84 - 145 + goodlist: []
85 }) 146 })
  147 + this.getshanguqan();
  148 +
  149 + this.gethomelist()
86 } else if (this.data.selt == 1) { 150 } else if (this.data.selt == 1) {
87 this.setData({ 151 this.setData({
88 - selarray: ['东京菜(234)', '神户菜(23)', '大阪菜(45)'],  
89 - 152 + goodlist: []
90 }) 153 })
  154 +
  155 + this.getcai();
  156 + this.gethomelist()
91 } else if (this.data.selt == 2) { 157 } else if (this.data.selt == 2) {
92 this.setData({ 158 this.setData({
93 - selarray: ['米其林三星级(123)', '米其林二星级(123)', '米其林一星级(123)'],  
94 - 159 + goodlist: []
95 }) 160 })
  161 + this.getrank();
  162 + this.gethomelist()
96 } else if (this.data.selt == 3) { 163 } else if (this.data.selt == 3) {
97 this.setData({ 164 this.setData({
98 - selarray: ['好评优先', '距离优先', '高价优先', '低价优先'],  
99 - 165 + goodlist: []
100 }) 166 })
  167 + this.gettotal();
  168 + this.gethomelist()
101 } 169 }
102 170
103 }, 171 },
104 - go(){  
105 - 172 + go() {
  173 +
106 }, 174 },
107 selwrap(e) { 175 selwrap(e) {
108 - this.setData({  
109 - selk: e.currentTarget.dataset.index 176 + let that = this;
  177 + let id = e.currentTarget.dataset.id;
  178 + let type = e.currentTarget.dataset.type;
  179 + that.setData({
  180 + goodlist: []
  181 + })
  182 + this.data.selarray.forEach(function(value, index, array) {
  183 + if (id == value.id) {
  184 + value.sel = !value.sel;
  185 + if (value.sel == true) {
  186 + if (type == 1) {
  187 + that.setData({
  188 + business_id: id
  189 + })
  190 + } else if (type == 2) {
  191 + that.setData({
  192 + series_id: id
  193 + })
  194 + } else if (type == 3) {
  195 + that.setData({
  196 + grade_id: id
  197 + })
  198 + } else if (type == 4) {
  199 + that.setData({
  200 + composite_id: id
  201 + })
  202 + }
  203 + } else {
  204 + if (type == 1) {
  205 + that.setData({
  206 + business_id: ''
  207 + })
  208 + } else if (type == 2) {
  209 + that.setData({
  210 + series_id: ''
  211 + })
  212 + } else if (type == 3) {
  213 + that.setData({
  214 + grade_id: ''
  215 + })
  216 + } else if (type == 4) {
  217 + that.setData({
  218 + composite_id: ''
  219 + })
  220 + }
  221 + }
  222 + } else {
  223 + value.sel = false;
  224 +
  225 + }
  226 + })
  227 +
  228 + that.setData({
  229 + selarray: that.data.selarray
110 }) 230 })
111 - console.log(this.data.selk) 231 +
  232 + that.gethomelist()
112 }, 233 },
113 selctcity() { 234 selctcity() {
114 - wx.navigateTo({  
115 - url: '/pages/searchcity/searchcity',  
116 - }) 235 + let token = wx.getStorageSync("token");
  236 + if (token == '') {
  237 + wx.showToast({
  238 + title: '请先登录',
  239 + icon: "none"
  240 + })
  241 + setTimeout(function() {
  242 + wx.navigateTo({
  243 + url: '/pages/index/index',
  244 + })
  245 + }, 1500)
  246 + } else {
  247 + wx.navigateTo({
  248 + url: '/pages/searchcity/searchcity?countryid=' + this.data.countryid + '&cityname=' + app.globalData.cityname + '&cityid=' + this.data.userinfo.city_id,
  249 + })
  250 + }
  251 +
117 }, 252 },
118 253
119 swiperChange: function(e) { 254 swiperChange: function(e) {
@@ -123,16 +258,232 @@ Page({ @@ -123,16 +258,232 @@ Page({
123 }, 258 },
124 // 搜索框 259 // 搜索框
125 search() { 260 search() {
126 - wx.navigateTo({  
127 - url: '/pages/searchresult/searchresult',  
128 - }) 261 + let token = wx.getStorageSync("token");
  262 + if (token == '') {
  263 + wx.showToast({
  264 + title: '请先登录',
  265 + icon: "none"
  266 + })
  267 + setTimeout(function () {
  268 + wx.navigateTo({
  269 + url: '/pages/index/index',
  270 + })
  271 + }, 1500)
  272 + }else{
  273 + wx.navigateTo({
  274 + url: '/pages/searchresult/searchresult',
  275 + })
  276 + }
  277 +
129 }, 278 },
130 -// 隐藏遮罩层  
131 - hidewrap(){ 279 + // 隐藏遮罩层
  280 + hidewrap() {
132 this.setData({ 281 this.setData({
133 - wrap:false 282 + wrap: false
  283 + })
  284 + },
  285 +
  286 + // 获取用户信息
  287 + getuserinfo() {
  288 + let that = this;
  289 + var url = 'member/index';
  290 + var params = {
  291 +
  292 +
  293 + }
  294 + app.post(url, params).then((res) => {
  295 + console.log(res);
  296 + console.log('37494', app.globalData.cityname)
  297 +
  298 + if (app.globalData.cityname != undefined) {
  299 + res.city_name = app.globalData.cityname
  300 + that.setData({
  301 + userinfo: res
  302 + })
  303 +
  304 + } else {
  305 + that.setData({
  306 + userinfo: res
  307 + })
  308 + app.globalData.cityname=res.city_name==null?'东京':res.city_name
  309 + }
  310 + console.log('9999', app.globalData.cityname)
  311 +
  312 + that.getshanguqan();
  313 + that.gethomelist()
  314 +
  315 +
  316 +
  317 + }).catch((err) => {
  318 +
134 }) 319 })
135 }, 320 },
  321 +
  322 + // 获取首页列表
  323 + gethomelist() {
  324 + let that = this;
  325 + var url = 'index/getShopList';
  326 + console.log('234924',that.data.userinfo)
  327 + var params = {
  328 + page: that.data.page,
  329 + limit: 15,
  330 + business_id: that.data.business_id,
  331 + series_id: that.data.series_id,
  332 + grade_id: that.data.grade_id,
  333 + composite_id: that.data.composite_id,
  334 + is_recommend: 0,
  335 + city_id: that.data.userinfo.city_id == null ? 1 : that.data.userinfo.city_id,
  336 + }
  337 + app.post(url, params).then((res) => {
  338 + console.log(res);
  339 + that.setData({
  340 + goodlist: that.data.goodlist.concat(res.data)
  341 + })
  342 + that.data.goodlist.forEach(function(value, index, array) {
  343 + value.level = value.level.toFixed("1")
  344 + })
  345 + that.setData({
  346 + goodlist: that.data.goodlist
  347 + })
  348 +
  349 +
  350 + }).catch((err) => {
  351 +
  352 + })
  353 +
  354 + },
  355 +
  356 + // 获取国家
  357 + getcountry() {
  358 + let that = this;
  359 + var url = 'sundry/get_country';
  360 + var params = {
  361 +
  362 + }
  363 + app.post(url, params).then((res) => {
  364 + console.log(res);
  365 + that.setData({
  366 + countryname: res[0].name,
  367 + countryid: res[0].id
  368 + })
  369 +
  370 +
  371 +
  372 + }).catch((err) => {
  373 +
  374 + })
  375 + },
  376 +
  377 + // 获取商圈
  378 + getshanguqan() {
  379 + let that = this;
  380 + var url = 'sundry/get_business';
  381 + var params = {
  382 + city_id: that.data.userinfo.city_id == null?'' : that.data.userinfo.city_id,
  383 + }
  384 + app.post(url, params, "post").then((res) => {
  385 + console.log(res);
  386 + that.setData({
  387 + selarray: res,
  388 + })
  389 + that.data.selarray.forEach(function(value, index, array) {
  390 + value.sel = false;
  391 + value.type = 1;
  392 + if (that.data.business_id == value.id) {
  393 + value.sel = true
  394 + }
  395 + })
  396 + that.setData({
  397 + selarray: that.data.selarray
  398 + })
  399 +
  400 + }).catch((err) => {
  401 +
  402 + })
  403 + },
  404 + // 获取菜系
  405 + getcai() {
  406 + let that = this;
  407 + var url = 'sundry/get_series';
  408 + var params = {
  409 +
  410 + }
  411 + app.post(url, params, "post").then((res) => {
  412 + console.log(res);
  413 + that.setData({
  414 + selarray: res,
  415 +
  416 + })
  417 + that.data.selarray.forEach(function(value, index, array) {
  418 + value.sel = false;
  419 + value.type = 2;
  420 + if (that.data.series_id == value.id) {
  421 + value.sel = true
  422 + }
  423 + })
  424 + that.setData({
  425 + selarray: that.data.selarray
  426 + })
  427 +
  428 + }).catch((err) => {
  429 +
  430 + })
  431 + },
  432 + // 获取评级
  433 + getrank() {
  434 + let that = this;
  435 + var url = 'sundry/get_grade';
  436 + var params = {
  437 +
  438 + }
  439 + app.post(url, params, "post").then((res) => {
  440 + console.log(res);
  441 + that.setData({
  442 + selarray: res,
  443 +
  444 +
  445 + })
  446 + that.data.selarray.forEach(function(value, index, array) {
  447 + value.sel = false;
  448 + value.type = 3;
  449 + if (that.data.grade_id == value.id) {
  450 + value.sel = true
  451 + }
  452 + })
  453 + that.setData({
  454 + selarray: that.data.selarray
  455 + })
  456 +
  457 + }).catch((err) => {
  458 +
  459 + })
  460 + },
  461 +
  462 + // 获取综合评分
  463 + gettotal() {
  464 + let that = this;
  465 + var url = 'sundry/get_score_option';
  466 + var params = {
  467 +
  468 + }
  469 + app.post(url, params).then((res) => {
  470 + console.log(res);
  471 + that.setData({
  472 + selarray: res,
  473 + })
  474 + that.data.selarray.forEach(function(value, index, array) {
  475 + value.sel = false;
  476 + value.type = 4;
  477 + if (that.data.composite_id == value.id) {
  478 + value.sel = true
  479 + }
  480 + })
  481 + that.setData({
  482 + selarray: that.data.selarray
  483 + })
  484 +
  485 + }).catch((err) => {})
  486 + },
136 /** 487 /**
137 * 生命周期函数--监听页面初次渲染完成 488 * 生命周期函数--监听页面初次渲染完成
138 */ 489 */
@@ -144,7 +495,13 @@ Page({ @@ -144,7 +495,13 @@ Page({
144 * 生命周期函数--监听页面显示 495 * 生命周期函数--监听页面显示
145 */ 496 */
146 onShow: function() { 497 onShow: function() {
147 - 498 + this.setData({
  499 + page:1,
  500 + goodlist:[]
  501 + })
  502 + this.getuserinfo();
  503 + // //获取首页列表
  504 + // this.gethomelist();
148 }, 505 },
149 506
150 /** 507 /**
1 { 1 {
2 - "navigationBarTitleText": "美味日本" 2 + "navigationBarTitleText": "美味星球"
3 } 3 }
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 <view class="headleftimg"> 4 <view class="headleftimg">
5 <image src="/img/address.png" mode=""></image> 5 <image src="/img/address.png" mode=""></image>
6 </view> 6 </view>
7 - <view class="cityname commonname">日本</view> 7 + <view class="cityname commonname">{{userinfo.city_name==null?'东京':userinfo.city_name}}</view>
8 </view> 8 </view>
9 <view class="headmiddle" bindtap="search"> 9 <view class="headmiddle" bindtap="search">
10 <view class="headmiddleleft"> 10 <view class="headmiddleleft">
@@ -19,10 +19,10 @@ @@ -19,10 +19,10 @@
19 </view> 19 </view>
20 20
21 <view class="swiper_image"> 21 <view class="swiper_image">
22 - <swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" class="swiper_item_img" bindchange="swiperChange"> 22 + <swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" class="swiper_item_img" bindchange="swiperChange" circular="true">
23 <block wx:for="{{imgUrls}}" wx:key="doct"> 23 <block wx:for="{{imgUrls}}" wx:key="doct">
24 <swiper-item> 24 <swiper-item>
25 - <image src="{{item}}" class="slide-image" /> 25 + <image src="{{item.image}}" class="slide-image" />
26 <view class="picimg"> 26 <view class="picimg">
27 <image src="/img/meitu.png"></image> 27 <image src="/img/meitu.png"></image>
28 </view> 28 </view>
@@ -49,21 +49,23 @@ @@ -49,21 +49,23 @@
49 </view> 49 </view>
50 </view> 50 </view>
51 51
52 -<view class='case-page'> 52 +<view class="nodata" wx:if="{{goodlist.length==0}}">暂无数据</view>
  53 +
  54 +<view class='case-page' wx:else>
53 <view class='list-masonry'> 55 <view class='list-masonry'>
54 - <view class='item-masonry' bindtap="goodtail">  
55 - <image src='/img/deng.png' mode='widthFix'></image>  
56 - <view class="goodname">基值支义们京候么眼革下使叫南石很少去构。</view>  
57 - <view class="intro flexone"> 56 + <view class='item-masonry' bindtap="goodtail" data-id="{{item.id}}" wx:for="{{goodlist}}" wx:key="" >
  57 + <image src='{{item.image}}' mode='widthFix'></image>
  58 + <view class="goodname">{{item.name}}</view>
  59 + <view class="intro flextwo">
58 <view class="introleft"> 60 <view class="introleft">
59 - 魚介?海鮮料理 61 + {{item.series_name}}
60 </view> 62 </view>
61 <view class="introright"> 63 <view class="introright">
62 <view class="ping flexone"> 64 <view class="ping flexone">
63 <view class="pingleft"> 65 <view class="pingleft">
64 <image src='/img/kuaizi.png'></image> 66 <image src='/img/kuaizi.png'></image>
65 </view> 67 </view>
66 - <view class="pingfen">4.7</view> 68 + <view class="pingfen">{{item.level}}</view>
67 </view> 69 </view>
68 <view class="hualist flexone"> 70 <view class="hualist flexone">
69 <view class="huaitem"> 71 <view class="huaitem">
@@ -79,17 +81,17 @@ @@ -79,17 +81,17 @@
79 </view> 81 </view>
80 </view> 82 </view>
81 <view class="shou"> 83 <view class="shou">
82 - <text class="shoumoney">¥50</text> 84 + <text class="shoumoney">¥{{item.price}}</text>
83 <text class="shouren">/人</text> 85 <text class="shouren">/人</text>
84 </view> 86 </view>
85 <view class="addname flexone"> 87 <view class="addname flexone">
86 <view class="addimg"> 88 <view class="addimg">
87 <image src="/img/huangweizhi.png"></image> 89 <image src="/img/huangweizhi.png"></image>
88 </view> 90 </view>
89 - <view class="dizhi commnameone">银厦</view> 91 + <view class="dizhi commnameone">{{item.city_name}}</view>
90 </view> 92 </view>
91 </view> 93 </view>
92 - <view class='item-masonry'> 94 + <!-- <view class='item-masonry'>
93 <image src='/img/deng.png' mode='widthFix'></image> 95 <image src='/img/deng.png' mode='widthFix'></image>
94 <view class="goodname">基值支义们京候么眼革下使叫南石很少去构。</view> 96 <view class="goodname">基值支义们京候么眼革下使叫南石很少去构。</view>
95 <view class="intro flexone"> 97 <view class="intro flexone">
@@ -278,7 +280,7 @@ @@ -278,7 +280,7 @@
278 </view> 280 </view>
279 <view class="dizhi commnameone">银厦</view> 281 <view class="dizhi commnameone">银厦</view>
280 </view> 282 </view>
281 - </view> 283 + </view> -->
282 284
283 </view> 285 </view>
284 </view> 286 </view>
@@ -295,14 +297,9 @@ @@ -295,14 +297,9 @@
295 </view> 297 </view>
296 </view> 298 </view>
297 <view class="wrappage"> 299 <view class="wrappage">
298 - <view class="wrapitem {{selk==index?'wrapactive':''}}" wx:for="{{selarray}}" wx:key="" catchtap="selwrap" data-index="{{index}}">  
299 - {{item}} 300 + <view class="wrapitem {{item.sel==true?'wrapactive':''}}" wx:for="{{selarray}}" wx:key="" catchtap="selwrap" data-index="{{index}}" data-id="{{item.id}}" data-type="{{item.type}}">
  301 + {{item.name}}
300 </view> 302 </view>
301 -  
302 -  
303 </view> 303 </view>
304 </view> 304 </view>
305 -  
306 -  
307 -  
308 </view> 305 </view>
@@ -63,8 +63,8 @@ swiper-item { @@ -63,8 +63,8 @@ swiper-item {
63 /*未选中时的小圆点样式 */ 63 /*未选中时的小圆点样式 */
64 64
65 .dot { 65 .dot {
66 - width: 12rpx;  
67 - height: 12rpx; 66 + width: 14rpx;
  67 + height: 14rpx;
68 border-radius: 50%; 68 border-radius: 50%;
69 margin-right: 16rpx; 69 margin-right: 16rpx;
70 background-color: #b9c0f7; 70 background-color: #b9c0f7;
@@ -139,7 +139,7 @@ swiper-item { @@ -139,7 +139,7 @@ swiper-item {
139 break-inside: avoid; 139 break-inside: avoid;
140 box-sizing: border-box; 140 box-sizing: border-box;
141 padding: 20rpx; 141 padding: 20rpx;
142 - margin-bottom: 28rpx; 142 + /* margin-bottom: 28rpx; */
143 box-shadow: 0rpx 8rpx 16rpx rgba(0, 0, 0, 0.08); 143 box-shadow: 0rpx 8rpx 16rpx rgba(0, 0, 0, 0.08);
144 border-radius: 8rpx; 144 border-radius: 8rpx;
145 } 145 }
@@ -154,10 +154,12 @@ swiper-item { @@ -154,10 +154,12 @@ swiper-item {
154 font-weight: bold; 154 font-weight: bold;
155 margin-top: 20rpx; 155 margin-top: 20rpx;
156 width: 296rpx; 156 width: 296rpx;
  157 + margin-bottom:10rpx;
157 } 158 }
158 159
159 .hualist { 160 .hualist {
160 margin-top: 4rpx; 161 margin-top: 4rpx;
  162 + justify-content: flex-end
161 } 163 }
162 164
163 .huaitem { 165 .huaitem {
@@ -174,9 +176,14 @@ swiper-item { @@ -174,9 +176,14 @@ swiper-item {
174 } 176 }
175 177
176 .pingfen { 178 .pingfen {
  179 +
  180 + overflow: hidden;
  181 + text-overflow: ellipsis;
177 color: #fca052; 182 color: #fca052;
178 font-size: 22rpx; 183 font-size: 22rpx;
179 margin-left: 6rpx; 184 margin-left: 6rpx;
  185 + text-align: right;
  186 + margin-right:8rpx;
180 } 187 }
181 188
182 .introleft { 189 .introleft {
@@ -248,11 +255,14 @@ page { @@ -248,11 +255,14 @@ page {
248 .wrapitem{ 255 .wrapitem{
249 color:#06121E; 256 color:#06121E;
250 font-size: 24rpx; 257 font-size: 24rpx;
251 - font-weight: bold; 258 + /* font-weight: bold; */
252 padding: 16rpx 52rpx; 259 padding: 16rpx 52rpx;
253 box-sizing: border-box; 260 box-sizing: border-box;
254 border-bottom:1rpx solid #f5f5f5; 261 border-bottom:1rpx solid #f5f5f5;
255 } 262 }
  263 +.wrapitem:last-child{
  264 + border-bottom:none;
  265 +}
256 .wrappage{ 266 .wrappage{
257 margin-top:26rpx; 267 margin-top:26rpx;
258 } 268 }
@@ -4,51 +4,114 @@ const app = getApp() @@ -4,51 +4,114 @@ const app = getApp()
4 4
5 Page({ 5 Page({
6 data: { 6 data: {
7 - motto: 'Hello World',  
8 - userInfo: {},  
9 - hasUserInfo: false,  
10 - canIUse: wx.canIUse('button.open-type.getUserInfo') 7 + sessionKey: '',
  8 + openid: '',
  9 + iv: '',
  10 + encryptedData: '',
  11 + type:'',
  12 + shopid:''
11 }, 13 },
12 - //事件处理函数  
13 - bindViewTap: function() {  
14 - wx.navigateTo({  
15 - url: '../logs/logs'  
16 - })  
17 - },  
18 - onLoad: function () {  
19 - if (app.globalData.userInfo) { 14 +
  15 + onLoad: function (options) {
  16 + if(options.type!=undefined){
20 this.setData({ 17 this.setData({
21 - userInfo: app.globalData.userInfo,  
22 - hasUserInfo: true  
23 - })  
24 - } else if (this.data.canIUse){  
25 - // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回  
26 - // 所以此处加入 callback 以防止这种情况  
27 - app.userInfoReadyCallback = res => {  
28 - this.setData({  
29 - userInfo: res.userInfo,  
30 - hasUserInfo: true  
31 - })  
32 - }  
33 - } else {  
34 - // 在没有 open-type=getUserInfo 版本的兼容处理  
35 - wx.getUserInfo({  
36 - success: res => {  
37 - app.globalData.userInfo = res.userInfo  
38 - this.setData({  
39 - userInfo: res.userInfo,  
40 - hasUserInfo: true  
41 - })  
42 - } 18 + type:options.type,
  19 + shopid:options.id
43 }) 20 })
44 } 21 }
45 }, 22 },
46 - getUserInfo: function(e) { 23 +
  24 +
  25 + // 登录
  26 + start(e) {
47 console.log(e) 27 console.log(e)
48 - app.globalData.userInfo = e.detail.userInfo  
49 - this.setData({  
50 - userInfo: e.detail.userInfo,  
51 - hasUserInfo: true 28 + console.log(434348389)
  29 +
  30 + let that = this;
  31 + that.setData({
  32 + iv: e.detail.iv,
  33 + encryptedData: e.detail.encryptedData
52 }) 34 })
  35 +
  36 +
  37 + console.log(this.data.iv);
  38 + console.log(this.data.encryptedData)
  39 +
  40 + wx.getSetting({
  41 + success(res) {
  42 + console.log("res", res)
  43 + if (res.authSetting['scope.userInfo']) {
  44 + console.log(348438)
  45 + wx.login({
  46 + success: (res) => {
  47 + console.log(res)
  48 +
  49 + var url = 'user/getSessionKey';
  50 + var params = {
  51 + code: res.code,
  52 +
  53 + }
  54 + app.post(url, params).then((res) => {
  55 + console.log(res);
  56 + console.log(435485, res.session_key)
  57 + that.setData({
  58 + sessionKey: res.session_key,
  59 + openid: res.openid
  60 + })
  61 + wx.setStorageSync("sessionKey", res.session_key)
  62 + wx.setStorageSync("openid", res.openid)
  63 + that.login()
  64 + }).catch((err) => {
  65 +
  66 + })
  67 +
  68 +
  69 +
  70 + }
  71 + });
  72 + } else {
  73 + console.log("未授权=====")
  74 + // wx.switchTab({
  75 + // url: '/pages/homepage/homepage',
  76 + // })
  77 + }
  78 + }
  79 + })
  80 +
  81 +
  82 + },
  83 +
  84 + login() {
  85 + let that = this;
  86 + console.log(378784)
  87 + let url = 'user/login';
  88 + let params = {
  89 + session_key: that.data.sessionKey,
  90 + iv: that.data.iv,
  91 + encrypted_data: that.data.encryptedData,
  92 + openid: that.data.openid
  93 +
  94 + }
  95 + app.post(url, params, 'post').then((res) => {
  96 + console.log(res)
  97 + wx.setStorageSync('token', res.token);
  98 + if(that.data.type==1){
  99 + wx.navigateTo({
  100 + url: '/pages/shopdetail/shopdetail?id='+that.data.shopid,
  101 + })
  102 + }else{
  103 + wx.switchTab({
  104 + url: '/pages/homepage/homepage',
  105 + })
  106 + }
  107 +
  108 +
  109 +
  110 +
  111 + }).catch((errMsg) => {
  112 + console.log(errMsg)
  113 +
  114 + })
  115 +
53 } 116 }
54 -}) 117 +})
1 { 1 {
2 - "usingComponents": {} 2 + "navigationBarTitleText": "美味星球"
3 } 3 }
1 <!--index.wxml--> 1 <!--index.wxml-->
2 -<view class="container">  
3 - <view class="userinfo">  
4 - <button wx:if="{{!hasUserInfo && canIUse}}" open-type="getUserInfo" bindgetuserinfo="getUserInfo"> 获取头像昵称 </button>  
5 - <block wx:else>  
6 - <image bindtap="bindViewTap" class="userinfo-avatar" src="{{userInfo.avatarUrl}}" mode="cover"></image>  
7 - <text class="userinfo-nickname">{{userInfo.nickName}}</text>  
8 - </block>  
9 - </view>  
10 - <view class="usermotto">  
11 - <text class="user-motto">{{motto}}</text> 2 +<view class="box">
  3 + <view class='logo'>
  4 + <image src="/img/logo.png"></image>
12 </view> 5 </view>
  6 +<button open-type="getUserInfo" bindgetuserinfo='start' class="bottomtextright" >微信授权</button>
13 </view> 7 </view>
1 -/**index.wxss**/  
2 -.userinfo {  
3 - display: flex;  
4 - flex-direction: column;  
5 - align-items: center; 1 +.logo {
  2 + width: 197rpx;
  3 + height: 197rpx;
  4 + font-size: 0;
  5 + margin: 120rpx auto 0;
  6 + border-radius: 50%;
6 } 7 }
7 -  
8 -.userinfo-avatar {  
9 - width: 128rpx;  
10 - height: 128rpx;  
11 - margin: 20rpx; 8 +.logon image{
12 border-radius: 50%; 9 border-radius: 50%;
13 } 10 }
14 11
15 -.userinfo-nickname {  
16 - color: #aaa; 12 +.bottomtextright {
  13 + width: 360rpx;
  14 + height: 80rpx;
  15 + background: rgba(253, 172, 48, 1);
  16 + border: 2rpx solid rgba(253, 170, 42, 1);
  17 + opacity: 1;
  18 + border-radius: 8rpx;
  19 + color:#fff;
  20 + font-size: 28rpx;
  21 + text-align: center;
  22 +
  23 + margin:522rpx auto 0;
  24 +}
  25 +button::after{
  26 + border:none;
  27 + outline:none;
17 } 28 }
18 -  
19 -.usermotto {  
20 - margin-top: 200px;  
21 -}  
1 // pages/morecomment/morecomment.js 1 // pages/morecomment/morecomment.js
  2 +const app=getApp()
2 Page({ 3 Page({
3 4
4 /** 5 /**
@@ -6,30 +7,65 @@ Page({ @@ -6,30 +7,65 @@ Page({
6 */ 7 */
7 data: { 8 data: {
8 comentarr: ['全部', '好评', '差评', '带图评论'], 9 comentarr: ['全部', '好评', '差评', '带图评论'],
9 -  
10 -  
11 coment:0, 10 coment:0,
  11 + page:1,
  12 + shopid:'',
  13 + commentlist:[]
  14 +
12 }, 15 },
13 16
14 /** 17 /**
15 * 生命周期函数--监听页面加载 18 * 生命周期函数--监听页面加载
16 */ 19 */
17 onLoad: function(options) { 20 onLoad: function(options) {
  21 + console.log(options)
  22 + this.setData({
  23 + shopid:options.shopid
  24 + })
  25 + this.getmorecomment()
18 26
19 }, 27 },
20 selitem(e){ 28 selitem(e){
21 console.log(e) 29 console.log(e)
22 this.setData({ 30 this.setData({
23 - coment: e.currentTarget.dataset.index 31 + coment: e.currentTarget.dataset.index,
  32 + page:1,
  33 + commentlist:[]
24 }) 34 })
  35 + this.getmorecomment()
25 36
26 }, 37 },
27 - comdetail(){ 38 + // 获取更多的评论列表
  39 + getmorecomment(){
  40 + let that = this;
  41 + console.log(that.data.coment)
  42 + var url = '/remark/getRemarkList';
  43 + var params = {
  44 + page: that.data.page,
  45 + shop_id:that.data.shopid,
  46 + limit:15,
  47 + type:that.data.comment
  48 +
  49 + }
  50 + app.post(url, params,"post").then((res) => {
  51 + console.log(res);
  52 + that.setData({
  53 + commentlist: that.data.commentlist.concat(res.data)
  54 + })
  55 +
  56 +
  57 +
  58 + }).catch((err) => {
  59 +
  60 + })
  61 + },
  62 + // 点评详情
  63 + comentdetail(e) {
  64 + let commentid = e.currentTarget.dataset.id
28 wx.navigateTo({ 65 wx.navigateTo({
29 - url: '/pages/commentdetail/commentdetail', 66 + url: '/pages/commentdetail/commentdetail?commentid=' + commentid + '&shopid=' + this.data.shopid,
30 }) 67 })
31 }, 68 },
32 -  
33 /** 69 /**
34 * 生命周期函数--监听页面初次渲染完成 70 * 生命周期函数--监听页面初次渲染完成
35 */ 71 */
@@ -69,7 +105,13 @@ Page({ @@ -69,7 +105,13 @@ Page({
69 * 页面上拉触底事件的处理函数 105 * 页面上拉触底事件的处理函数
70 */ 106 */
71 onReachBottom: function() { 107 onReachBottom: function() {
  108 + let newpage=this.data.page;
  109 + newpage++;
  110 + this.setData({
  111 + page:newpage
  112 + })
72 113
  114 + this.getmorecomment()
73 }, 115 },
74 116
75 /** 117 /**
@@ -2,35 +2,46 @@ @@ -2,35 +2,46 @@
2 <view class="commenttopitem {{coment==index?'comactive':''}}" wx:for="{{comentarr}}" wx:key="" bindtap="selitem" data-index="{{index}}">{{item}}</view> 2 <view class="commenttopitem {{coment==index?'comactive':''}}" wx:for="{{comentarr}}" wx:key="" bindtap="selitem" data-index="{{index}}">{{item}}</view>
3 </view> 3 </view>
4 <view class="bodybox"> 4 <view class="bodybox">
5 - <view class="photo" >  
6 - <view class="jianintro photobox" bindtap="comdetail"> 5 + <view class="photo" wx:for="{{commentlist}}" wx:key="">
  6 + <view class="jianintro photobox" bindtap="comentdetail" data-id="{{item.id}}">
7 <view class="comtop flextwo"> 7 <view class="comtop flextwo">
8 <view class="comleft"> 8 <view class="comleft">
9 - <image src="/img/kele.png"></image> 9 + <image src="{{item.avatar}}"></image>
10 </view> 10 </view>
11 <view class="comright"> 11 <view class="comright">
12 12
13 <view class="comrtop flextwo"> 13 <view class="comrtop flextwo">
14 - <view class="comrname">一心只想撤撤撤</view> 14 + <view class="comrname">{{item.nickname}}</view>
15 <view class="star starone flexone"> 15 <view class="star starone flexone">
16 <view class="staritem"> 16 <view class="staritem">
17 - <image src="/img/star.png"></image> 17 + <image src="/img/star.png" wx:if="{{item.user_level>=1}}"></image>
  18 + <image src="/img/huangkong.png" wx:if="{{item.user_level<0.5}}"></image>
  19 + <image src="/img/huangban.png" wx:if="{{item.user_level>=0.5&&tem.user_level<1}}"></image>
18 </view> 20 </view>
19 <view class="staritem"> 21 <view class="staritem">
20 - <image src="/img/star.png"></image> 22 + <image src="/img/star.png" wx:if="{{item.user_level>=2}}"></image>
  23 + <image src="/img/huangkong.png" wx:if="{{item.user_level<1.5}}"></image>
  24 + <image src="/img/huangban.png" wx:if="{{item.user_level==1.5&&tem.user_level<2}}"></image>
21 </view> 25 </view>
22 <view class="staritem"> 26 <view class="staritem">
23 - <image src="/img/star.png"></image> 27 + <image src="/img/star.png" wx:if="{{item.user_level>=3}}"></image>
  28 + <image src="/img/huangkong.png" wx:if="{{item.user_level<2.5}}"></image>
  29 + <image src="/img/huangban.png" wx:if="{{item.user_level>=2.5&&item.user_level<3}}"></image>
24 </view> 30 </view>
25 <view class="staritem"> 31 <view class="staritem">
26 - <image src="/img/star.png"></image> 32 + <image src="/img/star.png" wx:if="{{item.user_level>=4}}"></image>
  33 + <image src="/img/huangkong.png" wx:if="{{item.user_level<3.5}}"></image>
  34 + <image src="/img/huangban.png" wx:if="{{item.user_level>=3.5&&item.user_level<4}}"></image>
27 </view> 35 </view>
28 - <view class="staritem">  
29 - <image src="/img/star.png"></image> 36 + <view class="staritem">
  37 + <image src="/img/star.png" wx:if="{{item.user_level>=5}}"></image>
  38 + <image src="/img/huangkong.png" wx:if="{{item.user_level<4.5}}"></image>
  39 + <image src="/img/huangban.png" wx:if="{{item.user_level>=4.5&&item.user_level<5}}"></image>
30 </view> 40 </view>
  41 +
31 </view> 42 </view>
32 </view> 43 </view>
33 - <view class="comdate">2019年10月12日</view> 44 + <view class="comdate">{{item.createtime}}</view>
34 45
35 </view> 46 </view>
36 </view> 47 </view>
@@ -41,39 +52,48 @@ @@ -41,39 +52,48 @@
41 <view class="flexone fenxia"> 52 <view class="flexone fenxia">
42 <view class="star starone flexone"> 53 <view class="star starone flexone">
43 <view class="staritem"> 54 <view class="staritem">
44 - <image src="/img/star.png"></image>  
45 - </view>  
46 - <view class="staritem">  
47 - <image src="/img/star.png"></image> 55 + <image src="/img/pingfenshi.png" wx:if="{{item.score>=1}}"></image>
  56 + <image src="/img/noxing.png" wx:if="{{item.score<0.5}}"></image>
  57 + <image src="/img/banke.png" wx:if="{{item.score>=0.5&&item.score<1}}"></image>
  58 +
48 </view> 59 </view>
49 <view class="staritem"> 60 <view class="staritem">
50 - <image src="/img/star.png"></image> 61 + <image src="/img/pingfenshi.png" wx:if="{{item.score>=2}}"></image>
  62 + <image src="/img/noxing.png" wx:if="{{item.score<1.5}}"></image>
  63 + <image src="/img/banke.png" wx:if="{{item.score>=1.5&&item.score<2}}"></image>
51 </view> 64 </view>
52 <view class="staritem"> 65 <view class="staritem">
53 - <image src="/img/star.png"></image> 66 + <image src="/img/pingfenshi.png" wx:if="{{item.score>=3}}"></image>
  67 + <image src="/img/noxing.png" wx:if="{{item.score<2.5}}"></image>
  68 + <image src="/img/banke.png" wx:if="{{item.score>=2.5&&item.score<3}}"></image>
54 </view> 69 </view>
55 <view class="staritem"> 70 <view class="staritem">
56 - <image src="/img/banke.png"></image> 71 + <image src="/img/pingfenshi.png" wx:if="{{item.score>=4}}"></image>
  72 + <image src="/img/noxing.png" wx:if="{{item.score<3.5}}"></image>
  73 + <image src="/img/banke.png" wx:if="{{item.score>=3.5&&item.score<4}}"></image>
57 </view> 74 </view>
58 <view class="staritem"> 75 <view class="staritem">
59 - <image src="/img/star.png"></image> 76 + <image src="/img/pingfenshi.png" wx:if="{{item.score>=5}}"></image>
  77 + <image src="/img/noxing.png" wx:if="{{item.score<4.5}}"></image>
  78 + <image src="/img/banke.png" wx:if="{{item.score>=4.5&&item.score<5}}"></image>
60 </view> 79 </view>
  80 +
61 </view> 81 </view>
62 - <view class="fen">8.5分</view> 82 + <view class="fen">{{item.score}}分</view>
63 </view> 83 </view>
64 <view class="text"> 84 <view class="text">
65 - 掌柜态度很专业热情,有问必答,回复也很快,我问了不少问题,他都不觉得烦,都会认真回答我,这点我向掌柜表示由衷的敬意,这样的好掌柜可不多了。 85 + {{item.content}}
66 </view> 86 </view>
67 <view class="textboximg flexone"> 87 <view class="textboximg flexone">
68 - <view class="boxitem">  
69 - <image src="/img/photo.png"></image> 88 + <view class="boxitem" wx:for='{{item.images}}' wx:key="">
  89 + <image src="{{item}}"></image>
70 </view> 90 </view>
71 - <view class="boxitem"> 91 + <!-- <view class="boxitem">
72 <image src="/img/photo.png"></image> 92 <image src="/img/photo.png"></image>
73 </view> 93 </view>
74 <view class="boxitem"> 94 <view class="boxitem">
75 <image src="/img/photo.png"></image> 95 <image src="/img/photo.png"></image>
76 - </view> 96 + </view> -->
77 </view> 97 </view>
78 </view> 98 </view>
79 99
@@ -81,7 +101,7 @@ @@ -81,7 +101,7 @@
81 </view> 101 </view>
82 </view> 102 </view>
83 </view> 103 </view>
84 - <view class="photo" > 104 + <!-- <view class="photo" >
85 <view class="jianintro photobox" bindtap="comdetail"> 105 <view class="jianintro photobox" bindtap="comdetail">
86 <view class="comtop flextwo"> 106 <view class="comtop flextwo">
87 <view class="comleft"> 107 <view class="comleft">
@@ -159,6 +179,6 @@ @@ -159,6 +179,6 @@
159 179
160 </view> 180 </view>
161 </view> 181 </view>
162 - </view> 182 + </view> -->
163 183
164 </view> 184 </view>
1 // pages/morephoto/morephoto.js 1 // pages/morephoto/morephoto.js
  2 +const app=getApp()
2 Page({ 3 Page({
3 4
4 /** 5 /**
5 * 页面的初始数据 6 * 页面的初始数据
6 */ 7 */
7 data: { 8 data: {
8 - 9 + photolist:[]
9 }, 10 },
10 11
11 /** 12 /**
12 * 生命周期函数--监听页面加载 13 * 生命周期函数--监听页面加载
13 */ 14 */
14 onLoad: function (options) { 15 onLoad: function (options) {
15 - 16 + this.getphoto()
16 }, 17 },
  18 + // 获取相册
  19 + getphoto(){
  20 + let that = this;
  21 + var url = '/member/getPhoto';
  22 + var params = {
  23 +
  24 +
  25 + }
  26 + app.post(url, params).then((res) => {
  27 + console.log(res);
  28 + that.setData({
  29 + photolist:res
  30 + })
  31 +
17 32
  33 +
  34 + }).catch((err) => {
  35 +
  36 + })
  37 + },
  38 + previewimg(e){
  39 + let that=this;
  40 + let index=e.currentTarget.dataset.index;
  41 +
  42 + wx.previewImage({
  43 + current: that.data.photolist[index],
  44 + urls: that.data.photolist,
  45 + success: function (res) { },
  46 + fail: function (res) { },
  47 + complete: function (res) { },
  48 + })
  49 + },
18 /** 50 /**
19 * 生命周期函数--监听页面初次渲染完成 51 * 生命周期函数--监听页面初次渲染完成
20 */ 52 */
1 -<view class="photoptop flexone">  
2 - <view class="photoitem">  
3 - <image src="/img/photo.png"></image>  
4 - </view>  
5 - <view class="photoitem">  
6 - <image src="/img/photo.png"></image>  
7 - </view>  
8 - <view class="photoitem">  
9 - <image src="/img/photo.png"></image>  
10 - </view>  
11 - <view class="photoitem">  
12 - <image src="/img/photo.png"></image>  
13 - </view>  
14 - <view class="photoitem">  
15 - <image src="/img/photo.png"></image>  
16 - </view>  
17 - <view class="photoitem lastimg">  
18 - <image src="/img/photo.png"></image>  
19 1
  2 + <view class="noimg" wx:if="{{photolist.length==0}}">
  3 + <view class="nodataimg" >
  4 + <image src="/img/nodataimg.png"></image>
  5 + </view>
  6 + <view class="nomoer nomoredata">没有更多了哦~</view>
20 </view> 7 </view>
21 -  
22 - <view class="photoitem">  
23 - <image src="/img/photo.png"></image>  
24 - </view>  
25 - <view class="photoitem">  
26 - <image src="/img/photo.png"></image>  
27 - </view>  
28 - <view class="photoitem lastimg">  
29 - <image src="/img/photo.png"></image>  
30 - 8 +<view class="photoptop flexone" wx:else>
  9 + <view class="photoitem" wx:for='{{photolist}}' wx:key="" bindtap='previewimg' data-index="{{index}}">
  10 + <image src="{{item}}" mode="aspectFit" ></image>
31 </view> 11 </view>
  12 +
32 </view> 13 </view>
  1 +// pages/morepic/morepic.js
  2 +const app=getApp()
  3 +Page({
  4 +
  5 + /**
  6 + * 页面的初始数据
  7 + */
  8 + data: {
  9 + images:[]
  10 + },
  11 +
  12 + /**
  13 + * 生命周期函数--监听页面加载
  14 + */
  15 + onLoad: function (options) {
  16 + this.setData({
  17 + images: app.globalData.images
  18 + })
  19 + console.log(this.data.images)
  20 + },
  21 +
  22 + previewimg(e) {
  23 + let that = this;
  24 + let index = e.currentTarget.dataset.index;
  25 +
  26 + wx.previewImage({
  27 + current: that.data.images[index],
  28 + urls: that.data.images,
  29 + success: function (res) { },
  30 + fail: function (res) { },
  31 + complete: function (res) { },
  32 + })
  33 + },
  34 +
  35 + /**
  36 + * 生命周期函数--监听页面初次渲染完成
  37 + */
  38 + onReady: function () {
  39 +
  40 + },
  41 +
  42 + /**
  43 + * 生命周期函数--监听页面显示
  44 + */
  45 + onShow: function () {
  46 +
  47 + },
  48 +
  49 + /**
  50 + * 生命周期函数--监听页面隐藏
  51 + */
  52 + onHide: function () {
  53 +
  54 + },
  55 +
  56 + /**
  57 + * 生命周期函数--监听页面卸载
  58 + */
  59 + onUnload: function () {
  60 +
  61 + },
  62 +
  63 + /**
  64 + * 页面相关事件处理函数--监听用户下拉动作
  65 + */
  66 + onPullDownRefresh: function () {
  67 +
  68 + },
  69 +
  70 + /**
  71 + * 页面上拉触底事件的处理函数
  72 + */
  73 + onReachBottom: function () {
  74 +
  75 + },
  76 +
  77 + /**
  78 + * 用户点击右上角分享
  79 + */
  80 + onShareAppMessage: function () {
  81 +
  82 + }
  83 +})
  1 +{
  2 + "navigationBarTitleText": ""
  3 +}
  1 +
  2 + <view class="noimg" wx:if="{images.length==0}}">
  3 + <view class="nodataimg" >
  4 + <image src="/img/nodataimg.png"></image>
  5 + </view>
  6 + <view class="nomoer nomoredata">没有更多了哦~</view>
  7 + </view>
  8 +<view class="photoptop flexone" wx:else>
  9 + <view class="photoitem" wx:for='{{images}}' wx:key="" bindtap="previewimg" data-index="{{index}}">
  10 + <image src="{{item}}"></image>
  11 + </view>
  12 +
  13 +</view>
  1 +@import '../shopdetail/shopdetail.wxss';
  2 +.jianintro {
  3 + background: #FBF8FB;
  4 +}
  5 +.photobox{
  6 + padding: 30rpx;
  7 + box-sizing: border-box;
  8 +}
  9 +.photoitem{
  10 + width:214rpx;
  11 + height:214rpx;
  12 +
  13 +}
  14 +.photoptop{
  15 + padding: 30rpx 12rpx 30rpx 30rpx;
  16 + flex-wrap: wrap
  17 +}
1 // pages/morecomment/morecomment.js 1 // pages/morecomment/morecomment.js
  2 +const app=getApp()
2 Page({ 3 Page({
3 4
4 /** 5 /**
5 * 页面的初始数据 6 * 页面的初始数据
6 */ 7 */
7 data: { 8 data: {
8 - comentarr: ['全部', '已发布', '审核中', '未通过'], 9 + comentarr: ['全部', '审核中', '已发布', '未通过'],
9 coment: 0, 10 coment: 0,
  11 + type:'',
  12 + commentlist:[],
  13 + page:1
10 }, 14 },
11 15
12 /** 16 /**
13 * 生命周期函数--监听页面加载 17 * 生命周期函数--监听页面加载
14 */ 18 */
15 onLoad: function (options) { 19 onLoad: function (options) {
16 - 20 + this.getcomment()
17 }, 21 },
18 selitem(e) { 22 selitem(e) {
19 console.log(e) 23 console.log(e)
20 this.setData({ 24 this.setData({
21 - coment: e.currentTarget.dataset.index 25 + coment: e.currentTarget.dataset.index,
  26 + page:1,
  27 + commentlist:[]
22 }) 28 })
23 29
  30 + console.log(this.data.coment)
  31 + if (this.data.coment==0){
  32 + this.setData({
  33 + type:''
  34 + })
  35 + } else if (this.data.coment==1){
  36 + console.log(this.data.comment)
  37 + this.setData({
  38 + type:1
  39 + })
  40 + console.log(this.data.type)
  41 + } else if (this.data.coment==2){
  42 + this.setData({
  43 + type:2
  44 + })
  45 + } else if (this.data.coment == 3) {
  46 + this.setData({
  47 + type: 3
  48 + })
  49 + }
  50 + console.log(this.data.type)
  51 +
  52 + this.getcomment()
  53 +
24 }, 54 },
25 comdetail() { 55 comdetail() {
26 wx.navigateTo({ 56 wx.navigateTo({
@@ -28,6 +58,129 @@ Page({ @@ -28,6 +58,129 @@ Page({
28 }) 58 })
29 }, 59 },
30 60
  61 + // 获取我的评论
  62 + getcomment(){
  63 + console.log(990900)
  64 + var that = this;
  65 + var url = 'member/getRemark';
  66 + var params = {
  67 + type: that.data.type,
  68 + page:that.data.page,
  69 + limit:15
  70 +
  71 + }
  72 + app.post(url, params).then((res) => {
  73 + console.log(res);
  74 + that.setData({
  75 + commentlist: that.data.commentlist.concat(res.data)
  76 + })
  77 +
  78 +
  79 +
  80 + }).catch((err) => {
  81 +
  82 + })
  83 +
  84 + },
  85 +
  86 + // 店铺收藏
  87 + collect(e){
  88 + let id=e.currentTarget.dataset.id;
  89 + let index=e.currentTarget.dataset.index;
  90 + console.log(index)
  91 + let that = this;
  92 + var url = '/shop/shopCollect';
  93 + var params = {
  94 + shop_id: id,
  95 +
  96 + }
  97 + app.post(url, params,"post").then((res) => {
  98 + console.log(res);
  99 +
  100 +
  101 + that.data.commentlist.forEach(function(value,indexk,array){
  102 + if(index==indexk){
  103 + if (value.is_collect==0){
  104 + value.is_collect=1;
  105 + wx.showToast({
  106 + title: '店铺收藏成功',
  107 + icon: 'none'
  108 + })
  109 + } else if (value.is_collect == 1){
  110 + value.is_collect = 0;
  111 + wx.showToast({
  112 + title: '取消店铺收藏成功',
  113 + icon: 'none'
  114 + })
  115 + }
  116 + }
  117 + })
  118 +
  119 + that.setData({
  120 + commentlist: that.data.commentlist
  121 + })
  122 + console.log(that.data.commentlist)
  123 +
  124 +
  125 +
  126 + }).catch((err) => {
  127 +
  128 + })
  129 + },
  130 + goodtail(e) {
  131 + let id = e.currentTarget.dataset.id;
  132 + wx.navigateTo({
  133 + url: '/pages/shopdetail/shopdetail?id=' + id,
  134 + })
  135 + },
  136 +
  137 + // 删除点评
  138 + delcomment(e){
  139 + let that = this
  140 + let id=e.currentTarget.dataset.id;
  141 + wx.showModal({
  142 + title: '提示',
  143 + content: '是否删除此条评论',
  144 + success(res) {
  145 + if (res.confirm) {
  146 + var url = '/remark/deleteRemark';
  147 + var params = {
  148 + remark_id:id
  149 +
  150 + }
  151 + app.post(url, params).then((res) => {
  152 + console.log(res);
  153 + wx.showToast({
  154 + title: '删除点评成功',
  155 + icon:'none'
  156 + })
  157 + console.log(6666)
  158 + that.setData({
  159 + commentlist:[],
  160 + page:1,
  161 + })
  162 +
  163 + that.getcomment()
  164 +
  165 + }).catch((err) => {
  166 +
  167 + })
  168 + } else if (res.cancel) {
  169 + console.log('用户点击取消')
  170 + }
  171 + }
  172 + })
  173 +
  174 + },
  175 + // 点评详情
  176 + comentdetail(e) {
  177 + let commentid = e.currentTarget.dataset.id;
  178 + let shopid=e.currentTarget.dataset.shop_id
  179 + wx.navigateTo({
  180 + url: '/pages/commentdetail/commentdetail?commentid='+commentid+'&shopid='+ this.data.shopid,
  181 + })
  182 + },
  183 +
31 /** 184 /**
32 * 生命周期函数--监听页面初次渲染完成 185 * 生命周期函数--监听页面初次渲染完成
33 */ 186 */
@@ -67,7 +220,12 @@ Page({ @@ -67,7 +220,12 @@ Page({
67 * 页面上拉触底事件的处理函数 220 * 页面上拉触底事件的处理函数
68 */ 221 */
69 onReachBottom: function () { 222 onReachBottom: function () {
70 - 223 + let newpage=this.data.page;
  224 + newpage++;
  225 + this.setData({
  226 + page:newpage
  227 + })
  228 + this.getcomment()
71 }, 229 },
72 230
73 /** 231 /**
1 <view class="commenttop flexone"> 1 <view class="commenttop flexone">
2 <view class="commenttopitem {{coment==index?'comactive':''}}" wx:for="{{comentarr}}" wx:key="" bindtap="selitem" data-index="{{index}}">{{item}}</view> 2 <view class="commenttopitem {{coment==index?'comactive':''}}" wx:for="{{comentarr}}" wx:key="" bindtap="selitem" data-index="{{index}}">{{item}}</view>
3 </view> 3 </view>
4 -<view class="bodybox">  
5 - <view class="photo">  
6 - <view class="jianintro photobox" bindtap="comdetail">  
7 - <view class="comtop flextwo">  
8 - <view class="comleft">  
9 - <image src="/img/kele.png"></image>  
10 - </view>  
11 - <view class="comright">  
12 -  
13 - <view class="comrtop flextwo">  
14 -  
15 - <view class="usertop flexone">  
16 - <view class="comrname">一心只想撤撤撤</view>  
17 - <view class="userlevel">Lv 20</view>  
18 - </view>  
19 -  
20 - <view class="delimg">  
21 - <image src="/img/delimg.png"></image>  
22 - </view>  
23 - </view>  
24 - <view class="comdate">2019年10月12日</view>  
25 -  
26 - </view>  
27 - </view>  
28 - <view class="comtext flexone">  
29 - <view class="comleft"></view>  
30 -  
31 - <view class="comright">  
32 - <view class="flexone fenxia">  
33 - <view class="star starone flexone">  
34 - <view class="staritem">  
35 - <image src="/img/star.png"></image>  
36 - </view>  
37 - <view class="staritem">  
38 - <image src="/img/star.png"></image>  
39 - </view>  
40 - <view class="staritem">  
41 - <image src="/img/star.png"></image>  
42 - </view>  
43 - <view class="staritem">  
44 - <image src="/img/star.png"></image>  
45 - </view>  
46 - <view class="staritem">  
47 - <image src="/img/banke.png"></image>  
48 - </view>  
49 - <view class="staritem">  
50 - <image src="/img/star.png"></image>  
51 - </view>  
52 - </view>  
53 - <view class="fen">8.5分</view>  
54 - </view>  
55 - <view class="fuwu flexone">  
56 - <view class="fuwuitem">服务:4.2</view>  
57 - <view class="fuwuitem">口味:4.2</view>  
58 - <view class="fuwuitem">环境:4.2</view>  
59 - <view class="fuwuitem">食材:4.2</view>  
60 - </view>  
61 - <view class="text">  
62 - 掌柜态度很专业热情,有问必答,回复也很快,我问了不少问题,他都不觉得烦,都会认真回答我,这点我向掌柜表示由衷的敬意,这样的好掌柜可不多了。  
63 - </view>  
64 - <view class="all">全部</view>  
65 - <view class="textboximg flexone">  
66 - <view class="boxitem">  
67 - <image src="/img/photo.png"></image>  
68 - </view>  
69 - <view class="boxitem">  
70 - <image src="/img/photo.png"></image>  
71 - </view>  
72 - <view class="boxitem">  
73 - <image src="/img/photo.png"></image>  
74 - </view>  
75 - </view>  
76 - </view>  
77 -  
78 -  
79 - </view>  
80 - </view>  
81 - <view class="jianbot flextwo">  
82 - <view class="jianleft flex">  
83 - <view class="collectbitemleft">  
84 - <image src="/img/photo.png"></image>  
85 - </view>  
86 - <view class="collectbtitemr">  
87 4
  5 +<view class="noimg" wx:if="{{commentlist.length==0}}">
  6 + <view class="nodataimg">
  7 + <image src="/img/nodataimg.png"></image>
  8 + </view>
  9 + <view class="nomoer nomoredata">没有更多了哦~</view>
  10 +</view>
88 11
89 - <view class='goodname goodtext'>海贼王寿司店</view>  
90 - <view class="addressbox flexone">  
91 - <view class='asddressitem'>东京街</view>  
92 - <view class='asddressitem'>东京街</view>  
93 - <view class='asddressitem'>东京街</view>  
94 - </view>  
95 - </view>  
96 - </view>  
97 12
98 - <view class="jianright">  
99 - <image src="/img/graycollect.png"></image>  
100 - </view>  
101 13
102 - </view>  
103 - <view class="combotright flexone">  
104 - <view class="combotitem flexone itemleft">  
105 - <view class="combotitemleft ">  
106 - <image src="/img/pingtiao.png"></image>  
107 - </view>  
108 - <view class="combotzannumber">23</view>  
109 - </view>  
110 - <view class="combotitem flexone">  
111 - <view class="combotitemleft">  
112 - <image src="/img/smallzan.png"></image>  
113 - </view>  
114 - <view class="combotzannumber">23</view>  
115 - </view>  
116 - </view>  
117 - </view>  
118 -  
119 - <view class="photo">  
120 - <view class="jianintro photobox" bindtap="comdetail"> 14 +<view class="bodybox" wx:else>
  15 + <view class="photo" wx:for="{{commentlist}}" wx:key="">
  16 + <view class="jianintro photobox" bindtap="comentdetail" data-id="{{item.id}}" data-shopid="{{item.shop_id}}">
121 <view class="comtop flextwo"> 17 <view class="comtop flextwo">
122 <view class="comleft"> 18 <view class="comleft">
123 - <image src="/img/kele.png"></image> 19 + <image src="{{item.avatar}}"></image>
124 </view> 20 </view>
125 <view class="comright"> 21 <view class="comright">
126 -  
127 <view class="comrtop flextwo"> 22 <view class="comrtop flextwo">
128 -  
129 <view class="usertop flexone"> 23 <view class="usertop flexone">
130 - <view class="comrname">一心只想撤撤撤</view>  
131 - <view class="userlevel">Lv 20</view> 24 + <view class="comrname">{{item.nickname}}</view>
  25 + <view class="userlevel">Lv {{item.user_level}}</view>
132 </view> 26 </view>
  27 +
133 <view class="flexone"> 28 <view class="flexone">
134 - <view class="statename">未通过</view>  
135 - <view class="delimg">  
136 - <image src="/img/delimg.png"></image>  
137 - </view> 29 + <view class="shenstatus" wx:if="{{item.status==1}}">审核中</view>
  30 + <view class="shenstatus" wx:if="{{item.status==3}}">审核未通过</view>
  31 + <view class="delimg" catchtap="delcomment" data-id="{{item.id}}">
  32 + <image src="/img/delimg.png"></image>
  33 + </view>
138 </view> 34 </view>
139 35
  36 +
140 </view> 37 </view>
141 - <view class="comdate">2019年10月12日</view> 38 + <view class="comdate">{{item.createtime}}</view>
142 39
143 </view> 40 </view>
144 </view> 41 </view>
@@ -146,49 +43,51 @@ @@ -146,49 +43,51 @@
146 <view class="comleft"></view> 43 <view class="comleft"></view>
147 44
148 <view class="comright"> 45 <view class="comright">
149 - <view class="flexone fenxia">  
150 - <view class="star starone flexone"> 46 + <view class="flexone starbox">
  47 + <view class="star flexone">
151 <view class="staritem"> 48 <view class="staritem">
152 - <image src="/img/star.png"></image> 49 + <image src="/img/pingfenshi.png" wx:if="{{item.score1>=1}}"></image>
  50 + <image src="/img/noxing.png" wx:if="{{item.score1<0.5}}"></image>
  51 + <image src="/img/banke.png" wx:if="{{item.score1>=0.5&&item.score1<1}}"></image>
153 </view> 52 </view>
154 <view class="staritem"> 53 <view class="staritem">
155 - <image src="/img/star.png"></image> 54 + <image src="/img/pingfenshi.png" wx:if="{{item.score1>=2}}"></image>
  55 + <image src="/img/noxing.png" wx:if="{{item.score1<1.5}}"></image>
  56 + <image src="/img/banke.png" wx:if="{{item.score1>=1.5&&item.score1<2}}"></image>
156 </view> 57 </view>
157 <view class="staritem"> 58 <view class="staritem">
158 - <image src="/img/star.png"></image> 59 + <image src="/img/pingfenshi.png" wx:if="{{item.score1>=3}}"></image>
  60 + <image src="/img/noxing.png" wx:if="{{item.score1<2.5}}"></image>
  61 + <image src="/img/banke.png" wx:if="{{item.score1>=2.5&&item.score1<3}}"></image>
159 </view> 62 </view>
160 <view class="staritem"> 63 <view class="staritem">
161 - <image src="/img/star.png"></image> 64 + <image src="/img/pingfenshi.png" wx:if="{{item.score1>=4}}"></image>
  65 + <image src="/img/noxing.png" wx:if="{{item.score1<3.5}}"></image>
  66 + <image src="/img/banke.png" wx:if="{{item.score1>=3.5&&item.score1<4}}"></image>
162 </view> 67 </view>
163 <view class="staritem"> 68 <view class="staritem">
164 - <image src="/img/banke.png"></image>  
165 - </view>  
166 - <view class="staritem">  
167 - <image src="/img/star.png"></image> 69 + <image src="/img/pingfenshi.png" wx:if="{{item.score1>=5}}"></image>
  70 + <image src="/img/noxing.png" wx:if="{{item.score1<4.5}}"></image>
  71 + <image src="/img/banke.png" wx:if="{{item.score1>=4.5&&item.score1<5}}"></image>
168 </view> 72 </view>
169 </view> 73 </view>
170 - <view class="fen">8.5分</view> 74 + <view class="shouprice">¥{{item.price}}/人</view>
171 </view> 75 </view>
172 <view class="fuwu flexone"> 76 <view class="fuwu flexone">
173 - <view class="fuwuitem">服务:4.2</view>  
174 - <view class="fuwuitem">口味:4.2</view>  
175 - <view class="fuwuitem">环境:4.2</view>  
176 - <view class="fuwuitem">食材:4.2</view> 77 + <view class="fuwuitem">服务:{{item.score2}}</view>
  78 + <view class="fuwuitem">口味:{{item.score3}}</view>
  79 + <view class="fuwuitem">环境:{{item.score4}}</view>
  80 + <view class="fuwuitem">食材:{{itme.score5}}</view>
177 </view> 81 </view>
178 <view class="text"> 82 <view class="text">
179 - 掌柜态度很专业热情,有问必答,回复也很快,我问了不少问题,他都不觉得烦,都会认真回答我,这点我向掌柜表示由衷的敬意,这样的好掌柜可不多了。 83 + {{item.content}}
180 </view> 84 </view>
181 - <view class="all">全部</view>  
182 - <view class="textboximg flexone">  
183 - <view class="boxitem">  
184 - <image src="/img/photo.png"></image>  
185 - </view>  
186 - <view class="boxitem">  
187 - <image src="/img/photo.png"></image>  
188 - </view>  
189 - <view class="boxitem">  
190 - <image src="/img/photo.png"></image> 85 + <!-- <view class="all">全部</view> -->
  86 + <view class="textboximg flexone" wx:if="{{item.images.length!=0}}">
  87 + <view class="boxitem" wx:for="{{item.images}}" wx:key="">
  88 + <image src="{{item}}"></image>
191 </view> 89 </view>
  90 +
192 </view> 91 </view>
193 </view> 92 </view>
194 93
@@ -198,22 +97,23 @@ @@ -198,22 +97,23 @@
198 <view class="jianbot flextwo"> 97 <view class="jianbot flextwo">
199 <view class="jianleft flex"> 98 <view class="jianleft flex">
200 <view class="collectbitemleft"> 99 <view class="collectbitemleft">
201 - <image src="/img/photo.png"></image> 100 + <image src="{{item.image}}"></image>
202 </view> 101 </view>
203 <view class="collectbtitemr"> 102 <view class="collectbtitemr">
204 103
205 104
206 - <view class='goodname goodtext'>海贼王寿司店</view> 105 + <view class='goodname goodtext'>{{item.shop_name}}</view>
207 <view class="addressbox flexone"> 106 <view class="addressbox flexone">
208 - <view class='asddressitem'>东京街</view>  
209 - <view class='asddressitem'>东京街</view>  
210 - <view class='asddressitem'>东京街</view> 107 + <view class='asddressitem'>{{item.business_name}}</view>
  108 + <view class='asddressitem'>{{item.series_name}}</view>
  109 + <!-- <view class='asddressitem'>东京街</view> -->
211 </view> 110 </view>
212 </view> 111 </view>
213 </view> 112 </view>
214 113
215 - <view class="jianright">  
216 - <image src="/img/graycollect.png"></image> 114 + <view class="jianright" bindtap="collect" data-id="{{item.shop_id}}" data-index="{{index}}">
  115 + <image src="/img/graycollect.png" wx:if="{{item.is_collect==0}}"></image>
  116 + <image src="/img/yellowcollect.png" wx:if="{{item.is_collect==1}}"></image>
217 </view> 117 </view>
218 118
219 </view> 119 </view>
@@ -228,11 +128,13 @@ @@ -228,11 +128,13 @@
228 <view class="combotitemleft"> 128 <view class="combotitemleft">
229 <image src="/img/smallzan.png"></image> 129 <image src="/img/smallzan.png"></image>
230 </view> 130 </view>
231 - <view class="combotzannumber">23</view> 131 + <view class="combotzannumber">{{item.praise_num}}</view>
232 </view> 132 </view>
233 </view> 133 </view>
234 </view> 134 </view>
235 135
  136 +
  137 +
236 </view> 138 </view>
237 139
238 -<view class="nomoer">没有更多了哦~</view>  
  140 +<!-- <view class="nomoer">没有更多了哦~</view> -->
@@ -137,3 +137,12 @@ @@ -137,3 +137,12 @@
137 line-height: 36rpx; 137 line-height: 36rpx;
138 margin-right:14rpx; 138 margin-right:14rpx;
139 } 139 }
  140 +.shenstatus{
  141 + padding: 2rpx 18rpx;
  142 + border-radius: 180rpx;
  143 + background:#BDC4CE;
  144 + color:#fff;
  145 + font-size: 22rpx;
  146 + text-align: center;
  147 + margin-right:26rpx;
  148 +}
@@ -5,13 +5,25 @@ Page({ @@ -5,13 +5,25 @@ Page({
5 * 页面的初始数据 5 * 页面的初始数据
6 */ 6 */
7 data: { 7 data: {
8 - 8 + totalstar: 0,
  9 + servicestar: 0,
  10 + taststar: 0,
  11 + environmentstar: 0,
  12 + foodstar: 0,
  13 + mark:'',
  14 + money:'',
  15 + image:[],
  16 + cimage:[],
  17 + shopid:''
9 }, 18 },
10 19
11 /** 20 /**
12 * 生命周期函数--监听页面加载 21 * 生命周期函数--监听页面加载
13 */ 22 */
14 onLoad: function (options) { 23 onLoad: function (options) {
  24 + this.setData({
  25 + shopid:options.shopid
  26 + })
15 if(options.type==1){ 27 if(options.type==1){
16 wx.setNavigationBarTitle({ 28 wx.setNavigationBarTitle({
17 title: '传照片' 29 title: '传照片'
@@ -23,6 +35,193 @@ Page({ @@ -23,6 +35,193 @@ Page({
23 } 35 }
24 }, 36 },
25 37
  38 + // 上传图片
  39 +
  40 + chooseImage() {
  41 + let that = this;
  42 + wx.chooseImage({
  43 + count: 1,
  44 + sizeType: ['original', 'compressed'],
  45 + success: function (res) {
  46 + console.log(res.tempFilePaths[0])
  47 + app.upload('image', res.tempFilePaths[0], "post").then((res) => {
  48 + console.log('上传文件', res);
  49 + let url = app.globalData.baseurl + res.url;
  50 + that.data.image.push(url)
  51 + that.data.cimage.push(res.url)
  52 + that.setData({
  53 + image: that.data.image,
  54 + cimage: that.data.cimage
  55 + })
  56 +
  57 + console.log(that.data.image);
  58 + console.log(that.data.cimage)
  59 +
  60 +
  61 + }).catch((err) => {
  62 + console.log(err)
  63 + })
  64 + },
  65 + fail: function (res) { }
  66 + })
  67 + },
  68 +
  69 + // 删除图片
  70 + del(e) {
  71 + let that = this;
  72 + let url = e.currentTarget.dataset.url;
  73 + that.data.image.forEach(function (value, index, array) {
  74 + if (value == url) {
  75 + that.data.image.splice(index, 1);
  76 + that.data.cimage.splice(index, 1)
  77 + }
  78 + })
  79 + that.setData({
  80 + image: that.data.image,
  81 + cimage: that.data.cimage
  82 + })
  83 +
  84 + console.log(that.data.image);
  85 + console.log(that.data.cimage)
  86 +
  87 + },
  88 +
  89 + entermark(e){
  90 + this.setData({
  91 + mark:e.detail.value
  92 + })
  93 + },
  94 +
  95 + // 综合评分
  96 + total(e) {
  97 + let id = e.currentTarget.dataset.id;
  98 + this.setData({
  99 + totalstar: id
  100 + })
  101 + },
  102 + // 服务评分
  103 +
  104 + service(e) {
  105 + let id = e.currentTarget.dataset.id
  106 + this.setData({
  107 + servicestar: id
  108 + })
  109 + },
  110 +
  111 + // 口味评分
  112 + tast(e) {
  113 + let id = e.currentTarget.dataset.id
  114 + this.setData({
  115 + taststar: id
  116 + })
  117 + },
  118 +
  119 + // 环境评分
  120 + envirment(e) {
  121 + let id = e.currentTarget.dataset.id
  122 + this.setData({
  123 + environmentstar: id
  124 + })
  125 + },
  126 + // 食材评分
  127 + food(e) {
  128 + let id = e.currentTarget.dataset.id
  129 + this.setData({
  130 + foodstar: id
  131 + })
  132 + },
  133 + // 输入金额
  134 + entermoney(e) {
  135 + this.setData({
  136 + money: e.detail.value
  137 + })
  138 + console.log(this.data.money)
  139 + },
  140 +
  141 + publish() {
  142 + let that = this;
  143 + if(that.data.mark==''){
  144 + wx.showToast({
  145 + title: '请输入评论内容',
  146 + icon: "none"
  147 + })
  148 + return false
  149 + }
  150 + if (that.data.totalstar == 0) {
  151 + wx.showToast({
  152 + title: '请选择综合评分',
  153 + icon: "none"
  154 + })
  155 + return false
  156 + }
  157 + if (that.data.servicestar == 0) {
  158 + wx.showToast({
  159 + title: '请选择服务评分',
  160 + icon: "none"
  161 + })
  162 + return false
  163 + }
  164 + if (that.data.taststar == 0) {
  165 + wx.showToast({
  166 + title: '请选择口味评分',
  167 + icon: "none"
  168 + })
  169 + return false
  170 + }
  171 + if (that.data.environmentstar == 0) {
  172 + wx.showToast({
  173 + title: '请选择环境评分',
  174 + icon: "none"
  175 + })
  176 + return false
  177 + }
  178 + if (that.data.money==''){
  179 + wx.showToast({
  180 + title: '请输入人均消费',
  181 + icon:'none'
  182 + })
  183 + return false
  184 + }
  185 + if (that.data.money == '') {
  186 + wx.showToast({
  187 + title: '请输入人均消费',
  188 + icon: 'none'
  189 + })
  190 + return false
  191 + }
  192 + var url = '/remark/addRemark';
  193 + var params = {
  194 + shop_id: that.data.shopid,
  195 + price: that.data.money,
  196 + content: that.data.mark,
  197 + images: that.data.image.join(","),
  198 + score1: that.data.totalstar,
  199 + score2: that.data.servicestar,
  200 + score3: that.data.taststar,
  201 + score4: that.data.environmentstar,
  202 + score5: that.data.foodstar,
  203 + type: 1
  204 +
  205 + }
  206 + app.post(url, params, "post").then((res) => {
  207 + console.log(res);
  208 + wx.showToast({
  209 + title: '发表成功',
  210 + icon: 'none'
  211 + })
  212 + setTimeout(function () {
  213 + wx.navigateBack({
  214 + checked: true
  215 + })
  216 + }, 1500)
  217 +
  218 +
  219 +
  220 + }).catch((err) => {
  221 +
  222 + })
  223 + },
  224 +
26 /** 225 /**
27 * 生命周期函数--监听页面初次渲染完成 226 * 生命周期函数--监听页面初次渲染完成
28 */ 227 */
1 <view class="infobox"> 1 <view class="infobox">
2 - <view class="imgarr">  
3 - <image class="imgItem" mode="aspectFill" src="/img/jiang.png" />  
4 - <image class="imgItem" mode="aspectFill" src="/img/tianjia_img@2x.png" />  
5 - <image class="imgItem" mode="aspectFill" src="/img/shangchuan_img.png" />  
6 - </view>  
7 - <textarea placeholder="说说此刻的感受吧…" class="wordArea" />  
8 - <view class="labelbox">  
9 - <view class="labelItem">  
10 - <text>+</text>标题 2 + <view class="imagebox flexone">
  3 + <view class="picbox flexone">
  4 + <view class="imgItem" wx:for="{{image}}" wx:key="">
  5 + <image mode="aspectFill" src="{{item}}" />
  6 + <view class="chahao" bindtap="del" data-url="{{item}}">
  7 + <image src="/img/chahao.png"></image>
  8 + </view>
11 </view> 9 </view>
12 </view> 10 </view>
  11 +
  12 + <view class="imgItem" bindtap="chooseImage">
  13 + <image mode="aspectFill" src="/img/jiang.png" />
  14 + </view>
  15 + </view>
  16 + <textarea placeholder="说说此刻的感受吧…" class="wordArea" bindinput="entermark"/>
  17 + <!-- <view class="labelbox">
  18 + <view class="labelItem">
  19 + <text>+</text>标题
  20 + </view>
  21 + </view> -->
13 </view> 22 </view>
14 - <view class="infobox">  
15 - <view class="infoTitle">评分</view>  
16 - <view class="evaluateItem">  
17 - <view class="tltle">综合</view>  
18 - <view class="starbox">  
19 - <image class="starItem" src="/img/star.png"/>  
20 - <image class="starItem" src="/img/star.png"/>  
21 - <image class="starItem" src="/img/star.png"/>  
22 - <image class="starItem" src="/img/star.png"/>  
23 - <image class="starItem" src="/img/banke.png"/>  
24 - </view>  
25 - </view>  
26 - <view class="evaluateItem">  
27 - <view class="tltle">服务</view>  
28 - <view class="starbox">  
29 - <image class="starItem" src="/img/star.png"/>  
30 - <image class="starItem" src="/img/star.png"/>  
31 - <image class="starItem" src="/img/star.png"/>  
32 - <image class="starItem" src="/img/star.png"/>  
33 - <image class="starItem" src="/img/banke.png"/>  
34 - </view>  
35 - </view>  
36 - <view class="evaluateItem">  
37 - <view class="tltle">口味</view>  
38 - <view class="starbox">  
39 - <image class="starItem" src="/img/star.png"/>  
40 - <image class="starItem" src="/img/star.png"/>  
41 - <image class="starItem" src="/img/star.png"/>  
42 - <image class="starItem" src="/img/star.png"/>  
43 - <image class="starItem" src="/img/banke.png"/>  
44 - </view> 23 +<view class="infobox">
  24 + <view class="infoTitle">评分</view>
  25 + <view class="infobox">
  26 + <view class="infoTitle">评分</view>
  27 + <view class="evaluateItem">
  28 + <view class="tltle">综合</view>
  29 + <view class="starbox" bindtap="total" data-id="1">
  30 + <image class="starItem" src="/img/pingfenshi.png" wx:if="{{totalstar>=1}}" />
  31 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
45 </view> 32 </view>
46 - <view class="evaluateItem">  
47 - <view class="tltle">环境</view>  
48 - <view class="starbox">  
49 - <image class="starItem" src="/img/star.png"/>  
50 - <image class="starItem" src="/img/star.png"/>  
51 - <image class="starItem" src="/img/star.png"/>  
52 - <image class="starItem" src="/img/star.png"/>  
53 - <image class="starItem" src="/img/banke.png"/>  
54 - </view> 33 + <view class="starbox" bindtap="total" data-id="2">
  34 + <image class="starItem" src="/img/pingfenshi.png " wx:if="{{totalstar>=2}}" />
  35 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
55 </view> 36 </view>
  37 + <view class="starbox" bindtap="total" data-id="3">
  38 + <image class="starItem" src="/img/pingfenshi.png" wx:if="{{totalstar>=3}}" />
  39 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  40 +
  41 + </view>
  42 + <view class="starbox" bindtap="total" data-id="4">
  43 + <image class="starItem" src="/img/pingfenshi.png" wx:if="{{totalstar>=4}}" />
  44 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  45 + </view>
  46 + <view class="starbox" bindtap="total" data-id="5">
  47 + <image class="starItem" src="/img/pingfenshi.png" wx:if="{{totalstar>=5}}" />
  48 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  49 +
  50 + </view>
  51 + </view>
  52 + <view class="evaluateItem">
  53 + <view class="tltle">服务</view>
  54 + <view class="starbox" bindtap="service" data-id="1">
  55 + <image class="starItem" src="/img/pingfenshi.png" wx:if="{{servicestar>=1}}" />
  56 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  57 + </view>
  58 + <view class="starbox" bindtap="service" data-id="2">
  59 + <image class="starItem" src="/img/pingfenshi.png " wx:if="{{servicestar>=2}}" />
  60 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  61 + </view>
  62 + <view class="starbox" bindtap="service" data-id="3">
  63 + <image class="starItem" src="/img/pingfenshi.png" wx:if="{{servicestar>=3}}" />
  64 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  65 +
  66 + </view>
  67 + <view class="starbox" bindtap="service" data-id="4">
  68 + <image class="starItem" src="/img/pingfenshi.png" wx:if="{{servicestar>=4}}" />
  69 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  70 + </view>
  71 + <view class="starbox" bindtap="service" data-id="5">
  72 + <image class="starItem" src="/img/pingfenshi.png" wx:if="{{servicestar>=5}}" />
  73 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  74 +
  75 + </view>
  76 + </view>
  77 + <view class="evaluateItem">
  78 + <view class="tltle">口味</view>
  79 + <view class="starbox" bindtap="tast" data-id="1">
  80 + <image class="starItem" src="/img/pingfenshi.png" wx:if="{{taststar>=1}}" />
  81 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  82 + </view>
  83 + <view class="starbox" bindtap="tast" data-id="2">
  84 + <image class="starItem" src="/img/pingfenshi.png " wx:if="{{taststar>=2}}" />
  85 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  86 + </view>
  87 + <view class="starbox" bindtap="tast" data-id="3">
  88 + <image class="starItem" src="/img/pingfenshi.png" wx:if="{{taststar>=3}}" />
  89 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  90 +
  91 + </view>
  92 + <view class="starbox" bindtap="tast" data-id="4">
  93 + <image class="starItem" src="/img/pingfenshi.png" wx:if="{{taststar>=4}}" />
  94 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  95 + </view>
  96 + <view class="starbox" bindtap="tast" data-id="5">
  97 + <image class="starItem" src="/img/pingfenshi.png" wx:if="{{taststar>=5}}" />
  98 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  99 +
  100 + </view>
  101 + </view>
  102 + <view class="evaluateItem">
  103 + <view class="tltle">环境</view>
  104 + <view class="starbox" bindtap="envirment" data-id="1">
  105 + <image class="starItem" src="/img/pingfenshi.png" wx:if="{{environmentstar>=1}}" />
  106 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  107 + </view>
  108 + <view class="starbox" bindtap="envirment" data-id="2">
  109 + <image class="starItem" src="/img/pingfenshi.png " wx:if="{{environmentstar>=2}}" />
  110 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  111 + </view>
  112 + <view class="starbox" bindtap="envirment" data-id="3">
  113 + <image class="starItem" src="/img/pingfenshi.png" wx:if="{{environmentstar>=3}}" />
  114 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  115 +
  116 + </view>
  117 + <view class="starbox" bindtap="envirment" data-id="4">
  118 + <image class="starItem" src="/img/pingfenshi.png" wx:if="{{environmentstar>=4}}" />
  119 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  120 + </view>
  121 + <view class="starbox" bindtap="envirment" data-id="5">
  122 + <image class="starItem" src="/img/pingfenshi.png" wx:if="{{environmentstar>=5}}" />
  123 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
56 124
57 - <view class="evaluateItem">  
58 - <view class="tltle">食材</view>  
59 - <view class="starbox">  
60 - <image class="starItem" src="/img/star.png"/>  
61 - <image class="starItem" src="/img/star.png"/>  
62 - <image class="starItem" src="/img/star.png"/>  
63 - <image class="starItem" src="/img/star.png"/>  
64 - <image class="starItem" src="/img/banke.png"/>  
65 - </view>  
66 </view> 125 </view>
67 - </view> 126 + </view>
  127 +
  128 + <view class="evaluateItem">
  129 + <view class="tltle">食材</view>
  130 + <view class="starbox" bindtap="food" data-id="1">
  131 + <image class="starItem" src="/img/pingfenshi.png" wx:if="{{foodstar>=1}}" />
  132 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  133 + </view>
  134 + <view class="starbox" bindtap="food" data-id="2">
  135 + <image class="starItem" src="/img/pingfenshi.png " wx:if="{{foodstar>=2}}" />
  136 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  137 + </view>
  138 + <view class="starbox" bindtap="food" data-id="3">
  139 + <image class="starItem" src="/img/pingfenshi.png" wx:if="{{foodstar>=3}}" />
  140 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
68 141
69 - <view class="costbox"> 142 + </view>
  143 + <view class="starbox" bindtap="food" data-id="4">
  144 + <image class="starItem" src="/img/pingfenshi.png" wx:if="{{foodstar>=4}}" />
  145 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  146 + </view>
  147 + <view class="starbox" bindtap="food" data-id="5">
  148 + <image class="starItem" src="/img/pingfenshi.png" wx:if="{{foodstar>=5}}" />
  149 + <image class="starItem" src="/img/lingfen_icon.png" wx:else/>
  150 + </view>
  151 + </view>
  152 + </view>
  153 +</view>
  154 +<view class="costbox">
70 <view class="costTitle">人均</view> 155 <view class="costTitle">人均</view>
71 <view class="fillbox"> 156 <view class="fillbox">
72 <text>¥</text> 157 <text>¥</text>
73 - <input placeholder="请输入消费金额" class="fillCost" type="number"/> 158 + <input placeholder="请输入消费金额" class="fillCost" type="digit" bindinput="entermoney"/>
74 </view> 159 </view>
75 - </view>  
76 -  
77 - <view class="submit">发表</view>  
  160 +</view>
  161 +<view class="submit" bindtap="publish">发表</view>
  1 +@import '../comment/comment.wxss';
1 page { 2 page {
2 background: #F9F9F9; 3 background: #F9F9F9;
3 padding: 0 32rpx 32rpx; 4 padding: 0 32rpx 32rpx;
@@ -82,9 +83,10 @@ page { @@ -82,9 +83,10 @@ page {
82 } 83 }
83 84
84 .starItem { 85 .starItem {
85 - width: 24rpx;  
86 - height: 24rpx;  
87 - margin-right: 8rpx; 86 + width: 32rpx;
  87 + height: 32rpx;
  88 + font-size: 0
  89 +
88 } 90 }
89 91
90 .costbox { 92 .costbox {
@@ -131,7 +133,7 @@ page { @@ -131,7 +133,7 @@ page {
131 .submit { 133 .submit {
132 width: 686rpx; 134 width: 686rpx;
133 height: 88rpx; 135 height: 88rpx;
134 - background: rgba(189, 196, 206, 1); 136 + background: #FDAA2A;
135 opacity: 1; 137 opacity: 1;
136 border-radius: 8rpx; 138 border-radius: 8rpx;
137 font-size: 28rpx; 139 font-size: 28rpx;
  1 +// pages/usecenter/usecenter.js
  2 +const app = getApp()
  3 +Page({
  4 +
  5 + /**
  6 + * 页面的初始数据
  7 + */
  8 + data: {
  9 + userid:'',
  10 + page:1,
  11 + goodlist:[],
  12 + userinfo:''
  13 + },
  14 +
  15 + // 获取用户信息
  16 + getuserinfo() {
  17 + let that = this;
  18 + var url = 'member/getUserInfo';
  19 + var params = {
  20 + user_id:that.data.userid
  21 +
  22 + }
  23 + app.post(url, params).then((res) => {
  24 + console.log(res);
  25 + that.setData({
  26 + userinfo: res
  27 + })
  28 +
  29 + that.gethomelist()
  30 + }).catch((err) => {
  31 +
  32 + })
  33 + },
  34 +
  35 + // 获取首页列表
  36 + gethomelist() {
  37 + let that = this;
  38 + var url = 'index/getShopList';
  39 + var params = {
  40 + page: that.data.page,
  41 + limit: 15,
  42 + business_id: '',
  43 + series_id: '',
  44 + grade_id: '',
  45 + composite_id: '',
  46 + is_recommend: 1,
  47 + city_id: that.data.userinfo.city_id
  48 + }
  49 + app.post(url, params, "post").then((res) => {
  50 + console.log(res);
  51 + that.setData({
  52 + goodlist: that.data.goodlist.concat(res.data)
  53 + })
  54 + that.data.goodlist.forEach(function (value, index, array) {
  55 + value.level = value.level.toFixed("1")
  56 + })
  57 + that.setData({
  58 + goodlist: that.data.goodlist
  59 + })
  60 +
  61 +
  62 + }).catch((err) => {
  63 +
  64 + })
  65 +
  66 + },
  67 + goodtail(e) {
  68 + let id = e.currentTarget.dataset.id;
  69 + wx.navigateTo({
  70 + url: '/pages/shopdetail/shopdetail?id=' + id,
  71 + })
  72 + },
  73 +
  74 + /**
  75 + * 生命周期函数--监听页面加载
  76 + */
  77 + onLoad: function (options) {
  78 + console.log(options)
  79 + this.setData({
  80 + userid: options.userid
  81 + })
  82 + this.getuserinfo();
  83 + // // 获取列表
  84 + // this.gethomelist()
  85 + },
  86 +
  87 +
  88 + /**
  89 + * 生命周期函数--监听页面初次渲染完成
  90 + */
  91 + onReady: function () {
  92 +
  93 + },
  94 +
  95 + /**
  96 + * 生命周期函数--监听页面显示
  97 + */
  98 + onShow: function () {
  99 +
  100 + },
  101 +
  102 + /**
  103 + * 生命周期函数--监听页面隐藏
  104 + */
  105 + onHide: function () {
  106 +
  107 + },
  108 +
  109 + /**
  110 + * 生命周期函数--监听页面卸载
  111 + */
  112 + onUnload: function () {
  113 +
  114 + },
  115 +
  116 + /**
  117 + * 页面相关事件处理函数--监听用户下拉动作
  118 + */
  119 + onPullDownRefresh: function () {
  120 +
  121 + },
  122 +
  123 + /**
  124 + * 页面上拉触底事件的处理函数
  125 + */
  126 + onReachBottom: function () {
  127 +
  128 + },
  129 +
  130 + /**
  131 + * 用户点击右上角分享
  132 + */
  133 + onShareAppMessage: function () {
  134 +
  135 + }
  136 +})
  1 +{
  2 + "navigationBarTitleText": "个人主页"
  3 +}