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 }}