From 5ba3101a9c2047e8b772a0879f205691d5f28b37 Mon Sep 17 00:00:00 2001 From: unknown <qq1940665526@163.com> Date: 星期二, 25 六月 2024 10:59:12 +0800 Subject: [PATCH] 优化 --- src/books/sportsAndHealth/css/default.less | 33 ---------------- src/components/pdfview/index.vue | 41 ++++++++++++++++++-- src/App.vue | 2 3 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/App.vue b/src/App.vue index 58ee2a9..07b117e 100644 --- a/src/App.vue +++ b/src/App.vue @@ -65,7 +65,7 @@ process.env.VUE_APP_RESOURCE_CTX + (process.env.VUE_APP_ENV == "product" ? process.env.VUE_APP_BOOK_ID - : "mathBook") + : "sportsAndHealth") ); // 娴嬭瘯璇曡30椤� // this.activeBook.tryPageCount = 10; diff --git a/src/books/sportsAndHealth/css/default.less b/src/books/sportsAndHealth/css/default.less index 92ba479..a31699e 100644 --- a/src/books/sportsAndHealth/css/default.less +++ b/src/books/sportsAndHealth/css/default.less @@ -1964,39 +1964,6 @@ } } -.preview { - width: 100%; - height: 100%; - - .imageBox { - height: calc(100% - 30px); - overflow-x: hidden; - overflow-y: auto; - background: #ccc; - box-sizing: border-box; - } - - .imageBox:hover { - cursor: zoom-in !important; - } - - .bottom_tool { - height: 30px; - background-color: rgba(0, 0, 0, 0.8); - display: flex; - justify-content: flex-end; - align-items: center; - svg { - margin-right: 15px; - fill: #d1d1d1; - } - svg:hover { - fill: #fff; - cursor: pointer; - } - } -} - .custom-dialog { overflow: hidden !important; diff --git a/src/components/pdfview/index.vue b/src/components/pdfview/index.vue index ff893e8..8c620be 100644 --- a/src/components/pdfview/index.vue +++ b/src/components/pdfview/index.vue @@ -78,7 +78,9 @@ window.open(await getResourcePath(this.preViewMd5)); }, domViewer() { - let ele = document.getElementById("imageParent"); + let ele = (this.container ? this.container : document).getElementById( + "imageParent" + ); this.viewerCon = new Viewer(ele, { inline: false, container: this.container @@ -90,12 +92,12 @@ }); }, clearDom() { - let ele = document.getElementById("imageParent"); + let ele = (this.container ? this.container : document).getElementById("imageParent"); ele.innerHtml = ""; }, createDom(page) { var that = this; - let ele = document.getElementById("imageParent"); + let ele = (this.container ? this.container : document).getElementById("imageParent"); const img = document.createElement("img"); img.src = this.getPageImage(page); img.alt = ""; @@ -110,7 +112,7 @@ }, scrollBottom() { var that = this; - var ele = document.getElementById("imageParent"); + var ele = (this.container ? this.container : document).getElementById("imageParent"); ele.addEventListener("scroll", function () { // 璁$畻婊氬姩鏉¤窛绂诲簳閮ㄧ殑浣嶇疆 const scrollBottom = @@ -153,5 +155,36 @@ }; </script> <style scoped lang="less"> +.preview { + width: 100%; + height: 100%; + .imageBox { + height: calc(100% - 30px); + overflow-x: hidden; + overflow-y: auto; + background: #ccc; + box-sizing: border-box; + } + + .imageBox:hover { + cursor: zoom-in !important; + } + + .bottom_tool { + height: 30px; + background-color: rgba(0, 0, 0, 0.8); + display: flex; + justify-content: flex-end; + align-items: center; + svg { + margin-right: 15px; + fill: #d1d1d1; + } + svg:hover { + fill: #fff; + cursor: pointer; + } + } +} </style> -- Gitblit v1.9.1