Commit 37ea7f6845630d376fad2792c27866ab43524401

Authored by yvan.ni
1 parent 25466ae7

添加评论

pages/goods/goodsInfo/goodsInfo.js
... ... @@ -1343,7 +1343,6 @@ Page({
1343 1343 parent_id: 0,
1344 1344 goods_id: th.data.gid,
1345 1345 commenttype: tp,
1346   -
1347 1346 }
1348 1347 if(getApp().globalData.userInfo){
1349 1348 req_where.userId=getApp().globalData.userInfo.user_id;
... ...
pages/user/add_comment/add_comment.js
... ... @@ -24,8 +24,6 @@ Page({
24 24 },
25 25 onLoad: async function (a) {
26 26 var th = this;
27   - console.log('onLoad');
28   - console.log(a);
29 27  
30 28 await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + a.goods_id, { 1: 1 }).then(res => {
31 29 a.img = th.data.iurl + res.data.data.original_img
... ... @@ -85,8 +83,12 @@ Page({
85 83 },
86 84 submitComment: function () {
87 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 89 this.uploadPhotos(function () {
  90 + console.log("submitComment");
  91 + console.log(a.data.uploadPath);
90 92 e.post("/api/weshop/comment/savecomment", {
91 93 data: {
92 94 email: ' ',
... ... @@ -109,12 +111,14 @@ Page({
109 111 });
110 112 });
111 113 },
  114 +
  115 +
112 116 uploadPhotos: function (t, a) {
113 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 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 122 name: "img_file",
119 123 success: function (e) {
120 124 s.data.uploadPath[a] = e.data.result, s.uploadPhotos(t, a + 1);
... ... @@ -137,11 +141,6 @@ Page({
137 141 this.setData({
138 142 lenMore: 1
139 143 });
140   - setTimeout(function () {
141   - that.setData({
142   - lenMore: 0
143   - });
144   - }, 2500);
145 144 return false;
146 145 }
147 146 wx.chooseImage({
... ...
pages/user/add_comment/add_comment.json
1 1 {
2 2 "navigationBarTitleText": "评价宝贝",
3   - "enablePullDownRefresh": false
  3 + "enablePullDownRefresh": false,
  4 + "usingComponents": {
  5 + "warn": "/components/long_warn/long_warn"
  6 + }
4 7 }
5 8 \ No newline at end of file
... ...
pages/user/add_comment/add_comment.wxml
... ... @@ -104,24 +104,10 @@
104 104  
105 105 </view>
106 106  
107   -
108   -
109   -
110   -
111   -
112   -
113   -
114 107 </view>
115   -
116   -
117   -
118   -
119   -
120   -
121 108 </view>
122 109  
123 110 <!-- 评价等级 -->
124   -
125 111 <view class="Grade">
126 112 <!-- 宝贝评分 -->
127 113 <view class="title flex-vertical">
... ... @@ -134,22 +120,24 @@
134 120 <view class="score-item flex-vertical">
135 121 <view class="fs24">描述相符</view>
136 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 125 </view>
140 126 </view>
141 127  
142 128 <view class="score-item flex-vertical">
143 129 <view class="fs24">物流服务</view>
144 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 134 </view>
148 135 </view>
149 136 <view class="score-item flex-vertical">
150 137 <view class="fs24">服务态度</view>
151 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 143 </view>
... ... @@ -163,19 +151,15 @@
163 151  
164 152 <!-- 是否匿名评价 -->
165 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 157 <view class="fs24 ">匿名评价</view>
171 158 </view>
172 159  
173 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 162 </view>
  163 +</view>
178 164  
179   -
180   -
181   -</view>
182 165 \ No newline at end of file
  166 +<warn id="warn"></warn>
183 167 \ No newline at end of file
... ...