| | |
| | | |
| | | // 检查登录状态 |
| | | const token = wx.getStorageSync(app.config.tokenKey) |
| | | if (!token) { |
| | | loginInfo(app, (data) => { |
| | | if (data) { |
| | | that.setData({ |
| | | userInfo: JSON.parse(wx.getStorageSync(app.config.userInfoKey)) |
| | | }) |
| | | that.getAlreadyPBookList() |
| | | that.getAlreadyEBookList() |
| | | // 获取申请次数 |
| | | that.getSelectPaperBookCount() |
| | | that.getSelectBookCount() |
| | | |
| | | } |
| | | }) |
| | | } else { |
| | | if (token) { |
| | | that.setData({ |
| | | userInfo: JSON.parse(wx.getStorageSync(app.config.userInfoKey)) |
| | | }) |
| | |
| | | */ |
| | | onShow() { |
| | | let that = this; |
| | | // that.setData({ |
| | | // page: 1, |
| | | // paperBookList: [], |
| | | // electronicBookList: [] |
| | | // }) |
| | | that.getAlreadyPBookList() |
| | | that.getAlreadyEBookList() |
| | | // 获取申请次数 |
| | | that.getSelectPaperBookCount() |
| | | that.getSelectBookCount() |
| | | const token = wx.getStorageSync(app.config.tokenKey) |
| | | if (!token) { |
| | | loginInfo(app, (data) => { |
| | | if (data) { |
| | | that.setData({ |
| | | userInfo: JSON.parse(wx.getStorageSync(app.config.userInfoKey)) |
| | | }) |
| | | that.getAlreadyPBookList() |
| | | that.getAlreadyEBookList() |
| | | that.getSelectPaperBookCount() |
| | | that.getSelectBookCount() |
| | | } else { |
| | | wx.switchTab({ |
| | | url: '/pages/home/home', |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | if (wx.getStorageSync("paperBookList") || wx.getStorageSync("electronicBookList")) { |
| | | if (wx.getStorageSync("paperBookList")) { |
| | | that.setData({ |