From af2e38d1d72633d03afdb6e75f8d30b7ef0d0aee Mon Sep 17 00:00:00 2001 From: 闫增涛 <1829501689@qq.com> Date: 星期一, 29 七月 2024 15:24:30 +0800 Subject: [PATCH] 图书详情页添加对云学习目录整体购买的判断 --- packageBookService/pages/bookServices/detail/components/tree/index.js | 112 +++++++++++++++++++++++++++++--------------------------- 1 files changed, 58 insertions(+), 54 deletions(-) diff --git a/packageBookService/pages/bookServices/detail/components/tree/index.js b/packageBookService/pages/bookServices/detail/components/tree/index.js index c2f07e2..981c95f 100644 --- a/packageBookService/pages/bookServices/detail/components/tree/index.js +++ b/packageBookService/pages/bookServices/detail/components/tree/index.js @@ -96,6 +96,7 @@ }, // 鑺傜偣灞曞紑 handleChange(e) { + console.log(e.detail.value); this.setData({ openIds: e.detail.value, }); @@ -139,6 +140,7 @@ if (token) { const item = e.currentTarget.dataset.item; const parent = e.currentTarget.dataset.parent; + console.log('item', item); const parentProductLinkPath = parent ? parent.productLinkPath : wx.getStorageSync("teachResourcesPath"); @@ -173,6 +175,7 @@ if ( this.properties.tab == "jsek_cloudLearning" && this.resourceIsBuy(item) + // item.saleMethod.length > 0 ) { return wx.showToast({ icon: "error", @@ -180,16 +183,16 @@ "璇峰厛璐拱璇ヨ祫婧�" : "璇峰厛鐐瑰嚮棰嗗彇鏌ョ湅鎸夐挳", }); } - if ( - item.saleMethod.length == 0 && - item.sysType == "CmsItem" && - this.properties.tab == "jsek_cloudLearning" - ) { - return wx.showToast({ - icon: "error", - title: "鏆傛湭寮�濮嬮攢鍞紝璇疯仈绯荤鐞嗗憳", - }); - } + // if ( + // item.saleMethod.length == 0 && + // item.sysType == "CmsItem" && + // this.properties.tab == "jsek_cloudLearning" + // ) { + // return wx.showToast({ + // icon: "error", + // title: "鏆傛湭寮�濮嬮攢鍞紝璇疯仈绯荤鐞嗗憳", + // }); + // } if (this.properties.tab == "jsek_teachingResources" && (item.file || item.freeFile)) { let file = item.fileMap[item.file] ? item.fileMap[item.file] : item.fileMap[item.freeFile] if (file && file.protectType !== "Public") { @@ -198,7 +201,7 @@ title: "璧勬簮涓嶅彲鐢紝璇疯仈绯荤鐞嗗憳", }); } - } else if ((this.properties.tab == "jsek_teachingResources" || this.properties.tab == "jsek_cloudLearning") && (!item.file || !item.freeFile || !item.protectedFile)) { + } else if ((this.properties.tab == "jsek_teachingResources" || this.properties.tab == "jsek_cloudLearning") && (!item.file && !item.freeFile && !item.protectedFile)) { return wx.showToast({ icon: 'error', title: '鏆傛棤璧勬簮', @@ -207,7 +210,9 @@ wx.navigateTo({ url: `${url}?productLinkPath=${item.productLinkPath}&parentProductLinkPath=${parentProductLinkPath}&parentName=${parentName}&activeId=${item.id}&bookId=${this.properties.bookInfo.id}&bookName=${this.properties.bookInfo.name}&cmsId=${this.properties.bookInfo.rootCmsItemId}&formPath=${this.properties.tab}&applyState=${this.properties.applyState}&deadline=${this.properties.deadline}`, }); - if (item.selectType == "pdf") { + + // debugger + if (item.selectType == "pdf" || item.selectType == "document") { const fileLink = item.file ? item.file : item.freeFile console.log(fileLink); wx.navigateTo({ @@ -215,50 +220,49 @@ fileLink + "&fileName=" + item.name + - "&fileType=" + - item.selectType + "&bookBuy=true" + "&fileType=pdf" + "&bookBuy=true" }); } - if (item.selectType == "document") { - // freeFile - if (item.selectType == "document") { - item.selectType = "pptx"; - } - const fileLink = item.file ? - app.config.requestCtx + "/file/api/ApiDownload?md5=" + item.file : - app.config.requestCtx + - "/file/api/ApiDownload?md5=" + - item.freeFile; - console.log(fileLink, "fileLink"); - //鎻愮ず鍔犺浇涓� - // 鍗曟涓嬭浇鍏佽鐨勬渶澶ф枃浠朵负 200MB - wx.downloadFile({ - url: fileLink, - // filePath: wx.env.USER_DATA_PATH + `/${item.name}.${item.selectType}`, - filePath: wx.env.USER_DATA_PATH + `/${item.name}.${item.selectType}`, - success: function (res) { - console.log(res, "wx.downloadFile success res"); - if (res.statusCode != 200) { - util.hideLoadingWithErrorTips(); - return false; - } - var Path = res.tempFilePath; //杩斿洖鐨勬枃浠朵复鏃跺湴鍧�锛岀敤浜庡悗闈㈡墦寮�鏈湴棰勮鎵�鐢� - let data = res.filePath; - wx.openDocument({ - filePath: data, - showMenu: true, - success: function (res) { - console.log("鎵撳紑鎴愬姛"); - util.hideLoading(); - }, - }); - }, - fail: function (err) { - console.log(err, "wx.downloadFile fail err"); - util.hideLoadingWithErrorTips(); - }, - }); - } + // if (item.selectType == "document") { + // // freeFile + // // if (item.selectType == "document") { + // // item.selectType = "pptx"; + // // } + // const fileLink = item.file ? + // app.config.requestCtx + "/file/api/ApiDownload?md5=" + item.file : + // app.config.requestCtx + + // "/file/api/ApiDownload?md5=" + + // item.freeFile; + // console.log(fileLink, "fileLink"); + // //鎻愮ず鍔犺浇涓� + // // 鍗曟涓嬭浇鍏佽鐨勬渶澶ф枃浠朵负 200MB + // wx.downloadFile({ + // url: fileLink, + // // filePath: wx.env.USER_DATA_PATH + `/${item.name}.${item.selectType}`, + // filePath: wx.env.USER_DATA_PATH + `/${item.name}.${item.selectType}`, + // success: function (res) { + // console.log(res, "wx.downloadFile success res"); + // if (res.statusCode != 200) { + // util.hideLoadingWithErrorTips(); + // return false; + // } + // var Path = res.tempFilePath; //杩斿洖鐨勬枃浠朵复鏃跺湴鍧�锛岀敤浜庡悗闈㈡墦寮�鏈湴棰勮鎵�鐢� + // let data = res.filePath; + // wx.openDocument({ + // filePath: data, + // showMenu: true, + // success: function (res) { + // console.log("鎵撳紑鎴愬姛"); + // util.hideLoading(); + // }, + // }); + // }, + // fail: function (err) { + // console.log(err, "wx.downloadFile fail err"); + // util.hideLoadingWithErrorTips(); + // }, + // }); + // } if (item.selectType == "webpage") { this.setData({ webpageSrc: item.jsek_link, -- Gitblit v1.9.1