liukangdong
2024-08-05 00bf17838b496e6fcfed2e521f9c27f8f0e3e3c7
wechat_staff/pages/sets/index.js
@@ -1,6 +1,8 @@
// pages/sets/index.js
import { logout } from '../../api/index'
import {
  logout
} from '../../api/index'
Page({
  /**
@@ -17,25 +19,38 @@
  },
  showLogout() {
    this.setData({show: true})
    wx.showModal({
      title: '提示',
      content: '确认退出登录',
      success(res) {
        if (res.confirm) {
          logout({}).then(res => {
            const sessionKey = wx.getStorageSync('sessionKey')
            wx.clearStorageSync()
            setTimeout(() => {
              wx.setStorageSync('sessionKey', sessionKey)
              wx.redirectTo({
                url: '/pages/login/index',
              })
            }, 300)
          })
        }
      }
    })
  },
  onClose() {
    this.setData({show: false})
  },
  changeDeal(e){
    wx.navigateTo({
      url: '/pages/sets/protocol?type='+e.currentTarget.dataset.index,
    this.setData({
      show: false
    })
  },
  logout(){
    logout({
    }).then(res => {
      wx.setStorageSync('member', null)
      wx.setStorageSync('token', '')
      wx.navigateTo({
        url: '/pages/login/index',
      })
    })
  changeDeal(e) {
    wx.navigateTo({
      url: '/pages/sets/protocol?type=' + e.currentTarget.dataset.index,
    })
  },
  logout() {
  },
  /**
   * 生命周期函数--监听页面初次渲染完成