| | |
| | | // pages/index/bookDetail.js |
| | | const app = getApp() |
| | | import { |
| | | loginInfo |
| | | } from '../../assets/js/login'; |
| | | Page({ |
| | | |
| | | /** |
| | |
| | | * 生命周期函数--监听页面加载 |
| | | */ |
| | | onLoad(options) { |
| | | if (options.scene) { |
| | | this.setData({ |
| | | refcode: options.scene, |
| | | const token = wx.getStorageSync(app.config.tokenKey) |
| | | if (!token) { |
| | | loginInfo(app, (data) => { |
| | | // 如果不是第一次登录,会执行回调 |
| | | if (data) { |
| | | if (options.scene) { |
| | | this.setData({ |
| | | refcode: options.scene, |
| | | }) |
| | | this.getBookList() |
| | | } |
| | | } |
| | | }) |
| | | this.getBookList() |
| | | } else { |
| | | if (options.scene) { |
| | | this.setData({ |
| | | refcode: options.scene, |
| | | }) |
| | | this.getBookList() |
| | | } |
| | | } |
| | | |
| | | }, |
| | | |
| | | /** |