yiming
2024-04-28 1845fc66deb7676c7cf8a1b73ac1f72517557861
pages/bookExhibitionList/index.js
@@ -78,6 +78,7 @@
        },
      ],
    },
    newValue: ''
  },
@@ -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: {
@@ -126,10 +127,10 @@
   * 生命周期函数--监听页面显示
   */
  onShow() {
    // 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: [],
@@ -318,48 +311,81 @@
  //重点项目接口
  keyProjectsGet(newPrice) {
    this.setData({
      filteredItems: [] // 如果存在子项则赋值,否则赋值为空数组
    });
    //骨架屏
    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) {
          this.setData({
            filteredItems: item.child || [] // 如果存在子项则赋值,否则赋值为空数组
          });
        }
      })
      let singleSelectOptions = []
      // 单列选择器选项
      const singleSelectOptions = this.data.filteredItems.map(item => ({
        label: item.name,
        value: item.value,
      }))
      // 单列选择器选项
      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
    //   })
    // }
  },
@@ -371,51 +397,41 @@
    // this.data.page.size = 16 //更改显示的值
    const newValue = e.detail.value;
    this.setData({
      'product.value': newValue,
      newValue: newValue
    });
    // debugger
    // let newPrice = ''
    let newPrice = ''
    if (newValue == 'jsek_bFHigherEducation') {
      this.setData({
        newPrice: 'jsek_higherEducation'
      })
      newPrice = 'jsek_higherEducation'
      // this.setData({
      //   newPrice: 'jsek_higherEducation'
      // })
    } else if (newValue == 'jsek_bFVocationalEducation') {
      this.setData({
        newPrice: 'jsek_vocationalEducation'
      })
      // this.setData({
      //   newPrice: 'jsek_vocationalEducation'
      // })
      newPrice = 'jsek_vocationalEducation'
    } else if (newValue == 'jsek_bFTeacherEducation') {
      this.setData({
        newPrice: 'jsek_teacherEducation'
      })
      // this.setData({
      //   newPrice: 'jsek_teacherEducation'
      // })
      newPrice = 'jsek_teacherEducation'
    } else {
      newPrice = ''
    }
    this.keyProjectsGet(newPrice)
    this.bookExhibitionGet(newValue);
    this.keyProjectsGet(this.data.newPrice)
    if (this.data.keynoteValue) {
      //如果有数据就清空并刷新页面
      this.data.keynoteValue = []
      this.bookExhibitionGet(newValue)
    }
    this.onLoad()
  },
  // 重点项目
@@ -437,7 +453,6 @@
  handleReset(e) {
    // 重置操作的处理逻辑
    this.data.keynoteValue = []
    this.bookExhibitionGet()