haomingming 4f14aad6f3 优化
2023-04-11 18:41:46 +08:00

41 lines
864 B
JavaScript

// Pages/index/index.js
const app = getApp()
Page({
data: {
loading: true
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
if (typeof this.getTabBar === 'function' && this.getTabBar()) {
this.getTabBar().setData({
tabBarShow:false, //true/false
})
}
this.setData({ loading: false });
},
goCheck(e){
console.log(e);
let usertype = e.currentTarget.dataset.usertype;
let url = e.currentTarget.dataset.url;
wx.setStorageSync('usertype', usertype);
wx.setStorageSync('next_url', url);
if(usertype == 2){
app.imInit();
}else{
app.imLogout();
}
let token = wx.getStorageSync('AUTH_TOKEN_'+usertype);
console.log(token);
if(token){
wx.switchTab({
url: url
})
}else{
app.go(app.globalData.login_url);
}
}
})