zhongshujie
18 小时以前 e33672cf85da88d515d5fe6ccc0a139c3cfaa5db
src/books/preventiveDentistry/view/components/index.vue
@@ -9,32 +9,44 @@
      transformOrigin: 'center top',
    }">
      <pageHeader v-if="showCatalogList.indexOf(1) > -1" :showPageList="loadPageList"></pageHeader>
      <chapterOne v-if="showCatalogList.indexOf(2) > -1" :showPageList="loadPageList" :resourceList="resourceList">
      <chapterOne v-if="showCatalogList.indexOf(2) > -1" :showPageList="loadPageList" :getResourceInfo="resourceListFun"
        :interfaceQuestion="bookQuestionsList">
      </chapterOne>
      <chapterTwo v-if="showCatalogList.indexOf(3) > -1" :showPageList="loadPageList" :resourceList="resourceList">
      <chapterTwo v-if="showCatalogList.indexOf(3) > -1" :showPageList="loadPageList"
        :getResourceInfo="resourceListFun">
      </chapterTwo>
      <chapterThree v-if="showCatalogList.indexOf(4) > -1" :showPageList="loadPageList" :resourceList="resourceList">
      <chapterThree v-if="showCatalogList.indexOf(4) > -1" :showPageList="loadPageList"
        :getResourceInfo="resourceListFun">
      </chapterThree>
      <chapterFour v-if="showCatalogList.indexOf(5) > -1" :showPageList="loadPageList" :resourceList="resourceList">
      <chapterFour v-if="showCatalogList.indexOf(5) > -1" :showPageList="loadPageList"
        :getResourceInfo="resourceListFun">
      </chapterFour>
      <chapterFive v-if="showCatalogList.indexOf(6) > -1" :showPageList="loadPageList" :resourceList="resourceList">
      <chapterFive v-if="showCatalogList.indexOf(6) > -1" :showPageList="loadPageList"
        :getResourceInfo="resourceListFun">
      </chapterFive>
      <chapterSix v-if="showCatalogList.indexOf(7) > -1" :showPageList="loadPageList" :resourceList="resourceList">
      <chapterSix v-if="showCatalogList.indexOf(7) > -1" :showPageList="loadPageList"
        :getResourceInfo="resourceListFun">
      </chapterSix>
      <chapterSeven v-if="showCatalogList.indexOf(8) > -1" :showPageList="loadPageList" :resourceList="resourceList">
      <chapterSeven v-if="showCatalogList.indexOf(8) > -1" :showPageList="loadPageList"
        :getResourceInfo="resourceListFun">
      </chapterSeven>
      <chapterEight v-if="showCatalogList.indexOf(9) > -1" :showPageList="loadPageList" :resourceList="resourceList">
      <chapterEight v-if="showCatalogList.indexOf(9) > -1" :showPageList="loadPageList"
        :getResourceInfo="resourceListFun">
      </chapterEight>
      <chapterNine v-if="showCatalogList.indexOf(10) > -1" :showPageList="loadPageList" :resourceList="resourceList">
      <chapterNine v-if="showCatalogList.indexOf(10) > -1" :showPageList="loadPageList"
        :getResourceInfo="resourceListFun">
      </chapterNine>
      <chapterTen v-if="showCatalogList.indexOf(11) > -1" :showPageList="loadPageList" :resourceList="resourceList">
      <chapterTen v-if="showCatalogList.indexOf(11) > -1" :showPageList="loadPageList"
        :getResourceInfo="resourceListFun">
      </chapterTen>
      <chapterEleven v-if="showCatalogList.indexOf(12) > -1" :showPageList="loadPageList" :resourceList="resourceList">
      <chapterEleven v-if="showCatalogList.indexOf(12) > -1" :showPageList="loadPageList"
        :getResourceInfo="resourceListFun">
      </chapterEleven>
      <chapterTwelve v-if="showCatalogList.indexOf(13) > -1" :showPageList="loadPageList" :resourceList="resourceList">
      <chapterTwelve v-if="showCatalogList.indexOf(13) > -1" :showPageList="loadPageList"
        :getResourceInfo="resourceListFun">
      </chapterTwelve>
      <chapterThirteen v-if="showCatalogList.indexOf(14) > -1" :showPageList="loadPageList"
        :resourceList="resourceList">
        :getResourceInfo="resourceListFun">
      </chapterThirteen>
    </div>
  </div>
@@ -57,6 +69,9 @@
import chapterTwelve from "./chapter012.vue"
import chapterThirteen from "./chapter013.vue"
import NoteIcon from "@/assets/images/biji.png";
import getQuestionList from "@/assets/methods/examination";
import testData from "../../assets/examinationList";
import MG from "@/assets/js/middleGround/WebMiddleGroundApi";
import _ from "lodash";
import Swiper from "swiper/bundle";
import "swiper/swiper-bundle.css";
@@ -81,7 +96,8 @@
      audioPath: "",
      currentTime: null,
      videoList: [],
      resourceList: {},
      resourceList: [],
      bookQuestionsList: [],
    };
  },
  computed: {
@@ -112,7 +128,6 @@
        // 启动页码观察
        setTimeout(() => {
          this.initObservation();
          this.initThemeColor();
        }, 500);
      },
    },
