diff --git a/src/views/course/question/QuestionAdd.vue b/src/views/course/question/QuestionAdd.vue index d623c1a..3e1444e 100644 --- a/src/views/course/question/QuestionAdd.vue +++ b/src/views/course/question/QuestionAdd.vue @@ -232,12 +232,6 @@ export default { this.tabKey = key }, - //多选题选中 - onChange(checkedValues) { - console.log('checked = ', checkedValues); - this.checkedValues = checkedValues; - }, - // 添加填空 addAnswerSize() { if (this.Completion.answerList.length == 5) { @@ -319,6 +313,12 @@ export default { return from }, + //多选题选中 + onChange(checkedValues) { + console.log('checked = ', checkedValues); + this.checkedValues = checkedValues; + }, + // 验证多选题 multiselectV() { // 题目名称是否为空 @@ -352,18 +352,19 @@ export default { from = this.multiselect from.questionType = 2 from.rightAnswers = '' - // 验证是否勾选正确答案,并且正确答案不能少于一个 - if (this.multiselect.a && this.multiselect.a == true) from.rightAnswers += 'A' - if (this.multiselect.b && this.multiselect.b == true) from.rightAnswers += 'B' - if (this.multiselect.c && this.multiselect.c == true) from.rightAnswers += 'C' - if (this.multiselect.d && this.multiselect.d == true) from.rightAnswers += 'D' - if (this.multiselect.e && this.multiselect.e == true) from.rightAnswers += 'E' - if (this.multiselect.f && this.multiselect.f == true) from.rightAnswers += 'F' - if (from.rightAnswers.length < 1 || from.rightAnswers == '') { + + console.log('this.checkedValues',this.checkedValues) + + if (this.checkedValues.length < 1 || this.checkedValues.length == 0) { this.$message.error('请选择正确答案!') return false } + + for(let i = 0 ; i