url
litian
2024-07-11 f16f827b03d7b148e6ea4a52b66d14c577f1d0ca
pages/index/bookDetail.js
@@ -1,5 +1,10 @@
// pages/index/bookDetail.js
import request from '../../assets/request/index'
const app = getApp()
import {
  loginInfo
} from '../../assets/js/login';
Page({
  /**
@@ -44,31 +49,45 @@
  },
  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]
      }
    let url = '/store/api/ApiQueryProductByAppUser'
    let fields = {
      Name: [],
      'RefCodes': [this.data.refcode]
    }
    app.MG.store.getProductList(obj).then((res) => {
      console.log(res.datas, '图书信息')
      let book = res.datas[0]
    let queryBook = {
      AccessControl: {
        Path: '*',
        StoreRefCode: `defaultGoodsStore${app.config.appId}`,
        Type: '*',
        LinkType: ''
      },
      PageQuery: {
        Start: 0,
        Size: 3,
      },
      SortQuery: [{
        LinkOrder: 'Desc'
      }],
      Name: [],
      RefCode: [],
      ...fields
    }
    let body = {
      query: JSON.stringify({
        Query: [{
          queryBook: queryBook
        }]
      })
    }
    request({
      url: url,
      method: 'post',
      data: body
    }).then((res) => {
      console.log(res[0], 'resp');
      let book = res[0].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.datas.Name}`,
      });
    })
  },