litian
2024-07-10 81c23f9c2f5bdfbe962d0b19a5a80ea7c12f043d
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)
      }
    }
  },
@@ -82,7 +100,7 @@
          this.data.rootCmsItemId
        }&idPathList=${JSON.stringify(idPathList)}&answerTitle=${
          this.data.answerTitle
        }&answerType=${"option"}&storeInfo=${book.storeInfo}`,
        }&answerType=${"option"}`,
      });
    })
  },