yiming
2024-04-19 338ad19ee45b5380a0d8433cbbce2a727a576dfa
pages/bookExhibitionList/index.js
@@ -91,8 +91,7 @@
   */
  onLoad(options) {
    console.log(this.data.keynoteDisabled, 'keynoteDisabled');
    // console.log(this.data.filteredItems, 88888);
    const systInfo = wx.getSystemInfoSync();
    const menu = wx.getMenuButtonBoundingClientRect(); // 胶囊信息
    const navBarHeight = (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 导航栏高度
@@ -109,7 +108,7 @@
    }))
    if (this.data.filteredItems = []) {
      console.log(11111);
      // singleSelectOptions.push({
      //   label: '暂无数据',
      //   value: 'disabled',
@@ -123,7 +122,7 @@
    console.log(this.data.bookExhibitionList.length, 'this.data.bookExhibitionList.length');
    // 更新数据
    this.setData({
      'multipleSelect.options': singleSelectOptions,
@@ -175,9 +174,7 @@
  // },
  onScrollToLower() {
    console.log(789);
    console.log(this.data.bookExhibitionList.length);
    console.log(this.data.totalSize);
    if (this.data.bookExhibitionList.length < this.data.totalSize) {
      this.setData({
        isMore: true,
@@ -192,7 +189,7 @@
        this.setData({
          isMore: false
        })
        console.log('300');
      }, 300)
    }
  },
@@ -200,10 +197,9 @@
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {
    // console.log(this.data.page.size);
    // console.log(this.data.total);
    if (this.data.page.size >= this.data.total) {
      console.log('已加载完所有数据');
      Toast({
        context: this,
        selector: '#t-toast',
@@ -244,7 +240,7 @@
      'Name*': this.data.keyword,
      '||subtitle*': this.data.keyword
    }
    // console.log(this.data.keynoteValue);
    let sort = {};
    const sortOptions = {
@@ -267,7 +263,7 @@
    sort = sortOptions[this.data.product.value] || {};
    console.log(sort);
    app.MG.store.getProductList({
      storeInfo: 'jsek_bookFair',
@@ -294,11 +290,11 @@
        }
        item.subtitleName = item.subtitle + item.name
      })
      console.log(res, 'item');
      this.data.total = res.total
      // list.push(res.datas)
      console.log(res.datas.length);
      if (res.datas.length == 0) {
@@ -308,18 +304,17 @@
      }
      const list = [...res.datas]
      console.log(res);
      this.setData({
        bookExhibitionList: list,
        totalSize: res.total
      })
      // 判断数据长度
      console.log(list.length, 'list.length');
      //取消
      wx.hideLoading()
      // console.log(this.data.bookExhibitionList, '数据');
      this.setData({
        loading: false,
@@ -335,7 +330,7 @@
      loading: true,
      hidden: true,
    })
    // console.log(newPrice, 'newPrice');
    let parms = {
      refCodes: ['bookClassification']
    }
@@ -346,7 +341,7 @@
          this.setData({
            filteredItems: item.child || [] // 如果存在子项则赋值,否则赋值为空数组
          });
          // console.log(this.data.filteredItems);
        }
      })
@@ -365,28 +360,17 @@
  // 总分类
  // 总分类
  onChange(e) {
    // e.stopImmediatePropagation();
    this.data.page.size = 16 //更改显示的值
    const newValue = e.detail.value;
    const selectedOption = this.data.product.options.find(option => option.value === newValue);
    const newPrice = selectedOption ? selectedOption.price : null;
    const bookExhibitionListsubsidiary = []
    this.setData({
      bookExhibitionListsubsidiary: this.data.bookExhibitionList
    })
    console.log(bookExhibitionListsubsidiary, 'bookExhibitionListsubsidiary');
    console.log(newValue, 'newValue');
    console.log(newPrice, 'newPrice');
    // const bookExhibitionListsubsidiary = []
    // this.setData({
    //   bookExhibitionListsubsidiary: this.data.bookExhibitionList
    // })
    if (newPrice) {
      this.setData({
@@ -398,7 +382,7 @@
        keynoteDisabled: true
      })
    }
    console.log(newValue);
    this.setData({
      'product.value': newValue,
      'product.price': newPrice, // 将选中的 price 值保存在数据中
@@ -413,6 +397,12 @@
      this.bookExhibitionGet(newValue)
      this.onLoad()
    }
    // e.stopImmediatePropagation()
  },
@@ -429,7 +419,7 @@
    } = event.detail;
    // 确认操作的处理逻辑
    console.log('确认操作,选中的值为:', value);
    this.data.keynoteValue = value
    this.bookExhibitionGet()
  },
@@ -461,13 +451,12 @@
  },
  onSwapLeft() {
    this.data.nameSort = 'Desc'
    // console.log('sssssss');
    this.bookExhibitionGet()
  },
  onBookExhibitionDetails: function (event) {
    console.log(456);
    const item = event.currentTarget.dataset.item;
    console.log(item);
    wx.navigateTo({
      url: '/pages/bookExhibitionDetails/index?id=' + item.id + '&bookName=' + item.name + '&subtitleName=' + item.subtitleName // 假设跳转到详情页面,并传递了id参数
    });
@@ -478,7 +467,7 @@
    this.setData({
      keyword: e.detail.value
    })
    console.log(this.data.keyword, 'keyword');
    this.bookExhibitionGet()
  },
  goBack() {
@@ -488,10 +477,10 @@
    this.setData({
      'product.value': e.detail.value,
    });
    console.log(e.detail.value, 'e.detail.value');
    this.bookExhibitionGet()
  },
  onOpend() {
    console.log(7555);
  }
})