litian
2024-03-05 42cc31916c043f681c271efeb73394260e7d77aa
pages/bookExhibitionList/index.js
@@ -8,6 +8,8 @@
   * 页面的初始数据
   */
  data: {
    value: '',
    keyword: '',
    nameSort: null,
    total: null,
    page: {
@@ -17,7 +19,6 @@
    keynoteValue: null,
    filteredItems: [],
    newValue: null,
    value: '',
    bookExhibitionList: [],
    sorter: {
      value: 'default',
@@ -138,7 +139,10 @@
    wx.showLoading({
      title: '加载中...',
    })
    let searchObj = {
      'Name*': this.data.keyword,
      '||subtitle*': this.data.keyword
    }
    // console.log(this.data.keynoteValue);
    let sort = {
      Name: this.data.nameSort || 'Desc'
@@ -149,7 +153,8 @@
      queryType: '*',
      fields: {
        jsek_link: [],
        'bookClassification*': this.data.keynoteValue || []
        'bookClassification*': this.data.keynoteValue || [],
        ...searchObj
      },
      paging: this.data.page,
      sort: sort,
@@ -290,13 +295,32 @@
  },
  onSwapRight() {
    // console.log('xxxxxx');
    this.data.nameSort = 'Asc'
    // this.data.nameSort = 'Asc'
    if (!this.data.nameSort) {
      this.setData({
        nameSort: 'Desc',
      });
    } else if (this.data.nameSort == 'Desc') {
      this.setData({
        nameSort: 'Asc',
      });
    } else if (this.data.nameSort == 'Asc') {
      this.setData({
        nameSort: '',
      });
    }
    this.bookExhibitionGet()
  },
  onSwapLeft() {
    this.data.nameSort = 'Desc'
    // console.log('sssssss');
    this.bookExhibitionGet()
  },
  onBookExhibitionDetails: function (event) {
    const item = event.currentTarget.dataset.item;
@@ -304,5 +328,13 @@
    wx.navigateTo({
      url: '/pages/bookExhibitionDetails/index?id=' + item.id // 假设跳转到详情页面,并传递了id参数
    });
  },
  // 搜索框
  onSearchSubmit(e) {
    this.setData({
      keyword: e.detail.value
    })
    console.log(this.data.keyword, 'keyword');
    this.bookExhibitionGet()
  }
})