From d966101089895cdab701947aea479faed2334f17 Mon Sep 17 00:00:00 2001 From: 18571350067 Date: Mon, 29 Nov 2021 11:51:30 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=98=E7=9B=AE=E6=96=B0=E5=A2=9E-=E5=A4=9A?= =?UTF-8?q?=E9=80=89=E9=A2=98=E6=94=AF=E6=8C=81=E5=88=B0F,=E9=A2=98?= =?UTF-8?q?=E7=9B=AE=E8=AF=A6=E6=83=85=E5=8F=AF=E6=94=AF=E6=8C=81=E5=88=B0?= =?UTF-8?q?=E7=AD=94=E6=A1=88E=E5=92=8CF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/course/question/QuestionAdd.vue | 81 +++++++++++++--------- src/views/course/question/QuestionList.vue | 2 + 2 files changed, 51 insertions(+), 32 deletions(-) diff --git a/src/views/course/question/QuestionAdd.vue b/src/views/course/question/QuestionAdd.vue index 204912a..3af5e72 100644 --- a/src/views/course/question/QuestionAdd.vue +++ b/src/views/course/question/QuestionAdd.vue @@ -78,6 +78,20 @@ + + + + + + + + @@ -156,38 +170,36 @@ export default { estimate: {}, shortAnswer: {}, Completion: { answerList: [''] }, - tabKey: this.$route.query.questionType ? this.$route.query.questionType : '1' + tabKey: this.$route.query.questionType ? this.$route.query.questionType : '1', } }, created() { - //判断是否是编辑 if (this.$route.query.id && !this.$route.query.opt) { - - this.radio.disabled = true; - this.multiselect.disabled = true; - this.estimate.disabled = true; - this.shortAnswer.disabled = true; - this.Completion.disabled = true; + this.radio.disabled = true + this.multiselect.disabled = true + this.estimate.disabled = true + this.shortAnswer.disabled = true + this.Completion.disabled = true getQuestionDeatil({ id: this.$route.query.id }).then((res) => { if (this.tabKey == '1') { - this.radio = res.data; - this.radio.disabled = false; + this.radio = res.data + this.radio.disabled = false } else if (this.tabKey == '2') { - this.multiselect = res.data; - this.multiselect.disabled = false; - this.getRightAnswer(); - } else if(this.tabKey == '3') { - this.estimate = res.data; - this.estimate.disabled = false; + this.multiselect = res.data + this.multiselect.disabled = false + this.getRightAnswer() + } else if (this.tabKey == '3') { + this.estimate = res.data + this.estimate.disabled = false } else if (this.tabKey == '4') { - this.shortAnswer = res.data; - this.shortAnswer.disabled = false; + this.shortAnswer = res.data + this.shortAnswer.disabled = false } else if (this.tabKey == '5') { - this.Completion = res.data; - this.Completion.disabled = false; + this.Completion = res.data + this.Completion.disabled = false } }) } @@ -213,22 +225,22 @@ export default { this.Completion = { answerList: [''] } this.tabKey = key }, - + // 添加填空 addAnswerSize() { - if (this.Completion.answerList.length == 10) { - this.$message.error('填空数量最多不能超过10个') + if (this.Completion.answerList.length == 5) { + this.$message.error('填空数量最多不能超过5个') return } this.Completion.answerList.push('') }, // 刪除填空 delAnswerSize() { - if (this.Completion.answerList.length == 1) { + if (this.Completion.answerList.length == 1) { this.$message.error('填空数量最少不能少于1个') return } - this.Completion.answerList.splice(this.Completion.answerList.length-1, 1); + this.Completion.answerList.splice(this.Completion.answerList.length - 1, 1) }, // 确定 @@ -314,7 +326,13 @@ export default { this.$message.error('答案C不能为空!') return false } else if (!this.multiselect.answerD || this.multiselect.answerD === '') { - this.$$message.error('答案D不能为空!') + this.$message.error('答案D不能为空!') + return false + } else if (!this.multiselect.answerE || this.multiselect.answerD === '') { + this.$message.error('答案E不能为空!') + return false + } else if (!this.multiselect.answerF || this.multiselect.answerD === '') { + this.$message.error('答案F不能为空!') return false } @@ -384,13 +402,12 @@ export default { }, // 获取多选题的正确答案 - getRightAnswer(){ - if(this.multiselect.rightAnswers.indexOf('A') > -1) this.multiselect.a = true; - if(this.multiselect.rightAnswers.indexOf('B') > -1) this.multiselect.b = true; - if(this.multiselect.rightAnswers.indexOf('C') > -1) this.multiselect.c = true; - if(this.multiselect.rightAnswers.indexOf('D') > -1) this.multiselect.d = true; + getRightAnswer() { + if (this.multiselect.rightAnswers.indexOf('A') > -1) this.multiselect.a = true + if (this.multiselect.rightAnswers.indexOf('B') > -1) this.multiselect.b = true + if (this.multiselect.rightAnswers.indexOf('C') > -1) this.multiselect.c = true + if (this.multiselect.rightAnswers.indexOf('D') > -1) this.multiselect.d = true }, - }, } diff --git a/src/views/course/question/QuestionList.vue b/src/views/course/question/QuestionList.vue index 7f6846e..e1339ae 100644 --- a/src/views/course/question/QuestionList.vue +++ b/src/views/course/question/QuestionList.vue @@ -65,6 +65,8 @@
B. {{ questionDetail.answerB }}
C. {{ questionDetail.answerC }}
D. {{ questionDetail.answerD }}
+
E. {{ questionDetail.answerE }}
+
F. {{ questionDetail.answerF }}