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