From 9cc35aa83764cb91436750db66e9868c99c1de90 Mon Sep 17 00:00:00 2001 From: yiming <m13691596795@163.com> Date: 星期一, 29 四月 2024 13:14:50 +0800 Subject: [PATCH] 标题bug1 --- packageBookService/pages/bookServices/detail/components/tree/index.js | 75 ++++++++++++++++++++++++++++--------- 1 files changed, 56 insertions(+), 19 deletions(-) diff --git a/packageBookService/pages/bookServices/detail/components/tree/index.js b/packageBookService/pages/bookServices/detail/components/tree/index.js index 21592ed..379c69a 100644 --- a/packageBookService/pages/bookServices/detail/components/tree/index.js +++ b/packageBookService/pages/bookServices/detail/components/tree/index.js @@ -58,6 +58,7 @@ selectAll: [], shoppingCart: true, stop: false, + cart: true }, ready() {}, @@ -131,18 +132,11 @@ goPlayer(e) { // 妫�鏌ョ櫥褰曠姸鎬� const token = wx.getStorageSync(app.config.tokenKey); - if (!token) { - loginInfo(app, (data) => { - // 濡傛灉涓嶆槸绗竴娆$櫥褰曪紝浼氭墽琛屽洖璋� - if (data) { - // 鐧诲綍鎴愬姛锛岃嚜鍔ㄨ褰晅oken鍜岀敤鎴蜂俊鎭紝骞惰繑鍥瀟rue - } else { - // 鍑虹幇閿欒锛岃繑鍥瀎alse - } - }); - } else { + 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; @@ -167,18 +161,48 @@ "璇峰厛璐拱璇ヨ祫婧�" : "璇峰厛鐐瑰嚮棰嗗彇鏌ョ湅鎸夐挳", }); } + 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=${parent.productLinkPath}&parentName=${parent.name}&activeId=${item.id}&bookId=${this.properties.bookInfo.id}&bookName=${this.properties.bookInfo.name}&cmsId=${this.properties.bookInfo.rootCmsItemId}`, + 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}`, }); + + console.log(item, '7899'); if (item.selectType == "document" || item.selectType == "pdf") { - const fileLink = - app.config.requestCtx + "/file/api/ApiDownload?md5=" + item.file; + // 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, // 鍦板潃宸叉墦鐮侊紝鑷繁鎹釜鍏朵粬鐨勫湴鍧�锛�"https://www.xxxxx.com/file/娴嬭瘯閫氱煡.pdf"锛� + 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) { @@ -186,8 +210,9 @@ return false; } var Path = res.tempFilePath; //杩斿洖鐨勬枃浠朵复鏃跺湴鍧�锛岀敤浜庡悗闈㈡墦寮�鏈湴棰勮鎵�鐢� + let data = res.filePath; wx.openDocument({ - filePath: Path, + filePath: data, showMenu: true, success: function (res) { console.log("鎵撳紑鎴愬姛"); @@ -201,6 +226,10 @@ }, }); } + + + + if (item.selectType == "webpage") { this.setData({ webpageSrc: item.jsek_link, @@ -209,6 +238,7 @@ } } }, + // 鎷垮埌鎵�鏈夐」 getAllChildren(id) { let result = []; @@ -478,6 +508,9 @@ // 鍔犲叆璐墿杞� async onCloudShoppingCart(e) { let shoppingCartGetId = []; + + const item = e.currentTarget.dataset.item + console.log(item.isShopCar); const saleMethodId = e.currentTarget.dataset.item.saleMethod[0].Id; console.log(saleMethodId); let query = { @@ -513,10 +546,14 @@ }; const addRes = await app.MG.store.addShoppingCart(query); console.log(addRes, "addRes"); - wx.showToast({ - icon: "success", - title: "娣诲姞鎴愬姛", - }); + if (addRes) { + wx.showToast({ + icon: "success", + title: "娣诲姞鎴愬姛", + }); + item.isShopCar = false + this.triggerEvent("updateCloudLearning") + } } }, sadd() { -- Gitblit v1.9.1