From 18d886c2f23dc5c032ebcf42bbb39c739d908a4f Mon Sep 17 00:00:00 2001
From: litian <2804272236@qq.com>
Date: 星期二, 05 十一月 2024 15:49:51 +0800
Subject: [PATCH] Merge branch 'master' of http://182.92.203.7:2001/r/TextbookReader

---
 src/views/examination/index.vue |   54 ++++++++++++++++++++++--------------------------------
 1 files changed, 22 insertions(+), 32 deletions(-)

diff --git a/src/views/examination/index.vue b/src/views/examination/index.vue
index 573ab21..6499ea5 100644
--- a/src/views/examination/index.vue
+++ b/src/views/examination/index.vue
@@ -210,7 +210,7 @@
       examination.loading = true
       examination.submitStatus = false
       examination.cardList = []
-      examination.collectList = []
+      // examination.collectList = []
       examination.errorList = []
       goTop()
       if (props.type == 'option') {
@@ -624,16 +624,16 @@
       domain: 'collectData',
       keys: [props.activeBook.bookId]
     })
-    .then(async (res) => {
+    .then(async (res:any) => {
       try {
         const collect = JSON.parse(res[0].value)
         if (collect.length) {
-          examination.collectList = collect.find((citem) => citem.type == 'bits').collectList
+          examination.collectList = collect.find((citem:any) => citem.type == 'bits').collectList
           examination.allCollect[0].collectList = collect.find(
-            (citem) => citem.type == 'bits'
+            (citem:any) => citem.type == 'bits'
           ).collectList
           examination.allCollect[1].collectList = collect.find(
-            (citem) => citem.type == 'json'
+            (citem:any) => citem.type == 'json'
           ).collectList
         }
       } catch (error) {}
@@ -663,14 +663,9 @@
 }
 // 鑾峰彇鏀惰棌澶�
 const getCollectDataList = async () => {
-  if (!examination.collectList.length) {
-    examination.loading = false
-    examination.noData = true
-    return false
-  }
   // 寮�濮嬭姹�
   let oldData = null
-  let oldList = []
+  let oldList:any = []
   let cardList = [
     {
       catalogName: '鍗曢�夐',
@@ -693,11 +688,11 @@
       infoList: []
     }
   ]
-  let singleChoiceArr = [] // 鍗曢��
-  let judgeArr = [] // 鍒ゆ柇
-  let shortArr = [] // 绠�绛�
-  let multipleChoiceArr = [] // 澶氶��
-  let completionArr = [] // 濉┖
+  let singleChoiceArr:any = [] // 鍗曢��
+  let judgeArr:any = [] // 鍒ゆ柇
+  let shortArr:any = [] // 绠�绛�
+  let multipleChoiceArr:any = [] // 澶氶��
+  let completionArr:any = [] // 濉┖
   // 11
   for (let qindex = 0; qindex < examination.collectList.length; qindex++) {
     const qitem = examination.collectList[qindex]
@@ -791,7 +786,7 @@
         questionObj.stem.stemImage = getPublicImage(questionObj.stem.stemImage, 150)
       }
       if (questionObj.optionStyle == 'Image' || questionObj.optionStyle == 'TxtAndImage') {
-        questionObj.option.forEach((optionItem) => {
+        questionObj.option.forEach((optionItem:any) => {
           if (optionItem.img) optionItem.img = getPublicImage(optionItem.img, 150)
         })
       }
@@ -813,7 +808,7 @@
           questionObj.questionType == 'judge' ||
           questionObj.questionType == 'multipleChoice')
       ) {
-        questionObj.option.forEach((item) => {
+        questionObj.option.forEach((item:any) => {
           if (item.txt)
             item.txt = item.txt
               .replace(/\<img/gi, '<img class="option-rich-img"')
@@ -897,9 +892,7 @@
 
   for (let index = 0; index < jsonCollectList.length; index++) {
     const item = jsonCollectList[index]
-    if (item.type && item.type == 'material') {
-      examination.cardList.push(item)
-    } else if (item.questionType == 'singleChoice') {
+  if (item.questionType == 'singleChoice') {
       examination.cardList[0].infoList.push(item)
     } else if (item.questionType == 'judge') {
       examination.cardList[1].infoList.push(item)
@@ -909,6 +902,8 @@
       examination.cardList[3].infoList.push(item)
     } else if (item.questionType == 'shortAnswer') {
       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)
@@ -935,6 +930,7 @@
         examination.cardList = (await getErrorDataList()) as any
         await getJsonError()
       } else {
+        examination.noData = true
         examination.loading = false
         ElMessageBox.confirm('閿欓闆嗘殏鏃犳暟鎹�!', '鎻愮ず', {
           confirmButtonText: '纭畾',
@@ -953,12 +949,6 @@
 }
 // 鑾峰彇閿欓闆�
 const getErrorDataList = async () => {
-  if (!examination.errorList.length) {
-    examination.loading = false
-    examination.noData = true
-    return false
-  }
-  // 寮�濮嬭姹�
   let oldData = null
   let oldList:any = []
   let cardList = [
@@ -1187,9 +1177,7 @@
 
   for (let index = 0; index < jsonCollectList.length; index++) {
     const item = jsonCollectList[index]
-    if (item.type && item.type == 'material') {
-      examination.cardList.push(item)
-    } else if (item.questionType == 'singleChoice') {
+    if (item.questionType == 'singleChoice') {
       examination.cardList[0].infoList.push(item)
     } else if (item.questionType == 'judge') {
       examination.cardList[1].infoList.push(item)
@@ -1199,6 +1187,8 @@
       examination.cardList[3].infoList.push(item)
     } else if (item.questionType == 'shortAnswer') {
       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)
@@ -1355,7 +1345,7 @@
       keys: [props.info.id]
     })
     .then((res:any) => {
-      if(res) {
+      if(res.length) {
         data = JSON.parse(res[0].value)
       }
     })
@@ -1426,7 +1416,7 @@
       ]
     })
     .then((res:any) => {
-      console.log('閿欓宸蹭繚瀛�', examination.allError)
+      console.log('閿欓宸叉竻绌�')
     })
 }
 defineExpose({ handleExaminationDialog })

--
Gitblit v1.9.1