Commit 2366867aa1cd33b07cda91ee35d75d929b639687
Merge branch 'dev' of http://git.vipzhuang.cn/wxd/MShopWeApp into dev
Showing
3 changed files
with
13 additions
and
8 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, |
... | ... | @@ -154,12 +157,15 @@ Page({ |
154 | 157 | return; |
155 | 158 | } |
156 | 159 | |
160 | + wx.showLoading({ | |
161 | + title:'处理中', | |
162 | + mask: true | |
163 | + }); | |
157 | 164 | //先获取图片 然后根据长宽 缩小 之后获取图片 |
158 | 165 | wx.getImageInfo({ |
159 | 166 | src: img, |
160 | 167 | success(res) { |
161 | - console.log(res.width) | |
162 | - console.log(res.height) | |
168 | + | |
163 | 169 | var ratio = size / 1024; |
164 | 170 | size1 = size1 / ratio; |
165 | 171 | var canvasWidth = res.width //图片原始长宽 |
... | ... | @@ -184,7 +190,7 @@ Page({ |
184 | 190 | destHeight: canvasHeight, |
185 | 191 | fileType: 'jpg', |
186 | 192 | success: function (res) { |
187 | - console.log(res.tempFilePath)//最终图片路径 | |
193 | + wx.hideLoading(); | |
188 | 194 | that.setData({ |
189 | 195 | canvasImgUrl: res.tempFilePath |
190 | 196 | }); |
... | ... | @@ -196,9 +202,8 @@ Page({ |
196 | 202 | app.goto(url); |
197 | 203 | }, |
198 | 204 | fail: function (res) { |
199 | - console.log("缩放图片失败"); | |
200 | - console.log(res.errMsg) | |
201 | 205 | wx.hideLoading(); |
206 | + that.setData({selecting:0}) | |
202 | 207 | wx.showToast({ |
203 | 208 | title: '识别图片失败', |
204 | 209 | image: '../../utils/img/wrong.png', |
... | ... | @@ -212,9 +217,8 @@ Page({ |
212 | 217 | }, 1000)) //留一定的时间绘制canvas 否则会报错fail canvas is empty |
213 | 218 | }, |
214 | 219 | fail: function (res) { |
215 | - console.log("获取图片失败"); | |
216 | - console.log(res.errMsg) | |
217 | 220 | 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> | ... | ... |