闫增涛
2024-06-27 21dae909b36aab7d9fe48ea904eb1b7d9f44a292
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(7,182);
    // this.gotoPage(8,175);
    //   setTimeout(() => {
    //     this.renderSign("Highlight", {
    //       id: "2ACA9359",
@@ -907,20 +898,34 @@
      // 跳转
      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);
          console.log('播放',item);
          for (let cindex = 0; cindex < videoList.length; cindex++) {
            const citem = videoList[cindex];
            if(citem.currentSrc != path && path) {
              citem.pause()
            }
          }
        }
        })
      }
    }
    //   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()
    //       }
    //     }
    //   }
  },
  components: {
    pageHeader,