| | |
| | | ></pageHeader> |
| | | <chapterOne |
| | | @saveCharacters="saveCharacters" |
| | | @closeMiniAudio="closeMiniAudio" |
| | | v-if="showCatalogList.indexOf(2) > -1" |
| | | :showPageList="loadPageList" |
| | | ></chapterOne> |
| | | <chapterTwo |
| | | @saveCharacters="saveCharacters" |
| | | @closeMiniAudio="closeMiniAudio" |
| | | v-if="showCatalogList.indexOf(3) > -1" |
| | | :showPageList="loadPageList" |
| | | ></chapterTwo> |
| | | <chapterThree |
| | | @saveCharacters="saveCharacters" |
| | | @closeMiniAudio="closeMiniAudio" |
| | | v-if="showCatalogList.indexOf(4) > -1" |
| | | :showPageList="loadPageList" |
| | | ></chapterThree> |
| | | <chapterFour |
| | | @saveCharacters="saveCharacters" |
| | | @closeMiniAudio="closeMiniAudio" |
| | | v-if="showCatalogList.indexOf(5) > -1" |
| | | :showPageList="loadPageList" |
| | | ></chapterFour> |
| | |
| | | import chapterTwo from "./chapter002.vue"; |
| | | import chapterThree from "./chapter003.vue"; |
| | | import chapterFour from "./chapter004.vue"; |
| | | import chapterFive from "./chapter005.vue"; |
| | | import chapterSex 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"; |
| | |
| | | export default { |
| | | data() { |
| | | return { |
| | | catalogLength: 5, // 总章节数 |
| | | catalogLength: 9, // 总章节数 |
| | | showCatalogList: [], // 显示的章节 |
| | | loadThreshold: 300, // 触发加载阈值 |
| | | throttleThreshold: 100, // 节流阈值 |
| | |
| | | setTimeout(() => { |
| | | this.initSwiper(); |
| | | this.initViewer(); |
| | | this.closeAudio() |
| | | }, 200); |
| | | }, |
| | | }, |
| | |
| | | chapterTwo, |
| | | chapterThree, |
| | | chapterFour, |
| | | chapterFive, |
| | | chapterSex, |
| | | chapterSeven, |
| | | chapterEight, |
| | | }; |
| | | // 遍历所有章节文件 |
| | | for (const key in pageData) { |
| | |
| | | closeMiniAudio() { |
| | | this.audioPath = ""; |
| | | }, |
| | | // 点击音频播放,关闭其他音频 |
| | | closeAudio() { |
| | | let allAudio = ( |
| | | this.container ? this.container : document |
| | | ).querySelectorAll(".audio"); |
| | | for (let index = 0; index < allAudio.length; index++) { |
| | | const item = allAudio[index]; |
| | | item.addEventListener("play", () => { |
| | | const audioList = Array.from(allAudio); |
| | | for (let cindex = 0; cindex < audioList.length; cindex++) { |
| | | const citem = audioList[cindex]; |
| | | if (citem.currentSrc != item.src) { |
| | | citem.pause(); |
| | | } |
| | | } |
| | | this.closeMiniAudio(); |
| | | }); |
| | | } |
| | | }, |
| | | }, |
| | | components: { |
| | | pageHeader, |
| | |
| | | chapterTwo, |
| | | chapterThree, |
| | | chapterFour, |
| | | chapterFive, |
| | | chapterSex, |
| | | chapterSeven, |
| | | chapterEight, |
| | | miniAudio, |
| | | }, |
| | | }; |