From ad0ff1ca7a7a0c39c3cf0bdbbe94867fa0b15675 Mon Sep 17 00:00:00 2001 From: fish Date: Tue, 21 Jul 2026 22:17:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=A6=E4=B9=A0=E8=AE=B0=E5=BD=95=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=E5=85=B7=E4=BD=93=E5=AD=A6=E4=B9=A0=E6=97=B6=E9=97=B4?= =?UTF-8?q?=EF=BC=8C=E7=B2=BE=E7=A1=AE=E5=88=B0=E6=97=B6=E5=88=86=E7=A7=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.7 --- .../LearnEnglish/Views/HistoryViewController.swift | 9 ++++++++- LearnEnglish/LearnEnglish/Views/WordCardCell.swift | 4 ++-- .../LearnEnglish/Views/WordHistoryViewController.swift | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/LearnEnglish/LearnEnglish/Views/HistoryViewController.swift b/LearnEnglish/LearnEnglish/Views/HistoryViewController.swift index c1c2841..6c1a1b4 100644 --- a/LearnEnglish/LearnEnglish/Views/HistoryViewController.swift +++ b/LearnEnglish/LearnEnglish/Views/HistoryViewController.swift @@ -3,6 +3,12 @@ import UIKit final class HistoryViewController: UITableViewController { private var sections: [(title: String, items: [LearnedRecord])] = [] private var speechObserver: NSObjectProtocol? + private let timeFormatter: DateFormatter = { + let f = DateFormatter() + f.locale = Locale(identifier: "zh_CN") + f.dateFormat = "HH:mm:ss" + return f + }() init() { super.init(style: .plain) @@ -73,7 +79,8 @@ final class HistoryViewController: UITableViewController { override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! WordCardCell let record = sections[indexPath.section].items[indexPath.row] - cell.configure(with: record.word, count: record.count, accuracy: record.accuracy) + let time = timeFormatter.string(from: record.learnedAt) + cell.configure(with: record.word, count: record.count, accuracy: record.accuracy, time: time) cell.onSpeak = { word in SpeechService.shared.speak(word.word) } diff --git a/LearnEnglish/LearnEnglish/Views/WordCardCell.swift b/LearnEnglish/LearnEnglish/Views/WordCardCell.swift index a0e983a..eb4623c 100644 --- a/LearnEnglish/LearnEnglish/Views/WordCardCell.swift +++ b/LearnEnglish/LearnEnglish/Views/WordCardCell.swift @@ -92,9 +92,9 @@ final class WordCardCell: UITableViewCell { updateSpeakerState() } - func configure(with word: Word, count: Int, accuracy: Int) { + func configure(with word: Word, count: Int, accuracy: Int, time: String) { configure(with: word) - countLabel.text = "\(count)次 · \(accuracy)%" + countLabel.text = "\(count)次 · \(accuracy)% · \(time)" countLabel.isHidden = false } diff --git a/LearnEnglish/LearnEnglish/Views/WordHistoryViewController.swift b/LearnEnglish/LearnEnglish/Views/WordHistoryViewController.swift index adaed13..de0249f 100644 --- a/LearnEnglish/LearnEnglish/Views/WordHistoryViewController.swift +++ b/LearnEnglish/LearnEnglish/Views/WordHistoryViewController.swift @@ -118,7 +118,7 @@ final class WordHistoryViewController: UIViewController { let formatter = DateFormatter() formatter.locale = Locale(identifier: "zh_CN") - formatter.dateFormat = "yyyy-MM-dd HH:mm" + formatter.dateFormat = "yyyy-MM-dd HH:mm:ss" let dateLabel = UILabel() dateLabel.text = "最近学习:\(formatter.string(from: record.learnedAt))" dateLabel.font = .preferredFont(forTextStyle: .caption1)