|
@@ -52,6 +52,22 @@ export default {
|
|
|
arrangeTypeList,
|
|
|
};
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ 'answer.answer_list': {
|
|
|
+ handler(val) {
|
|
|
+ if (val.length === 0) {
|
|
|
+ this.answer.is_right = false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (val.length !== this.data.answer.answer_list.length) {
|
|
|
+ this.answer.is_right = false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.answer.is_right = val.every((item) => this.data.answer.answer_list.includes(item));
|
|
|
+ },
|
|
|
+ deep: true,
|
|
|
+ },
|
|
|
+ },
|
|
|
methods: {
|
|
|
isAnswer(mark) {
|
|
|
return this.answer.answer_list.includes(mark);
|
|
@@ -70,17 +86,18 @@ export default {
|
|
|
if (!this.isJudgingRightWrong && !this.isShowRightAnswer) {
|
|
|
return [];
|
|
|
}
|
|
|
- let isHas = this.answer.answer_list.includes(mark); // 是否已选中的选项
|
|
|
+ let isHas = this.answer.answer_list.includes(mark); // 用户是否已选中
|
|
|
let isRight = this.data.answer.answer_list.includes(mark); // 是否是正确答案
|
|
|
|
|
|
+ let answerClass = [];
|
|
|
if (!isHas && this.isShowRightAnswer) {
|
|
|
- return isRight ? ['answer-right'] : [];
|
|
|
+ answerClass = isRight ? ['answer-right'] : [];
|
|
|
}
|
|
|
// 判断是否是正确答案
|
|
|
- if (this.isJudgingRightWrong) {
|
|
|
- return isRight ? ['right'] : ['wrong'];
|
|
|
+ if (isHas && this.isJudgingRightWrong) {
|
|
|
+ answerClass = isRight ? ['right'] : ['wrong'];
|
|
|
}
|
|
|
- return [];
|
|
|
+ return answerClass;
|
|
|
},
|
|
|
},
|
|
|
};
|