| | |
| | | // pages/test/testCover.js |
| | | const app = getApp() |
| | | import { |
| | | loginInfo |
| | | } from '../../assets/js/login'; |
| | | Page({ |
| | | |
| | | /** |
| | |
| | | * 生命周期函数--监听页面加载 |
| | | */ |
| | | onLoad(options) { |
| | | if (options.scene) { |
| | | this.getBookInfo(options.scene) |
| | | const token = wx.getStorageSync(app.config.tokenKey) |
| | | if (!token) { |
| | | loginInfo(app, (data) => { |
| | | // 如果不是第一次登录,会执行回调 |
| | | if (data) { |
| | | // 登录成功,自动记录token和用户信息,并返回true |
| | | if (options.scene) { |
| | | this.getBookInfo(options.scene) |
| | | } |
| | | } |
| | | }) |
| | | } else { |
| | | // 如果是第一次登录,会跳转至绑定用户信息页面,填写完用户信息后进行登录并储存token和用户信息,结束后跳转回当前页面(携带页面参数) |
| | | if (options.scene) { |
| | | this.getBookInfo(options.scene) |
| | | } |
| | | } |
| | | |
| | | |
| | | }, |
| | | |
| | |
| | | this.data.rootCmsItemId |
| | | }&idPathList=${JSON.stringify(idPathList)}&answerTitle=${ |
| | | this.data.answerTitle |
| | | }&answerType=${"option"}&storeInfo=${book.storeInfo}`, |
| | | }&answerType=${"option"}`, |
| | | }); |
| | | }) |
| | | }, |