diff --git a/packageD/pages/AI-test-skin/analyse/analyse.js b/packageD/pages/AI-test-skin/analyse/analyse.js index b820186..b15a485 100644 --- a/packageD/pages/AI-test-skin/analyse/analyse.js +++ b/packageD/pages/AI-test-skin/analyse/analyse.js @@ -368,7 +368,8 @@ Page({ "appid": "25521854", "image": getApp().globalData.face_SourceImg, "face_field": "age,expression,face_shape,gender,glasses,landmark,landmark150,quality,eye_status,emotion,face_type,mask,spoofing", - "image_type": "URL" + "image_type": "URL", + "store_id":setting.stoid } //开始调用接口,进行对图片进行判断是否符合标准 this.json_post("/api/weshop/baidubce/face/skindetect", data, function (res) { diff --git a/packageD/pages/AI-test-skin/index/aiskin.js b/packageD/pages/AI-test-skin/index/aiskin.js index fa0d8ce..9a6b94e 100644 --- a/packageD/pages/AI-test-skin/index/aiskin.js +++ b/packageD/pages/AI-test-skin/index/aiskin.js @@ -54,23 +54,27 @@ Page({ }, goto(e) { - var user=getApp().globalData.userInfo; - if(!user){ - wx.showToast({ - title: "请先授权登陆", - icon: 'none', - duration: 2000 - }); - - setTimeout(function () { - let url = "/pages/togoin/togoin"; - app.goto(url); - },1000) - return false; - } - - let url = e.currentTarget.dataset.url; - app.goto(url); + + this.check_num(function () { + var user=getApp().globalData.userInfo; + if(!user){ + wx.showToast({ + title: "请先授权登陆", + icon: 'none', + duration: 2000 + }); + + setTimeout(function () { + let url = "/pages/togoin/togoin"; + app.goto(url); + },1000) + return false; + } + + let url = e.currentTarget.dataset.url; + app.goto(url); + }) + }, /** @@ -99,5 +103,28 @@ Page({ */ onShareAppMessage: function () { + }, + + 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 diff --git a/packageD/pages/AI-test-skin/success_result/dark/dark.wxml b/packageD/pages/AI-test-skin/success_result/dark/dark.wxml index 96f6dcf..c068c85 100644 --- a/packageD/pages/AI-test-skin/success_result/dark/dark.wxml +++ b/packageD/pages/AI-test-skin/success_result/dark/dark.wxml @@ -43,15 +43,15 @@ - 色素性-中度 + 色素性 - 血管性-轻度 + 血管性 - 阴影型-无 + 阴影型 diff --git a/packageD/pages/AI-test-skin/success_result/success_result.js b/packageD/pages/AI-test-skin/success_result/success_result.js index a1679d0..e00232d 100644 --- a/packageD/pages/AI-test-skin/success_result/success_result.js +++ b/packageD/pages/AI-test-skin/success_result/success_result.js @@ -495,8 +495,10 @@ Page({ }) switch (type) { case 1: //毛孔 - var pore_list = this.data.face_data.blackheadpore.circles[0].pore; - this.setData({ pore_list: pore_list }); + var pore_list = this.data.face_data.blackheadpore.circles.filter(function (e) { + return e.pore + }) + this.setData({ pore_list: pore_list[0].pore }); break; case 2://色斑 var speckle_list = this.data.face_data.acnespotmole.speckle_list; @@ -514,8 +516,10 @@ Page({ this.setData({ wrinkle_list: wrinkle_list }); break; case 4://黑头 - var blackhead_list = this.data.face_data.blackheadpore.circles[0].blackhead; - this.setData({ blackhead_list: blackhead_list }); + var blackhead_list = this.data.face_data.blackheadpore.circles.filter(function (e) { + return e.blackhead + }) + this.setData({ blackhead_list: blackhead_list[0].blackhead }); break; case 5://黑眼圈 var arr = this.data.face_data.eyesattr.dark_circle_left[0]; diff --git a/pages/user/index/index.js b/pages/user/index/index.js index f2acb92..9f283d7 100644 --- a/pages/user/index/index.js +++ b/pages/user/index/index.js @@ -58,9 +58,23 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function(options) { - var th=this; - //-- 读取会员中心按钮列表 -- - getApp().request.get("/api/weshop/userTool/page?pageSize=100&store_id="+os.stoid, { + var th=this; + getApp().request.get("/api/weshop/ad/page?pid=401&store_id=" + os.stoid, { + data: { + enabled: 1 + }, + success:function(res){ + if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length){ + var item=res.data.data.pageData[0]; + if (item && item.ad_code) th.setData({ad_img:item.ad_code}) + } + } + }) + app.getUserFir(); + + //-- 读取会员中心按钮列表 -- + /*-- + getApp().request.get("/api/weshop/userTool/page?pageSize=100&store_id="+os.stoid, { success:function(res){ if(ut.ajax_ok(res)) { var d_list=res.data.data.pageData; @@ -73,24 +87,14 @@ Page({ } th.setData({user_tool:d_list}); - getApp().request.get("/api/weshop/ad/page?pid=401&store_id=" + os.stoid, { - data: { - enabled: 1 - }, - success:function(res){ - if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length){ - var item=res.data.data.pageData[0]; - if (item && item.ad_code) th.setData({ad_img:item.ad_code}) - } - } - }) - app.getUserFir(); }) } } }) + --*/ + this.init_user_tool() }, @@ -98,10 +102,6 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function() { - - - - //看一下小程序是不是过期了 getApp().getConfig2(function(config2){ if(config2 && config2.is_overdue==1){ @@ -870,6 +870,42 @@ Page({ corpId: id, success(res) {} }) + }, + + //初始话按钮图标 + init_user_tool:async function () { + var d_list=null; + //读取user_tool按钮图标 + await getApp().promiseGet("/api/weshop/userTool/page?pageSize=100&store_id="+os.stoid, { + }).then(res=>{ + if(ut.ajax_ok(res)) { + d_list=res.data.data.pageData; + } + }) + if(!d_list) return false; + //过滤掉分销关闭的 + await getApp().promiseGet("/api/weshop/storeDistribut/get/"+os.stoid,{}).then(rs=>{ + if(rs.data.code==0){ + var dis=rs.data.data; + for(var i in d_list){ + if(d_list[i].name=='我的分销' && (!dis || dis.switch==0)){ + d_list.splice(i,1); + } + } + } + }) + + //判断右没有开AI测肤 + await getApp().promiseGet("/api/weshop/wx/weappSkin/get/"+os.stoid,{}).then(rs=>{ + if(rs.data.code!=0 || !rs.data.data){ + for(var i in d_list){ + if(d_list[i].name=='AI测肤'){ + d_list.splice(i,1); + } + } + } + }) + this.setData({user_tool:d_list}); }