Commit 1ae1cf35a3540fc28f42eec68f59f08b816c3016

Authored by yvan.ni
1 parent cff379c2

图片压缩过程的滚动条处理

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