闫增涛
2024-09-18 c96612e8a63ecef9590be0f8b5199277ec94e5b9
pages/digitalCourses/index.js
@@ -20,6 +20,8 @@
    active: 0,
    activeItem: null,
    loading: false,
    contentLoading: false,
    noData:false,
    shoppingCartGetId: [],
    sorter: {
      value: "*",
@@ -46,7 +48,6 @@
      ],
    },
    sortActive: '',
    otherType: null
  },
  /**
@@ -120,6 +121,9 @@
  },
  onTabsChange(event) {
    const value = event.detail.value
    this.setData({
      contentLoading: true
    })
    this.getCourseList(this.data.tabList[value])
  },
@@ -129,7 +133,7 @@
  },
  getCourseTypeListList() {
    this.setData({
      loading: true
      loading: true,
    })
    const data = {
      path: '*',
@@ -148,10 +152,6 @@
      }
    }
    app.MG.store.getStoreChannelList(data).then((res) => {
      // 去除数组最后一个元素
      // 找出其他分类的path,用于排除其他分类里的数据
      this.data.otherType = res.datas.find(item => item.refCode == "jsek_dCOther")
      res.datas = res.datas.filter(item => item.state == 'Normal')
      const newData = res.datas.slice(0, res.datas.length - 1)
      newData.unshift({
        name: "全部",
@@ -181,8 +181,8 @@
    if (this.data.searchValue) {
      searchObj = {
        'Name*': this.data.searchValue.trim(),
        '||isbn*': searchInputValue.value.trim(),
        '||courseLeader*': searchInputValue.value.trim()
        '||isbn*': this.data.searchValue.trim(),
        '||courseLeader*': this.data.searchValue.trim()
      }
    }
@@ -231,13 +231,20 @@
      }
    }
    app.MG.store.getProductList(obj).then((res) => {
      if(!res.datas.length) {
        return this.setData({
          noData:true,
          contentLoading:false
        })
      }
      res.datas.forEach(item => {
        item.price = item.price.toFixed(2)
        item.productLinkInfo = JSON.parse(item.productLinkInfo)
      })
      // 排除其他分类里的数据
      this.setData({
        courseList: res.datas.filter(item => item.productLinkInfo[0].LinkPath != this.data.otherType.pathList[0] + '\\' + this.data.otherType.id)
        courseList: res.datas,
        contentLoading: false,
      })
    })
  },
@@ -248,7 +255,6 @@
    this.setData({
      "sortActive": e.detail.value,
    });
    console.log(e)
    this.getCourseList(this.data.activeItem);
  },
  courseDetail(e) {
@@ -256,7 +262,7 @@
    setNewView('productId', item.id)
    this.getCourseTypeListList()
    wx.navigateTo({
      url: '/pages/digitalCourses/digitalCoursesDetails/index?id=' + item.id,
      url: '/pages/digitalCourses/digitalCoursesDetails/index?id=' + item.id + '&path=' + item.idPath
    })
  },