| | |
| | | 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"); |
| | |
| | | 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: '暂无资源', |
| | |
| | | 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") { |
| | | <<<<<<< Updated upstream |
| | | ======= |
| | | |
| | | // debugger |
| | | >>>>>>> Stashed changes |
| | | if (item.selectType == "pdf" || item.selectType == "document") { |
| | | const fileLink = item.file ? item.file : item.freeFile |
| | | console.log(fileLink); |
| | | wx.navigateTo({ |
| | |
| | | fileLink + |
| | | "&fileName=" + |
| | | item.name + |
| | | "&fileType=" + |
| | | item.selectType + "&bookBuy=true" |
| | | <<<<<<< Updated upstream |
| | | "&fileType=pdf" + |
| | | "&bookBuy=true" |
| | | ======= |
| | | "&fileType=pdf" + "&bookBuy=true" |
| | | >>>>>>> Stashed changes |
| | | }); |
| | | } |
| | | 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, |