@@ -124,6 +139,7 @@
          this.initViewer();
          this.closeAudio();
          this.closeVideo();
          this.initThemeColor();
        }, 200);
      },
    },
@@ -140,6 +156,11 @@
        this.resourceList = newVal;
      },
    },
    bookQuestionsList: {
      handler(newVal, oldVal) {
        this.bookQuestionsList = newVal;
      },
    }
  },
  mounted() {
    // 默认加载章节
@@ -194,16 +215,18 @@
    this.getBookResourceList();
    // 获取整本书题目
    this.getBookQuestionList();
    // 启动页码观察
    setTimeout(() => {
      this.initObservation();
      this.initThemeColor();
    }, 500);
    // 测试页面跳转
    // setTimeout(() => {
    //   this.gotoPage(14, 196);
    // }, 500);
    setTimeout(() => {
      this.gotoPage(2, 18);
    }, 500);
    // const pageDom = (this.container ? this.container : document)
    //   .querySelector("#app")
@@ -221,27 +244,67 @@
  },
  methods: {
    // setZoom1() {
    //   let scale = this.$store.state.qiankun.scale + 10;
    //   const scrollBox = (
    //     this.container ? this.container : document
    //   ).querySelector(".page-main");
    //   this.$store.commit("setZoom", scale);
    // },
    // setZoom2() {
    //   let scale = this.$store.state.qiankun.scale - 10;
    //   const scrollBox = (
    //     this.container ? this.container : document
    //   ).querySelector(".page-main");
    //   this.$store.commit("setZoom", scale);
    // },
    // 请求资源Json
    async getBookResourceList() {
      this.resourceList = await this.config.getBookResources(
        process.env.VUE_APP_RESOURCE_CTX + (process.env.VUE_APP_ENV == "product"
    getBookResourceList() {
      this.config.getBookResources(
        process.env.VUE_APP_RESOURCE_CTX + (process.env.VUE_APP_ENV === "product"
          ? process.env.VUE_APP_BOOK_ID
          : "preventiveDentistry")
      );
      )
        .then(data => {
          this.resourceList = data;
        })
        .catch(error => {
          console.error("获取图书资源列表失败:", error);
        });
    },
    // 获取图书问题列表
    getBookQuestionList() {
      let query = {
        storeInfo: this.config.activeBook.storeRefcode,
        path: "*",
        cmsPath: this.config.activeBook.rootCmsItemId,
        cmsType: "*",
        productId: this.config.activeBook.bookId,
        queryType: "*",
        itemFields: {
          Embedded_QuestionBank_Stem: [],
          Embedded_QuestionBank_AnalysisCon: [],
          Embedded_QuestionBank_Answer: [],
          Embedded_QuestionBank_Option: [],
          Embedded_QuestionBank_QuestionType: [],
          Embedded_QuestionBank_StemStyle: [],
          Embedded_QuestionBank_OptionStyle: [],
          Embedded_QuestionBank_KnowledgePoint: [],
          Embedded_QuestionBank_Difficulty: [],
        },
      }
      MG.store.getProductDetail(query)
        .then(res => {
          console.log(res.datas.cmsDatas[0].datas, "获取bookQuestionList成功");
          let bookQuestionList = [];
          if (res.datas.cmsDatas[0].datas.length > 0) {
            res.datas.cmsDatas[0].datas.forEach(item => {
              if (item.datas.Type === "questionBankItem") {
                bookQuestionList.push(item);
              }
              if (item.id == 21987) {
                console.log(item, "21987");
              }
            });
          }
          console.log(bookQuestionList, "bookQuestionList");
          this.bookQuestionsList = bookQuestionList;
        })
        .catch(error => {
          console.error("获取图书问题列表失败:", error);
        });
    },
    resourceListFun(id, key) {
      let data = this.resourceList.find(item => item.key == id)
      return key ? data[key] : data
    },
    // 滚动监听
    scrollFun(event) {
@@ -590,7 +653,8 @@
            //         this.questionDataMap[page] = await getQuestionList(
            //           page,
            //           testData[catalog][page],
            //           this.config.activeBook
            //           this.config.activeBook,
            //           this.bookQuestionsList,
            //         );
            //       } else {
            //         const obj = {};
@@ -598,7 +662,8 @@
            //           obj[key] = await getQuestionList(
            //             [],
            //             testData[catalog][page][key],
            //             this.config.activeBook
            //             this.config.activeBook,
            //             this.bookQuestionsList,
            //           );
            //         }
            //         this.questionDataMap[page] = obj;