题目新增-多选题支持到F,题目详情可支持到答案E和F

This commit is contained in:
18571350067 2021-11-29 11:51:30 +08:00
parent 200538d486
commit d966101089
2 changed files with 51 additions and 32 deletions

View File

@ -78,6 +78,20 @@
</template>
<a-textarea placeholder="" :rows="6" v-model="multiselect.answerD" style="width: 100%" />
</a-card>
<a-card :bordered="false">
<template slot="title">
E &nbsp;&nbsp;
<a-checkbox v-model="multiselect.E" value="E">答案</a-checkbox>
</template>
<a-textarea placeholder="" :rows="6" v-model="multiselect.answerE" style="width: 100%" />
</a-card>
<a-card :bordered="false">
<template slot="title">
F &nbsp;&nbsp;
<a-checkbox v-model="multiselect.F" value="F">答案</a-checkbox>
</template>
<a-textarea placeholder="" :rows="6" v-model="multiselect.answerF" style="width: 100%" />
</a-card>
<a-card title="答案解析" :bordered="false">
<a-textarea placeholder="" :rows="6" v-model="multiselect.asnwerParse" style="width: 100%" />
</a-card>
@ -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
}
})
}
@ -216,19 +228,19 @@ export default {
//
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
},
},
}
</script>

View File

@ -65,6 +65,8 @@
<div class="answer">B. {{ questionDetail.answerB }}</div>
<div class="answer">C. {{ questionDetail.answerC }}</div>
<div class="answer">D. {{ questionDetail.answerD }}</div>
<div v-if="questionDetail.answerE" class="answer">E. {{ questionDetail.answerE }}</div>
<div v-if="questionDetail.answerF" class="answer">F. {{ questionDetail.answerF }}</div>
</div>
<!-- 显示简答题 -->