Commit bf3cc529622deba5e67d3166037497b3cee2a849
1 parent
5415949c
从美导跳转到手店测肤
Showing
1 changed file
with
23 additions
and
20 deletions
packageD/pages/AI-test-skin/index/aiskin.js
1 | /* | 1 | /* |
2 | * @Author: abson | 2 | * @Author: abson |
3 | * @Date: 2022-02-11 14:13:05 | 3 | * @Date: 2022-02-11 14:13:05 |
4 | - * @LastEditTime: 2022-02-22 15:17:48 | 4 | + * @LastEditTime: 2022-03-26 17:03:01 |
5 | * @LastEditors: Please set LastEditors | 5 | * @LastEditors: Please set LastEditors |
6 | * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE | 6 | * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE |
7 | * @FilePath: \MShopWeApp\packageB\pages\AI-test-skin\index\aiskin.js | 7 | * @FilePath: \MShopWeApp\packageB\pages\AI-test-skin\index\aiskin.js |
@@ -25,11 +25,13 @@ Page({ | @@ -25,11 +25,13 @@ Page({ | ||
25 | * 生命周期函数--监听页面加载 | 25 | * 生命周期函数--监听页面加载 |
26 | */ | 26 | */ |
27 | onLoad: function (options) { | 27 | onLoad: function (options) { |
28 | - var user=getApp().globalData.userInfo; | ||
29 | - if(!user){ | ||
30 | - let url = "/pages/togoin/togoin"; | ||
31 | - app.goto(url); | ||
32 | - } | 28 | + console.log(options); |
29 | + getApp().globalData.user_id = options?.user_id; | ||
30 | + var user = getApp().globalData.userInfo; | ||
31 | + if (!user || !getApp().globalData.user_id) { | ||
32 | + let url = "/pages/togoin/togoin"; | ||
33 | + app.goto(url); | ||
34 | + } | ||
33 | }, | 35 | }, |
34 | 36 | ||
35 | /** | 37 | /** |
@@ -57,8 +59,8 @@ Page({ | @@ -57,8 +59,8 @@ Page({ | ||
57 | goto(e) { | 59 | goto(e) { |
58 | 60 | ||
59 | this.check_num(function () { | 61 | this.check_num(function () { |
60 | - var user=getApp().globalData.userInfo; | ||
61 | - if(!user){ | 62 | + var user = getApp().globalData.userInfo; |
63 | + if (!user) { | ||
62 | wx.showToast({ | 64 | wx.showToast({ |
63 | title: "请先授权登陆", | 65 | title: "请先授权登陆", |
64 | icon: 'none', | 66 | icon: 'none', |
@@ -68,14 +70,14 @@ Page({ | @@ -68,14 +70,14 @@ Page({ | ||
68 | setTimeout(function () { | 70 | setTimeout(function () { |
69 | let url = "/pages/togoin/togoin"; | 71 | let url = "/pages/togoin/togoin"; |
70 | app.goto(url); | 72 | app.goto(url); |
71 | - },1000) | 73 | + }, 1000) |
72 | return false; | 74 | return false; |
73 | } | 75 | } |
74 | 76 | ||
75 | let url = e.currentTarget.dataset.url; | 77 | let url = e.currentTarget.dataset.url; |
76 | app.goto(url); | 78 | app.goto(url); |
77 | }) | 79 | }) |
78 | - | 80 | + |
79 | }, | 81 | }, |
80 | 82 | ||
81 | /** | 83 | /** |
@@ -102,26 +104,27 @@ Page({ | @@ -102,26 +104,27 @@ Page({ | ||
102 | /** | 104 | /** |
103 | * 用户点击右上角分享 | 105 | * 用户点击右上角分享 |
104 | */ | 106 | */ |
105 | - onShareAppMessage: function () { getApp().globalData.no_clear=1 | 107 | + onShareAppMessage: function () { |
108 | + getApp().globalData.no_clear = 1 | ||
106 | 109 | ||
107 | }, | 110 | }, |
108 | 111 | ||
109 | - check_num:function (func) { | 112 | + check_num: function (func) { |
110 | //判断右没有开AI测肤 | 113 | //判断右没有开AI测肤 |
111 | - getApp().promiseGet("/api/weshop/wx/weappSkin/get/"+setting.stoid,{}).then(rs=>{ | ||
112 | - if(rs.data.code!=0 || !rs.data.data){ | 114 | + getApp().promiseGet("/api/weshop/wx/weappSkin/get/" + setting.stoid, {}).then(rs => { |
115 | + if (rs.data.code != 0 || !rs.data.data) { | ||
113 | wx.showToast({ | 116 | wx.showToast({ |
114 | title: "未开通测肤功能,请联系商家", | 117 | title: "未开通测肤功能,请联系商家", |
115 | icon: 'none', | 118 | icon: 'none', |
116 | duration: 3000 | 119 | duration: 3000 |
117 | }) | 120 | }) |
118 | - }else if(!rs.data.data.skin_num || rs.data.data.skin_num<=0){ | 121 | + } else if (!rs.data.data.skin_num || rs.data.data.skin_num <= 0) { |
119 | wx.showToast({ | 122 | wx.showToast({ |
120 | title: "测肤功能的使用次数已经达到上限,请联系商家", | 123 | title: "测肤功能的使用次数已经达到上限,请联系商家", |
121 | icon: 'none', | 124 | icon: 'none', |
122 | duration: 3000 | 125 | duration: 3000 |
123 | }) | 126 | }) |
124 | - }else{ | 127 | + } else { |
125 | func(); | 128 | func(); |
126 | } | 129 | } |
127 | }) | 130 | }) |
@@ -139,14 +142,14 @@ Page({ | @@ -139,14 +142,14 @@ Page({ | ||
139 | store_id: setting.stoid, | 142 | store_id: setting.stoid, |
140 | user_id: os.user_id, | 143 | user_id: os.user_id, |
141 | page: 1, | 144 | page: 1, |
142 | - pageSize:1, | 145 | + pageSize: 1, |
143 | } | 146 | } |
144 | }); | 147 | }); |
145 | // initChart.setOption(option); | 148 | // initChart.setOption(option); |
146 | if (res.code == 0 && res.data.pageData.length > 0) { | 149 | if (res.code == 0 && res.data.pageData.length > 0) { |
147 | - this.setData({show_his:1}) | 150 | + this.setData({ show_his: 1 }) |
148 | } | 151 | } |
149 | } | 152 | } |
150 | - | ||
151 | - | 153 | + |
154 | + | ||
152 | }) | 155 | }) |
153 | \ No newline at end of file | 156 | \ No newline at end of file |