From ef77d2b27d0de0d01f0f00525325c2bad36eb0a0 Mon Sep 17 00:00:00 2001
From: 闫增涛 <1829501689@qq.com>
Date: 星期四, 20 六月 2024 18:34:05 +0800
Subject: [PATCH] 答题器优化

---
 src/books/mathBook/view/components/chapter001.vue |   77 ++++++++++++++++++++------------------
 1 files changed, 40 insertions(+), 37 deletions(-)

diff --git a/src/books/mathBook/view/components/chapter001.vue b/src/books/mathBook/view/components/chapter001.vue
index 55f50d7..b278ea5 100644
--- a/src/books/mathBook/view/components/chapter001.vue
+++ b/src/books/mathBook/view/components/chapter001.vue
@@ -564,8 +564,9 @@
           </p>
           <div class="bj">
             <examinations
-              :cardList="questionData"
+              :cardList="questionData[9]"
               :hideCollect="true"
+              sourceType="json"
               inputBc="#d3edfa"
               v-if="questionData"
               :isReal="false"
@@ -827,6 +828,9 @@
       type: Array,
       default: [],
     },
+    questionData:{
+      type:Object
+    }
   },
   mounted() {
     const data = localStorage.getItem("math-chapterData");
@@ -834,7 +838,7 @@
       this.chapterData = JSON.parse(data);
     }
     this.getPath();
-    this.getQuestionData();
+    // this.getQuestionData();
   },
   data() {
     return {
@@ -849,7 +853,6 @@
       thinkingDialog: false,
       stepDialog: false,
       videoPath: "",
-      questionData: [],
       stepIndex: 1,
       thinkIndex: 1,
       chapterData: {
@@ -896,40 +899,40 @@
         "a28cd862d61b5df2201406b76e9f01b0"
       );
     },
-    getQuestionData() {
-      axios
-        .get(this.config.activeBook.resourceUrl + "/question.json")
-        .then((res) => {
-          let oldAnswer = localStorage.getItem(
-            this.config.activeBook.name + "oldAnswerData"
-          );
-          if (oldAnswer) {
-            oldAnswer = JSON.parse(oldAnswer);
-            console.log("鏃ф暟鎹�", oldAnswer);
-            if (oldAnswer[9]) {
-              for (let index = 0; index < res.data.data.length; index++) {
-                const item = res.data.data[index];
-                if (item.infoList.length) {
-                  for (
-                    let cindex = 0;
-                    cindex < item.infoList.length;
-                    cindex++
-                  ) {
-                    const citem = item.infoList[cindex];
-                    const question = oldAnswer[9].find(
-                      (ditem) => ditem.id == citem.id
-                    );
-                    if (question) {
-                      citem.userAnswer = question.userAnswer;
-                    }
-                  }
-                }
-              }
-            }
-          }
-          this.questionData = res.data.data;
-        });
-    },
+    // getQuestionData() {
+    //   axios
+    //     .get(this.config.activeBook.resourceUrl + "/question.json")
+    //     .then((res) => {
+    //       let oldAnswer = localStorage.getItem(
+    //         this.config.activeBook.name + "oldAnswerData"
+    //       );
+    //       if (oldAnswer) {
+    //         oldAnswer = JSON.parse(oldAnswer);
+    //         console.log("鏃ф暟鎹�", oldAnswer);
+    //         if (oldAnswer[9]) {
+    //           for (let index = 0; index < res.data.data.length; index++) {
+    //             const item = res.data.data[index];
+    //             if (item.infoList.length) {
+    //               for (
+    //                 let cindex = 0;
+    //                 cindex < item.infoList.length;
+    //                 cindex++
+    //               ) {
+    //                 const citem = item.infoList[cindex];
+    //                 const question = oldAnswer[9].find(
+    //                   (ditem) => ditem.id == citem.id
+    //                 );
+    //                 if (question) {
+    //                   citem.userAnswer = question.userAnswer;
+    //                 }
+    //               }
+    //             }
+    //           }
+    //         }
+    //       }
+    //       this.questionData = res.data.data;
+    //     });
+    // },
     handleCollect(type) {
       if (type == "img") {
         this.chapterData.isCollectImg = !this.chapterData.isCollectImg;

--
Gitblit v1.9.1