Commit cff379c2766f1eabe9c9f4586f0470d684f71df9

Authored by yvan.ni
1 parent eeec174b

选择图片,避免重复点击

packageD/pages/AI-test-skin/shoot_notice/shoot_notice.js
@@ -100,6 +100,7 @@ Page({ @@ -100,6 +100,7 @@ Page({
100 takePhoto() { 100 takePhoto() {
101 var that = this; 101 var that = this;
102 getApp().globalData.no_clear=1; 102 getApp().globalData.no_clear=1;
  103 + that.setData({selecting:1});
103 wx.chooseImage({ 104 wx.chooseImage({
104 count: 1, 105 count: 1,
105 sizeType: ['compressed'], 106 sizeType: ['compressed'],
@@ -119,6 +120,7 @@ Page({ @@ -119,6 +120,7 @@ Page({
119 120
120 }, 121 },
121 fail(err) { 122 fail(err) {
  123 + that.setData({selecting:0})
122 console.log(err); 124 console.log(err);
123 } 125 }
124 }) 126 })
@@ -144,6 +146,7 @@ Page({ @@ -144,6 +146,7 @@ Page({
144 var that = this; 146 var that = this;
145 //size小于100kb 时 直接转码识别 147 //size小于100kb 时 直接转码识别
146 if (size < 1024) { 148 if (size < 1024) {
  149 + that.setData({selecting:0})
147 getApp().globalData.skin_img_info = { 150 getApp().globalData.skin_img_info = {
148 path:img, 151 path:img,
149 size, 152 size,
@@ -185,6 +188,7 @@ Page({ @@ -185,6 +188,7 @@ Page({
185 fileType: 'jpg', 188 fileType: 'jpg',
186 success: function (res) { 189 success: function (res) {
187 console.log(res.tempFilePath)//最终图片路径 190 console.log(res.tempFilePath)//最终图片路径
  191 + that.setData({selecting:0})
188 that.setData({ 192 that.setData({
189 canvasImgUrl: res.tempFilePath 193 canvasImgUrl: res.tempFilePath
190 }); 194 });
@@ -196,9 +200,9 @@ Page({ @@ -196,9 +200,9 @@ Page({
196 app.goto(url); 200 app.goto(url);
197 }, 201 },
198 fail: function (res) { 202 fail: function (res) {
  203 + that.setData({selecting:0})
199 console.log("缩放图片失败"); 204 console.log("缩放图片失败");
200 console.log(res.errMsg) 205 console.log(res.errMsg)
201 - wx.hideLoading();  
202 wx.showToast({ 206 wx.showToast({
203 title: '识别图片失败', 207 title: '识别图片失败',
204 image: '../../utils/img/wrong.png', 208 image: '../../utils/img/wrong.png',
@@ -214,7 +218,7 @@ Page({ @@ -214,7 +218,7 @@ Page({
214 fail: function (res) { 218 fail: function (res) {
215 console.log("获取图片失败"); 219 console.log("获取图片失败");
216 console.log(res.errMsg) 220 console.log(res.errMsg)
217 - wx.hideLoading(); 221 + that.setData({selecting:0})
218 wx.showToast({ 222 wx.showToast({
219 title: '识别图片失败', 223 title: '识别图片失败',
220 image: '../../utils/img/wrong.png', 224 image: '../../utils/img/wrong.png',
packageD/pages/AI-test-skin/shoot_notice/shoot_notice.wxml
@@ -55,7 +55,7 @@ @@ -55,7 +55,7 @@
55 55
56 <view style="height: 300rpx;background-color: #e7f5fb;"> 56 <view style="height: 300rpx;background-color: #e7f5fb;">
57 <view class="btn_fixed"> 57 <view class="btn_fixed">
58 - <view class="btn" bindtap="takePhoto">准备闭眼拍摄</view> 58 + <botton disabled="{{selecting}}" class="btn" bindtap="takePhoto">准备闭眼拍摄</botton>
59 <view class="notice" style="display:flex;justify-content:center;align-items: center;"> 59 <view class="notice" style="display:flex;justify-content:center;align-items: center;">
60 <text class="iconfont icon-info" style="margin-right: 10rpx;font-size: 26rpx"></text> 60 <text class="iconfont icon-info" style="margin-right: 10rpx;font-size: 26rpx"></text>
61 <text>如无闭眼,将导致图片分析失败</text> 61 <text>如无闭眼,将导致图片分析失败</text>
packageD/pages/AI-test-skin/shoot_notice/shoot_notice.wxss
@@ -103,6 +103,7 @@ page { @@ -103,6 +103,7 @@ page {
103 text-align: center; 103 text-align: center;
104 border-radius: 50rpx; 104 border-radius: 50rpx;
105 color: #fff; 105 color: #fff;
  106 + display: block;
106 } 107 }
107 108
108 .btn_fixed { 109 .btn_fixed {