From e38c14de9637d22d0a35ae06bede82dcf31b64ec Mon Sep 17 00:00:00 2001 From: YM <479443481@qq.com> Date: 星期二, 10 九月 2024 16:52:58 +0800 Subject: [PATCH] 1 --- packageBookService/pages/bookServices/detail/components/tree/index.js | 149 ++++++++++++++----------------------------------- 1 files changed, 44 insertions(+), 105 deletions(-) diff --git a/packageBookService/pages/bookServices/detail/components/tree/index.js b/packageBookService/pages/bookServices/detail/components/tree/index.js index 332d2d4..fd3b476 100644 --- a/packageBookService/pages/bookServices/detail/components/tree/index.js +++ b/packageBookService/pages/bookServices/detail/components/tree/index.js @@ -140,53 +140,17 @@ 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"); const parentName = parent ? parent.name : "鏁欏璧勬簮"; - let url; - if (item.selectType == "webpage") { - // 缃戦〉绫诲瀷璺宠浆鍒扮綉鍧�澶嶅埗椤碉紝鍥犱负url浼犲弬涓嶈兘浼� 甯﹀弬鏁扮殑缃戠粶鍦板潃锛屾墍浠ユ澶勮鎶婄綉缁滃湴鍧�閲岀殑浼犲弬鎽樺嚭鏉ワ紝鏀惧埌url閲� - let urlData = '' - const flags = item.jsek_link.indexOf("?") - if (flags > -1) { - urlData = item.jsek_link.slice(flags + 1, item.jsek_link.length) - } - url = '/packageBookService/pages/bookServices/linkPage/index' - return wx.navigateTo({ - url: urlData ? url + `?path=${item.jsek_link.slice(0,flags)}` + '&' + urlData : url + `?path=${item.jsek_link}` - }) - } else if (item.selectType == 'zip') { - if (this.properties.applyState == 'Normal') { - return wx.showToast({ - icon: 'error', - title: '璇峰墠寰�PC绔笅杞�', - }) - } else { - return wx.showToast({ - icon: 'error', - title: '璇峰厛鐢宠涓嬭浇', - }) - } - } if (this.properties.isShowCheck && this.resourceIsBuy(item)) { return false; } - if (item.selectType == "video" || item.learnSelectType == "video") { - url = "/packageDomain/pages/resourceDetails/myVideo/index"; - } else if ( - item.selectType == "audio" || - item.learnSelectType == "audio" - ) { - url = "/packageDomain/pages/resourceDetails/myAudio/index"; - } else if (item.selectType == "picture") { - url = "/packageDomain/pages/resourceDetails/document/index"; - } + if ( this.properties.tab == "jsek_cloudLearning" && this.resourceIsBuy(item) - // item.saleMethod.length > 0 ) { return wx.showToast({ icon: "error", @@ -194,16 +158,8 @@ "璇峰厛璐拱璇ヨ祫婧�" : "璇峰厛鐐瑰嚮棰嗗彇鏌ョ湅鎸夐挳", }); } - // 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") { @@ -218,67 +174,50 @@ title: '鏆傛棤璧勬簮', }) } + + if (item.selectType == 'zip') { + if (this.properties.applyState == 'Normal') { + return wx.showToast({ + icon: 'error', + title: '璇峰墠寰�PC绔笅杞�', + }) + } else { + return wx.showToast({ + icon: 'error', + title: '璇峰厛鐢宠涓嬭浇', + }) + } + } + + let url; + if (item.selectType == "webpage") { + // 缃戦〉绫诲瀷璺宠浆鍒扮綉鍧�澶嶅埗椤碉紝鍥犱负url浼犲弬涓嶈兘浼� 甯﹀弬鏁扮殑缃戠粶鍦板潃锛屾墍浠ユ澶勮鎶婄綉缁滃湴鍧�閲岀殑浼犲弬鎽樺嚭鏉ワ紝鏀惧埌url閲� + let urlData = '' + const flags = item.jsek_link.indexOf("?") + if (flags > -1) { + urlData = item.jsek_link.slice(flags + 1, item.jsek_link.length) + } + url = '/packageBookService/pages/bookServices/linkPage/index' + return wx.navigateTo({ + url: urlData ? url + `?path=${item.jsek_link.slice(0,flags)}` + '&' + urlData : url + `?path=${item.jsek_link}` + }) + } + + if (item.selectType == "video" || item.learnSelectType == "video") { + url = "/packageDomain/pages/resourceDetails/myVideo/index"; + } + if ( + item.selectType == "audio" || + item.learnSelectType == "audio" + ) { + url = "/packageDomain/pages/resourceDetails/myAudio/index"; + } + if (item.selectType == "picture") { + url = "/packageDomain/pages/resourceDetails/document/index"; + } 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}`, }); - - // debugger - if (item.selectType == "pdf" || item.selectType == "document") { - 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=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 == "webpage") { - // this.setData({ - // webpageSrc: item.jsek_link, - // }); - // } } }, -- Gitblit v1.9.1