yiming
2024-04-28 9ba507bed7688a1a9eee31255e40add8bf1a8689
pages/bookExhibitionList/index.js
@@ -78,6 +78,7 @@
        },
      ],
    },
    newValue: ''
  },
@@ -86,7 +87,7 @@
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    console.log(this.data.multipleSelect.options.length, '44444');
    // this.setData({
    //   'product.value': '*',
    // });
@@ -99,11 +100,11 @@
    })
    watch.setWatcher(this);
    let that = this;
    setTimeout(function () {
      that.data.name = "测试watch变化了"
    }, 5000)
    // watch.setWatcher(this);
    // let that = this;
    // setTimeout(function () {
    //   that.data.name = "测试watch变化了"
    // }, 5000)
    // 
  },
  watch: {
@@ -129,7 +130,7 @@
    // debugger
    this.bookExhibitionGet()
    // this.keyProjectsGet(this.data.newPrice)
    this.keyProjectsGet(this.data.newPrice)
  },
@@ -187,7 +188,6 @@
  onReachBottom() {
    if (this.data.page.size >= this.data.total) {
      Toast({
        context: this,
        selector: '#t-toast',
@@ -197,10 +197,6 @@
        preventScrollThrough: true,
        icon: 'poweroff',
      });
    } else {
      // const currentPage = this.data.page.start + 1; // 获取当前页数并加1
      const newSize = this.data.page.size + 10; // 原来的基础上加10
@@ -209,9 +205,6 @@
        'page.size': newSize
      });
      // this.bookExhibitionGet(); // 调用方法加载更多数据
    }
  },
@@ -259,7 +252,7 @@
    app.MG.store.getProductList({
      storeInfo: 'jsek_bookFair',
      path: newValue,
      path: this.data.newValue,
      queryType: '*',
      fields: {
        jsek_link: [],
@@ -316,50 +309,95 @@
  },
  //重点项目接口
  keyProjectsGet(newPrice) {
  keyProjectsGet() {
    // debugger
    if (this.data.multipleSelect.options.length !== 0) {
      console.log('张一鸣');
      this.setData({
        'multipleSelect.options': [],
      });
    }
    //骨架屏
    this.setData({
      loading: true,
      hidden: true,
    })
    // 参数
    let parms = {
      refCodes: ['bookClassification']
    }
    //请求数据
    app.MG.store.getProductTypeField(parms).then(res => {
      // 格式化数据
      const checkData = JSON.parse(res[0].config)
      console.log(checkData);
      // 循环然后判断相匹配的数据赋值给filteredItems
      checkData.option.forEach(item => {
        if (newPrice == item.value) {
        if (this.data.newPrice == item.value) {
          if (this.data.filteredItems.length !== 0) {
            this.setData({
              filteredItems: [] // 如果存在子项则赋值,否则赋值为空数组
            });
          }
          this.setData({
            filteredItems: item.child || [] // 如果存在子项则赋值,否则赋值为空数组
          });
        }
      })
      this.setData({
        'multipleSelect.options': [],
      });
      const singleSelectOptions = []
      console.log(this.data.multipleSelect.options, 'multipleSelect.options');
      console.log(singleSelectOptions, 'singleSelectOptions');
      // 单列选择器选项
      const singleSelectOptions = this.data.filteredItems.map(item => ({
      // 单列选择器选项
      this.data.filteredItems.forEach(item => {
        singleSelectOptions.push({
        label: item.name,
        value: item.value,
      }))
        });
      });
      if (singleSelectOptions.length === 0) {
        singleSelectOptions.push({
          label: '暂无数据',
        });
      }
      // 更新数据
      this.setData({
        'multipleSelect.options': singleSelectOptions,
      });
      // 取消骨架屏
      this.setData({
        loading: false,
        hidden: false,
      })
    })
    if (newPrice) {
      this.setData({
        keynoteDisabled: false
      })
    }
    if (!newPrice) {
      this.setData({
        keynoteDisabled: true
      })
    }
    // if (newPrice) {
    //   this.setData({
    //     keynoteDisabled: false
    //   })
    // }
    // if (!newPrice) {
    //   this.setData({
    //     keynoteDisabled: true
    //   })
    // }
  },
@@ -369,25 +407,19 @@
  // 总分类
  onChange(e) {
    // this.data.page.size = 16 //更改显示的值
    this.setData({
      'multipleSelect.options': [],
    });
    console.log(this.data.multipleSelect.options);
    const newValue = e.detail.value;
    console.log(newValue);
    this.setData({
      'product.value': newValue,
      newValue: newValue
    });
    // debugger
    // let newPrice = ''
    if (newValue == 'jsek_bFHigherEducation') {
      this.setData({
        newPrice: 'jsek_higherEducation'
      })
@@ -400,22 +432,15 @@
        newPrice: 'jsek_teacherEducation'
      })
    }
    this.bookExhibitionGet(newValue);
    this.keyProjectsGet(this.data.newPrice)
    this.bookExhibitionGet(newValue);
    if (this.data.keynoteValue) {
      //如果有数据就清空并刷新页面
      this.data.keynoteValue = []
      this.bookExhibitionGet(newValue)
    }
    this.onLoad()
  },
  // 重点项目
@@ -437,7 +462,6 @@
  handleReset(e) {
    // 重置操作的处理逻辑
    this.data.keynoteValue = []
    this.bookExhibitionGet()