yiming
2024-03-15 7231b5929a66bb1ec3b832be85f5e3f6ce40ad9f
pages/bookExhibitionList/index.js
@@ -29,7 +29,6 @@
      options: [
        {
          value: '*',
          label: '总分类',
        },
        {
@@ -50,15 +49,63 @@
          price: 'jsek_teacherEducation',
          label: '教师教育',
        },
      ],
    },
    multipleSelect: {
      value: [],
      options: [],
    },
    navBarHeight: '',
    barHeight: ''
  },
  /**
    * 生命周期函数--监听页面加载
    */
  onLoad(options) {
    // console.log(this.data.filteredItems, 88888);
    const systInfo = wx.getSystemInfoSync();
    const menu = wx.getMenuButtonBoundingClientRect(); // 胶囊信息
    const navBarHeight = (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 导航栏高度
    this.setData({
      navBarHeight: navBarHeight,
      barHeight: systInfo.statusBarHeight,
    })
    // 单列选择器选项
    const singleSelectOptions = this.data.filteredItems.map(item => ({
      label: item.name,
      value: item.value,
      disabled: false,
    }))
    if (this.data.filteredItems = []) {
      console.log(11111);
      singleSelectOptions.push({
        label: '禁用选项',
        value: 'disabled',
        disabled: true,
      });
    }
    // singleSelectOptions.push({
    //   label: '禁用选项',
    //   value: 'disabled',
    //   disabled: true,
    // });
    // 更新数据
    this.setData({
      'multipleSelect.options': singleSelectOptions,
    });
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
@@ -123,6 +170,8 @@
      });
      this.bookExhibitionGet(); // 调用方法加载更多数据
      console.log(1111);
    }
  },
@@ -153,6 +202,7 @@
      queryType: '*',
      fields: {
        jsek_link: [],
        subtitle: [],
        'bookClassification*': this.data.keynoteValue || [],
        ...searchObj
      },
@@ -162,7 +212,10 @@
      //   width: 100
      // },
    }).then(res => {
      res.datas.forEach((item) => {
        item.subtitleName = item.subtitle + item.name
      })
      console.log(res, 'item');
      this.data.total = res.total
      //  list.push(res.datas)
@@ -171,6 +224,7 @@
      this.setData({
        bookExhibitionList: list
      })
      //取消
      wx.hideLoading()
      // console.log(this.data.bookExhibitionList, '数据');
@@ -205,41 +259,6 @@
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    // console.log(this.data.filteredItems, 88888);
    // 单列选择器选项
    const singleSelectOptions = this.data.filteredItems.map(item => ({
      label: item.name,
      value: item.value,
      disabled: false,
    }))
    if (this.data.filteredItems = []) {
      console.log(11111);
      singleSelectOptions.push({
        label: '禁用选项',
        value: 'disabled',
        disabled: true,
      });
    }
    // singleSelectOptions.push({
    //   label: '禁用选项',
    //   value: 'disabled',
    //   disabled: true,
    // });
    // 更新数据
    this.setData({
      'multipleSelect.options': singleSelectOptions,
    });
  },
  // 总分类
@@ -326,7 +345,7 @@
    const item = event.currentTarget.dataset.item;
    console.log(item);
    wx.navigateTo({
      url: '/pages/bookExhibitionDetails/index?id=' + item.id // 假设跳转到详情页面,并传递了id参数
      url: '/pages/bookExhibitionDetails/index?id=' + item.id + '&bookName=' + item.name // 假设跳转到详情页面,并传递了id参数
    });
  },
  // 搜索框
@@ -336,5 +355,8 @@
    })
    console.log(this.data.keyword, 'keyword');
    this.bookExhibitionGet()
  }
  },
  goBack() {
    wx.navigateBack();
  },
})