// 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; if(usertype == 2){ app.imInit(); }else{ app.imLogout(); } let url = e.currentTarget.dataset.url; wx.setStorageSync('usertype', usertype); wx.setStorageSync('next_url', url); let token = wx.getStorageSync('AUTH_TOKEN_'+usertype); console.log(token); if(token){ wx.switchTab({ url: url }) }else{ app.go(app.globalData.login_url); } } })