闫增涛
2024-04-02 aef06b129be7a3a12ac097db8e372b0cb33c6c42
packageBookService/pages/bookServices/detail/index.js
@@ -1010,45 +1010,49 @@
    wx.showLoading({
      title: '加载中',
    })
    // let role = userStore.userInfo ? userStore.userInfo.role : null
    // if (role) {
    //   if (role == 'Teacher') {
    // 申请教学资源
    let query = {
      topicIdOrRefCode: 'productDownLoad',
      type: 'applyForDownload',
      state: 'WaitAudit',
      cmsTypeRefCode: '',
      newDataListRequest: [],
      name: this.data.bookDetail.name, // name为申请的书本名称
      content: JSON.stringify([{
        name: this.data.bookDetail.name,
        id: this.data.bookDetail.id,
        // defaultSaleMethodId: bookData.value.defaultSaleMethodId,
        icon: this.data.bookDetail.icon
      }])
    }
    app.MG.ugc.newTopicMessage(query).then(async (res) => {
      if (res) {
        wx.showToast({
          title: '申请已提交',
          duration: 2000,
    let role = wx.getStorageSync(app.config.userInfoKey).role
    if (role) {
      debugger
      if (role == 'Teacher') {
        // 申请教学资源
        let query = {
          topicIdOrRefCode: 'productDownLoad',
          type: 'applyForDownload',
          state: 'WaitAudit',
          cmsTypeRefCode: '',
          newDataListRequest: [],
          name: this.data.bookDetail.name, // name为申请的书本名称
          content: JSON.stringify([{
            name: this.data.bookDetail.name,
            id: this.data.bookDetail.id,
            // defaultSaleMethodId: bookData.value.defaultSaleMethodId,
            icon: this.data.bookDetail.icon
          }])
        }
        app.MG.ugc.newTopicMessage(query).then(async (res) => {
          if (res) {
            wx.showToast({
              title: '申请已提交',
              duration: 2000,
            })
          }
          await this.getApplyInfo(this.data.bookDetail.id)
        })
      } else {
        wx.showModal({
          title: '尊敬的用户,您好!',
          content: '请先进行教师认证!',
          complete: (res) => {
            if (res.cancel) {}
            if (res.confirm) {
              wx.navigateTo({
                url: '/packageDomain/pages/teacherCertification/index',
              })
            }
          }
        })
      }
      await this.getApplyInfo(this.data.bookDetail.id)
    })
    //   } else {
    //     ElMessageBox.confirm('请先进行教师认证!', '尊敬的用户,您好!', {
    //       confirmButtonText: '去认证',
    //       cancelButtonText: '取消',
    //       type: 'warning'
    //     })
    //       .then(() => {
    //         isShow.value = true
    //       })
    //       .catch(() => { })
    //   }
    // }
    }
  },
  // 教学资源下载前往PC提示Diialog
  closeTeachDownload() {
@@ -1058,10 +1062,27 @@
  },
  // 下载功能
  downloadTeach(e) {
    this.setData({
      isShowTeachDownload: true
    })
    console.log('zhuan', this.data.isShowTeachDownload);
    let role = JSON.parse(wx.getStorageSync(app.config.userInfoKey)).role
    if (role && role == 'Teacher') {
      this.setData({
        isShowTeachDownload: true
      })
    } else {
      wx.showModal({
        title: '尊敬的用户,您好!',
        content: '请先进行教师认证!',
        complete: (res) => {
          if (res.cancel) {
          }
          if (res.confirm) {
            wx.navigateTo({
              url: '/packageDomain/pages/teacherCertification/index',
            })
          }
        }
      })
    }
    //   const data = e.detail.value
    //   // const data
    //   // let role = userStore.userInfo ? userStore.userInfo.role : null