const util = require("../../../utils/util") const app = getApp() Page({ data: { spinShow: false, userInfo:{}, out:0, visit:0 }, onShow: function () { app.checkLogin( userInfo =>{ this.setData({userInfo}) if( userInfo.adminId >0){ this.loadConfirm() } }) }, loadConfirm(){ app.formPost('User.confirmInfo', {} ).then(res => { if (res.code === 200) { let {out, visit} = res.data; this.setData({out, visit}); } }) }, goLogin( e){ wx.navigateTo({ url: '/pages/index/index', }) }, logOut() { wx.setStorageSync('userId', '') wx.setStorageSync('@token', '') wx.setStorageSync('@openid', '') let userInfo = {} this.setData({userInfo}) app.setUserInfo( userInfo ) }, gotoConfirmOut( e ){ if( this.data.userInfo.adminId==0){ return; } wx.navigateTo({ url: `/pages/user/out/index`, }) }, gotoConfirmVisit( e ){ if( this.data.userInfo.adminId==0){ return; } wx.navigateTo({ url: `/pages/user/visit/index`, }) } })