学习模式自动提交,正确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,13 +190,21 @@ final class QuizViewController: UIViewController {
if isSpelling { if isSpelling {
spellingHintLabel.text = "\(question.word.word.count) 个字母,补全空缺部分" spellingHintLabel.text = "\(question.word.word.count) 个字母,补全空缺部分"
spellingView.configure(blankedWord: question.blankedWord, blankPositions: question.blankPositions) spellingView.configure(blankedWord: question.blankedWord, blankPositions: question.blankPositions)
spellingView.onChange = { [weak self] in if config.isStudyMode {
guard let self else { return } nextButton.isHidden = true
nextButton.isEnabled = spellingView.isComplete 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
}
nextButton.configuration?.title = "确认"
nextButton.isEnabled = false
nextButton.isHidden = false
} }
nextButton.configuration?.title = "确认"
nextButton.isEnabled = false
nextButton.isHidden = false
spellingView.activate() spellingView.activate()
} else if isDictation { } else if isDictation {
dictationView.reset() dictationView.reset()
@@ -348,15 +356,10 @@ final class QuizViewController: UIViewController {
resultLabel.isHidden = false resultLabel.isHidden = false
if config.isStudyMode { if config.isStudyMode {
if correct { nextButton.isHidden = true
nextButton.isHidden = true let delay: TimeInterval = correct ? 1.0 : 3.0
DispatchQueue.main.asyncAfter(deadline: .now() + 0.8) { [weak self] in DispatchQueue.main.asyncAfter(deadline: .now() + delay) { [weak self] in
self?.restart() self?.restart()
}
} else {
nextButton.configuration?.title = "继续学习"
nextButton.isEnabled = true
nextButton.isHidden = false
} }
} else { } else {
nextButton.configuration?.title = currentIndex + 1 < questions.count ? "下一题" : "查看成绩" nextButton.configuration?.title = currentIndex + 1 < questions.count ? "下一题" : "查看成绩"
@@ -189,7 +189,7 @@ final class WordDetailViewController: UIViewController {
@objc private func startSpelling() { @objc private func startSpelling() {
Haptics.selection() 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) navigationController?.pushViewController(QuizViewController(config: config), animated: true)
} }