From 90b09add4ebe0b245c467bff8372f49b8fe3fb6e Mon Sep 17 00:00:00 2001 From: litian <C21AF165> Date: 星期四, 11 七月 2024 11:42:49 +0800 Subject: [PATCH] bitian --- packageBookService/pages/bookServices/detail/index.js | 118 +++++++++++++++++++++++++++++++++------------------------- 1 files changed, 67 insertions(+), 51 deletions(-) diff --git a/packageBookService/pages/bookServices/detail/index.js b/packageBookService/pages/bookServices/detail/index.js index 57f03e7..042346a 100644 --- a/packageBookService/pages/bookServices/detail/index.js +++ b/packageBookService/pages/bookServices/detail/index.js @@ -512,14 +512,14 @@ "fileInfo.bookName": this.data.bookDetail.name, "fileInfo.fileType": "pdf", "fileInfo.md5": res.datas[0].bookshelf_pdf, - "fileInfo.freePage": res.datas[0].bookshelf_probationPage, + "fileInfo.freePage": res.datas[0].bookshelf_probationPage ? res.datas[0].bookshelf_probationPage : 30, }); } else if (res.datas[0].bookshelf_protectedEpub) { this.setData({ "fileInfo.bookName": this.data.bookDetail.name, "fileInfo.fileType": "epub", "fileInfo.md5": res.datas[0].bookshelf_protectedEpub, - "fileInfo.freePage": res.datas[0].bookshelf_freeEpub, + "fileInfo.freePage": res.datas[0].bookshelf_freeEpub ? res.datas[0].bookshelf_freeEpub : 30, }); } } @@ -533,7 +533,7 @@ "fileInfo.bookName": this.data.bookDetail.name, "fileInfo.fileType": "pdf", "fileInfo.md5": this.data.bookDetail.pdf, - "fileInfo.freePage": this.data.bookDetail.probationPage, + "fileInfo.freePage": this.data.bookDetail.probationPage ? this.data.bookDetail.probationPage : 30, }); } else if (this.data.bookDetail.protectedEpub) { @@ -541,7 +541,7 @@ "fileInfo.bookName": this.data.bookDetail.name, "fileInfo.fileType": "epub", "fileInfo.md5": this.data.bookDetail.protectedEpub, - "fileInfo.freePage": this.data.bookDetail.freeEpubPage, + "fileInfo.freePage": this.data.bookDetail.freeEpubPage ? this.data.bookDetail.freeEpubPage : 30, }); } } @@ -690,9 +690,7 @@ // this.getResourceData(checkData); // } if ((e.detail.value == "jsek_teachingResources" && !this.data.teach.length) || (e.detail.value == "jsek_cloudLearning" && !this.data.learn.length)) { - if (e.detail.value == "jsek_teachingResources") { - wx.setStorageSync('teachResourcesPath', checkData.productLinkPath) - } + wx.setStorageSync('teachResourcesPath', checkData.productLinkPath) this.getResourceDataList(checkData) } else if (e.detail.value == "questionBank" && !this.data.test.length) { this.getResourceData(checkData); @@ -992,31 +990,45 @@ app.MG.store .getProductDetail(query) .then(async (res) => { - if (!res.datas.cmsDatas[0].datas.length) { - return this.setData({ - noResources: true, - loading: false, - }); - } // 浜戞祴璇曪紝閫掑綊璇锋眰閲屽眰鏁版嵁 if (type.refCode == "questionBank") { - const data = res.datas.cmsDatas[0].datas.filter((item) => item.type == 'questionBankFolder' && item.childrenFolderCount > 0); - if (data.length > 0) { - let list = [] - console.log(query.cmsPath, query.cmsPath.length) - // 娴嬭瘯 6浣�// 姝e紡 5浣�// 娴嬭瘯璋冪敤浼�20锛屽唴閮�7 姝e紡璋冪敤浼�17 鍐呴儴浼�6 - const addNum = query.cmsPath.length > 12 ? 7 : query.cmsPath.length > 14 ? 8 : 6 - const num = query.cmsPath.length + addNum - this.getTreeList(data, num, list, '\\', addNum) - list = this.ensureTreeConsistency(list) - let result = []; - this.findChildIds(list[0].children, result); - this.setData({ - test: list[0].children, - loading: false, - openTeachids: result, - }); - console.log(this.data.test, "test") + let data = [] + let result = []; + if (this.data.options.storeInfo == 'jsek_jslx') { + data = res.datas.cmsDatas[0].datas.filter((item) => item.type == 'questionBankFolder'); + if (data.length > 0) { + this.setData({ + test: data, + loading: false, + openTeachids: result, + }); + } else { + this.setData({ + noResources: true, + loading: false, + }); + } + } else { + data = res.datas.cmsDatas[0].datas.filter((item) => item.type == 'questionBankFolder' && item.childrenFolderCount > 0); + if (data.length > 0) { + let list = [] + // 娴嬭瘯 6浣�// 姝e紡 5浣�// 娴嬭瘯璋冪敤浼�20锛屽唴閮�7 姝e紡璋冪敤浼�17 鍐呴儴浼�6 + const addNum = query.cmsPath.length > 12 ? 7 : query.cmsPath.length > 14 ? 8 : 6 + const num = query.cmsPath.length + addNum + this.getTreeList(data, num, list, '\\', addNum) + list = this.ensureTreeConsistency(list) + this.findChildIds(list[0].children, result); + this.setData({ + test: list[0].children, + loading: false, + openTeachids: result, + }); + } else { + this.setData({ + noResources: true, + loading: false, + }); + } } } }) @@ -1112,30 +1124,33 @@ // 鑾峰彇灞曞紑椤� findChildIds(data, result) { let index = 0 - for (let i = 0; i < data.length; i++) { - if (index < 3) { - const item = data[i] - if (item.childrenFolderCount > 0) { - result.push(item.id) - for (let j = 0; j < item.children.length; j++) { - if (index < 3) { - const childrenItme = item.children[j] - if (item.childrenCount > 0) { - result.push(childrenItme.id) - index += 1 + if (data) + for (let i = 0; i < data.length; i++) { + if (index < 3) { + const item = data[i] + if (item.childrenFolderCount > 0) { + result.push(item.id) + if (item.children) { + for (let j = 0; j < item.children.length; j++) { + if (index < 3) { + const childrenItme = item.children[j] + if (item.childrenCount > 0) { + result.push(childrenItme.id) + index += 1 + } + } else { + break + } } - } else { - break } + } else if (item.childrenCount > 0) { + result.push(item.id) + index += 1 } - } else if (item.childrenCount > 0) { - result.push(item.id) - index += 1 + } else { + break } - } else { - break } - } }, // 鍥句功娣诲姞璐墿杞� @@ -2084,7 +2099,7 @@ const smBook = list.find(item => item.content[0].id == this.data.bookDetail.id) console.log('宸茬敵璇�', smBook); if (smBook && smBook.state == 'Normal') { - const flag = new Date(smBook.feedBack.endDate + '23:59:59').getTime() > new Date().getTime() + const flag = new Date(smBook.feedBack.endDate + ' 23:59:59').getTime() > new Date().getTime() if (flag) { this.setData({ applicationState: 'Normal' @@ -2194,7 +2209,8 @@ }); return false; } else if (isApply.state == 'Normal') { - const flag = new Date(isApply.feedBack.endDate + '23:59:59').getTime() > new Date().getTime() + console.log(isApply.state, "isApply.state") + const flag = new Date(isApply.feedBack.endDate + ' 23:59:59').getTime() > new Date().getTime() if (flag) { wx.showToast({ title: "璇ヤ功宸茬敵璇凤紒", -- Gitblit v1.9.1