litian
2024-04-11 f00c1cca98455a036548672d28e7e8ad13729a21
pages/bindInfo/index.js
@@ -1,5 +1,7 @@
// pages/index/bindInfo/index.js
import { setSessionGuid } from "../../assets/js/userAction"
import {
  setSessionGuid
} from "../../assets/js/userAction"
const app = getApp();
Page({
@@ -56,10 +58,10 @@
              if (res && res.status == "Ok") {
                // 储存token
                wx.setStorageSync(app.config.tokenKey, res.token);
                // 记录登录统计
                setSessionGuid()
                // 获取用户信息
                this.getUserInfo()
                // 记录登录统计
                setSessionGuid()
              } else {
                wx.showToast({
                  icon: "error",
@@ -74,6 +76,7 @@
  },
  // 获取登录用户身份
  getUserInfo() {
    let that = this;
    app.MG.identity.getCurrentAppUser().then(res => {
      // 用户信息优先级:教师认证 > 微信 > 学生(注册时默认)
      if (res) {
@@ -93,9 +96,15 @@
        }
        wx.setStorageSync(app.config.userInfoKey, JSON.stringify(defaultUser));
      }
      wx.switchTab({
        url: this.data.redirectPage ? this.data.redirectPage : '/pages/home/home'
      })
      if (that.data.redirectPage == "" || that.data.redirectPage == "/pages/home/home" || that.data.redirectPage == "/pages/bookServices/assort/index" || that.data.redirectPage == "/pages/study/index" || that.data.redirectPage == "/pages/cart/index" || that.data.redirectPage == "/pages/personalCenter/index") {
        wx.switchTab({
          url: that.data.redirectPage != "" ? that.data.redirectPage : '/pages/home/home'
        })
      } else {
        wx.navigateTo({
          url: that.data.redirectPage
        })
      }
    });
  },