diff --git a/src/components/VocabularyStudy.tsx b/src/components/VocabularyStudy.tsx index ad8864d..a1d9b87 100644 --- a/src/components/VocabularyStudy.tsx +++ b/src/components/VocabularyStudy.tsx @@ -642,13 +642,17 @@ const VocabularyStudy: React.FC = () => { answerSubmittingRef.current = false; return; } - if (testType === 'multiple-choice' && options.length > 0 && options.every(option => option.token !== userAnswer)) { + const normalizedUserAnswer = userAnswer.trim(); + if (!normalizedUserAnswer) { + answerSubmittingRef.current = false; + return; + } + if (testType === 'multiple-choice' && options.length > 0 && options.every(option => option.token !== normalizedUserAnswer)) { answerSubmittingRef.current = false; message.warning('请选择一个选项后再提交'); return; } const submittedAt = Date.now(); - const normalizedUserAnswer = userAnswer.trim(); const answerProof = buildAnswerProof( testAttemptId, currentQuestion.questionToken, @@ -1411,6 +1415,7 @@ const VocabularyStudy: React.FC = () => { style={{ marginBottom: 15, userSelect: 'none', WebkitUserSelect: 'none' }} onPressEnter={e => { e.stopPropagation(); + if (!userAnswer.trim() || showAnswer) return; submitAnswer(); }} autoFocus @@ -1444,7 +1449,7 @@ const VocabularyStudy: React.FC = () => {