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 | 2 | * @Author: abson |
| 3 | 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 | 5 | * @LastEditors: Please set LastEditors |
| 6 | 6 | * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE |
| 7 | 7 | * @FilePath: \MShopWeApp\packageB\pages\AI-test-skin\index\aiskin.js |
| ... | ... | @@ -25,11 +25,13 @@ Page({ |
| 25 | 25 | * 生命周期函数--监听页面加载 |
| 26 | 26 | */ |
| 27 | 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 | 59 | goto(e) { |
| 58 | 60 | |
| 59 | 61 | this.check_num(function () { |
| 60 | - var user=getApp().globalData.userInfo; | |
| 61 | - if(!user){ | |
| 62 | + var user = getApp().globalData.userInfo; | |
| 63 | + if (!user) { | |
| 62 | 64 | wx.showToast({ |
| 63 | 65 | title: "请先授权登陆", |
| 64 | 66 | icon: 'none', |
| ... | ... | @@ -68,14 +70,14 @@ Page({ |
| 68 | 70 | setTimeout(function () { |
| 69 | 71 | let url = "/pages/togoin/togoin"; |
| 70 | 72 | app.goto(url); |
| 71 | - },1000) | |
| 73 | + }, 1000) | |
| 72 | 74 | return false; |
| 73 | 75 | } |
| 74 | 76 | |
| 75 | 77 | let url = e.currentTarget.dataset.url; |
| 76 | 78 | app.goto(url); |
| 77 | 79 | }) |
| 78 | - | |
| 80 | + | |
| 79 | 81 | }, |
| 80 | 82 | |
| 81 | 83 | /** |
| ... | ... | @@ -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 | 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 | 116 | wx.showToast({ |
| 114 | 117 | title: "未开通测肤功能,请联系商家", |
| 115 | 118 | icon: 'none', |
| 116 | 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 | 122 | wx.showToast({ |
| 120 | 123 | title: "测肤功能的使用次数已经达到上限,请联系商家", |
| 121 | 124 | icon: 'none', |
| 122 | 125 | duration: 3000 |
| 123 | 126 | }) |
| 124 | - }else{ | |
| 127 | + } else { | |
| 125 | 128 | func(); |
| 126 | 129 | } |
| 127 | 130 | }) |
| ... | ... | @@ -139,14 +142,14 @@ Page({ |
| 139 | 142 | store_id: setting.stoid, |
| 140 | 143 | user_id: os.user_id, |
| 141 | 144 | page: 1, |
| 142 | - pageSize:1, | |
| 145 | + pageSize: 1, | |
| 143 | 146 | } |
| 144 | 147 | }); |
| 145 | 148 | // initChart.setOption(option); |
| 146 | 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 | 156 | \ No newline at end of file | ... | ... |