From 4496721cd3af3c68ed4d55218d3e83ea0664c57e Mon Sep 17 00:00:00 2001 From: yiming <m13691596795@163.com> Date: 星期一, 29 四月 2024 17:53:10 +0800 Subject: [PATCH] bug3 --- packageBookService/pages/bookServices/detail/components/tree/index.js | 165 +++++++++++++++++++++++++++--------------------------- 1 files changed, 83 insertions(+), 82 deletions(-) diff --git a/packageBookService/pages/bookServices/detail/components/tree/index.js b/packageBookService/pages/bookServices/detail/components/tree/index.js index ef5aa5a..b15157c 100644 --- a/packageBookService/pages/bookServices/detail/components/tree/index.js +++ b/packageBookService/pages/bookServices/detail/components/tree/index.js @@ -48,6 +48,9 @@ checkAllState: { type: Boolean, }, + deadline: { + type: String + } }, data: { sonPurchaseSaleMethodId: "", @@ -58,7 +61,8 @@ selectAll: [], shoppingCart: true, stop: false, - cart: true + cart: true, + canExecute: true }, ready() {}, @@ -131,14 +135,25 @@ // 璺宠浆闊宠棰戞挱鏀惧櫒 goPlayer(e) { // 妫�鏌ョ櫥褰曠姸鎬� - const token = wx.getStorageSync(app.config.tokenKey); + + + + const token = wx.getStorageSync(app.config.tokenKey); if (token) { + + + + + const item = e.currentTarget.dataset.item; const parent = e.currentTarget.dataset.parent; const parentProductLinkPath = parent ? parent.productLinkPath : wx.getStorageSync('teachResourcesPath') const parentName = parent ? parent.name : '鏁欏璧勬簮' let url; + + + if (this.properties.isShowCheck && this.resourceIsBuy(item)) { return false; } @@ -162,20 +177,66 @@ "璇峰厛璐拱璇ヨ祫婧�" : "璇峰厛鐐瑰嚮棰嗗彇鏌ョ湅鎸夐挳", }); } + 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.fileMap) { + if (item.file && item.fileMap[item.file].protectType !== "Public") { + return wx.showToast({ + icon: 'error', + title: '璧勬簮涓嶅彲鐢紝璇疯仈绯荤鐞嗗憳', + }) + } else if (item.freeFile && item.fileMap[item.freeFile].protectType !== "Public") { + return wx.showToast({ + icon: 'error', + title: '璧勬簮涓嶅彲鐢紝璇疯仈绯荤鐞嗗憳', + }) + } + } 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}`, + 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 == "document" || item.selectType == "pdf") { - const fileLink = - app.config.requestCtx + "/file/api/ApiDownload?md5=" + item.file; + // || item.selectType == "pdf" + + + + if (item.selectType == "pdf") { + console.log(item, '79825'); + const fileLink = item.file ? item.file : item.freeFile + console.log(fileLink); + wx.navigateTo({ + url: "/packageBookService/pages/components/webView/index?md5=" + + fileLink + + "&fileName=" + + item.name + + "&fileType=" + + item.selectType + "&bookBuy=true" + + }); + } + if (item.selectType == "document") { + // freeFile + + if (item.selectType == "document") { + item.selectType = "pptx" + + } + console.log(item); + 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"); //鎻愮ず鍔犺浇涓� util.showLoading(); // 鍗曟涓嬭浇鍏佽鐨勬渶澶ф枃浠朵负 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) { @@ -183,8 +244,9 @@ return false; } var Path = res.tempFilePath; //杩斿洖鐨勬枃浠朵复鏃跺湴鍧�锛岀敤浜庡悗闈㈡墦寮�鏈湴棰勮鎵�鐢� + let data = res.filePath; wx.openDocument({ - filePath: Path, + filePath: data, showMenu: true, success: function (res) { console.log("鎵撳紑鎴愬姛"); @@ -197,81 +259,11 @@ util.hideLoadingWithErrorTips(); }, }); + + + + } - - - - - - - - - - - - - - - - - - - - - - - - // if (item.selectType == "document" || item.selectType == "pdf") { - // const fileLink = app.config.requestCtx + "/file/api/ApiDownload?md5=" + item.file; - - // let filePath = wx.env.USER_DATA_PATH + '/' + item.name - // console.log(filePath, 'filePath'); - // //鎻愮ず鍔犺浇涓� - // util.showLoading(); - // // 鍗曟涓嬭浇鍏佽鐨勬渶澶ф枃浠朵负 200MB - // wx.downloadFile({ - // url: fileLink, - // success: function (res) { - - // if (res.statusCode != 200) { - // util.hideLoadingWithErrorTips(); - // return false; - // } - // var Path = res.tempFilePath; //杩斿洖鐨勬枃浠朵复鏃跺湴鍧�锛岀敤浜庡悗闈㈡墦寮�鏈湴棰勮鎵�鐢� - - // wx.saveFile({ - // tempFilePath: Path, - // success: function (res) { - // var savedFilePath = res.savedFilePath; - // // 灏嗘枃浠朵繚瀛樹负 item.name - // wx.saveFile({ - // tempFilePath: savedFilePath, - // filePath: wx.env.USER_DATA_PATH + '/' + item.name, - // success: function (res) { - // wx.openDocument({ - // filePath: res.savedFilePath, - // showMenu: true, - // success: function (res) { - // util.hideLoading(); - // }, - // }); - // }, - // fail: function (err) { - // util.hideLoadingWithErrorTips(); - // } - // }); - // }, - // fail: function (err) { - // util.hideLoadingWithErrorTips(); - // } - // }); - // }, - // fail: function (err) { - // util.hideLoadingWithErrorTips(); - // }, - // }); - // } - @@ -282,6 +274,16 @@ }); console.log(this.data.webpageSrc, "webpageSrc"); } + + + + + + + + + + } }, @@ -600,7 +602,6 @@ item.isShopCar = false this.triggerEvent("updateCloudLearning") } - } }, sadd() { -- Gitblit v1.9.1