css
litian
2024-09-25 b471803c1a9e4c1452a98a8b3631bde66641b910
pages/digitalCourses/digitalCoursesDetails/index.js
@@ -4,13 +4,15 @@
import FormData from '../../../utils/formdata/index.js';
import Wxml2Canvas from 'wxml2canvas';
import {
  worksDataBytool
  worksDataBytool,
  UpdateworksDataBytool
} from "../../../assets/js/toolClass.js";
import moment from 'moment'
import Toast from "tdesign-miniprogram/toast";
import {
  loginInfo
} from '../../../assets/js/login';
import wxbarcode from 'wxbarcode'
Page({
  /**
@@ -104,6 +106,9 @@
    imageWidth: '', //画在画布上的图片的宽度
    imageHeight: '', //画在画布上的图片的高度
    website: 'https://jsek.bnuic.com/home/#/digitalCourses',
    wxShareUrl: '',
    imgUrl: '',
    imgUrl1: ''
  },
  formatDate(dateString) {
    if (!dateString) {
@@ -243,6 +248,7 @@
      })
  },
  digitalCoursesDetailsGet(digitalTextId) {
    let that = this;
    let query = {
      path: '*',
      queryType: '*',
@@ -329,8 +335,34 @@
      )
      this.setData({
        digitalsData: res.datas,
        loading: false
        loading: false,
        wxShareUrl: app.config.shareUrl + '?id=' + res.datas.id + '&path=' + this.data.bookPath + '&type=course'
      })
      if (this.data.wxShareUrl) {
        wxbarcode.qrcode('qrcode', this.data.wxShareUrl, 160, 160);
        wxbarcode.qrcode('qrcode1', this.data.wxShareUrl, 160, 160);
        setTimeout(() => {
          wx.canvasToTempFilePath({
            canvasId: 'qrcode',
            success: function (res) {
              // res.tempFilePath 包含生成的图片文件路径
              that.setData({
                imgUrl: res.tempFilePath
              })
            }
          });
          wx.canvasToTempFilePath({
            canvasId: 'qrcode1',
            success: function (res) {
              // res.tempFilePath 包含生成的图片文件路径
              that.setData({
                imgUrl1: res.tempFilePath
              })
            }
          });
        }, 1000)
      }
    })
  },
  //获取主讲人
@@ -1056,7 +1088,7 @@
    app.MG.ugc.getTopicMessageList(data).then((res) => {
      res.datas.map((item) => {
        item.content = JSON.parse(item.content)
        if (item.content.id == this.data.bookId) {
        if (item.content.bookId == this.data.bookId) {
          this.setData({
            isCertificate: item,
            userName: item.content.userName,
@@ -1064,11 +1096,8 @@
          })
        }
      })
    })
  },
  onCertificate() {
    if (!this.data.isBuy) {
@@ -1207,37 +1236,81 @@
        userName: this.data.userInfo.fullName,
        userPicture: this.data.pictureMd5,
        studyTime: this.data.digitalsData.beginDate + '-' + year + '-' + month + '-' + today,
        website: this.data.website
        website: this.data.website,
        wxShareUrl: this.data.wxShareUrl
      }
      data = {
        topicIdOrRefCode: 'applyCourseCertificate',
        name: this.data.userInfo.fullName,
        content: JSON.stringify(bookInfo),
        state: 'WaitAudit',
        cmsTypeRefCode: 'jsek_courseCertificate',
        type: 'applyCourse',
        newDataListRequest: worksDataBytool(this.data.worksInfo, this.data.userInfo)
      if (this.data.isCertificate.id) {
        let dataRequests = UpdateworksDataBytool(
          this.data.worksInfo,
          [this.data.isCertificate],
          this.data.userInfo
        )
        data = {
          id: this.data.isCertificate.id,
          topicIdOrRefCode: 'applyCourseCertificate',
          name: this.data.userInfo.fullName,
          content: JSON.stringify(bookInfo),
          state: 'WaitAudit',
          cmsTypeRefCode: 'jsek_courseCertificate',
          type: 'applyCourse',
          newDataRequests: dataRequests.newData,
          updateDataRequests: dataRequests.updateData,
          delDataRequest: {
            ids: []
          }
        }
        app.MG.ugc
          .updateTopicMessage(data)
          .then((res) => {
            wx.showToast({
              title: "已提交申请",
              icon: "none",
              duration: 1000,
            });
            this.setData({
              "userInfo.fullName": "",
              dialogBox: false,
              scrollJudge: true
            })
            this.getCertificateList()
          })
          .catch(() => {
            btnLoading.value = false
          })
      } else {
        data = {
          topicIdOrRefCode: 'applyCourseCertificate',
          name: this.data.userInfo.fullName,
          content: JSON.stringify(bookInfo),
          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": "",
            })
          })
      }
      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: "姓名不能为空",