Browse Source

Update index.tsx

lex 2 years ago
parent
commit
7b0b35ae33
1 changed files with 15 additions and 7 deletions
  1. 15 7
      src/views/unit-test/examination-mode/index.tsx

+ 15 - 7
src/views/unit-test/examination-mode/index.tsx

@@ -111,7 +111,7 @@ export default defineComponent({
       // 时间到了考试结束
       if (minu <= 0) {
         eventUnit.emit('unitAudioStop')
-        await onConfirmExam(false)
+        await afterQuestion()
         state.visiableExam = true
       } else {
         // pause()
@@ -219,7 +219,19 @@ export default defineComponent({
     /**
      * @description 提交最终答案
      */
-    const onConfirmExam = async (status = true) => {
+    const onConfirmExam = async () => {
+      try {
+        await afterQuestion()
+        onAfter()
+        // if (status) {
+        state.visiableResult = true
+        // }
+      } catch {
+        //
+      }
+    }
+
+    const afterQuestion = async () => {
       try {
         const questionList = state.questionList || []
         const userAnswerList: any = [] // 所有题目的答案
@@ -257,10 +269,6 @@ export default defineComponent({
             examName: state.examDetail.unitExaminationName
           }
         }
-        onAfter()
-        if (status) {
-          state.visiableResult = true
-        }
       } catch {
         //
       }
@@ -325,7 +333,7 @@ export default defineComponent({
                     autoStart={false}
                     onFinish={async () => {
                       eventUnit.emit('unitAudioStop')
-                      await onConfirmExam(false)
+                      await afterQuestion()
                       state.visiableExam = true
                     }}
                   />