fixed a bug
This commit is contained in:
@@ -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 = () => {
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={submitAnswer}
|
||||
disabled={!userAnswer || showAnswer}
|
||||
disabled={!userAnswer.trim() || showAnswer}
|
||||
style={{ width: '100%' }}
|
||||
>
|
||||
提交答案
|
||||
|
||||
Reference in New Issue
Block a user