From 2f9305515c7264637164c9e03c2840f4219ca1e3 Mon Sep 17 00:00:00 2001 From: litian <C21AF165> Date: 星期五, 05 七月 2024 11:46:01 +0800 Subject: [PATCH] kong, --- pages/digitalCourses/digitalCoursesDetails/index.js | 135 ++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 132 insertions(+), 3 deletions(-) diff --git a/pages/digitalCourses/digitalCoursesDetails/index.js b/pages/digitalCourses/digitalCoursesDetails/index.js index 27e1095..71d94da 100644 --- a/pages/digitalCourses/digitalCoursesDetails/index.js +++ b/pages/digitalCourses/digitalCoursesDetails/index.js @@ -2,6 +2,9 @@ const app = getApp() import moment from 'moment' import Toast from "tdesign-miniprogram/toast"; +import { + loginInfo +} from '../../../assets/js/login'; Page({ /** @@ -62,6 +65,17 @@ notePage: 1, noteLimit: 6, noteTotalCount: 0, + images: [], + visible: false, + showIndex: false, + closeBtn: false, + deleteBtn: false, + bookId: '', + playerList: [], + worksInfo: [], + isCertificate: {}, + isLearn: false, + isTest: false, }, formatDate(dateString) { if (!dateString) { @@ -113,9 +127,12 @@ * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇 */ onLoad(options) { - console.log(options); + this.setData({ + bookId: options.id + }) this.digitalCoursesDetailsGet(options.id) - + this.getPlayerList() + this.getResource() }, /** @@ -165,6 +182,22 @@ */ onShareAppMessage() { + }, + //鑾峰彇瑙嗛瀛︿範 + getPlayerList() { + app.MG.identity + .getUserKey({ + domain: 'videoPlayer', + keys: [this.data.bookId] + }) + .then((res) => { + if (res.length > 0) { + this.setData({ + playerList: JSON.parse(res[0].value) + }) + console.log(this.data.playerList, "playerList") + } + }) }, digitalCoursesDetailsGet(digitalTextId) { let query = { @@ -310,17 +343,27 @@ } } app.MG.store.getProductDetail(query).then((res) => { - console.log(res.datas, 1111) let test = [] let learn = [] + let learnItemList = [] if (res.datas.cmsDatas[0].datas.length > 0) { 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) { + item.progress = pItem.progress + } + }) learn.push(item) } + if (item.type == 'productItem') { + learnItemList.push(item) + } + }) + if (this.data.selectActive === 'learn') { let list = [] // 娴嬭瘯 6浣�// 姝e紡 5浣�// 娴嬭瘯璋冪敤浼�20锛屽唴閮�7 姝e紡璋冪敤浼�17 鍐呴儴浼�6 @@ -357,6 +400,24 @@ openTeachids: result, }); } + } + //鍒ゆ柇璧勬簮鏄惁瀛︿範瀹屾垚 + if (learnItemList.length == playerList.value.length) { + let data = playerList.value.filter((ditem) => ditem.progress != '100') + if (data) { + this.setData({ + isLearn: false, + }); + + } else { + this.setData({ + isLearn: true, + }); + } + } else { + this.setData({ + isLearn: false, + }); } } }) @@ -584,7 +645,50 @@ }); }, //鐢宠璇佷功 + + //鑾峰彇瀛楁 + getType() { + app.MG.resource.getCmsTypeByRefCode({ + refCodes: ['jsek_courseCertificate'] + }).then((res) => { + this.setData({ + worksInfo: res[0].cmsTypeLinks[0].children, + }) + }) + }, + getCertificateList() { + const data = { + start: 0, + size: 9999, + topicIdOrRefCode: 'applyCourseCertificate', + appRefCode: 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.bookId) { + this.setData({ + isCertificate: item + }) + } + }) + }) + }, + onCertificate() { + if (!this.data.isBuy) { + wx.showToast({ + title: "璇峰厛璐拱锛屼綋楠屽畬鏁存湇鍔�", + icon: "none", + duration: 1000, + }); + } + var page = getCurrentPages().pop(); // 鑾峰彇褰撳墠椤甸潰瀹炰緥 page.setData({ // 鍔ㄦ�佽缃姝㈡粴鍔ㄧ殑鏍峰紡 @@ -666,4 +770,29 @@ } } }, + + //璇佷功鏌ョ湅 + onClick1() { + this.setData({ + images: ['/static/images/certificate/cbzs.jpg'], + showIndex: true, + visible: true, + }) + }, + onClick2() { + this.setData({ + images: ['/static/images/certificate/rzzs.jpg'], + showIndex: true, + visible: true, + }) + }, + onClose(e) { + const { + trigger + } = e.detail; + console.log(trigger); + this.setData({ + visible: false, + }); + }, }) \ No newline at end of file -- Gitblit v1.9.1