Commit 37ea7f6845630d376fad2792c27866ab43524401

Authored by yvan.ni
1 parent 25466ae7

添加评论

pages/goods/goodsInfo/goodsInfo.js
@@ -1343,7 +1343,6 @@ Page({ @@ -1343,7 +1343,6 @@ Page({
1343 parent_id: 0, 1343 parent_id: 0,
1344 goods_id: th.data.gid, 1344 goods_id: th.data.gid,
1345 commenttype: tp, 1345 commenttype: tp,
1346 -  
1347 } 1346 }
1348 if(getApp().globalData.userInfo){ 1347 if(getApp().globalData.userInfo){
1349 req_where.userId=getApp().globalData.userInfo.user_id; 1348 req_where.userId=getApp().globalData.userInfo.user_id;
pages/user/add_comment/add_comment.js
@@ -24,8 +24,6 @@ Page({ @@ -24,8 +24,6 @@ Page({
24 }, 24 },
25 onLoad: async function (a) { 25 onLoad: async function (a) {
26 var th = this; 26 var th = this;
27 - console.log('onLoad');  
28 - console.log(a);  
29 27
30 await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + a.goods_id, { 1: 1 }).then(res => { 28 await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + a.goods_id, { 1: 1 }).then(res => {
31 a.img = th.data.iurl + res.data.data.original_img 29 a.img = th.data.iurl + res.data.data.original_img
@@ -85,8 +83,12 @@ Page({ @@ -85,8 +83,12 @@ Page({
85 }, 83 },
86 submitComment: function () { 84 submitComment: function () {
87 var a = this; 85 var a = this;
88 - if (!a.data.service_rank || !a.data.goods_rank || !a.data.deliver_rank) return t.showWarning("请先打完分~"); 86 + if (!a.data.service_rank || !a.data.goods_rank || !a.data.deliver_rank)
  87 + return getApp().my_warnning("请先打分",0,a);
  88 +
89 this.uploadPhotos(function () { 89 this.uploadPhotos(function () {
  90 + console.log("submitComment");
  91 + console.log(a.data.uploadPath);
90 e.post("/api/weshop/comment/savecomment", { 92 e.post("/api/weshop/comment/savecomment", {
91 data: { 93 data: {
92 email: ' ', 94 email: ' ',
@@ -109,12 +111,14 @@ Page({ @@ -109,12 +111,14 @@ Page({
109 }); 111 });
110 }); 112 });
111 }, 113 },
  114 +
  115 +
112 uploadPhotos: function (t, a) { 116 uploadPhotos: function (t, a) {
113 if (0 == this.data.filePaths.length) return t(); 117 if (0 == this.data.filePaths.length) return t();
114 - if ("number" != typeof a) a = 0; else if (a >= this.data.filePaths.length) return t(); 118 + if ("number" != typeof a) a = 0; else if (a >= this.data.imgs.length) return t();
115 var s = this; 119 var s = this;
116 - e.uploadFile("/api/user/upload_comment_img", {  
117 - filePath: s.data.filePaths[a], 120 + e.uploadFile("api/weshop/comment/uploadCommentImg", {
  121 + filePath: s.data.imgs[a],
118 name: "img_file", 122 name: "img_file",
119 success: function (e) { 123 success: function (e) {
120 s.data.uploadPath[a] = e.data.result, s.uploadPhotos(t, a + 1); 124 s.data.uploadPath[a] = e.data.result, s.uploadPhotos(t, a + 1);
@@ -137,11 +141,6 @@ Page({ @@ -137,11 +141,6 @@ Page({
137 this.setData({ 141 this.setData({
138 lenMore: 1 142 lenMore: 1
139 }); 143 });
140 - setTimeout(function () {  
141 - that.setData({  
142 - lenMore: 0  
143 - });  
144 - }, 2500);  
145 return false; 144 return false;
146 } 145 }
147 wx.chooseImage({ 146 wx.chooseImage({
pages/user/add_comment/add_comment.json
1 { 1 {
2 "navigationBarTitleText": "评价宝贝", 2 "navigationBarTitleText": "评价宝贝",
3 - "enablePullDownRefresh": false 3 + "enablePullDownRefresh": false,
  4 + "usingComponents": {
  5 + "warn": "/components/long_warn/long_warn"
  6 + }
4 } 7 }
5 \ No newline at end of file 8 \ No newline at end of file
pages/user/add_comment/add_comment.wxml
@@ -104,24 +104,10 @@ @@ -104,24 +104,10 @@
104 104
105 </view> 105 </view>
106 106
107 -  
108 -  
109 -  
110 -  
111 -  
112 -  
113 -  
114 </view> 107 </view>
115 -  
116 -  
117 -  
118 -  
119 -  
120 -  
121 </view> 108 </view>
122 109
123 <!-- 评价等级 --> 110 <!-- 评价等级 -->
124 -  
125 <view class="Grade"> 111 <view class="Grade">
126 <!-- 宝贝评分 --> 112 <!-- 宝贝评分 -->
127 <view class="title flex-vertical"> 113 <view class="title flex-vertical">
@@ -134,22 +120,24 @@ @@ -134,22 +120,24 @@
134 <view class="score-item flex-vertical"> 120 <view class="score-item flex-vertical">
135 <view class="fs24">描述相符</view> 121 <view class="fs24">描述相符</view>
136 <view class="stars flex-vertical"> 122 <view class="stars flex-vertical">
137 - <image data-i="{{index}}" src="{{index<goods_rank?iurl+'/miniapp/images/StarsredCk.png':iurl+'/miniapp/images/StarswhiteUnCk.png'}}" wx:for="{{5}}" wx:key="{{index}}" bindtap="checkGoodsRank"></image>  
138 - 123 + <image data-i="{{index}}" src="{{index<goods_rank?iurl+'/miniapp/images/StarsredCk.png':iurl+'/miniapp/images/StarswhiteUnCk.png'}}"
  124 + wx:for="{{5}}" wx:key="{{index}}" bindtap="checkGoodsRank"></image>
139 </view> 125 </view>
140 </view> 126 </view>
141 127
142 <view class="score-item flex-vertical"> 128 <view class="score-item flex-vertical">
143 <view class="fs24">物流服务</view> 129 <view class="fs24">物流服务</view>
144 <view class="stars flex-vertical"> 130 <view class="stars flex-vertical">
145 - <image bindtap="checkDeliverRank" data-i="{{index}}" src="{{index<deliver_rank?iurl+'/miniapp/images/StarsredCk.png':iurl+'/miniapp/images/StarswhiteUnCk.png'}}" wx:for="{{5}}" wx:key="{{index}}"></image> 131 + <image bindtap="checkDeliverRank" data-i="{{index}}" src="{{index<deliver_rank?iurl+'/miniapp/images/StarsredCk.png':iurl+'/miniapp/images/StarswhiteUnCk.png'}}"
  132 + wx:for="{{5}}" wx:key="{{index}}"></image>
146 133
147 </view> 134 </view>
148 </view> 135 </view>
149 <view class="score-item flex-vertical"> 136 <view class="score-item flex-vertical">
150 <view class="fs24">服务态度</view> 137 <view class="fs24">服务态度</view>
151 <view class="stars flex-vertical"> 138 <view class="stars flex-vertical">
152 - <image src="{{index<service_rank?iurl+'/miniapp/images/StarsredCk.png':iurl+'/miniapp/images/StarswhiteUnCk.png'}}" bindtap="checkServiceRank" data-i="{{index}}" wx:for="{{5}}" wx:key="{{index}}"></image> 139 + <image src="{{index<service_rank?iurl+'/miniapp/images/StarsredCk.png':iurl+'/miniapp/images/StarswhiteUnCk.png'}}"
  140 + bindtap="checkServiceRank" data-i="{{index}}" wx:for="{{5}}" wx:key="{{index}}"></image>
153 141
154 142
155 </view> 143 </view>
@@ -163,19 +151,15 @@ @@ -163,19 +151,15 @@
163 151
164 <!-- 是否匿名评价 --> 152 <!-- 是否匿名评价 -->
165 <view class=" Whether "> 153 <view class=" Whether ">
166 -  
167 <!-- 选择是否匿名 --> 154 <!-- 选择是否匿名 -->
168 - <view class="allClick flex-right-vertical ">  
169 - <icon class="radio " bindtap="checkAnonymous " color="{{is_anonymous? 'white': 'red'}} " size="15 " type="success "></icon> 155 + <view class="allClick flex-right-vertical" bindtap="checkAnonymous">
  156 + <icon class="radio" size="15" type="success" color="{{is_anonymous?'red':'gainsboro'}}"></icon>
170 <view class="fs24 ">匿名评价</view> 157 <view class="fs24 ">匿名评价</view>
171 </view> 158 </view>
172 159
173 <view class="Submission flex-level "> 160 <view class="Submission flex-level ">
174 - <view class="fs30 flex-level white " bindtap="submitComment ">  
175 - 提交评价  
176 - </view> 161 + <view class="fs30 flex-level white " bindtap="submitComment">提交评价</view>
177 </view> 162 </view>
  163 +</view>
178 164
179 -  
180 -  
181 -</view>  
182 \ No newline at end of file 165 \ No newline at end of file
  166 +<warn id="warn"></warn>
183 \ No newline at end of file 167 \ No newline at end of file