| | |
| | | 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({ |
| | | |
| | | /** |
| | |
| | | rzzsImg: '', //认证证书base64 |
| | | imageWidth: '', //画在画布上的图片的宽度 |
| | | imageHeight: '', //画在画布上的图片的高度 |
| | | website: 'https://jsek.bnuic.com', |
| | | website: 'https://jsek.bnuic.com/home/#/digitalCourses', |
| | | wxShareUrl: '', |
| | | imgUrl: '', |
| | | imgUrl1: '' |
| | | }, |
| | | formatDate(dateString) { |
| | | if (!dateString) { |
| | |
| | | this.digitalCoursesDetailsGet(options.id) |
| | | this.getPlayerList() |
| | | this.getType() |
| | | // this.setData({ |
| | | // userName: JSON.parse(wx.getStorageSync(app.config.userInfoKey)).name, |
| | | // }) |
| | | this.setData({ |
| | | userName: JSON.parse(wx.getStorageSync(app.config.userInfoKey)).name, |
| | | }) |
| | | }, |
| | | |
| | | /** |
| | |
| | | * 生命周期函数--监听页面显示 |
| | | */ |
| | | onShow() { |
| | | |
| | | if (this.data.tabValue == 2 && this.data.selectActive == 'learn') { |
| | | this.getPlayerList() |
| | | this.getResource() |
| | | this.getRelationBook() |
| | | } |
| | | }, |
| | | |
| | | /** |
| | |
| | | keys: [this.data.bookId + ''] |
| | | }) |
| | | .then((res) => { |
| | | console.log(1, res); |
| | | if (res.length > 0) { |
| | | this.setData({ |
| | | playerList: JSON.parse(res[0].value) |
| | |
| | | }) |
| | | }, |
| | | digitalCoursesDetailsGet(digitalTextId) { |
| | | let that = this; |
| | | let query = { |
| | | path: '*', |
| | | queryType: '*', |
| | |
| | | ) |
| | | 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) |
| | | } |
| | | }) |
| | | }, |
| | | //获取主讲人 |
| | |
| | | selectChange(event) { |
| | | const value = event.target.dataset.value |
| | | this.setData({ |
| | | selectActive: value |
| | | selectActive: value, |
| | | testCount: 0 |
| | | }) |
| | | this.getResource() |
| | | }, |
| | |
| | | res.datas.cmsDatas[0].datas.forEach((item) => { |
| | | if (item.type == 'questionBankFolder' || item.type == 'questionBankItem') { |
| | | test.push(item) |
| | | |
| | | } else if (item.type != "resourceItem") { |
| | | this.data.playerList.forEach(pItem => { |
| | | if (pItem.cmsItemId == item.id) { |
| | |
| | | if (item.type == 'productItem') { |
| | | learnItemList.push(item) |
| | | } |
| | | |
| | | }) |
| | | |
| | | if (this.data.selectActive === 'learn') { |
| | | let list = [] |
| | | // 测试 6位// 正式 5位// 测试调用传20,内部7 正式调用传17 内部传6 |
| | |
| | | |
| | | //在线测试获取最后一个节点数量 |
| | | countLeafNodes(tree) { |
| | | |
| | | tree.forEach(node => { |
| | | if (!node.children || node.children.length === 0) { |
| | | this.setData({ |
| | |
| | | Toast({ |
| | | context: this, |
| | | selector: "#t-toast", |
| | | message: "该书已在购物车,请勿重复添加", |
| | | message: "该课程已在购物车,请勿重复添加", |
| | | theme: "warning", |
| | | direction: "column", |
| | | }); |
| | |
| | | }) |
| | | .then((res) => { |
| | | if (res) { |
| | | this.digitalCoursesDetailsGet(this.data.digitalsData.id); |
| | | wx.showToast({ |
| | | title: "领取成功", |
| | | icon: "none", |
| | |
| | | }, |
| | | ) |
| | | .exec() |
| | | this.drawImage() |
| | | setTimeout(() => { |
| | | this.drawImage() |
| | | }, 500) |
| | | query |
| | | .select('#textCertificate') |
| | | .fields({ |
| | |
| | | }, |
| | | ) |
| | | .exec() |
| | | this.drawImage1() |
| | | setTimeout(() => { |
| | | this.drawImage1() |
| | | }, 500) |
| | | }, |
| | | drawImage() { |
| | | let that = this; |
| | |
| | | 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, |
| | |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | }) |
| | | }, |
| | | |
| | | |
| | | |
| | | onCertificate() { |
| | | if (!this.data.isBuy) { |
| | |
| | | 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: "姓名不能为空", |