litian
2024-07-11 57ba8e29b5cfdd3fc5b0b9b631a26ff095d1ac5d
pages/digitalCourses/digitalCoursesDetails/index.js
@@ -1,5 +1,8 @@
// pages/digitalCourses/digitalCoursesDetails/index.js
const app = getApp()
import {
  worksDataBytool
} from "../../../assets/js/toolClass.js";
import moment from 'moment'
import Toast from "tdesign-miniprogram/toast";
import {
@@ -76,6 +79,9 @@
    isCertificate: {},
    isLearn: false,
    isTest: false,
    userInfo: {
      fullName: '' //名称
    }
  },
  formatDate(dateString) {
    if (!dateString) {
@@ -132,7 +138,8 @@
    })
    this.digitalCoursesDetailsGet(options.id)
    this.getPlayerList()
    this.getResource()
    this.getType()
    this.getCertificateList()
  },
  /**
@@ -661,7 +668,7 @@
      start: 0,
      size: 9999,
      topicIdOrRefCode: 'applyCourseCertificate',
      appRefCode: config.appRefCode,
      appRefCode: app.config.appRefCode,
      sort: {
        type: 'Desc',
        field: 'CreateDate'
@@ -681,22 +688,30 @@
  },
  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: "您申请的证书正在审核中",
    //     icon: "none",
    //     duration: 1000,
    //   });
    //   return false
    // }
    var page = getCurrentPages().pop(); // 获取当前页面实例
    page.setData({
@@ -714,11 +729,52 @@
      scrollJudge: true
    })
  },
  confirmM() {
  //姓名
  onFullNameInput(e) {
    this.setData({
      dialogBox: false,
      scrollJudge: true
    })
      "userInfo.fullName": e.detail.value,
    });
  },
  confirmM() {
    if (this.data.userInfo.fullName) {
      let data = {}
      data = {
        topicIdOrRefCode: 'applyCourseCertificate',
        name: this.data.userInfo.fullName,
        content: JSON.stringify(this.data.digitalsData),
        state: 'WaitAudit',
        cmsTypeRefCode: 'jsek_courseCertificate',
        type: 'applyCourse',
        newDataListRequest: worksDataBytool(this.data.worksInfo, this.data.userInfo)
      }
      app.MG.ugc
        .newTopicMessage(data)
        .then((res) => {
          wx.showToast({
            title: "已提交申请",
            icon: "none",
            duration: 1000,
          });
          this.setData({
            "userInfo.fullName": "",
            dialogBox: false,
            scrollJudge: true
          })
          this.getCertificateList()
        })
        .catch(() => {
          this.setData({
            "userInfo.fullName": "",
          })
        })
    } else {
      wx.showToast({
        title: "姓名不能为空",
        icon: "none",
        duration: 1000,
      });
    }
  },
  setCoolect() {
    // 首页测试登录功能,后续注释