From cc670c2b2aa7256c82b8895a1e405cdad7912923 Mon Sep 17 00:00:00 2001 From: litian <C21AF165> Date: 星期一, 02 九月 2024 20:42:40 +0800 Subject: [PATCH] ceshi --- pages/digitalCourses/digitalCoursesDetails/index.js | 19 ++++++++++++++++++- 1 files changed, 18 insertions(+), 1 deletions(-) diff --git a/pages/digitalCourses/digitalCoursesDetails/index.js b/pages/digitalCourses/digitalCoursesDetails/index.js index 0f4acde..7066a1d 100644 --- a/pages/digitalCourses/digitalCoursesDetails/index.js +++ b/pages/digitalCourses/digitalCoursesDetails/index.js @@ -2,7 +2,7 @@ const app = getApp() import SparkMD5 from 'spark-md5' import FormData from '../../../utils/formdata/index.js'; -import Wxml2Canvas from 'wxml2canvas'; +// import Wxml2Canvas from 'wxml2canvas'; import { worksDataBytool } from "../../../assets/js/toolClass.js"; @@ -66,6 +66,7 @@ selectActive: 'learn', learnList: [], testList: [], + testCount: 0, openTeachids: [], onlineQuestionsList: [], //鍒嗛〉 @@ -401,6 +402,7 @@ 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) { @@ -438,6 +440,7 @@ const data = test.filter( (item) => item.type == 'questionBankFolder' && item.childrenFolderCount > 0 ) + if (data.length > 0) { let list = [] let addNum = query.cmsPath.length > 5 ? 7 : query.cmsPath.length > 6 ? 8 : 6 @@ -446,6 +449,7 @@ list = this.ensureTreeConsistency(list) let result = []; this.findChildIds(list[0].children, result) + this.countLeafNodes(list[0].children) this.setData({ testList: list[0].children, openTeachids: result, @@ -579,6 +583,19 @@ } }, + //鍦ㄧ嚎娴嬭瘯鑾峰彇鏈�鍚庝竴涓妭鐐规暟閲� + countLeafNodes(tree) { + tree.forEach(node => { + if (!node.children || node.children.length === 0) { + this.setData({ + testCount: this.data.testCount + 1 + }) + } else { + this.countLeafNodes(node.children); + } + }); + }, + //鑾峰彇鍏宠仈瀛愬晢鍝�/鏁板瓧鏁欐潗 getRelationBook() { app.MG.store.getProductList({ -- Gitblit v1.9.1