学习模式自动提交,正确1秒/错误3秒后自动刷新

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-07-20 08:19:25 +08:00
parent 342a2765d7
commit e2c1345d40
2 changed files with 19 additions and 16 deletions
@@ -190,6 +190,13 @@ final class QuizViewController: UIViewController {
if isSpelling {
spellingHintLabel.text = "\(question.word.word.count) 个字母,补全空缺部分"
spellingView.configure(blankedWord: question.blankedWord, blankPositions: question.blankPositions)
if config.isStudyMode {
nextButton.isHidden = true
spellingView.onChange = { [weak self] in
guard let self, spellingView.isComplete else { return }
submitSpelling(spellingView.typedWord(), for: question)
}
} else {
spellingView.onChange = { [weak self] in
guard let self else { return }
nextButton.isEnabled = spellingView.isComplete
@@ -197,6 +204,7 @@ final class QuizViewController: UIViewController {
nextButton.configuration?.title = "确认"
nextButton.isEnabled = false
nextButton.isHidden = false
}
spellingView.activate()
} else if isDictation {
dictationView.reset()
@@ -348,16 +356,11 @@ final class QuizViewController: UIViewController {
resultLabel.isHidden = false
if config.isStudyMode {
if correct {
nextButton.isHidden = true
DispatchQueue.main.asyncAfter(deadline: .now() + 0.8) { [weak self] in
let delay: TimeInterval = correct ? 1.0 : 3.0
DispatchQueue.main.asyncAfter(deadline: .now() + delay) { [weak self] in
self?.restart()
}
} else {
nextButton.configuration?.title = "继续学习"
nextButton.isEnabled = true
nextButton.isHidden = false
}
} else {
nextButton.configuration?.title = currentIndex + 1 < questions.count ? "下一题" : "查看成绩"
nextButton.isEnabled = true
@@ -189,7 +189,7 @@ final class WordDetailViewController: UIViewController {
@objc private func startSpelling() {
Haptics.selection()
let config = QuizConfig(mode: .spelling, words: [word])
let config = QuizConfig(mode: .spelling, words: [word], isStudyMode: true)
navigationController?.pushViewController(QuizViewController(config: config), animated: true)
}