From 1ae1cf35a3540fc28f42eec68f59f08b816c3016 Mon Sep 17 00:00:00 2001 From: yvan.ni Date: Fri, 11 Mar 2022 09:39:38 +0800 Subject: [PATCH] 图片压缩过程的滚动条处理 --- packageD/pages/AI-test-skin/shoot_notice/shoot_notice.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/packageD/pages/AI-test-skin/shoot_notice/shoot_notice.js b/packageD/pages/AI-test-skin/shoot_notice/shoot_notice.js index 5aec0f9..0b18b08 100644 --- a/packageD/pages/AI-test-skin/shoot_notice/shoot_notice.js +++ b/packageD/pages/AI-test-skin/shoot_notice/shoot_notice.js @@ -157,12 +157,17 @@ Page({ return; } + wx.showLoading({ + title:'处理中', + mask: true + }); //先获取图片 然后根据长宽 缩小 之后获取图片 wx.getImageInfo({ src: img, success(res) { - console.log(res.width) - console.log(res.height) + + + var ratio = size / 1024; size1 = size1 / ratio; var canvasWidth = res.width //图片原始长宽 @@ -187,7 +192,7 @@ Page({ destHeight: canvasHeight, fileType: 'jpg', success: function (res) { - console.log(res.tempFilePath)//最终图片路径 + wx.hideLoading(); that.setData({selecting:0}) that.setData({ canvasImgUrl: res.tempFilePath @@ -200,9 +205,8 @@ Page({ app.goto(url); }, fail: function (res) { + wx.hideLoading(); that.setData({selecting:0}) - console.log("缩放图片失败"); - console.log(res.errMsg) wx.showToast({ title: '识别图片失败', image: '../../utils/img/wrong.png', @@ -216,8 +220,7 @@ Page({ }, 1000)) //留一定的时间绘制canvas 否则会报错fail canvas is empty }, fail: function (res) { - console.log("获取图片失败"); - console.log(res.errMsg) + wx.hideLoading(); that.setData({selecting:0}) wx.showToast({ title: '识别图片失败', -- libgit2 0.21.4