litian
2024-08-27 f4a2f400fdc999946e75a4322fe1ceb6e528c169
pages/digitalCourses/digitalCoursesDetails/index.js
@@ -81,7 +81,8 @@
    isTest: false,
    userInfo: {
      fullName: '' //名称
    }
    },
    publishingUnit: ''
  },
  formatDate(dateString) {
    if (!dateString) {
@@ -244,7 +245,7 @@
        //epub试读百分比
      }
    }
    app.MG.store.getProductDetail(query).then(res => {
    app.MG.store.getProductDetail(query).then(async res => {
      console.log(res);
      if (res.datas.purchasedSaleMethodIdList.includes(res.datas.defaultSaleMethodId)) {
        this.setData({
@@ -266,12 +267,15 @@
          expire: res.false
        })
      }
      res.datas.publicationDate = this.formatDate(res.datas.publicationDate)
      res.datas.publicationDate = moment(res.datas.publicationDate).format('YYYY年MM月DD日')
      res.datas.price = res.datas.price.toFixed(2)
      wx.setNavigationBarTitle({
        title: res.datas.name,
      })
      if (res.datas.publishingUnit) {
        await this.getBookPublishUnit(res.datas.publishingUnit)
      }
      let lecturer = []
      if (res.datas.datas.speaker && res.datas.datas.speaker.length > 0) {
        res.datas.datas.speaker.forEach(item => {
@@ -297,6 +301,29 @@
      })
    })
  },
  //获取图书出版单位
  async getBookPublishUnit(listStr) {
    let query = {
      refCodes: ['publishingUnit']
    }
    await app.MG.store.getProductTypeField(query).then((res) => {
      const list = JSON.parse(listStr)
      let dataList = []
      list.forEach((unit) => {
        JSON.parse(res[0].config).option.forEach((item) => {
          if (item.value == unit) {
            dataList.push(item.name)
          }
        })
      })
      if (dataList.length == list.length) {
        this.setData({
          publishingUnit: dataList.join('  '),
        })
      }
    })
  },
  onTabsChange(event) {
    const value = event.detail.value
    this.setData({