From f4a2f400fdc999946e75a4322fe1ceb6e528c169 Mon Sep 17 00:00:00 2001 From: litian <C21AF165> Date: 星期二, 27 八月 2024 19:59:46 +0800 Subject: [PATCH] xuexi --- pages/digitalCourses/digitalCoursesDetails/index.js | 131 +++++++++++++++++++++++++++++++++++-------- 1 files changed, 107 insertions(+), 24 deletions(-) diff --git a/pages/digitalCourses/digitalCoursesDetails/index.js b/pages/digitalCourses/digitalCoursesDetails/index.js index f057cab..4ede1be 100644 --- a/pages/digitalCourses/digitalCoursesDetails/index.js +++ b/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,10 @@ isCertificate: {}, isLearn: false, isTest: false, + userInfo: { + fullName: '' //鍚嶇О + }, + publishingUnit: '' }, formatDate(dateString) { if (!dateString) { @@ -132,7 +139,8 @@ }) this.digitalCoursesDetailsGet(options.id) this.getPlayerList() - this.getResource() + this.getType() + this.getCertificateList() }, /** @@ -237,7 +245,7 @@ //epub璇曡鐧惧垎姣� } } - app.MG.store.getProductDetail(query).then(res => { + app.MG.store.getProductDetail(query).then(async res => { console.log(res); if (res.datas.purchasedSaleMethodIdList.includes(res.datas.defaultSaleMethodId)) { this.setData({ @@ -259,12 +267,15 @@ expire: res.false }) } - res.datas.publicationDate = this.formatDate(res.datas.publicationDate) + res.datas.publicationDate = moment(res.datas.publicationDate).format('YYYY骞碝M鏈圖D鏃�') res.datas.price = res.datas.price.toFixed(2) wx.setNavigationBarTitle({ title: res.datas.name, }) + if (res.datas.publishingUnit) { + await this.getBookPublishUnit(res.datas.publishingUnit) + } let lecturer = [] if (res.datas.datas.speaker && res.datas.datas.speaker.length > 0) { res.datas.datas.speaker.forEach(item => { @@ -288,6 +299,29 @@ digitalsData: res.datas, loading: false }) + }) + }, + + //鑾峰彇鍥句功鍑虹増鍗曚綅 + async getBookPublishUnit(listStr) { + let query = { + refCodes: ['publishingUnit'] + } + await app.MG.store.getProductTypeField(query).then((res) => { + const list = JSON.parse(listStr) + let dataList = [] + list.forEach((unit) => { + JSON.parse(res[0].config).option.forEach((item) => { + if (item.value == unit) { + dataList.push(item.name) + } + }) + }) + if (dataList.length == list.length) { + this.setData({ + publishingUnit: dataList.join(' '), + }) + } }) }, onTabsChange(event) { @@ -661,7 +695,7 @@ start: 0, size: 9999, topicIdOrRefCode: 'applyCourseCertificate', - appRefCode: config.appRefCode, + appRefCode: app.config.appRefCode, sort: { type: 'Desc', field: 'CreateDate' @@ -681,22 +715,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: "鎮ㄧ敵璇风殑璇佷功姝e湪瀹℃牳涓�", + // icon: "none", + // duration: 1000, + // }); + // return false + // } var page = getCurrentPages().pop(); // 鑾峰彇褰撳墠椤甸潰瀹炰緥 page.setData({ @@ -714,11 +756,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() { // 棣栭〉娴嬭瘯鐧诲綍鍔熻兘锛屽悗缁敞閲� -- Gitblit v1.9.1