zhongshujie
2024-12-27 8d1b3ab8d78cdcdd745f931ae6a8cf68173cfe69
src/books/aviationSafety/view/components/chapter007.vue
@@ -1070,12 +1070,43 @@
</template>
<script>
import preView from '@/components/pdfview/index.vue'
import preView from "@/components/pdfview/index.vue";
import { getResourcePath } from "@/assets/methods/resources";
import {
  getCollectResource,
  setCollectResource,
} from "@/assets/methods/resources";
export default {
    name: "chapterSeven",
    props: {
        showPageList: {
            type: Array,
    },
  },
  components: {
    preView,
  },
  data() {
    return {
      collectImg: require("../../assets/images/icon/heart.png"),
      collectCheck: require("../../assets/images/icon/heart-check.png"),
      collectResourceList: [],
      videoPathOne: "",
      videoPathTwo: "",
      videoPathThree: "",
      chapterData: {
        isCollectVideo: false,
        isCollectVideo2: false,
        isCollectVideo3: false
      },
      pdfDialogRef: "",
      somePdfTitleValue: "",
      p_md5: "",
      dialogVisible: false,
      questionData: {
        isComplete: false,
        checkOne: {
          value: [],
        },
    },
    components: {
@@ -1281,6 +1312,222 @@
                JSON.stringify(this.questionData)
            );
        },
        checkThree: {
          value: [],
        },
        checkFour: {
          value: [],
        },
        checkFive: {
          value: [],
        },
        teskOne: {
          one: "",
          two: "",
          three: "",
          four: "",
        },
        teskTwo: {
          one: "",
          two: "",
          three: "",
        },
        teskThree: {
          one: "",
          two: "",
        },
        teskFour: {
          one: "",
          two: "",
        },
      },
      tableData: {
        teskTableOne: {
          one: "",
        },
        teskTableTwo: {
          one: "",
          two: "",
          three: "",
          four: "",
          five: "",
          six: "",
          seven: "",
          eight: "",
          nine: "",
          ten: "",
          eleven: "",
        },
        teskTableSpecial: {
          one: "",
          two: "",
          three: "",
          four: "",
          five: "",
          six: "",
          seven: "",
          eight: "",
          nine: "",
          ten: "",
          eleven: "",
          twelve: "",
        },
        teskTableSpecialOne: {
          one: "",
          two: "",
          three: "",
          four: "",
          five: "",
          six: "",
          seven: "",
          eight: "",
          nine: "",
          ten: "",
          eleven: "",
          twelve: "",
        },
        teskTableSpecialTwo: {
          one: "",
          two: "",
          three: "",
          four: "",
          five: "",
          six: "",
          seven: "",
          eight: "",
          nine: "",
          ten: "",
          eleven: "",
          twelve: "",
        },
        teskTableSpecialThree: {
          one: "",
          two: "",
          three: "",
          four: "",
          five: "",
          six: "",
          seven: "",
          eight: "",
          nine: "",
          ten: "",
          eleven: "",
          twelve: "",
        },
      },
    };
  },
  async mounted() {
    const bookQuestion = localStorage.getItem("safety-book-chapter07");
    if (bookQuestion) {
      this.questionData = JSON.parse(bookQuestion);
    }
    const bookTableData = localStorage.getItem(
      "safety-book-chapter07-tableData"
    );
    if (bookTableData) {
      this.tableData = JSON.parse(bookTableData);
    }
    const choiceQuestion = localStorage.getItem("safety-book-chapter07-Data");
    if (choiceQuestion) {
      this.chapterData = JSON.parse(choiceQuestion);
    }
    this.getVidoePath();
    this.collectResourceList = await getCollectResource(
      this.config.activeBook.bookId
    );
  },
  methods: {
    async getVidoePath() {
      this.videoPathOne = await getResourcePath(
        "9f2d39d6006dd01b6cc03c7b493a48cb"
      );
      this.videoPathTwo = await getResourcePath(
        "e417b24d23bfcf0fd883a437f14efbee"
      );
      this.videoPathThree = await getResourcePath(
        "defb9b72a2cadcbbbffbc477f30209b1"
      );
    },
    handleCollect(e) {
      if (e == "video-01") {
        this.handleCollectResource(
          "9f2d39d6006dd01b6cc03c7b493a48cb",
          "9f2d39d6006dd01b6cc03c7b493a48cb",
          "",
          "视频",
          "bits",
          "视频:货邮安检的普通货物检查流程"
        );
        this.chapterData.isCollectVideo = !this.chapterData.isCollectVideo;
      } else if (e == "video-02") {
        this.handleCollectResource(
          "e417b24d23bfcf0fd883a437f14efbee",
          "e417b24d23bfcf0fd883a437f14efbee",
          "",
          "视频",
          "bits",
          "视频:货邮安检发现疑似爆炸物品的安全检查流程"
        );
        this.chapterData.isCollectVideo2 = !this.chapterData.isCollectVideo2;
      } else if (e == "video-03") {
        this.handleCollectResource(
          "defb9b72a2cadcbbbffbc477f30209b1",
          "defb9b72a2cadcbbbffbc477f30209b1",
          "",
          "视频",
          "bits",
          "视频:货邮安检货物检查和爆探检测流程"
        );
        this.chapterData.isCollectVideo3 = !this.chapterData.isCollectVideo3;
      }
      this.handleChapterData();
    },
    //资源收藏事件
    // resourcePath  文件路径,
    // resourceType  文件类型
    // source        文件来源
    handleCollectResource(
      id,
      md5,
      resourcePath,
      resourceType,
      source,
      resourceName
    ) {
      let list = this.collectResourceList;
      if (list.findIndex((item) => item.id == id) > -1) {
        list = list.filter((item) => item.id != id);
      } else {
        list.push({
          id,
          md5,
          resourcePath,
          resourceType,
          source,
          resourceName,
        });
      }
      this.collectResourceList = list;
      setCollectResource(
        this.config.activeBook.bookId,
        this.collectResourceList
      );
    },
    handleChapterData() {
      localStorage.setItem(
        "safety-book-chapter06-Data",
        JSON.stringify(this.chapterData)
      );
    },
    setBookQuestion() {
      localStorage.setItem(
        "safety-book-chapter07",
        JSON.stringify(this.questionData)
      );
    },
        setBookTableData() {
            localStorage.setItem(
                "safety-book-chapter07-tableData",
@@ -1289,9 +1536,9 @@
        },
        toUrl(val) {
            if (val) {
                this.p_md5 = this.chapter06.pdfMd5[val].md5
                this.somePdfTitleValue = this.chapter06.pdfMd5[val].name
                this.$refs.pdfDialogRef.openDialog()
        this.p_md5 = this.chapter06.pdfMd5[val].md5;
        this.somePdfTitleValue = this.chapter06.pdfMd5[val].name;
        this.$refs.pdfDialogRef.openDialog();
            }
        },
    },