| | |
| | | import { |
| | | loginInfo |
| | | } from '../../../assets/js/login'; |
| | | import { |
| | | worksDataBytool |
| | | } from "../../../assets/js/toolClass.js"; |
| | | const app = getApp() |
| | | Page({ |
| | | |
| | |
| | | }, |
| | | userInfo: { |
| | | fullName: '' //名称 |
| | | } |
| | | }, |
| | | worksInfo: [], |
| | | isCertificate: {}, |
| | | isLearn: false, |
| | | isTest: false, |
| | | }, |
| | | |
| | | /** |
| | |
| | | digitalTextId: options.id |
| | | }) |
| | | this.digitalTextbooksDetailsGet(this.data.digitalTextId) |
| | | this.getType() |
| | | this.getCertificateList() |
| | | }, |
| | | // 格式化日期 |
| | | // 格式化日期 |
| | |
| | | // }) |
| | | }, |
| | | |
| | | //申请证书 |
| | | //获取字段 |
| | | getType() { |
| | | app.MG.resource.getCmsTypeByRefCode({ |
| | | refCodes: ['jsek_textbookCertificate'] |
| | | }).then((res) => { |
| | | this.setData({ |
| | | worksInfo: res[0].cmsTypeLinks[0].children, |
| | | }) |
| | | }) |
| | | }, |
| | | getCertificateList() { |
| | | const data = { |
| | | start: 0, |
| | | size: 9999, |
| | | topicIdOrRefCode: 'applyTextbookCertificate', |
| | | appRefCode: app.config.appRefCode, |
| | | sort: { |
| | | type: 'Desc', |
| | | field: 'CreateDate' |
| | | } |
| | | } |
| | | app.MG.ugc.getTopicMessageList(data).then((res) => { |
| | | res.datas.map((item) => { |
| | | item.content = JSON.parse(item.content) |
| | | if (item.content.id == this.data.digitalsData.id) { |
| | | this.setData({ |
| | | isCertificate: item |
| | | }) |
| | | } |
| | | }) |
| | | }) |
| | | }, |
| | | |
| | | 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.isCertificate && this.data.isCertificate.state == 'WaitAudit') { |
| | | wx.showToast({ |
| | | title: "您申请的证书正在审核中", |
| | | icon: "none", |
| | | duration: 1000, |
| | | }); |
| | | return false |
| | | } |
| | | |
| | | var page = getCurrentPages().pop(); // 获取当前页面实例 |
| | | page.setData({ |
| | | // 动态设置禁止滚动的样式 |
| | | disableScrollStyle: 'overflow: hidden;' |
| | | }); |
| | | this.setData({ |
| | | dialogBox: true, |
| | | scrollJudge: '' |
| | | }) |
| | | }, |
| | | closeDialog() { |
| | | this.setData({ |
| | | dialogBox: false, |
| | | scrollJudge: true |
| | | }) |
| | | }, |
| | | |
| | | //姓名 |
| | | onFullNameInput(e) { |
| | | this.setData({ |
| | | "userInfo.fullName": e.detail.value, |
| | | }); |
| | | }, |
| | | confirmM() { |
| | | if (this.data.userInfo.fullName) { |
| | | let data = {} |
| | | data = { |
| | | topicIdOrRefCode: 'applyTextbookCertificate', |
| | | name: this.data.userInfo.fullName, |
| | | content: JSON.stringify(this.data.digitalsData), |
| | | state: 'WaitAudit', |
| | | cmsTypeRefCode: 'jsek_textbookCertificate', |
| | | type: 'applyTextbook', |
| | | 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, |
| | | }); |
| | | } |
| | | }, |
| | | |
| | | }) |