css
litian
2024-07-05 70f3d8c752ce474b224779cda054f8a6a7442872
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// pages/index/bookDetail.js
const app = getApp()
Page({
 
  /**
   * 页面的初始数据
   */
  data: {
    refcode: 0
  },
 
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    if (options.scene) {
      this.setData({
        refcode: options.scene,
      })
      this.getBookList()
    }
  },
 
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {
 
  },
  getBookList() {
    const obj = {
      storeInfo: app.config.jslx,
      path: "*",
      queryType: '*',
      coverSize: {
        width: 150
      },
      paging: {
        start: 0,
        size: 6
      },
      filterList: [{
        value: 'Normal',
        field: 'state'
      }],
      fields: {
        author: [],
        'RefCodes': [this.data.refcode]
      }
    }
    app.MG.store.getProductList(obj).then((res) => {
      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}`,
      });
    })
  },
 
  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {
 
  }
})