From 75a9abca4f4cf0ebe579705abc369489cfe20e7c Mon Sep 17 00:00:00 2001 From: litian <C21AF165> Date: 星期五, 28 六月 2024 11:16:37 +0800 Subject: [PATCH] 小程序,课程 --- pages/index/resourceCover.js | 30 +++++++----------------------- 1 files changed, 7 insertions(+), 23 deletions(-) diff --git a/pages/index/resourceCover.js b/pages/index/resourceCover.js index 79f79e8..22d3fb3 100644 --- a/pages/index/resourceCover.js +++ b/pages/index/resourceCover.js @@ -79,7 +79,7 @@ book.learnSelectType == "audio" ) { url = "/packageDomain/pages/resourceDetails/myAudio/index"; - } else if (book.selectType == "picture" || book.selectType == "zip") { + } else if (book.selectType == "picture") { url = "/packageDomain/pages/resourceDetails/document/index"; } this.setData({ @@ -91,22 +91,21 @@ formPath: book.learnSelectType ? 'jsek_cloudLearning' : '' }) wx.redirectTo({ - url: `${url}?productLinkPath=${this.data.productLinkPath}&parentProductLinkPath=${this.data.parentProductLinkPath}&bookId=${book.productLinkInfo.ProductId}&bookName=${book.productLinkInfo.Name}&cmsId=${book.id}&storeInfo=${book.storeInfo}&formPath=${this.data.formPath}`, + url: `${url}?productLinkPath=${this.data.productLinkPath}&parentProductLinkPath=${this.data.parentProductLinkPath}&bookId=${book.productLinkInfo.ProductId}&activeId=${book.id}&bookName=${book.productLinkInfo.Name}&cmsId=${book.id}&storeInfo=${book.storeInfo}&formPath=${this.data.formPath}`, }); - if (book.selectType == "pdf") { + if (book.selectType == "pdf" || book.selectType == 'document') { const fileLink = book.file ? book.file : book.freeFile console.log(fileLink); - wx.navigateTo({ + wx.redirectTo({ url: "/packageBookService/pages/components/webView/index?md5=" + fileLink + "&fileName=" + book.name + - "&fileType=" + - book.selectType + "&bookBuy=true" + "&fileType=pdf" + "&bookBuy=true" }); } - if (book.selectType == 'document') { + if (book.selectType == 'zip') { const fileLink = book.file ? app.config.requestCtx + "/file/api/ApiDownload?md5=" + book.file : app.config.requestCtx + @@ -121,24 +120,9 @@ 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(); - }, + } }); } }) -- Gitblit v1.9.1