From bd4d2df3c20c2baea23567f57556a70a38e1960d Mon Sep 17 00:00:00 2001 From: zhongshujie <2862698242@qq.com> Date: 星期五, 26 七月 2024 14:12:32 +0800 Subject: [PATCH] Merge branch 'master' of http://182.92.203.7:2001/r/testbookLayout --- src/books/childHealth/view/content/index.vue | 60 +++++++++++++++++++++++++++++++++++++++--------------------- 1 files changed, 39 insertions(+), 21 deletions(-) diff --git a/src/books/childHealth/view/content/index.vue b/src/books/childHealth/view/content/index.vue index 97e9d4e..fd91aa9 100644 --- a/src/books/childHealth/view/content/index.vue +++ b/src/books/childHealth/view/content/index.vue @@ -21,61 +21,51 @@ v-if="showCatalogList.indexOf(2) > -1" :showPageList="loadPageList" :questionData="questionDataMap" - @closeVideo="closeVideo" ></chapterOne> <chapterTwo v-if="showCatalogList.indexOf(3) > -1" :showPageList="loadPageList" :questionData="questionDataMap" - @closeVideo="closeVideo" ></chapterTwo> <chapterThree v-if="showCatalogList.indexOf(4) > -1" :showPageList="loadPageList" :questionData="questionDataMap" - @closeVideo="closeVideo" ></chapterThree> <chapterFour v-if="showCatalogList.indexOf(5) > -1" :showPageList="loadPageList" :questionData="questionDataMap" - @closeVideo="closeVideo" ></chapterFour> <chapterFive v-if="showCatalogList.indexOf(6) > -1" :showPageList="loadPageList" :questionData="questionDataMap" - @closeVideo="closeVideo" ></chapterFive> <chapterSix v-if="showCatalogList.indexOf(7) > -1" :showPageList="loadPageList" :questionData="questionDataMap" - @closeVideo="closeVideo" ></chapterSix> <chapterSeven v-if="showCatalogList.indexOf(8) > -1" :showPageList="loadPageList" :questionData="questionDataMap" - @closeVideo="closeVideo" ></chapterSeven> <chapterEight v-if="showCatalogList.indexOf(9) > -1" :showPageList="loadPageList" :questionData="questionDataMap" - @closeVideo="closeVideo" ></chapterEight> <chapterNine v-if="showCatalogList.indexOf(10) > -1" :showPageList="loadPageList" :questionData="questionDataMap" - @closeVideo="closeVideo" ></chapterNine> <chapterTen v-if="showCatalogList.indexOf(11) > -1" :showPageList="loadPageList" :questionData="questionDataMap" - @closeVideo="closeVideo" ></chapterTen> <chapterEleven v-if="showCatalogList.indexOf(12) > -1" @@ -167,6 +157,7 @@ setTimeout(() => { this.initSwiper(); this.initViewer(); + this.closeVideo() }, 200); } }, @@ -238,7 +229,7 @@ // 娴嬭瘯椤甸潰璺宠浆 // setTimeout(() => { - // this.gotoPage(2,58); + // this.gotoPage(11,282); // setTimeout(() => { // this.renderSign("Highlight", { // id: "2ACA9359", @@ -285,6 +276,8 @@ // }, // 婊氬姩鐩戝惉 scrollFun(event) { + // 瑙嗛灏忕獥鏂规硶 + this.handleVideoPicture() // 鍒ゆ柇鍚戜笂婊氬姩杩樻槸鍚戜笅婊氬姩 if (event.target.scrollTop > this.previousScrollTop) { // 鍚戜笅 @@ -623,11 +616,12 @@ if (testData && testData[catalog]) { if (testData[catalog][page]) { if (Array.isArray(testData[catalog][page])) { - this.questionDataMap[page] = await getQuestionList( + const datas = await getQuestionList( page, testData[catalog][page], this.config.activeBook ); + this.$set(this.questionDataMap,page,datas) } else { const obj = {}; for (let key in testData[catalog][page]) { @@ -637,7 +631,8 @@ this.config.activeBook ); } - this.questionDataMap[page] = obj; + this.$set(this.questionDataMap,page,obj) + // this.questionDataMap[page] = obj; } } } @@ -907,18 +902,41 @@ // 璺宠浆 this.gotoPage(data.catalog, data.page, () => {}); }, - closeVideo(path) { + // 鐐瑰嚮瑙嗛鍏抽棴鍏朵粬 + closeVideo() { let allVideo = ( this.container ? this.container : document ).querySelectorAll(".video"); - allVideo = Array.from(allVideo); - if(allVideo.length) { - for (let index = 0; index < allVideo.length; index++) { - const item = allVideo[index]; - if(item.currentSrc != path) { - item.pause() + 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(); + } } } }, -- Gitblit v1.9.1