| | |
| | | <template> |
| | | <div class="page-main" @scroll="throttledScrollHandler"> |
| | | <div |
| | | class="page-content" |
| | | :style="{ |
| | | fontSize: fontSize ? fontSize + 'px' : '16px', |
| | | transform: `scale(${pageZoom ? pageZoom : 1})`, |
| | | transformOrigin: 'center top', |
| | | }" |
| | | > |
| | | <pageHeader |
| | | v-if="showCatalogList.indexOf(1) > -1" |
| | | :showPageList="loadPageList" |
| | | ></pageHeader> |
| | | <chapterOne |
| | | @initViewer="initViewer" |
| | | v-if="showCatalogList.indexOf(2) > -1" |
| | | :showPageList="loadPageList" |
| | | ></chapterOne> |
| | | <!-- <chapterTwo |
| | | @initViewer="initViewer" |
| | | v-if="showCatalogList.indexOf(3) > -1" |
| | | :showPageList="loadPageList" |
| | | ></chapterTwo> |
| | | <chapterThree |
| | | @initViewer="initViewer" |
| | | v-if="showCatalogList.indexOf(4) > -1" |
| | | :showPageList="loadPageList" |
| | | ></chapterThree> |
| | | <chapterFour |
| | | @initViewer="initViewer" |
| | | v-if="showCatalogList.indexOf(5) > -1" |
| | | :showPageList="loadPageList" |
| | | ></chapterFour> |
| | | <chapterFive |
| | | @initViewer="initViewer" |
| | | v-if="showCatalogList.indexOf(6) > -1" |
| | | :showPageList="loadPageList" |
| | | ></chapterFive> |
| | | <chapterSix |
| | | @initViewer="initViewer" |
| | | v-if="showCatalogList.indexOf(7) > -1" |
| | | :showPageList="loadPageList" |
| | | ></chapterSix> |
| | | <chapterSeven |
| | | @initViewer="initViewer" |
| | | v-if="showCatalogList.indexOf(8) > -1" |
| | | :showPageList="loadPageList" |
| | | ></chapterSeven> |
| | | <chapterEight |
| | | @initViewer="initViewer" |
| | | v-if="showCatalogList.indexOf(9) > -1" |
| | | :showPageList="loadPageList" |
| | | ></chapterEight> --> |
| | | |
| | | <div id="searchDomBox" style="display: none"> |
| | | <div id="searchContent"></div> |
| | | </div> |
| | | <!-- <miniAudio |
| | | :path="audioPath" |
| | | :currentTime="currentTime" |
| | | @closeMiniAudio="closeMiniAudio" |
| | | ref="audioPlayer" |
| | | > |
| | | </miniAudio> --> |
| | | <div class="page-content" :style="{ |
| | | fontSize: fontSize ? fontSize + 'px' : '18px', |
| | | transform: `scale(${pageZoom ? pageZoom : 1})`, |
| | | transformOrigin: 'center top', |
| | | }"> |
| | | <pageHeader v-if="showCatalogList.indexOf(1) > -1" :showPageList="loadPageList"></pageHeader> |
| | | <chapterOne v-if="showCatalogList.indexOf(2) > -1" :showPageList="loadPageList"></chapterOne> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import pageHeader from "./header.vue"; |
| | | import chapterOne from "./chapter001.vue"; |
| | | // import chapterTwo from "./chapter002.vue"; |
| | | // import chapterThree from "./chapter003.vue"; |
| | | // import chapterFour from "./chapter004.vue"; |
| | | // import chapterFive from "./chapter005.vue"; |
| | | // import chapterSix from "./chapter006.vue"; |
| | | // import chapterSeven from "./chapter007.vue"; |
| | | // import chapterEight from "./chapter008.vue"; |
| | | import miniAudio from "@/components/miniAudio/index.vue"; |
| | | import NoteIcon from "@/assets/images/biji.png"; |
| | | import _ from "lodash"; |
| | | import Swiper from "swiper/bundle"; |
| | |
| | | import Viewer from "viewerjs"; |
| | | import "viewerjs/dist/viewer.css"; |
| | | export default { |
| | | name: "pageContent", |
| | | data() { |
| | | return { |
| | | catalogLength: 2, // 总章节数 |
| | |
| | | }, |
| | | computed: { |
| | | fontSize() { |
| | | this.transformDom(this.$store.state.qiankun.fontSize) |
| | | return this.$store.state.qiankun.fontSize; |
| | | }, |
| | | pageZoom() { |
| | |
| | | this.initSwiper(); |
| | | this.initViewer(); |
| | | this.closeAudio(); |
| | | this.saveWord() |
| | | this.closeVideo(); |
| | | }, 200); |
| | | }, |
| | | }, |
| | |
| | | }, 500); |
| | | |
| | | // 测试页面跳转 |
| | | // setTimeout(() => { |
| | | // this.gotoPage(5,69); |
| | | // setTimeout(() => { |
| | | // this.gotoPage(6, 30); |
| | | // setTimeout(() => { |
| | | // this.renderSign("Highlight", { |
| | | // id: "2ACA9359", |
| | |
| | | // ids: ["2ACA9359"] |
| | | // }); |
| | | // }, 2000); |
| | | // }, 5000); |
| | | // }, 500); |
| | | |
| | | // const pageDom = (this.container ? this.container : document) |
| | | // .querySelector("#app") |
| | |
| | | // txt: " 运动系统是由骨、骨连结和骨骼肌三部分组成的。全身的骨通过骨连结组成人体骨骼(见图1-1)。骨骼是人体的支架,具有保护内脏器官、供肌肉附着和作为肌肉运动的杠杆等作用。在神经系统的支配下,肌肉收缩牵动所附着的骨绕着关节转动,使身体产生各种动作。所以,运动系统具有运动、支持和保护等功能,幼年时期的骨骼还具有造血功能。 ", |
| | | // txtIndex: 57 |
| | | // }); |
| | | // }, 50); |
| | | // }, 500); |
| | | }, |
| | | methods: { |
| | | // setZoom1() { |
| | |
| | | // }, |
| | | // 滚动监听 |
| | | scrollFun(event) { |
| | | this.handleVideoPicture() |
| | | // 判断向上滚动还是向下滚动 |
| | | console.log(11); |
| | | |
| | | if (event.target.scrollTop > this.previousScrollTop) { |
| | | this.getAduio(); |
| | | // 向下 |
| | |
| | | event.target.scrollHeight - this.loadThreshold |
| | | ) { |
| | | console.log(1); |
| | | |
| | | |
| | | debugger |
| | | // 到达阈值 |
| | | if ( |
| | |
| | | page && pageThemeColor && pageThemeColor[page] |
| | | ? pageThemeColor[page] |
| | | : chapterNum && chapterThemeColor && chapterThemeColor[chapterNum] |
| | | ? chapterThemeColor[chapterNum] |
| | | : bookThemeColor; |
| | | ? chapterThemeColor[chapterNum] |
| | | : bookThemeColor; |
| | | if (themeColor) { |
| | | domItem.style.color = themeColor; |
| | | } |
| | |
| | | page && pageThemeColor && pageThemeColor[page] |
| | | ? pageThemeColor[page] |
| | | : chapterNum && chapterThemeColor && chapterThemeColor[chapterNum] |
| | | ? chapterThemeColor[chapterNum] |
| | | : bookThemeColor; |
| | | ? chapterThemeColor[chapterNum] |
| | | : bookThemeColor; |
| | | if (themeColor) { |
| | | domItem.style.backgroundColor = themeColor; |
| | | } |
| | |
| | | page && pageThemeColor && pageThemeColor[page] |
| | | ? pageThemeColor[page] |
| | | : chapterNum && chapterThemeColor && chapterThemeColor[chapterNum] |
| | | ? chapterThemeColor[chapterNum] |
| | | : bookThemeColor; |
| | | ? chapterThemeColor[chapterNum] |
| | | : bookThemeColor; |
| | | if (themeColor) { |
| | | domItem.style.borderColor = themeColor; |
| | | } |
| | | }); |
| | | }, |
| | | getParentWithClass(element, className) { |
| | | console.log(element, className, "element, className"); |
| | | while (element.parentElement) { |
| | | element = element.parentElement; |
| | | if (element.classList.contains(className)) { |
| | |
| | | prevEl: dom.querySelector(".swiper-button-prev"), |
| | | }, |
| | | // 窗口变化,重新init,针对F11全屏和放大缩小,必须加 |
| | | observer: true, |
| | | observeParents: true, |
| | | // observer: true, |
| | | // observeParents: true |
| | | // // 如果需要分页器 |
| | | // pagination: { |
| | | // el: (this.container ? this.container : document).querySelector( |
| | |
| | | const pageData = { |
| | | pageHeader, |
| | | chapterOne, |
| | | // chapterTwo, |
| | | // chapterThree, |
| | | // chapterFour, |
| | | // chapterFive, |
| | | // chapterSix, |
| | | // chapterSeven, |
| | | // chapterEight, |
| | | }; |
| | | // 遍历所有章节文件 |
| | | for (const key in pageData) { |
| | |
| | | // 记录高亮信息 |
| | | this.highlightData = data; |
| | | // 跳转 |
| | | this.gotoPage(data.catalog, data.page, () => {}); |
| | | }, |
| | | // 点击事件:将生僻单词传给 主应用 从而调用词典功能 |
| | | // saveCharacters(event, word) { |
| | | // if (this.$store.state.qiankun && this.$store.state.qiankun.chooseWords) { |
| | | // this.$store.state.qiankun.chooseWords({ |
| | | // type: "word", |
| | | // word, |
| | | // x: event.pageX, |
| | | // y: event.pageY, |
| | | // }); |
| | | // } |
| | | // }, |
| | | saveWord() { |
| | | const doms = ( |
| | | this.container ? this.container : document |
| | | ).querySelectorAll(".word-bc"); |
| | | for (let index = 0; index < doms.length; index++) { |
| | | const dom = doms[index]; |
| | | dom.addEventListener('click',(e) => { |
| | | let word = null |
| | | dom.getAttribute('word') ? word = dom.getAttribute('word') : word = e.srcElement.innerText |
| | | console.log('单词',word) |
| | | if (this.$store.state.qiankun && this.$store.state.qiankun.chooseWords) { |
| | | this.$store.state.qiankun.chooseWords({ |
| | | type: "word", |
| | | word, |
| | | x: e.pageX, |
| | | y: e.pageY, |
| | | }); |
| | | } |
| | | }) |
| | | } |
| | | this.gotoPage(data.catalog, data.page, () => { }); |
| | | }, |
| | | // 页面向下滚动,音频小窗播放功能 |
| | | getAduio() { |
| | |
| | | }); |
| | | } |
| | | }, |
| | | // 点击视频关闭其他 |
| | | closeVideo() { |
| | | let allVideo = ( |
| | | this.container ? this.container : document |
| | | ).querySelectorAll(".video"); |
| | | for (let index = 0; index < allVideo.length; index++) { |
| | | const item = allVideo[index]; |
| | | item.addEventListener("playing", (item) => { |
| | | const path = item.srcElement.src; |
| | | const videoList = Array.from(allVideo); |
| | | for (let cindex = 0; cindex < videoList.length; cindex++) { |
| | | const citem = videoList[cindex]; |
| | | if (citem.currentSrc != path && path) { |
| | | citem.pause(); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }, |
| | | // 视频小窗 |
| | | handleVideoPicture() { |
| | | let doms = ( |
| | | this.container ? this.container : document |
| | | ).querySelectorAll(".video"); |
| | | doms = Array.from(doms) |
| | | if (!doms.length) return false |
| | | const playVudio = doms |
| | | .reverse() |
| | | .find((item) => item.paused == false); |
| | | if (playVudio) { |
| | | const bottomGap = playVudio.getBoundingClientRect().bottom; |
| | | const topGap = playVudio.getBoundingClientRect().top; |
| | | if (bottomGap < 0 || topGap > window.innerHeight) { |
| | | playVudio.requestPictureInPicture(); |
| | | } |
| | | } |
| | | }, |
| | | //其他类名下字体大小变化 |
| | | transformDom(fs) { |
| | | const blockElement = this.$refs.blockElement; |
| | | if (blockElement) { |
| | | blockElement.style.fontSize = fs; // 或者你想要的任何大小 |
| | | } |
| | | } |
| | | }, |
| | | components: { |
| | | pageHeader, |
| | | chapterOne, |
| | | // chapterTwo, |
| | | // chapterThree, |
| | | // chapterFour, |
| | | // chapterFive, |
| | | // chapterSix, |
| | | // chapterSeven, |
| | | // chapterEight, |
| | | // miniAudio, |
| | | }, |
| | | }; |
| | | </script> |
| | | |
| | | <style lang="less" scoped> |
| | | .page-main { |
| | | width: 100%; |
| | | height: 100%; |
| | | width: 100% !important; |
| | | height: 100% !important; |
| | | overflow: auto; |
| | | |
| | | .page-content { |