|
@@ -74,6 +74,26 @@ export default {
|
|
return [..._option_type_list.slice(0, 2), ..._option_type_list.slice(3)];
|
|
return [..._option_type_list.slice(0, 2), ..._option_type_list.slice(3)];
|
|
},
|
|
},
|
|
},
|
|
},
|
|
|
|
+ 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.some(
|
|
|
|
+ (answerItem) => answerItem.mark === item.mark && answerItem.option_type === item.option_type,
|
|
|
|
+ ),
|
|
|
|
+ );
|
|
|
|
+ },
|
|
|
|
+ deep: true,
|
|
|
|
+ },
|
|
|
|
+ },
|
|
methods: {
|
|
methods: {
|
|
// 将数字转换为小写字母
|
|
// 将数字转换为小写字母
|
|
convertNumberToLetter(number) {
|
|
convertNumberToLetter(number) {
|
|
@@ -99,7 +119,7 @@ export default {
|
|
if (!this.isJudgingRightWrong) return '';
|
|
if (!this.isJudgingRightWrong) return '';
|
|
let selectOption = this.answer.answer_list.find((item) => item.mark === mark); // 查找是否已选中的选项
|
|
let selectOption = this.answer.answer_list.find((item) => item.mark === mark); // 查找是否已选中的选项
|
|
if (!selectOption) return 'wrong';
|
|
if (!selectOption) return 'wrong';
|
|
- return this.data.answer.answer_list.find((item) => item.mark === mark).option_type === selectOption.option_type
|
|
|
|
|
|
+ return this.data.answer.answer_list.find((item) => item.mark === mark)?.option_type === selectOption.option_type
|
|
? 'right'
|
|
? 'right'
|
|
: 'wrong';
|
|
: 'wrong';
|
|
},
|
|
},
|