扫码进入选择身份
This commit is contained in:
parent
edb10af380
commit
aabe8da621
@ -6,6 +6,7 @@ Page({
|
|||||||
data: {
|
data: {
|
||||||
showEntryTip:false,
|
showEntryTip:false,
|
||||||
showEntryTip_second:false,
|
showEntryTip_second:false,
|
||||||
|
isLogin:false,
|
||||||
beforeClose(action){
|
beforeClose(action){
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
if (action === 'confirm') {
|
if (action === 'confirm') {
|
||||||
@ -23,6 +24,20 @@ Page({
|
|||||||
checked: false,
|
checked: false,
|
||||||
static_host: api.getStaticHost()
|
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(){
|
onLoad(){
|
||||||
let usertype = wx.getStorageSync('usertype');
|
let usertype = wx.getStorageSync('usertype');
|
||||||
this.setData({
|
this.setData({
|
||||||
@ -115,6 +130,7 @@ Page({
|
|||||||
})
|
})
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
let THIS=this;
|
||||||
let usertype = wx.getStorageSync('usertype');
|
let usertype = wx.getStorageSync('usertype');
|
||||||
let next_url = wx.getStorageSync('next_url');
|
let next_url = wx.getStorageSync('next_url');
|
||||||
wx.login({
|
wx.login({
|
||||||
@ -129,6 +145,9 @@ Page({
|
|||||||
api.wechatMobileLogin(params).then(response => {
|
api.wechatMobileLogin(params).then(response => {
|
||||||
console.log(response);
|
console.log(response);
|
||||||
wx.setStorageSync('AUTH_TOKEN_'+usertype, response.data.token);
|
wx.setStorageSync('AUTH_TOKEN_'+usertype, response.data.token);
|
||||||
|
THIS.setData({
|
||||||
|
isLogin:true
|
||||||
|
})
|
||||||
wx.setStorageSync('user_id_'+usertype, response.data.user_id);
|
wx.setStorageSync('user_id_'+usertype, response.data.user_id);
|
||||||
wx.setStorageSync('client_user_id_'+usertype, response.data.client_user_id);
|
wx.setStorageSync('client_user_id_'+usertype, response.data.client_user_id);
|
||||||
app.globalData.config.userID = response.data.user_id;
|
app.globalData.config.userID = response.data.user_id;
|
||||||
|
|||||||
1
app.js
1
app.js
@ -151,6 +151,7 @@ App({
|
|||||||
wx.$TUIKit.logout();
|
wx.$TUIKit.logout();
|
||||||
wx.$TUIKit = undefined;
|
wx.$TUIKit = undefined;
|
||||||
}
|
}
|
||||||
|
wx.setStorageSync('usertype','');
|
||||||
this.clearAllInterval();
|
this.clearAllInterval();
|
||||||
this.globalData.chat_sdk_ready = false;
|
this.globalData.chat_sdk_ready = false;
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user