fixed a bug

This commit is contained in:
2026-06-13 12:04:54 +08:00
parent c6b2bb7800
commit 2841413927
3 changed files with 38 additions and 23 deletions

View File

@@ -619,7 +619,7 @@ const VocabularyStudy: React.FC = () => {
));
setUserAnswer(response.optionToken);
} catch (error) {
message.error(INVALID_CREDENTIAL_MESSAGE);
setUserAnswer(option.text);
}
};
@@ -647,7 +647,10 @@ const VocabularyStudy: React.FC = () => {
answerSubmittingRef.current = false;
return;
}
if (testType === 'multiple-choice' && options.length > 0 && options.every(option => option.token !== normalizedUserAnswer)) {
const isKnownMultipleChoiceAnswer = options.some(option =>
option.token === normalizedUserAnswer || option.text === normalizedUserAnswer
);
if (testType === 'multiple-choice' && options.length > 0 && !isKnownMultipleChoiceAnswer) {
answerSubmittingRef.current = false;
message.warning('请选择一个选项后再提交');
return;