Commit 04ff8978a0593f716fc5fb3483aeee2227c46918
Merge branch 'dev' of http://git.vipzhuang.cn/wxd/MShopWeApp into dev
Showing
1 changed file
with
43 additions
and
48 deletions
packageD/pages/AI-test-skin/select_photo/select_photo.js
| @@ -23,57 +23,31 @@ Page({ | @@ -23,57 +23,31 @@ Page({ | ||
| 23 | this.setData({ gl_skin_img: img }) | 23 | this.setData({ gl_skin_img: img }) |
| 24 | }, | 24 | }, |
| 25 | 25 | ||
| 26 | - /** | ||
| 27 | - * 生命周期函数--监听页面显示 | ||
| 28 | - */ | ||
| 29 | - onShow: function () { }, | ||
| 30 | - | ||
| 31 | - /** | ||
| 32 | - * 生命周期函数--监听页面隐藏 | ||
| 33 | - */ | ||
| 34 | - onHide: function () { | ||
| 35 | - | ||
| 36 | - }, | ||
| 37 | - /** | ||
| 38 | - * 页面上拉触底事件的处理函数 | ||
| 39 | - */ | ||
| 40 | - onReachBottom: function () { | ||
| 41 | - | ||
| 42 | - }, | ||
| 43 | - | ||
| 44 | - /** | ||
| 45 | - * 用户点击右上角分享 | ||
| 46 | - */ | ||
| 47 | - onShareAppMessage: function () { | ||
| 48 | - | ||
| 49 | - }, | ||
| 50 | - | ||
| 51 | //-- 完成选择 -- | 26 | //-- 完成选择 -- |
| 52 | ok_select: function () { | 27 | ok_select: function () { |
| 53 | const th = this; | 28 | const th = this; |
| 54 | - let filePath = th.data.gl_skin_img['path']; | ||
| 55 | - console.log('filePath', filePath); | ||
| 56 | - // if (th.data.skin_type) { | ||
| 57 | - // filePath = th.data.gl_skin_img['path']; | ||
| 58 | - // } | ||
| 59 | - app.request.uploadFile("/api/weshop/baidubce/face/uploadImg?uploadPath=faceimg&storeId=" + setting.stoid, { | ||
| 60 | - filePath: th.data.gl_skin_img['path'], | ||
| 61 | - name: "file", | ||
| 62 | - success: function (e) { | ||
| 63 | - if (e.data.code == 0) { | ||
| 64 | - getApp().globalData.face_img = e.data.data.img; | ||
| 65 | - getApp().globalData.face_SourceImg = e.data.data.SourceImg; | ||
| 66 | - let url = "/packageD/pages/AI-test-skin/analyse/analyse"; //跳到分析页 | ||
| 67 | - app.goto(url); | ||
| 68 | - } else { | ||
| 69 | - wx.showToast({ | ||
| 70 | - title: e.data.msg, | ||
| 71 | - icon: 'none', | ||
| 72 | - duration: 2000 | ||
| 73 | - }); | ||
| 74 | - }; | ||
| 75 | - } | ||
| 76 | - }); | 29 | + this.check_num(function () { |
| 30 | + let filePath = th.data.gl_skin_img['path']; | ||
| 31 | + app.request.uploadFile("/api/weshop/baidubce/face/uploadImg?uploadPath=faceimg&storeId=" + setting.stoid, { | ||
| 32 | + filePath: th.data.gl_skin_img['path'], | ||
| 33 | + name: "file", | ||
| 34 | + success: function (e) { | ||
| 35 | + if (e.data.code == 0) { | ||
| 36 | + getApp().globalData.face_img = e.data.data.img; | ||
| 37 | + getApp().globalData.face_SourceImg = e.data.data.SourceImg; | ||
| 38 | + let url = "/packageD/pages/AI-test-skin/analyse/analyse"; //跳到分析页 | ||
| 39 | + app.goto(url); | ||
| 40 | + } else { | ||
| 41 | + wx.showToast({ | ||
| 42 | + title: e.data.msg, | ||
| 43 | + icon: 'none', | ||
| 44 | + duration: 2000 | ||
| 45 | + }); | ||
| 46 | + }; | ||
| 47 | + } | ||
| 48 | + }); | ||
| 49 | + }) | ||
| 50 | + | ||
| 77 | }, | 51 | }, |
| 78 | //-- 重新从相册中选择图片 -- | 52 | //-- 重新从相册中选择图片 -- |
| 79 | show_pai_pop: function () { | 53 | show_pai_pop: function () { |
| @@ -204,4 +178,25 @@ Page({ | @@ -204,4 +178,25 @@ Page({ | ||
| 204 | }, | 178 | }, |
| 205 | }) | 179 | }) |
| 206 | }, | 180 | }, |
| 181 | + | ||
| 182 | + check_num:function (func) { | ||
| 183 | + //判断右没有开AI测肤 | ||
| 184 | + getApp().promiseGet("/api/weshop/wx/weappSkin/get/"+setting.stoid,{}).then(rs=>{ | ||
| 185 | + if(rs.data.code!=0 || !rs.data.data){ | ||
| 186 | + wx.showToast({ | ||
| 187 | + title: "未开通测肤功能,请联系商家", | ||
| 188 | + icon: 'none', | ||
| 189 | + duration: 3000 | ||
| 190 | + }) | ||
| 191 | + }else if(!rs.data.data.skin_num || rs.data.data.skin_num<=0){ | ||
| 192 | + wx.showToast({ | ||
| 193 | + title: "测肤功能的使用次数已经达到上限,请联系商家", | ||
| 194 | + icon: 'none', | ||
| 195 | + duration: 3000 | ||
| 196 | + }) | ||
| 197 | + }else{ | ||
| 198 | + func(); | ||
| 199 | + } | ||
| 200 | + }) | ||
| 201 | + } | ||
| 207 | }) | 202 | }) |
| 208 | \ No newline at end of file | 203 | \ No newline at end of file |