Commit 9578af1ae8933b5e5358c817b639bf5f7bf43837

Authored by yvan.ni
1 parent 534c226c

添加评论

pages/user/add_comment/add_comment.js
@@ -88,7 +88,7 @@ Page({ @@ -88,7 +88,7 @@ Page({
88 if(a.data.content=="") 88 if(a.data.content=="")
89 return getApp().my_warnning("请填写评价内容",0,a); 89 return getApp().my_warnning("请填写评价内容",0,a);
90 90
91 - this.uploadPhotos(function () { 91 + //this.uploadPhotos(function () {
92 var p_data= { 92 var p_data= {
93 email: ' ', 93 email: ' ',
94 is_show: 1, 94 is_show: 1,
@@ -118,7 +118,7 @@ Page({ @@ -118,7 +118,7 @@ Page({
118 }); 118 });
119 } 119 }
120 }); 120 });
121 - }); 121 + //});
122 }, 122 },
123 123
124 124
@@ -147,14 +147,15 @@ Page({ @@ -147,14 +147,15 @@ Page({
147 }, 147 },
148 // 上传图片 148 // 上传图片
149 chooseImg: function (e) { 149 chooseImg: function (e) {
150 - var imgs = that.data.imgs; 150 + var that = this;
  151 + var imgs = this.data.imgs;
151 if (imgs.length >= 3){ 152 if (imgs.length >= 3){
152 if(this.data.lenMore==0){ 153 if(this.data.lenMore==0){
153 this.setData({ lenMore: 1 }); 154 this.setData({ lenMore: 1 });
154 } 155 }
155 return false; 156 return false;
156 } 157 }
157 - var that = this; 158 +
158 var imgs = this.data.imgs; 159 var imgs = this.data.imgs;
159 160
160 wx.chooseImage({ 161 wx.chooseImage({
@@ -164,24 +165,20 @@ Page({ @@ -164,24 +165,20 @@ Page({
164 success: function (res) { 165 success: function (res) {
165 // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片 166 // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
166 var tempFilePaths = res.tempFilePaths; 167 var tempFilePaths = res.tempFilePaths;
167 - imgs.push(tempFilePaths[i]);  
168 168
169 e.uploadFile("/api/weshop/comment/uploadCommentImg", { 169 e.uploadFile("/api/weshop/comment/uploadCommentImg", {
170 - filePath: s.data.imgs[a], 170 + filePath: tempFilePaths[0],
171 name: "file", 171 name: "file",
172 success: function (e) { 172 success: function (e) {
173 - console.log("uploadPhotos");  
174 - console.log(e.data);  
175 - if(e.data.code==0)  
176 - s.data.uploadPath[a] = e.data.data, s.uploadPhotos(t, a + 1); 173 + if(e.data.code==0) {
  174 + s.data.uploadPath.push(e.data.data);
  175 + imgs.push(tempFilePaths[0]);
  176 + that.setData({
  177 + imgs: imgs
  178 + });
  179 + }
177 } 180 }
178 }); 181 });
179 -  
180 -  
181 -  
182 - that.setData({  
183 - imgs: imgs  
184 - });  
185 } 182 }
186 }); 183 });
187 }, 184 },