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