123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- booLogout: false,
- booLock: false
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- this.getTabBar().init()
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- },
- jump(e) {
- const { page } = e.currentTarget.dataset
- wx.navigateTo({
- url: `/pages/${page}/${page}`
- })
- },
- showLogout() {
- this.setData({
- booLogout: true
- })
- },
- hideLogout() {
- this.setData({
- booLogout: false
- })
- },
- async confirmLogout() {
- this.setData({
- booLock: true
- })
- try {
- const { status, msg } = await userLoginOut()
- if (status) {
- this.hideLogout()
- wx.removeStorageSync(sessionStorageKey)
- // 更新用户信息
- app.globalData.userInfo = {}
- wx.reLaunch({
- url: '/pages/mine/mine'
- })
- } else {
- wx.showToast({
- title: msg,
- icon: 'none'
- })
- }
- } catch (e) {}
- this.setData({
- booLock: false
- })
- }
- })
|