扫码进入选择身份
This commit is contained in:
parent
edb10af380
commit
aabe8da621
@ -6,6 +6,7 @@ Page({
|
||||
data: {
|
||||
showEntryTip:false,
|
||||
showEntryTip_second:false,
|
||||
isLogin:false,
|
||||
beforeClose(action){
|
||||
return new Promise((resolve) => {
|
||||
if (action === 'confirm') {
|
||||
@ -23,6 +24,20 @@ Page({
|
||||
checked: false,
|
||||
static_host: api.getStaticHost()
|
||||
},
|
||||
onHide: function() {
|
||||
let isLogin=this.data.isLogin;
|
||||
if(!isLogin){
|
||||
wx.setStorageSync('usertype','');
|
||||
}
|
||||
// 页面从前台变为后台时执行
|
||||
},
|
||||
onUnload: function() {
|
||||
let isLogin=this.data.isLogin;
|
||||
if(!isLogin){
|
||||
wx.setStorageSync('usertype','');
|
||||
}
|
||||
// 页面销毁时执行
|
||||
},
|
||||
onLoad(){
|
||||
let usertype = wx.getStorageSync('usertype');
|
||||
this.setData({
|
||||
@ -115,6 +130,7 @@ Page({
|
||||
})
|
||||
return;
|
||||
}
|
||||
let THIS=this;
|
||||
let usertype = wx.getStorageSync('usertype');
|
||||
let next_url = wx.getStorageSync('next_url');
|
||||
wx.login({
|
||||
@ -129,6 +145,9 @@ Page({
|
||||
api.wechatMobileLogin(params).then(response => {
|
||||
console.log(response);
|
||||
wx.setStorageSync('AUTH_TOKEN_'+usertype, response.data.token);
|
||||
THIS.setData({
|
||||
isLogin:true
|
||||
})
|
||||
wx.setStorageSync('user_id_'+usertype, response.data.user_id);
|
||||
wx.setStorageSync('client_user_id_'+usertype, response.data.client_user_id);
|
||||
app.globalData.config.userID = response.data.user_id;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user