| | |
| | | import userservice from '../../../service/userservice' |
| | | import moment from '../../../utils/moment.min' |
| | | |
| | | const app = getApp() |
| | | |
| | |
| | | app.globalData.accessToken = res.data |
| | | app.globalData.accessToken.userId = data.userId |
| | | app.globalData.accessToken.suserId = data.suserId |
| | | app.globalData.accessToken.openId = data.openId |
| | | if (accessTokenPW.userName) { |
| | | app.globalData.accessToken.userName = accessTokenPW.userName |
| | | } |
| | |
| | | password: accessTokenPW.password, |
| | | userId: data.userId, |
| | | suserId: data.suserId, |
| | | openId: data.openId |
| | | } |
| | | wx.setStorage({ |
| | | key: 'accessToken', |
| | |
| | | that.gotoHomePage() |
| | | } |
| | | }) |
| | | |
| | | |
| | | } else { |
| | | that._onLoginFail() |
| | | } |
| | |
| | | gotoHomePage() { |
| | | userservice.getUserInfo(app.globalData.accessToken.userId, { |
| | | success(data) { |
| | | if (data.uiCreateTime) { |
| | | const registerTime = moment(data.uiCreateTime) |
| | | const now = moment() |
| | | const m1 = now.month() |
| | | const m2 = registerTime.month() |
| | | app.globalData.newUser = m1 <= m2 |
| | | } |
| | | console.log(app.globalData.newUser); |
| | | |
| | | app.globalData.userInfo = data |
| | | app.globalData.isLogin = true |
| | | wx.setStorage({ |