From 9a3447819ccce94cf5051f038ea4f0e636f24a42 Mon Sep 17 00:00:00 2001
From: 钟日健 <5689795+arsn@user.noreply.gitee.com>
Date: Sat, 16 Oct 2021 22:03:03 +0800
Subject: [PATCH] 考试提交修改

---
 src/views/startexam/index.vue |   52 ++++++++++++++++++++++++++++++----------------------
 1 files changed, 30 insertions(+), 22 deletions(-)

diff --git a/src/views/startexam/index.vue b/src/views/startexam/index.vue
index 4f6df89..b51eec9 100644
--- a/src/views/startexam/index.vue
+++ b/src/views/startexam/index.vue
@@ -86,7 +86,7 @@
                       type="primary"
                       >下一题</el-button
                     >
-                    <el-button
+                    <!-- <el-button
                       :disabled="timesIT"
                       type="success"
                       @click="submitExam"
@@ -98,12 +98,10 @@
                           : '点击完成考试'
                       "
                       >完成考试 {{ time }}</el-button
-                    >
-                    <!-- <el-button
-                      type="success"
-                      @click="submitExam"
-                      >完成考试 {{ time }}</el-button
                     > -->
+                    <el-button type="success" @click="submitExam"
+                      >完成考试 {{ time }}</el-button
+                    >
                   </div>
                 </div>
               </el-col>
@@ -820,27 +818,37 @@
         examResultVOS: null,
       };
       var arr = [];
-      // console.log(this.subjectIds);
+      console.log(this.subjectIds);
+      // debugger;
+      console.log(this.subjectIds.length, 111);
       for (var i = 0; i < this.subjectIds.length; i++) {
         let item = this.subjectIds[i];
         // console.log(item.answer, i);
         if (item.type == 3 || item.type == 1) {
           var str = "";
-
           if (item.answer.length > 0) {
-            item.answer.forEach((it) => {
-              if (it.value != "") {
-                str += it.value + ",";
-              }
-            });
+            //如果是数组
+            if (item.answer instanceof Array) {
+              item.answer.forEach((it) => {
+                if (it.value != "") {
+                  str += it.value + ",";
+                }
+              });
 
-            var a = str.substr(0, str.length - 1);
+              var a = str.substr(0, str.length - 1);
 
-            arr.push({
-              subjectChoicesId: item.everyID,
-              value: a,
-              grade: item.score,
-            });
+              arr.push({
+                subjectChoicesId: item.everyID,
+                value: a,
+                grade: item.score,
+              });
+            }else{
+              arr.push({
+                subjectChoicesId: item.everyID,
+                value: item.answer,
+                grade: item.score,
+              });
+            }
           }
         } else {
           arr.push({
@@ -850,11 +858,11 @@
           });
         }
       }
-      // console.log(arr);
+      // console.log(arr, 123);
       // return;
       obj.examResultVOS = arr;
-      // console.log(this.subjectIds);
-      // console.log(obj.examResultVOS);
+      // console.log(this.subjectIds, 456);
+      // console.log(obj.examResultVOS, 789);
 
       saveAndNext(obj)
         .then((response) => {

--
Gitblit v1.9.3