闫增涛
2024-03-29 1e9c2bd06ab6851ed85b883c62cb7d74e012e2b2
packageBookService/pages/bookServices/list/index.js
@@ -53,6 +53,7 @@
    loading: false,
    noData: false,
    showDropdown: false,
    isRequesting: false,
  },
  /**
   * 生命周期函数--监听页面加载
@@ -143,11 +144,13 @@
  onReachBottom(e) {
    const flag = this.data.bookList.length < this.data.pageCount.total
    if (flag) {
      this.setData({
        isMore: true,
        "pageCount.page": this.data.pageCount.page + 1
      })
      this.getBookList(this.data.path)
      if (!this.data.isRequesting) {
        this.setData({
          isMore: true,
          "pageCount.page": this.data.pageCount.page + 1
        })
        this.getBookList(this.data.path)
      }
    } else {
      this.setData({
        isMore: true,
@@ -243,7 +246,7 @@
      refCodes: [type],
    };
    app.MG.store.getProductTypeField(query).then((res) => {
      array = JSON.parse(res[0].config).option;
      array = JSON.parse(res[0].config).option.filter(item => item.value == this.data.assortCheck.code);
      for (let index = 0; index < array.length; index++) {
        const element = array[index];
        if (element.child) {
@@ -281,9 +284,13 @@
  },
  // 获取图书列表
  getBookList(path) {
    if (this.data.isRequesting) {
      return false;
    }
    this.setData({
      loading: true,
      noData: false
      noData: false,
      isRequesting: true
    })
    let sort;
    let pathObj = {};
@@ -342,12 +349,23 @@
        bookList: res.datas,
        enable: false,
        "pageCount.total": res.total,
        loading: false
        loading: false,
        isRequesting: false
      });
      if (!res.datas.length) {
        this.setData({
          noData: true,
        })
        if (!this.data.pathList.length) {
          // 未选择二级分类,且无图书
          this.setData({
            disabledSecondList: true
          })
        } else {
          this.setData({
            disabledSecondList: false
          })
        }
      }
    });
  },