Commit 1ae1cf35a3540fc28f42eec68f59f08b816c3016
1 parent
cff379c2
图片压缩过程的滚动条处理
Showing
1 changed file
with
10 additions
and
7 deletions
packageD/pages/AI-test-skin/shoot_notice/shoot_notice.js
... | ... | @@ -157,12 +157,17 @@ Page({ |
157 | 157 | return; |
158 | 158 | } |
159 | 159 | |
160 | + wx.showLoading({ | |
161 | + title:'处理中', | |
162 | + mask: true | |
163 | + }); | |
160 | 164 | //先获取图片 然后根据长宽 缩小 之后获取图片 |
161 | 165 | wx.getImageInfo({ |
162 | 166 | src: img, |
163 | 167 | success(res) { |
164 | - console.log(res.width) | |
165 | - console.log(res.height) | |
168 | + | |
169 | + | |
170 | + | |
166 | 171 | var ratio = size / 1024; |
167 | 172 | size1 = size1 / ratio; |
168 | 173 | var canvasWidth = res.width //图片原始长宽 |
... | ... | @@ -187,7 +192,7 @@ Page({ |
187 | 192 | destHeight: canvasHeight, |
188 | 193 | fileType: 'jpg', |
189 | 194 | success: function (res) { |
190 | - console.log(res.tempFilePath)//最终图片路径 | |
195 | + wx.hideLoading(); | |
191 | 196 | that.setData({selecting:0}) |
192 | 197 | that.setData({ |
193 | 198 | canvasImgUrl: res.tempFilePath |
... | ... | @@ -200,9 +205,8 @@ Page({ |
200 | 205 | app.goto(url); |
201 | 206 | }, |
202 | 207 | fail: function (res) { |
208 | + wx.hideLoading(); | |
203 | 209 | that.setData({selecting:0}) |
204 | - console.log("缩放图片失败"); | |
205 | - console.log(res.errMsg) | |
206 | 210 | wx.showToast({ |
207 | 211 | title: '识别图片失败', |
208 | 212 | image: '../../utils/img/wrong.png', |
... | ... | @@ -216,8 +220,7 @@ Page({ |
216 | 220 | }, 1000)) //留一定的时间绘制canvas 否则会报错fail canvas is empty |
217 | 221 | }, |
218 | 222 | fail: function (res) { |
219 | - console.log("获取图片失败"); | |
220 | - console.log(res.errMsg) | |
223 | + wx.hideLoading(); | |
221 | 224 | that.setData({selecting:0}) |
222 | 225 | wx.showToast({ |
223 | 226 | title: '识别图片失败', | ... | ... |