From aa2c08b3be23a01d44205b2c19d21a2bf53f944f Mon Sep 17 00:00:00 2001 From: 闫增涛 <1829501689@qq.com> Date: 星期一, 01 四月 2024 16:15:38 +0800 Subject: [PATCH] 图书服务列表、详情页bug修改 --- packageBookService/pages/components/webView/index.js | 79 +++++++++++++++++++++++++++++++-------- 1 files changed, 63 insertions(+), 16 deletions(-) diff --git a/packageBookService/pages/components/webView/index.js b/packageBookService/pages/components/webView/index.js index 452b945..797d971 100644 --- a/packageBookService/pages/components/webView/index.js +++ b/packageBookService/pages/components/webView/index.js @@ -10,6 +10,8 @@ link: false, epubObj: null, currentPage: '', + pdfList: [], + skeletonLoding: true, }, /** @@ -27,8 +29,10 @@ src: '' }) if (options) { + console.log(options) wx.setNavigationBarTitle({ title: options.fileName, + skeletonLoding: true }) this.getProgress(options) } @@ -44,19 +48,62 @@ }, setWebViewSrc: function (data) { - var url = app.config.epubUrl + - "?md5=" + - data.md5 + - "&bookName=" + - data.fileName + - "&url=" + app.config.requestCtx + - "&token=" + - wx.getStorageSync(app.config.tokenKey) + - "&recordLocation=" + - this.data.currentPage - this.setData({ - src: url - }) + let that = this; + var url = ""; + if (data.fileType == 'epub') { + if (data.bookBuy) { + url = app.config.epubUrl + + "?md5=" + + data.md5 + + "&bookName=" + + data.fileName + + "&url=" + app.config.requestCtx + + "&token=" + + wx.getStorageSync(app.config.tokenKey) + + "&recordLocation=" + + this.data.currentPage + } else { + url = app.config.epubUrl + + "?md5=" + + data.md5 + + "&bookName=" + + data.fileName + + "&url=" + app.config.requestCtx + + "&token=" + + wx.getStorageSync(app.config.tokenKey) + + "&recordLocation=" + + this.data.currentPage + "&freeEpubPage=" + data.freePage + } + this.setData({ + src: url, + skeletonLoding: false, + }) + } else { + this.setData({ + navigationBarTitleText: data.fileName + }) + app.MG.file.getPdfInfo({ + md5: data.md5 + }).then((res) => { + let pageCount = data.bookBuy ? res.totalPages : Number(data.freePage) + + if (pageCount) { + let list = []; + + for (let i = 0; i < pageCount; i++) { + const src = app.config.requestCtx + '/file/GetPdfPageImage?md5=' + data.md5 + '&index=' + (i + 1) + '&dpi=300' + list.push(src) + } + console.log(list) + this.setData({ + pdfList: list, + skeletonLoding: false, + }) + + } + }) + } + }, @@ -96,9 +143,9 @@ domain: "bookReadProgress", key: this.data.epubObj.md5, value: JSON.stringify(data), - },], + }, ], }) - .then((res) => { }); + .then((res) => {}); } }, @@ -108,7 +155,7 @@ percentage, type } = - e.detail.data[0]; + e.detail.data[0]; if (type == "progress" && type != "backDetail") { this.setProgress({ page: currentLocation, -- Gitblit v1.9.1