闫增涛
2025-03-31 04c7b0163caeae4ab1c5da62e301fa993101cfad
packageDomain/pages/teacherCertification/index.js
@@ -57,17 +57,7 @@
    //获取职称
    this.getpositionalTitle();
    this.getAgreement();
    // 检查登录状态
    const token = wx.getStorageSync(app.config.tokenKey)
    if (!token) {
      loginInfo(app, (data) => {
        if (data) {
          this.getUserRole()
        }
      })
    } else {
      this.getUserRole()
    }
  },
  /**
@@ -81,6 +71,21 @@
   * 生命周期函数--监听页面显示
   */
  onShow() {
    // 检查登录状态
    const token = wx.getStorageSync(app.config.tokenKey)
    if (!token) {
      loginInfo(app, (data) => {
        if (data) {
          this.getUserRole()
        } else {
          wx.switchTab({
            url: '/pages/home/home',
          })
        }
      })
    } else {
      this.getUserRole()
    }
  },