| | |
| | | v-if="showCatalogList.indexOf(8) > -1" |
| | | :showPageList="loadPageList" |
| | | :questionData="questionData" |
| | | @eventSwdt="swdtChange" |
| | | /> |
| | | <chapterEight |
| | | v-if="showCatalogList.indexOf(9) > -1" |
| | |
| | | import _ from "lodash"; |
| | | import getQuestionList from "@/assets/methods/examination"; |
| | | import testData from "./js/examinationList"; |
| | | import Swiper from "swiper/bundle"; |
| | | import "swiper/swiper-bundle.css"; |
| | | import Viewer from "viewerjs"; |
| | | import "viewerjs/dist/viewer.css"; |
| | | export default { |
| | | data() { |
| | | return { |
| | |
| | | loadPageObserver: null, |
| | | loadPageList: [], |
| | | questionData: {}, |
| | | renderSignMap: {} |
| | | renderSignMap: {}, |
| | | }; |
| | | }, |
| | | computed: { |
| | |
| | | this.initObservation(); |
| | | this.initThemeColor(); |
| | | }, 500); |
| | | } |
| | | }, |
| | | }, |
| | | loadPageList: { |
| | | handler(newVal, oldVal) { |
| | | console.log(newVal, "this.loadPageList"); |
| | | handler() { |
| | | setTimeout(() => { |
| | | this.initSwiper(); |
| | | this.initViewer(); |
| | | }, 200); |
| | | } |
| | | } |
| | | }, |
| | | }, |
| | | }, |
| | | mounted() { |
| | | // 默认加载章节 |
| | | this.showCatalogList = [1]; |
| | | this.showCatalogList = [8]; |
| | | // 滚动监听节流 |
| | | this.throttledScrollHandler = _.throttle( |
| | | this.scrollFun, |
| | |
| | | |
| | | // 测试页面跳转 |
| | | // setTimeout(() => { |
| | | // this.gotoPage(1, 15); |
| | | // setTimeout(() => { |
| | | // this.renderSign("Note", { |
| | | // id: "2ACA9359", |
| | | // txt: "营养素和热量,才能", |
| | | // page: "100", |
| | | // type: "Highlight", |
| | | // color: "#F5E12A" |
| | | // }); |
| | | // setTimeout(() => { |
| | | // this.delSign({ |
| | | // ids: ["2ACA9359"] |
| | | // }); |
| | | // }, 2000); |
| | | // }, 1000); |
| | | // this.gotoPage(1, 15); |
| | | // setTimeout(() => { |
| | | // this.renderSign("Note", { |
| | | // id: "2ACA9359", |
| | | // txt: "营养素和热量,才能", |
| | | // page: "100", |
| | | // type: "Highlight", |
| | | // color: "#F5E12A" |
| | | // }); |
| | | // setTimeout(() => { |
| | | // this.delSign({ |
| | | // ids: ["2ACA9359"] |
| | | // }); |
| | | // }, 2000); |
| | | // }, 1000); |
| | | // }, 1000); |
| | | }, |
| | | methods: { |
| | |
| | | this.showCatalogList = [ |
| | | this.catalogLength - 2, |
| | | this.catalogLength - 1, |
| | | this.catalogLength |
| | | this.catalogLength, |
| | | ]; |
| | | } else { |
| | | this.showCatalogList = [catalog - 1, catalog, catalog + 1]; |
| | |
| | | this.$store.state.qiankun.pageChange({ |
| | | page: page, |
| | | catalog: catalog, |
| | | text |
| | | text, |
| | | }); |
| | | // const sections = Array.from(document.querySelectorAll(".section")); |
| | | //sections:获取所有具有 .section 类名的元素,并转换为数组。 |
| | |
| | | initSwiper() { |
| | | const doms = ( |
| | | this.container ? this.container : document |
| | | ).querySelectorAll(".swiper-container"); |
| | | ).querySelectorAll(".swiper-img"); |
| | | for (let i = 0; i < doms.length; i++) { |
| | | const dom = doms[i]; |
| | | new Swiper(dom, { |
| | |
| | | autoplay: { |
| | | //自动开始 |
| | | delay: 3000, //时间间隔 |
| | | disableOnInteraction: false //*手动操作轮播图后不会暂停* |
| | | disableOnInteraction: false, //*手动操作轮播图后不会暂停* |
| | | }, |
| | | paginationClickable: true, |
| | | slidesPerView: 1, // 一组三个 |
| | | spaceBetween: 30, // 间隔 |
| | | // 如果需要前进后退按钮 |
| | | navigation: { |
| | | nextEl: ".swiper-button-next", |
| | | prevEl: ".swiper-button-prev" |
| | | nextEl: (this.container ? this.container : document).querySelector( |
| | | ".swiper-button-next" |
| | | ), |
| | | prevEl: (this.container ? this.container : document).querySelector( |
| | | ".swiper-button-prev" |
| | | ), |
| | | }, |
| | | // 窗口变化,重新init,针对F11全屏和放大缩小,必须加 |
| | | observer: true, |
| | | observeParents: true, |
| | | // // 如果需要分页器 |
| | | // pagination: { |
| | | // el: ".swiper-pagination", |
| | | // el: (this.container ? this.container : document).querySelector( |
| | | // ".swiper-pagination" |
| | | // ), |
| | | // clickable: true // 分页器可以点击 |
| | | // } |
| | | }); |
| | | } |
| | | const pptDoms = ( |
| | | this.container ? this.container : document |
| | | ).querySelectorAll(".swiper_ppt"); |
| | | for (let i = 0; i < pptDoms.length; i++) { |
| | | const dom = pptDoms[i]; |
| | | new Swiper(dom, { |
| | | loop: false, // 无缝 |
| | | autoplay: false, |
| | | paginationClickable: true, |
| | | slidesPerView: 1, // 一组三个 |
| | | spaceBetween: 30, // 间隔 |
| | | // 如果需要前进后退按钮 |
| | | navigation: { |
| | | nextEl: (this.container ? this.container : document).querySelector( |
| | | ".swiper-button-next" |
| | | ), |
| | | prevEl: (this.container ? this.container : document).querySelector( |
| | | ".swiper-button-prev" |
| | | ), |
| | | }, |
| | | // 窗口变化,重新init,针对F11全屏和放大缩小,必须加 |
| | | observer: true, |
| | | observeParents: true, |
| | | on: { |
| | | init:(value) => { |
| | | let currentPage = value.activeIndex + 1; // 获取当前页(从1开始计数) |
| | | let totalPages = value.slides.length; // 获取总页数 |
| | | var paginationInfoEl = dom.querySelector('.pageBox'); |
| | | if(paginationInfoEl) |
| | | paginationInfoEl.textContent = currentPage + '/' + totalPages; |
| | | }, |
| | | slideChange:(value) => { |
| | | let currentPage = value.activeIndex + 1; // 获取当前页(从1开始计数) |
| | | let totalPages = value.slides.length; // 获取总页数 |
| | | var paginationInfoEl = dom.querySelector('.pageBox'); |
| | | if(paginationInfoEl) |
| | | paginationInfoEl.textContent = currentPage + '/' + totalPages; |
| | | }, |
| | | }, |
| | | }); |
| | | } |
| | | }, |
| | | initViewer() { |
| | |
| | | new Viewer(dom, { |
| | | navbar: true, // 显示导航栏 |
| | | toolbar: true, // 显示工具栏 |
| | | title: true // 显示标题 |
| | | title: true, // 显示标题 |
| | | }); |
| | | } |
| | | }, |
| | |
| | | } |
| | | } |
| | | }, |
| | | swdtChange(data) { |
| | | if (this.$store.state.qiankun && this.$store.state.qiankun.chooseWords) { |
| | | this.$store.state.qiankun.chooseWords({ |
| | | type: data, |
| | | }); |
| | | } |
| | | }, |
| | | }, |
| | | components: { |
| | | front001, |