| | |
| | | // pages/index/bindInfo/index.js |
| | | import { setSessionGuid } from "../../assets/js/userAction" |
| | | import { |
| | | setSessionGuid |
| | | } from "../../assets/js/userAction" |
| | | const app = getApp(); |
| | | Page({ |
| | | |
| | |
| | | if (res && res.status == "Ok") { |
| | | // 储存token |
| | | wx.setStorageSync(app.config.tokenKey, res.token); |
| | | // 记录登录统计 |
| | | setSessionGuid() |
| | | // 获取用户信息 |
| | | this.getUserInfo() |
| | | // 记录登录统计 |
| | | setSessionGuid() |
| | | } else { |
| | | wx.showToast({ |
| | | icon: "error", |
| | |
| | | }, |
| | | // 获取登录用户身份 |
| | | getUserInfo() { |
| | | let that = this; |
| | | app.MG.identity.getCurrentAppUser().then(res => { |
| | | // 用户信息优先级:教师认证 > 微信 > 学生(注册时默认) |
| | | if (res) { |
| | |
| | | } |
| | | 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 |
| | | }) |
| | | } |
| | | }); |
| | | }, |
| | | |