litian
2024-07-10 81c23f9c2f5bdfbe962d0b19a5a80ea7c12f043d
pages/index/bookDetail.js
@@ -1,5 +1,8 @@
// pages/index/bookDetail.js
const app = getApp()
import {
  loginInfo
} from '../../assets/js/login';
Page({
  /**
@@ -13,12 +16,28 @@
   * 生命周期函数--监听页面加载
   */
  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()
      }
    }
  },
  /**
@@ -29,7 +48,7 @@
  },
  getBookList() {
    const obj = {
      storeInfo: app.config.jslx,
      // storeInfo: app.config.jslx,
      path: "*",
      queryType: '*',
      coverSize: {
@@ -52,7 +71,7 @@
      console.log(res.datas, '图书信息')
      let book = res.datas[0]
      wx.redirectTo({
        url: `/packageBookService/pages/bookServices/detail/index?id=${book.id}&name=${book.name}&storeInfo=${app.config.jslx}`,
        url: `/packageBookService/pages/bookServices/detail/index?id=${book.id}&name=${book.name}`,
      });
    })
  },