litian
2024-08-30 122ca12cbb46a7fe9fc3489ad8310a6f3991fcfb
pages/digitalCourses/index.js
@@ -17,6 +17,7 @@
    tabList: [],
    courseList: [],
    searchValue: '',
    active: 0,
    activeItem: null,
    loading: false,
    shoppingCartGetId: []
@@ -34,6 +35,11 @@
      barHeight: systInfo.statusBarHeight,
      navBarHeight: navBarHeight,
    });
    if (options.courseTypeActive) {
      this.setData({
        active: JSON.parse(options.courseTypeActive),
      });
    }
    this.getCourseTypeListList()
    this.getShoppingCartList()
  },
@@ -96,7 +102,6 @@
    wx.navigateBack();
  },
  getCourseTypeListList() {
    this.setData({
      loading: true
    })
@@ -119,15 +124,19 @@
    app.MG.store.getStoreChannelList(data).then((res) => {
      // 去除数组最后一个元素
      const newData = res.datas.slice(0, res.datas.length - 1)
      this.setData({
        tabList: newData,
        activeItem: newData[0],
        loading: false
      })
      this.getCourseList(newData[0])
      if (this.data.active) {
        this.getCourseList(newData[this.data.active])
      } else {
        this.setData({
          activeItem: newData[0],
        })
        this.getCourseList(newData[0])
      }
    })
  },
@@ -184,7 +193,6 @@
      }
    }
    app.MG.store.getProductList(obj).then((res) => {
      console.log(res, '7895')
      res.datas.forEach(item => {
        item.price = item.price.toFixed(2)
      })
@@ -193,21 +201,15 @@
        courseList: res.datas
      })
      console.log(this.data.courseList);
    })
  },
  searchBook() {
    console.log(this.data.searchValue);
    this.getCourseList(this.data.activeItem)
  },
  courseDetail(e) {
    console.log(e);
    const item = e.currentTarget.dataset.item
    setNewView('productId', item.id)
    this.getCourseTypeListList()
    wx.navigateTo({
      url: '/pages/digitalCourses/digitalCoursesDetails/index?id=' + item.id,
    })