You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
92 lines
1.7 KiB
92 lines
1.7 KiB
const app = getApp<IAppOption>(); |
|
|
|
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', |
|
}); |
|
}, |
|
});
|
|
|