闫增涛
2025-03-31 04c7b0163caeae4ab1c5da62e301fa993101cfad
pages/test/testCover.js
@@ -1,5 +1,8 @@
// pages/test/testCover.js
const app = getApp()
import {
  loginInfo
} from '../../assets/js/login';
Page({
  /**
@@ -18,9 +21,24 @@
   * 生命周期函数--监听页面加载
   */
  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)
      }
    }
  },
@@ -78,11 +96,11 @@
      wx.redirectTo({
        url: `/packageBookService/pages/bookServices/examination/examination?bookId=${
          this.data.bookId
        }&productLinkPath=${this.data.productLinkPath}& =${
        }&productLinkPath=${this.data.productLinkPath}&rootCmsItemId=${
          this.data.rootCmsItemId
        }&idPathList=${JSON.stringify(idPathList)}&answerTitle=${
          this.data.answerTitle
        }&answerType=${"option"}&storeInfo=${book.storeInfo}`,
        }&answerType=${"option"}`,
      });
    })
  },