From 713e5f5c012eb510b768d4f75d6aa1e2631e649b Mon Sep 17 00:00:00 2001
From: 闫增涛 <1829501689@qq.com>
Date: 星期一, 03 六月 2024 19:09:23 +0800
Subject: [PATCH] 连线题,合并

---
 src/components/examinations/index.vue |   26 ++++++++++++++------------
 1 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/src/components/examinations/index.vue b/src/components/examinations/index.vue
index a69612c..b31b7a1 100644
--- a/src/components/examinations/index.vue
+++ b/src/components/examinations/index.vue
@@ -426,7 +426,6 @@
   props: {
     cardList: {
       type: Array,
-      default: [],
     },
     primaryColor: {
       type: String,
@@ -446,7 +445,13 @@
       cardData:[]
     };
   },
-  inject:['changeQuestionData'],
+  watch:{
+    cardList:{
+      handler(newVal) {
+        console.log('11',newVal);
+      }
+    }
+  },
   mounted() {
     this.cardData = this.cardList
     console.log('this.cardList',this.cardList);
@@ -510,7 +515,7 @@
     },
     // 鎵规敼棰樼洰  (缁冧範,鎴戠殑鍋氶,鎴戠殑鏀惰棌妯″紡涓�)
     handleQuestion() {
-      const list = this.$props.cardData;
+      const list = this.cardData;
       for (let index = 0; index < list.length; index++) {
         const item = list[index];
         for (let cindex = 0; cindex < item.infoList.length; cindex++) {
@@ -555,8 +560,8 @@
           }
         }
       }
-      this.$props.cardData = list;
-      console.log(this.$props.cardData);
+      this.cardData = list;
+      console.log(this.cardData);
     },
     getParentWithClass(element, className) {
       while (element.parentElement) {
@@ -580,8 +585,8 @@
         );
         let oldData = oldAnswerData ? JSON.parse(oldAnswerData) : {};
         const asnwerList = [];
-        for (let index = 0; index < this.$props.cardData.length; index++) {
-          const item = this.$props.cardData[index];
+        for (let index = 0; index < this.cardData.length; index++) {
+          const item = this.cardData[index];
           for (let cindex = 0; cindex < item.infoList.length; cindex++) {
             const citem = item.infoList[cindex];
             asnwerList.push({
@@ -591,11 +596,8 @@
           }
         }
         if(oldData[pageNum]) {
-          oldData[pageNum].push(asnwerList)
-          // for (let dindex = 0; dindex < oldData[pageNum].length; dindex++) {
-          //   const ditem = oldData[pageNum][dindex];
-          //   for(let eindex = 0; eindex < asnwerList.)
-          // }
+          oldData[pageNum] = oldData[pageNum].filter(citem => asnwerList.findIndex(ditem => ditem.id == citem.id) == -1 )
+          oldData[pageNum].push(...asnwerList)
         } else {
           oldData[pageNum] = asnwerList
         }

--
Gitblit v1.9.1