From 40b16e5fc85c445e0f21cfb75c10f6839fbacdfe Mon Sep 17 00:00:00 2001
From: 闫增涛 <1829501689@qq.com>
Date: 星期五, 22 十一月 2024 10:48:21 +0800
Subject: [PATCH] Merge branch 'master' of http://182.92.203.7:2001/r/TextbookReader

---
 src/views/examination/index.vue |   36 +++++++++++++++++++++++-------------
 1 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/src/views/examination/index.vue b/src/views/examination/index.vue
index 6499ea5..41dfcc6 100644
--- a/src/views/examination/index.vue
+++ b/src/views/examination/index.vue
@@ -85,6 +85,7 @@
               :cardList="examination.cardList"
               @setCollect="setCollect"
               @onChangeRadio="onChangeRadio"
+              @onChangeInput="onChangeInput"
             />
           </div>
         </li>
@@ -190,7 +191,7 @@
     getErrorList()
   } else if (props.type == 'collectQuestion') {
     examination.submitStatus = true
-    await getcollectId() // 鑾峰彇鏀惰棌棰樼洰
+    await getcollectId() // 鑾峰彇鏀惰棌棰樼洰id
     // 鏀惰棌澶�
   } else if (props.type == 'errorQuestion') {
     examination.submitStatus = true
@@ -244,7 +245,7 @@
   } else if (item.questionType == 'singleChoice' || item.questionType == 'judge') {
     // 鍗曢�� 鍒ゆ柇
     item.isRight = item.answer == item.userAnswer
-  } else if (item.questionType == 'shortAnswer') {
+  } else if (item.questionType == 'shortAnswer' || item.questionType == 'formula') {
     // 绠�绛� 缈昏瘧
     item.isRight = null
   } else if (item.questionType == 'completion') {
@@ -275,7 +276,7 @@
         citem.isUnfold = ''
         examination.isCollapse = false
       } else {
-        citem.questionType == 'shortAnswer' ? (citem.isUnfold = true) : (citem.isUnfold = citem.id)
+        citem.questionType == 'shortAnswer' || citem.questionType == 'formula' ? (citem.isUnfold = true) : (citem.isUnfold = citem.id)
         examination.isCollapse = true
       }
     }
@@ -289,8 +290,13 @@
   examination.submitStatus = true
 }
 // 棰樼洰鏀惰棌鎸夐挳,鏀惰棌鍜屽彇娑堝悓涓�鎺ュ彛锛屽彇娑堟暟缁勫噺鍘昏椤筰d
-const setCollect = (num: number, number: number) => {
-  const item = examination.cardList[num].infoList[number]
+const setCollect = (num: number, number?: number) => {
+  let item = null
+  if(number) {
+   item = examination.cardList[num].infoList[number]
+  } else {
+    item = examination.cardList[num]
+  }
   item.isCollect = !item.isCollect
   if (item.isJson) {
     // json棰樼洰鏀惰棌鍙栨秷
@@ -663,6 +669,7 @@
 }
 // 鑾峰彇鏀惰棌澶�
 const getCollectDataList = async () => {
+  console.log('鏀惰棌id',examination.allCollect)
   // 寮�濮嬭姹�
   let oldData = null
   let oldList:any = []
@@ -752,7 +759,7 @@
         isSubmit: false, // 鏌ョ湅瑙f瀽
         isRight: null, // 鏄惁姝g‘
         isComplete: false,
-        isCollect: examination.collectList.indexOf(item.id) > -1 ? true : false,
+        isCollect: true,
         isUnfold: ''
       }
       // 澶氶�夊拰濉┖绛旀鑲负鏁扮粍锛岃杞崲JSON鏍煎紡
@@ -889,7 +896,7 @@
       }
     }
   }
-
+  console.log('鏀惰棌json',jsonCollectList);
   for (let index = 0; index < jsonCollectList.length; index++) {
     const item = jsonCollectList[index]
   if (item.questionType == 'singleChoice') {
@@ -900,11 +907,11 @@
       examination.cardList[2].infoList.push(item)
     } else if (item.questionType == 'completion') {
       examination.cardList[3].infoList.push(item)
-    } else if (item.questionType == 'shortAnswer') {
+    } else if (item.questionType == 'shortAnswer' || item.questionType == 'formula') {
       examination.cardList[4].infoList.push(item)
     } else if (item.type && item.type == 'material') {
       examination.cardList[examination.cardList.length] = item
-    }
+    } 
   }
   examination.cardList = examination.cardList.filter((item) => item.infoList.length > 0)
   console.log('鎷兼帴棰�', examination.cardList)
@@ -1128,7 +1135,7 @@
       } else if (item.Embedded_QuestionBank_QuestionType == 'completion') {
         questionObj.type = '濉┖棰�'
         completionArr.push(questionObj)
-      } else if (item.Embedded_QuestionBank_QuestionType == 'shortAnswer') {
+      } else if (item.Embedded_QuestionBank_QuestionType == 'shortAnswer' ) {
         questionObj.type = '绠�绛旈'
         shortArr.push(questionObj)
       }
@@ -1185,7 +1192,7 @@
       examination.cardList[2].infoList.push(item)
     } else if (item.questionType == 'completion') {
       examination.cardList[3].infoList.push(item)
-    } else if (item.questionType == 'shortAnswer') {
+    } else if (item.questionType == 'shortAnswer' || item.questionType == 'formula') {
       examination.cardList[4].infoList.push(item)
     } else if (item.type && item.type == 'material') {
       examination.cardList[examination.cardList.length] = item
@@ -1215,7 +1222,7 @@
       } else if (citem.questionType == 'singleChoice' || citem.questionType == 'judge') {
         if (citem.id == '63825') console.log('i', item)
         citem.isRight = citem.answer == citem.userAnswer
-      } else if (citem.questionType == 'shortAnswer') {
+      } else if (citem.questionType == 'shortAnswer' || item.questionType == 'formula') {
         // 绠�绛� 缈昏瘧
         citem.isRight = null
       } else if (citem.questionType == 'completion') {
@@ -1230,7 +1237,7 @@
           }
         }
       }
-      if (!citem.isRight && citem.questionType != 'shortAnswer') {
+      if (!citem.isRight && citem.questionType != 'shortAnswer' && citem.questionType != 'formula') {
         
         // 瀹㈣棰樺洖绛旈敊璇� 璁板綍閿欓
         if (citem.isJson) {
@@ -1419,6 +1426,9 @@
       console.log('閿欓宸叉竻绌�')
     })
 }
+const onChangeInput = (value:any,index:number,cindex:number,dindex:number) => {
+  examination.cardList[index].infoList[cindex].userAnswer[dindex] = value
+}
 defineExpose({ handleExaminationDialog })
 </script>
 

--
Gitblit v1.9.1