From b77e8e776af4d81e748e9e21d51b64a11085a195 Mon Sep 17 00:00:00 2001 From: zhongshujie <2862698242@qq.com> Date: 星期四, 19 十二月 2024 10:49:11 +0800 Subject: [PATCH] 未提交退出提示 --- packageDomain/pages/resourceDetails/document/index.js | 56 +++++++++++++++++++++++++++++++------------------------- 1 files changed, 31 insertions(+), 25 deletions(-) diff --git a/packageDomain/pages/resourceDetails/document/index.js b/packageDomain/pages/resourceDetails/document/index.js index c33b79b..ab77867 100644 --- a/packageDomain/pages/resourceDetails/document/index.js +++ b/packageDomain/pages/resourceDetails/document/index.js @@ -29,6 +29,7 @@ showData: '', titleName: '', selectType: '', + learnSelectType: '', zipData: '', naturalResources: [], titleName: '', @@ -41,6 +42,7 @@ distance: 0, //璁板綍鎵嬫寚绉诲姩璺濈 scale: 1, //瀹氫箟鍒濆鍖栫殑椤甸潰缂╂斁澶у皬 newScale: 1, //璁板綍鏂扮殑椤甸潰缂╂斁澶у皬 + pdfSrc: '' }, /** * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇 @@ -49,7 +51,6 @@ wx.setNavigationBarTitle({ title: '璧勬簮璇︽儏' }); - console.log(options); const systInfo = wx.getSystemInfoSync(); const menu = wx.getMenuButtonBoundingClientRect(); // 鑳跺泭淇℃伅 const navBarHeight = (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 瀵艰埅鏍忛珮搴� @@ -79,7 +80,6 @@ } else { this.resourceDetailsData() } - }, /** @@ -105,7 +105,7 @@ this.setData({ pauseTime: Date.now() }) - if (wx.getStorageSync(app.config.tokenKey) && epubObj && epubObj.bookBuy) { + if (wx.getStorageSync(app.config.tokenKey)) { let duration = this.data.pauseTime - this.data.startTime this.count(duration) } @@ -118,7 +118,7 @@ this.setData({ pauseTime: Date.now() }) - if (wx.getStorageSync(app.config.tokenKey) && epubObj && epubObj.bookBuy) { + if (wx.getStorageSync(app.config.tokenKey)) { let duration = this.data.pauseTime - this.data.startTime this.count(duration) } @@ -152,9 +152,7 @@ /** * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁� */ - onReachBottom() { - - }, + onReachBottom() {}, /** * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜� @@ -197,13 +195,13 @@ query.storeInfo = this.data.storeInfo } app.MG.store.getProductDetail(query).then((res) => { - console.log(res); res.datas.cmsDatas[0].datas.forEach((item) => { if (this.data.productLinkPath == item.productLinkPath) { this.handleTeachData(item) this.setData({ titleName: item.name, - selectType: item.selectType + selectType: item.selectType, + learnSelectType: item.learnSelectType }) } }) @@ -221,14 +219,15 @@ }) } } - if (!item || !item.file) { + if (!item || !item.file || !item.protectedFile) { wx.showToast({ title: '鏂囦欢淇℃伅缂哄け', icon: 'none' }); return; } - const downloadUrl = app.config.requestCtx + '/file/api/ApiDownload?md5=' + item.file; + let file = item.file ? item.file : item.protectedFile + const downloadUrl = app.config.requestCtx + '/file/api/ApiDownload?md5=' + file; wx.showLoading({ title: '姝e湪涓嬭浇...', }); @@ -286,36 +285,46 @@ //鍒氳繘鏉ョ殑鏃跺�欒皟鐢� handleTeachData(item) { //鍥剧墖 - - if (item.selectType == 'picture') { + if (item.selectType == 'picture' || item.learnSelectType == 'picture') { + let file = item.file ? item.file : item.protectedFile ? item.protectedFile : item.freeFile this.setData({ - showData: item.file ? app.config.requestCtx + '/file/api/ApiDownload?md5=' + item.file : app.config.requestCtx + '/file/api/ApiDownload?md5=' + item.freeFile, + showData: app.config.requestCtx + '/file/api/ApiDownload?md5=' + file, }) wx.hideLoading(); } // 涓嬭浇鏂囦欢zip - if (item.selectType == 'zip') { + if (item.selectType == 'zip' || item.learnSelectType == 'zip') { this.setData({ zipData: item }) wx.hideLoading(); } //缃戦〉 - if (item.selectType == 'webpage') { + if (item.selectType == 'webpage' || item.learnSelectType == 'webpage') { this.setData({ webpageSrc: item.jsek_link }) wx.hideLoading(); } + // if (item.selectType == 'pdf') { + // console.log('pdf', item); + // wx.hideLoading() + // let md5 = item.file ? item.file : item.freeFile + // let pdfSrc = app.config.pdfUrl + "?MD5=" + md5 + "&url=" + app.config.requestCtx + '¤tPage=' + "1" + "&isPreview=" + false + "&warterMark=" + "鍖椾含甯堣寖澶у鍑虹増绀�" + "&previewPages=" + 30 + "&token=" + wx.getStorageSync(app.config.tokenKey) + // this.setData({ + // pdfSrc: pdfSrc + // }) + // } //鏂囨。绛� - if (item.selectType == 'pdf' || item.selectType == 'document') { + if (item.selectType == 'document' || item.selectType == 'pdf' || item.learnSelectType == 'document' || item.learnSelectType == 'pdf') { + let md5 = item.file ? item.file : item.protectedFile ? item.protectedFile : item.freeFile app.MG.file.getPdfInfo({ - md5: item.file + md5: md5 }).then((res) => { let naturalResources = [] - if (res && JSON.parse(res).totalPages) { - for (let i = 0; i < JSON.parse(res).totalPages; i++) { - const src = app.config.requestCtx + '/file/GetPdfPageImage?md5=' + item.file + '&index=' + (i + 1) + '&dpi=300' + if (res && res.totalPages) { + for (let i = 0; i < res.totalPages; i++) { + const src = app.config.requestCtx + '/file/GetPdfPageImage?md5=' + md5 + '&index=' + (i + 1) + '&dpi=300' naturalResources.push(src) } } @@ -330,9 +339,7 @@ handleTap: function () { const naturalResources = this.data.naturalResources; - naturalResources.forEach(function (item) { - // console.log(item); - }); + naturalResources.forEach(function (item) {}); }, onClick() { @@ -368,7 +375,6 @@ const { trigger } = e.detail; - console.log(trigger); this.setData({ visible: false, }); -- Gitblit v1.9.1