From e2c1345d408a9aa5d4e366876fa858a4b31258bf Mon Sep 17 00:00:00 2001 From: fish Date: Mon, 20 Jul 2026 08:19:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=A6=E4=B9=A0=E6=A8=A1=E5=BC=8F=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E6=8F=90=E4=BA=A4=EF=BC=8C=E6=AD=A3=E7=A1=AE1?= =?UTF-8?q?=E7=A7=92/=E9=94=99=E8=AF=AF3=E7=A7=92=E5=90=8E=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.7 --- .../Views/QuizViewController.swift | 33 ++++++++++--------- .../Views/WordDetailViewController.swift | 2 +- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/LearnEnglish/LearnEnglish/Views/QuizViewController.swift b/LearnEnglish/LearnEnglish/Views/QuizViewController.swift index c21ac4b..ff4297a 100644 --- a/LearnEnglish/LearnEnglish/Views/QuizViewController.swift +++ b/LearnEnglish/LearnEnglish/Views/QuizViewController.swift @@ -190,13 +190,21 @@ final class QuizViewController: UIViewController { if isSpelling { spellingHintLabel.text = "\(question.word.word.count) 个字母,补全空缺部分" spellingView.configure(blankedWord: question.blankedWord, blankPositions: question.blankPositions) - spellingView.onChange = { [weak self] in - guard let self else { return } - nextButton.isEnabled = spellingView.isComplete + 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 + } + nextButton.configuration?.title = "确认" + nextButton.isEnabled = false + nextButton.isHidden = false } - nextButton.configuration?.title = "确认" - nextButton.isEnabled = false - nextButton.isHidden = false spellingView.activate() } else if isDictation { dictationView.reset() @@ -348,15 +356,10 @@ 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 - self?.restart() - } - } else { - nextButton.configuration?.title = "继续学习" - nextButton.isEnabled = true - nextButton.isHidden = false + nextButton.isHidden = true + let delay: TimeInterval = correct ? 1.0 : 3.0 + DispatchQueue.main.asyncAfter(deadline: .now() + delay) { [weak self] in + self?.restart() } } else { nextButton.configuration?.title = currentIndex + 1 < questions.count ? "下一题" : "查看成绩" diff --git a/LearnEnglish/LearnEnglish/Views/WordDetailViewController.swift b/LearnEnglish/LearnEnglish/Views/WordDetailViewController.swift index ce7343a..ce74fcc 100644 --- a/LearnEnglish/LearnEnglish/Views/WordDetailViewController.swift +++ b/LearnEnglish/LearnEnglish/Views/WordDetailViewController.swift @@ -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) }