2 次代码提交 5a25781eb0 ... ffd0c47091

作者 SHA1 备注 提交日期
  任一存 ffd0c47091 gaigaigai 1 年之前
  任一存 bfbfa795c5 bug fix: 如果多选题是第一个冒出来的,会无法提交。 1 年之前
共有 3 个文件被更改,包括 30 次插入19 次删除
  1. 11 11
      src/quizData.js
  2. 11 5
      src/views/QuestionInner.vue
  3. 8 3
      src/views/QuestionView.vue

文件差异内容过多而无法显示
+ 11 - 11
src/quizData.js


+ 11 - 5
src/views/QuestionInner.vue

@@ -165,7 +165,9 @@ export default {
           return !!item
         }).length > 0
       } else if (this.questionInfo.questionType === '多选题') {
-        return this.selectedIdxList.length > 1
+        return !!this.selectedIdxList.find((item) => {
+          return !!item
+        })
       } else if (this.questionInfo.questionType === '连线题') {
         if (this.selectedIdxList && this.selectedIdxList.flat().filter((item) => {
           return !!item
@@ -222,8 +224,13 @@ export default {
         }
       }
     },
+    canSubmit: {
+      handler(vNew) {
+        this.$emit('canSubmitChange', vNew)
+      }
+    }
   },
-  async mounted() {
+  mounted() {
     this.resetSelectedIdxList()
   },
   methods: {
@@ -239,9 +246,6 @@ export default {
           this.selectedIdxList = JSON.parse(JSON.stringify(this.questionInfo.emptyAnswer))
         } else {
           this.selectedIdxList = new Array(this.questionInfo.answerOptions.length)
-          this.selectedIdxList.forEach(element => {
-            return !!element
-          })
         }
       }
     },
@@ -305,6 +309,8 @@ export default {
     font-family: Source Han Sans CN-Regular, Source Han Sans CN;
     font-weight: 400;
     color: #693D2F;
+    max-height: 50px;
+    overflow: auto;
   }
   > button.option {
     margin-top: 6px;

+ 8 - 3
src/views/QuestionView.vue

@@ -30,6 +30,7 @@
     <QuestionInner
       v-show="isDescInline || !isShowDesc"
       ref="question-inner"
+      @canSubmitChange="onCanSubmitChange"
       @submit="onSubmit"
     />
     <AnswerDesc
@@ -70,7 +71,7 @@
       >
     </div>
     <button
-      v-show="!isSubmitted && (questionInfo?.questionType === '多选题' || questionInfo.questionType === '连线题') && $refs['question-inner']?.canSubmit"
+      v-show="!isSubmitted && (questionInfo?.questionType === '多选题' || questionInfo.questionType === '连线题') && canSubmit"
       class="submit"
       @click="onSubmit"
     >
@@ -147,6 +148,7 @@ export default {
   data() {
     return {
       isShowDesc: false,
+      canSubmit: false,
     }
   },
   computed: {
@@ -163,7 +165,7 @@ export default {
   },
   watch: {
   },
-  async mounted() {
+  mounted() {
   },
   methods: {
     ...globalMapMutations([
@@ -174,8 +176,11 @@ export default {
     onClickClose() {
       window.parent.document.getElementById('closepop').click()
     },
+    onCanSubmitChange(p) {
+      this.canSubmit = p
+    },
     onSubmit() {
-      if (this.$refs['question-inner']?.canSubmit) {
+      if (this.canSubmit) {
         this.setIsSubmitted(true)
         globalApi.submitAnswer(
           this.$refs['question-inner']?.isCorrect,