const app = getApp(); Page({ data: { toastShow: false, toastType: 1, userInfo: {} as any, }, onShow() { // app.waitLogin().then(() => { // app.getUserInfo(this); // }); }, handleCollection() { wx.navigateTo({ url: '/pages/collection/index', }); }, handleLogin() { wx.navigateTo({ url: '/pages/login/index', }); }, handleLoginOut() { wx.showModal({ title: '是否确认退出登录?', success: (res) => { if (res.confirm) { wx.ajax({ method: 'POST', url: '?r=shizhong/account/logout', data: {}, }).then(() => { app.globalData.isLogin = 0; app.globalData.isAnswer = '0'; app.waitLogin(); }); } }, }); }, handleEditUser() { wx.navigateTo({ url: '/pages/userInfo/index', }); }, handleAvatar(e) { const avatar = e.detail.fileUrl; wx.ajax({ method: 'POST', url: '?r=shizhong/account/update-info', data: { userName: this.data.userInfo.username, avatar, }, }).then(() => { app.getUserInfo(this); }); }, handleOffice() { wx.hideTabBar({ success: () => { this.setData({ toastShow: true, toastType: 1, }); }, }); }, handleCompanyOffice() { wx.hideTabBar({ success: () => { this.setData({ toastShow: true, toastType: 2, }); }, }); }, handleToastClose() { this.setData({ toastShow: false, }); wx.showTabBar({}); }, handleTopic() { wx.navigateTo({ url: '/pages/topic/index?back=1', }); }, });