litian
2024-09-12 bbba5d26e9e26c910ed337dcb65f462752ee6dce
pages/digitalCourses/digitalCoursesDetails/index.js
@@ -224,9 +224,8 @@
  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {
  },
  onShareAppMessage() {},
  onShareTimeline() {},
  //获取视频学习
  getPlayerList() {
    app.MG.identity
@@ -310,22 +309,8 @@
      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 => {
          if (res.datas.subItems && res.datas.subItems.QueryCms.length > 0) {
            res.datas.subItems.QueryCms.forEach(item1 => {
              if (JSON.parse(item.Data.Value).items[0] == item1.id) {
                lecturer.push({
                  name: item1.name,
                  icon: item1.icon ? item1.icon : '',
                  description: item1.description ? item1.description : '',
                })
              }
            })
          }
        })
        this.getSpeaker(res.datas.datas.speaker)
      }
      if (this.data.bookPath) {
        this.getAboutBook(this.data.bookPath)
@@ -338,9 +323,66 @@
        '<img style="max-width:100%;height:auto;display:block;margin-top:0;margin-bottom:0;"'
      )
      this.setData({
        lecturerList: lecturer,
        digitalsData: res.datas,
        loading: false
      })
    })
  },
  //获取主讲人
  getSpeaker(list) {
    let query = {
      path: 'jsek_speaker',
      fields: {
        content: [],
        positionalTitle: []
      },
      coverSize: {
        height: 250
      }
    }
    app.MG.resource.getItem(query).then((res) => {
      let lecturerList = []
      if (list && res.datas.length > 0) {
        list.forEach((item) => {
          if (res.datas && res.datas.length > 0) {
            res.datas.forEach((item1) => {
              if (JSON.parse(item.Data.Value).items[0] == item1.id) {
                lecturerList.push({
                  name: item1.name,
                  positionalTitle: item1.positionalTitle,
                  icon: item1.icon,
                  description: item1.description ? item1.description : '暂无简介'
                })
              }
            })
          }
        })
        this.getPositionalTitle(lecturerList)
      }
    })
  },
  async getPositionalTitle(listStr) {
    let list = []
    let query = {
      refCodes: ['positionalTitle']
    }
    await app.MG.store.getProductTypeField(query).then((res) => {
      let option = JSON.parse(res[0].config).option
      listStr.forEach((unit) => {
        option.forEach((item) => {
          if (item.value == unit.positionalTitle) {
            unit.positionalName = item.name
          }
        })
        list.push({
          name: unit.name,
          positionalTitle: unit.positionalName,
          icon: unit.icon,
          description: unit.description ? unit.description : '暂无简介'
        })
      })
      this.setData({
        lecturerList: list
      })
    })
  },
@@ -1013,22 +1055,22 @@
  onCertificate() {
    if (!this.data.isBuy) {
      wx.showToast({
        title: "请先购买,体验完整服务",
        icon: "none",
        duration: 1000,
      });
      return false
    }
    if (!this.data.isLearn) {
      wx.showToast({
        title: "您的学习任务还未完成,暂不能申请证书,加油哦!",
        icon: "none",
        duration: 1000,
      });
      return false
    }
    // if (!this.data.isBuy) {
    //   wx.showToast({
    //     title: "请先购买,体验完整服务",
    //     icon: "none",
    //     duration: 1000,
    //   });
    //   return false
    // }
    // if (!this.data.isLearn) {
    //   wx.showToast({
    //     title: "您的学习任务还未完成,暂不能申请证书,加油哦!",
    //     icon: "none",
    //     duration: 1000,
    //   });
    //   return false
    // }
    if (this.data.isCertificate && this.data.isCertificate.state == 'WaitAudit') {
      wx.showToast({
        title: "您申请的证书正在审核中",
@@ -1120,6 +1162,10 @@
  },
  confirmM() {
    let currentDate = new Date()
    let year = currentDate.getFullYear()
    let month = currentDate.getMonth() + 1
    let today = currentDate.getDate()
    if (this.data.userInfo.fullName) {
      if (this.data.pictureMd5 == '') {
        wx.showToast({
@@ -1137,12 +1183,15 @@
        name: this.data.digitalsData.name,
        ISBN: this.data.digitalsData.isbn,
        affiliatedUnit: this.data.digitalsData.affiliatedUnit,
        publishingUnit: this.data.publishingUnit,
        publicationDate: this.data.digitalsData.publicationDate,
        classHours: this.data.digitalsData.classHours,
        lecturerList: this.data.lecturerList.length > 0 ?
          this.data.lecturerList[0].name : this.data.digitalsData.courseLeader,
        userName: this.data.userInfo.fullName,
        userPicture: this.data.pictureMd5,
        certificate: this.data.rzzsImg
        studyTime: this.data.digitalsData.beginDate + '-' + year + '-' + month + '-' + today,
        website: this.data.website
      }
      data = {
        topicIdOrRefCode: 'applyCourseCertificate',