diff --git a/packageD/pages/AI-test-skin/select_photo/select_photo.js b/packageD/pages/AI-test-skin/select_photo/select_photo.js index 68e9f1d..bc32fd8 100644 --- a/packageD/pages/AI-test-skin/select_photo/select_photo.js +++ b/packageD/pages/AI-test-skin/select_photo/select_photo.js @@ -23,57 +23,31 @@ Page({ this.setData({ gl_skin_img: img }) }, - /** - * 生命周期函数--监听页面显示 - */ - onShow: function () { }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { - - }, - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function () { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - - }, - //-- 完成选择 -- ok_select: function () { const th = this; - let filePath = th.data.gl_skin_img['path']; - console.log('filePath', filePath); - // if (th.data.skin_type) { - // filePath = th.data.gl_skin_img['path']; - // } - app.request.uploadFile("/api/weshop/baidubce/face/uploadImg?uploadPath=faceimg&storeId=" + setting.stoid, { - filePath: th.data.gl_skin_img['path'], - name: "file", - success: function (e) { - if (e.data.code == 0) { - getApp().globalData.face_img = e.data.data.img; - getApp().globalData.face_SourceImg = e.data.data.SourceImg; - let url = "/packageD/pages/AI-test-skin/analyse/analyse"; //跳到分析页 - app.goto(url); - } else { - wx.showToast({ - title: e.data.msg, - icon: 'none', - duration: 2000 - }); - }; - } - }); + this.check_num(function () { + let filePath = th.data.gl_skin_img['path']; + app.request.uploadFile("/api/weshop/baidubce/face/uploadImg?uploadPath=faceimg&storeId=" + setting.stoid, { + filePath: th.data.gl_skin_img['path'], + name: "file", + success: function (e) { + if (e.data.code == 0) { + getApp().globalData.face_img = e.data.data.img; + getApp().globalData.face_SourceImg = e.data.data.SourceImg; + let url = "/packageD/pages/AI-test-skin/analyse/analyse"; //跳到分析页 + app.goto(url); + } else { + wx.showToast({ + title: e.data.msg, + icon: 'none', + duration: 2000 + }); + }; + } + }); + }) + }, //-- 重新从相册中选择图片 -- show_pai_pop: function () { @@ -204,4 +178,25 @@ Page({ }, }) }, + + check_num:function (func) { + //判断右没有开AI测肤 + getApp().promiseGet("/api/weshop/wx/weappSkin/get/"+setting.stoid,{}).then(rs=>{ + if(rs.data.code!=0 || !rs.data.data){ + wx.showToast({ + title: "未开通测肤功能,请联系商家", + icon: 'none', + duration: 3000 + }) + }else if(!rs.data.data.skin_num || rs.data.data.skin_num<=0){ + wx.showToast({ + title: "测肤功能的使用次数已经达到上限,请联系商家", + icon: 'none', + duration: 3000 + }) + }else{ + func(); + } + }) + } }) \ No newline at end of file