Commit f89ad8d2836ffc924dac8c495cfb3e01ef39257a
1 parent
68ce9894
测肤功能的缴费功能的制作
Showing
5 changed files
with
112 additions
and
44 deletions
packageD/pages/AI-test-skin/analyse/analyse.js
... | ... | @@ -368,7 +368,8 @@ Page({ |
368 | 368 | "appid": "25521854", |
369 | 369 | "image": getApp().globalData.face_SourceImg, |
370 | 370 | "face_field": "age,expression,face_shape,gender,glasses,landmark,landmark150,quality,eye_status,emotion,face_type,mask,spoofing", |
371 | - "image_type": "URL" | |
371 | + "image_type": "URL", | |
372 | + "store_id":setting.stoid | |
372 | 373 | } |
373 | 374 | //开始调用接口,进行对图片进行判断是否符合标准 |
374 | 375 | this.json_post("/api/weshop/baidubce/face/skindetect", data, function (res) { | ... | ... |
packageD/pages/AI-test-skin/index/aiskin.js
... | ... | @@ -54,23 +54,27 @@ Page({ |
54 | 54 | }, |
55 | 55 | |
56 | 56 | goto(e) { |
57 | - var user=getApp().globalData.userInfo; | |
58 | - if(!user){ | |
59 | - wx.showToast({ | |
60 | - title: "请先授权登陆", | |
61 | - icon: 'none', | |
62 | - duration: 2000 | |
63 | - }); | |
64 | - | |
65 | - setTimeout(function () { | |
66 | - let url = "/pages/togoin/togoin"; | |
67 | - app.goto(url); | |
68 | - },1000) | |
69 | - return false; | |
70 | - } | |
71 | - | |
72 | - let url = e.currentTarget.dataset.url; | |
73 | - app.goto(url); | |
57 | + | |
58 | + this.check_num(function () { | |
59 | + var user=getApp().globalData.userInfo; | |
60 | + if(!user){ | |
61 | + wx.showToast({ | |
62 | + title: "请先授权登陆", | |
63 | + icon: 'none', | |
64 | + duration: 2000 | |
65 | + }); | |
66 | + | |
67 | + setTimeout(function () { | |
68 | + let url = "/pages/togoin/togoin"; | |
69 | + app.goto(url); | |
70 | + },1000) | |
71 | + return false; | |
72 | + } | |
73 | + | |
74 | + let url = e.currentTarget.dataset.url; | |
75 | + app.goto(url); | |
76 | + }) | |
77 | + | |
74 | 78 | }, |
75 | 79 | |
76 | 80 | /** |
... | ... | @@ -99,5 +103,28 @@ Page({ |
99 | 103 | */ |
100 | 104 | onShareAppMessage: function () { |
101 | 105 | |
106 | + }, | |
107 | + | |
108 | + check_num:function (func) { | |
109 | + //判断右没有开AI测肤 | |
110 | + getApp().promiseGet("/api/weshop/wx/weappSkin/get/"+setting.stoid,{}).then(rs=>{ | |
111 | + if(rs.data.code!=0 || !rs.data.data){ | |
112 | + wx.showToast({ | |
113 | + title: "未开通测肤功能,请联系商家", | |
114 | + icon: 'none', | |
115 | + duration: 3000 | |
116 | + }) | |
117 | + }else if(!rs.data.data.skin_num || rs.data.data.skin_num<=0){ | |
118 | + wx.showToast({ | |
119 | + title: "测肤功能的使用次数已经达到上限,请联系商家", | |
120 | + icon: 'none', | |
121 | + duration: 3000 | |
122 | + }) | |
123 | + }else{ | |
124 | + func(); | |
125 | + } | |
126 | + }) | |
102 | 127 | } |
128 | + | |
129 | + | |
103 | 130 | }) |
104 | 131 | \ No newline at end of file | ... | ... |
packageD/pages/AI-test-skin/success_result/dark/dark.wxml
... | ... | @@ -43,15 +43,15 @@ |
43 | 43 | <view class="leixing"> |
44 | 44 | <view class="_img"> |
45 | 45 | <image style="height:150rpx;width:150rpx;border-radius: 50%;" src="{{iurl}}/miniapp/images/skinimg/nan4.jpeg"></image> |
46 | - <view class="fs28">色素性-中度</view> | |
46 | + <view class="fs28">色素性</view> | |
47 | 47 | </view> |
48 | 48 | <view class="_img"> |
49 | 49 | <image style="height:150rpx;width:150rpx;border-radius: 50%;" src="{{iurl}}/miniapp/images/skinimg/nan5.jpeg"></image> |
50 | - <view class="fs28">血管性-轻度</view> | |
50 | + <view class="fs28">血管性</view> | |
51 | 51 | </view> |
52 | 52 | <view class="_img"> |
53 | 53 | <image style="height:150rpx;width:150rpx;border-radius: 50%;" src="{{iurl}}/miniapp/images/skinimg/nan6.jpeg"></image> |
54 | - <view class="fs28" style="color: #666;">阴影型-无</view> | |
54 | + <view class="fs28" style="color: #666;">阴影型</view> | |
55 | 55 | </view> |
56 | 56 | </view> |
57 | 57 | </block> | ... | ... |
packageD/pages/AI-test-skin/success_result/success_result.js
... | ... | @@ -495,8 +495,10 @@ Page({ |
495 | 495 | }) |
496 | 496 | switch (type) { |
497 | 497 | case 1: //毛孔 |
498 | - var pore_list = this.data.face_data.blackheadpore.circles[0].pore; | |
499 | - this.setData({ pore_list: pore_list }); | |
498 | + var pore_list = this.data.face_data.blackheadpore.circles.filter(function (e) { | |
499 | + return e.pore | |
500 | + }) | |
501 | + this.setData({ pore_list: pore_list[0].pore }); | |
500 | 502 | break; |
501 | 503 | case 2://色斑 |
502 | 504 | var speckle_list = this.data.face_data.acnespotmole.speckle_list; |
... | ... | @@ -514,8 +516,10 @@ Page({ |
514 | 516 | this.setData({ wrinkle_list: wrinkle_list }); |
515 | 517 | break; |
516 | 518 | case 4://黑头 |
517 | - var blackhead_list = this.data.face_data.blackheadpore.circles[0].blackhead; | |
518 | - this.setData({ blackhead_list: blackhead_list }); | |
519 | + var blackhead_list = this.data.face_data.blackheadpore.circles.filter(function (e) { | |
520 | + return e.blackhead | |
521 | + }) | |
522 | + this.setData({ blackhead_list: blackhead_list[0].blackhead }); | |
519 | 523 | break; |
520 | 524 | case 5://黑眼圈 |
521 | 525 | var arr = this.data.face_data.eyesattr.dark_circle_left[0]; | ... | ... |
pages/user/index/index.js
... | ... | @@ -58,9 +58,23 @@ Page({ |
58 | 58 | * 生命周期函数--监听页面加载 |
59 | 59 | */ |
60 | 60 | onLoad: function(options) { |
61 | - var th=this; | |
62 | - //-- 读取会员中心按钮列表 -- | |
63 | - getApp().request.get("/api/weshop/userTool/page?pageSize=100&store_id="+os.stoid, { | |
61 | + var th=this; | |
62 | + getApp().request.get("/api/weshop/ad/page?pid=401&store_id=" + os.stoid, { | |
63 | + data: { | |
64 | + enabled: 1 | |
65 | + }, | |
66 | + success:function(res){ | |
67 | + if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length){ | |
68 | + var item=res.data.data.pageData[0]; | |
69 | + if (item && item.ad_code) th.setData({ad_img:item.ad_code}) | |
70 | + } | |
71 | + } | |
72 | + }) | |
73 | + app.getUserFir(); | |
74 | + | |
75 | + //-- 读取会员中心按钮列表 -- | |
76 | + /*-- | |
77 | + getApp().request.get("/api/weshop/userTool/page?pageSize=100&store_id="+os.stoid, { | |
64 | 78 | success:function(res){ |
65 | 79 | if(ut.ajax_ok(res)) { |
66 | 80 | var d_list=res.data.data.pageData; |
... | ... | @@ -73,24 +87,14 @@ Page({ |
73 | 87 | } |
74 | 88 | th.setData({user_tool:d_list}); |
75 | 89 | |
76 | - getApp().request.get("/api/weshop/ad/page?pid=401&store_id=" + os.stoid, { | |
77 | - data: { | |
78 | - enabled: 1 | |
79 | - }, | |
80 | - success:function(res){ | |
81 | - if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length){ | |
82 | - var item=res.data.data.pageData[0]; | |
83 | - if (item && item.ad_code) th.setData({ad_img:item.ad_code}) | |
84 | - } | |
85 | - } | |
86 | - }) | |
87 | 90 | |
88 | - app.getUserFir(); | |
89 | 91 | |
90 | 92 | }) |
91 | 93 | } |
92 | 94 | } |
93 | 95 | }) |
96 | + --*/ | |
97 | + this.init_user_tool() | |
94 | 98 | |
95 | 99 | }, |
96 | 100 | |
... | ... | @@ -98,10 +102,6 @@ Page({ |
98 | 102 | * 生命周期函数--监听页面显示 |
99 | 103 | */ |
100 | 104 | onShow: function() { |
101 | - | |
102 | - | |
103 | - | |
104 | - | |
105 | 105 | //看一下小程序是不是过期了 |
106 | 106 | getApp().getConfig2(function(config2){ |
107 | 107 | if(config2 && config2.is_overdue==1){ |
... | ... | @@ -870,6 +870,42 @@ Page({ |
870 | 870 | corpId: id, |
871 | 871 | success(res) {} |
872 | 872 | }) |
873 | + }, | |
874 | + | |
875 | + //初始话按钮图标 | |
876 | + init_user_tool:async function () { | |
877 | + var d_list=null; | |
878 | + //读取user_tool按钮图标 | |
879 | + await getApp().promiseGet("/api/weshop/userTool/page?pageSize=100&store_id="+os.stoid, { | |
880 | + }).then(res=>{ | |
881 | + if(ut.ajax_ok(res)) { | |
882 | + d_list=res.data.data.pageData; | |
883 | + } | |
884 | + }) | |
885 | + if(!d_list) return false; | |
886 | + //过滤掉分销关闭的 | |
887 | + await getApp().promiseGet("/api/weshop/storeDistribut/get/"+os.stoid,{}).then(rs=>{ | |
888 | + if(rs.data.code==0){ | |
889 | + var dis=rs.data.data; | |
890 | + for(var i in d_list){ | |
891 | + if(d_list[i].name=='我的分销' && (!dis || dis.switch==0)){ | |
892 | + d_list.splice(i,1); | |
893 | + } | |
894 | + } | |
895 | + } | |
896 | + }) | |
897 | + | |
898 | + //判断右没有开AI测肤 | |
899 | + await getApp().promiseGet("/api/weshop/wx/weappSkin/get/"+os.stoid,{}).then(rs=>{ | |
900 | + if(rs.data.code!=0 || !rs.data.data){ | |
901 | + for(var i in d_list){ | |
902 | + if(d_list[i].name=='AI测肤'){ | |
903 | + d_list.splice(i,1); | |
904 | + } | |
905 | + } | |
906 | + } | |
907 | + }) | |
908 | + this.setData({user_tool:d_list}); | |
873 | 909 | } |
874 | 910 | |
875 | 911 | ... | ... |