Browse Source

修复考试未答题时提交异常的问题、最后一题无法自动提交的问题

luoaoxuan 1 năm trước cách đây
mục cha
commit
bda9c4310c
1 tập tin đã thay đổi với 24 bổ sung11 xóa
  1. 24 11
      src/views/platform/examination/questionBank/test.vue

+ 24 - 11
src/views/platform/examination/questionBank/test.vue

@@ -511,7 +511,7 @@ export default {
                     ti_gan_: item.stem,
                     ti_xing_: item.questionType,
                     fen_zhi_: item.score,
-                    fu_tu_: item.img,
+                    fu_tu_: item.img instanceof Array ? JSON.stringify(item.img) : item.img,
                     xuan_xiang_lei_xi: item.optionType,
                     xuan_xiang_: selectType ? JSON.stringify(item.options) : '',
                     can_kao_da_an_: item.rightKey,
@@ -558,16 +558,29 @@ export default {
             })
         },
         handleCancel () {
-            this.$confirm('中途退出将自动提交考试数据,是否确认操作?', '提示', {
-                confirmButtonText: '确定',
-                cancelButtonText: '取消',
-                type: 'warning',
-                showClose: false,
-                closeOnClickModal: false,
-                closeOnPressEscape: false
-            }).then(() => {
-                this.submitForm(this.dealFormData())
-            })
+            const nextHandle = () => {
+                this.$confirm('中途退出将自动提交考试数据,是否确认操作?', '提示', {
+                    confirmButtonText: '确定',
+                    cancelButtonText: '取消',
+                    type: 'warning',
+                    showClose: false,
+                    closeOnClickModal: false,
+                    closeOnPressEscape: false
+                }).then(() => {
+                    this.submitForm(this.dealFormData())
+                })
+            }
+            // 处理最后一题无法自动提交的bug
+            if (this.questionList[this.questionList.length - 1] !== '判断题' && this.questionList[this.questionList.length - 1] !== '单选题') {
+                if (this.showIndex !== this.questionList.length) {
+                    this.showIndex = this.questionList.length
+                } else {
+                    this.showIndex = 1
+                }
+                this.$nextTick(nextHandle)
+            } else {
+                nextHandle()
+            }
         },
         hilarity () {
             this.$notify({