From aff8d054df4a638f399dc8f15d98c19b9c9aa785 Mon Sep 17 00:00:00 2001 From: litian <C21AF165> Date: 星期二, 29 四月 2025 10:11:25 +0800 Subject: [PATCH] 扫码视频播放 --- packageCourse/components/teaching/index.js | 101 +++++++++++++++++++++++++++----------------------- 1 files changed, 54 insertions(+), 47 deletions(-) diff --git a/packageCourse/components/teaching/index.js b/packageCourse/components/teaching/index.js index d6476b8..3d3b478 100644 --- a/packageCourse/components/teaching/index.js +++ b/packageCourse/components/teaching/index.js @@ -96,56 +96,63 @@ cmsPath: data.productLinkPath }) .then((res) => { - const dataTeach = res.datas.cmsDatas[0]?.datas.find( - (item) => item.refCode == 'jsek_interaction' - ) - app.MG.store - .getProductDetail({ - path: '*', - queryType: '*', - productId: this.properties.bookId, - cmsPath: dataTeach.productLinkPath - }) - .then((res) => { - let datas = res.datas.cmsDatas[0] ? res.datas.cmsDatas[0].datas : [] - const dataRes = [] - if (datas?.length > 0) { - datas.forEach(async (item) => { - const cmsRes = await app.MG.store - .getProductDetail({ - path: '*', - queryType: '*', - productId: this.properties.bookId, - cmsPath: item.productLinkPath + try { + const dataTeach = res.datas.cmsDatas[0]?.datas.find( + (item) => item.refCode == 'jsek_interaction' + ) + app.MG.store + .getProductDetail({ + path: '*', + queryType: '*', + productId: this.properties.bookId, + cmsPath: dataTeach.productLinkPath + }) + .then((res) => { + let datas = res.datas.cmsDatas[0] ? res.datas.cmsDatas[0].datas : [] + const dataRes = [] + if (datas?.length > 0) { + datas.forEach(async (item) => { + const cmsRes = await app.MG.store + .getProductDetail({ + path: '*', + queryType: '*', + productId: this.properties.bookId, + cmsPath: item.productLinkPath + }) + if ( + cmsRes.datas.cmsDatas[0].datas && + cmsRes.datas.cmsDatas[0].datas.length > 0 + ) { + cmsRes.datas.cmsDatas[0].datas.forEach((item, i) => { + item.subList = [] + item.updateDate = '-' + if (this.data.dataList.length > 0) { + this.data.dataList.forEach((mitem) => { + if (mitem.name == item.name) { + item.updateDate = moment(mitem.updateDate).format( + 'YYYY-MM-DD HH:mm:ss' + ) + item.subList.push(mitem) + } + }) + } + dataRes.push(item) + }) + } + const resList = dataRes.sort((a, b) => b.subList.length - a.subList.length) + this.setData({ + cmsDataList: resList, + loading: false }) - if ( - cmsRes.datas.cmsDatas[0].datas && - cmsRes.datas.cmsDatas[0].datas.length > 0 - ) { - cmsRes.datas.cmsDatas[0].datas.forEach((item, i) => { - item.subList = [] - item.updateDate = '-' - if (this.data.dataList.length > 0) { - this.data.dataList.forEach((mitem) => { - if (mitem.name == item.name) { - item.updateDate = moment(mitem.updateDate).format( - 'YYYY-MM-DD HH:mm:ss' - ) - item.subList.push(mitem) - } - }) - } - dataRes.push(item) - }) - } - const resList = dataRes.sort((a, b) => b.subList.length - a.subList.length) - this.setData({ - cmsDataList: resList, - loading: false }) - }) - } + } + }) + } catch (error) { + this.setData({ + cmsDataList: [], + loading: false }) + } }) } catch (error) { this.setData({ -- Gitblit v1.9.1