| | |
| | | if (WindowInfo.safeArea.top > 20) { |
| | | this.globalData.bottomLift = WindowInfo.screenHeight - WindowInfo.safeArea.bottom; |
| | | } |
| | | // |
| | | return |
| | | const res = wx.getStorageSync('member') |
| | | if (res) { |
| | | this.globalData.userInfo = res |
| | | console.error("res",res) |
| | | } else { |
| | | // 登录 |
| | | wx.login({ |
| | |
| | | code: res.code |
| | | }).then(res => { |
| | | console.log(res) |
| | | if (res && res.data.member) { |
| | | wx.setStorageSync('member', res.data.member) |
| | | wx.setStorageSync('openid', res.data.member.openid) |
| | | if (res && res.data.users) { |
| | | wx.setStorageSync('member', res.data.users) |
| | | wx.setStorageSync('openid', res.data.users.openid) |
| | | wx.setStorageSync('sessionKey', res.data.sessionKey) |
| | | wx.setStorageSync('token', res.data.token) |
| | | } else { |
| | | wx.navigateTo({ |
| | | url: '/pages/login/index', |
| | | }) |
| | | console.log('登录失败!') |
| | | } |
| | | }) |
| | | } else { |
| | | wx.navigateTo({ |
| | | url: '/pages/login/index', |
| | | }) |
| | | console.log('登录失败!' + res) |
| | | } |
| | | }, |