Skip to content

Commit 21c7913

Browse files
committed
feat: add correct and error icons to QAController for visual feedback on answers
1 parent d864e88 commit 21c7913

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

20.2 KB
Loading

scripts/WenTianPavilion/index.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,8 +491,26 @@ class QAController {
491491
Array.from(this.optionsContainer.children).forEach(child => {
492492
if (child.dataset.id === question.answer) {
493493
child.style.backgroundColor = '#e0ffe0';
494+
// 添加正确图标
495+
const rightIcon = document.createElement('img');
496+
rightIcon.src = '../assets/images/WenTianPavilion/right.svg';
497+
rightIcon.alt = 'correct';
498+
rightIcon.style.width = '2rem';
499+
rightIcon.style.height = '2rem';
500+
rightIcon.style.marginLeft = '1rem';
501+
rightIcon.style.verticalAlign = 'middle';
502+
child.appendChild(rightIcon);
494503
} else if (child.classList.contains('selected') && !correct) {
495504
child.style.backgroundColor = '#ffe0e0';
505+
// 添加错误图标
506+
const errorIcon = document.createElement('img');
507+
errorIcon.src = '../assets/images/WenTianPavilion/error.svg';
508+
errorIcon.alt = 'error';
509+
errorIcon.style.width = '2rem';
510+
errorIcon.style.height = '2rem';
511+
errorIcon.style.marginLeft = '1rem';
512+
errorIcon.style.verticalAlign = 'middle';
513+
child.appendChild(errorIcon);
496514
}
497515
});
498516
}

0 commit comments

Comments
 (0)