feat(training): 同步培训中心学习答题功能

新增首页和个人页入口,支持课程阅读、答题卡、草稿恢复、成绩解析、历史记录与重考。保留独立的 Debug 本地演示数据源及后端接入协议,并对齐列表动画和答题卡布局约定。

来源:xh_test 的 74c451c。验证:iPhone 11 真机 59 项相关测试全部通过;全量测试中的 8 个既有失败已在同步前版本复现。
This commit is contained in:
2026-10-13 15:54:31 +08:00
parent 736b5515c0
commit 8862ae5401
16 changed files with 2645 additions and 7 deletions
@@ -30,6 +30,7 @@ final class ProfileViewController: BaseViewController {
private let realNameRow = ProfileInfoRowView(title: "认证状态")
private let statusRow = ProfileInfoRowView(title: "账号状态")
private let scenicRow = ProfileInfoRowView(title: "当前景区")
private let trainingRow = ProfileInfoRowView(title: "培训中心")
private let settingRow = ProfileInfoRowView(title: "设置中心")
private let logoutButton = UIButton(type: .system)
private var hasLoadedProfileOnce = false
@@ -92,6 +93,7 @@ final class ProfileViewController: BaseViewController {
withdrawalRow.addTarget(self, action: #selector(withdrawalTapped), for: .touchUpInside)
realNameRow.addTarget(self, action: #selector(realNameTapped), for: .touchUpInside)
settingRow.addTarget(self, action: #selector(settingTapped), for: .touchUpInside)
trainingRow.addTarget(self, action: #selector(trainingTapped), for: .touchUpInside)
NotificationCenter.default.addObserver(
self,
@@ -183,7 +185,7 @@ final class ProfileViewController: BaseViewController {
[
nameRow, accountRow, phoneRow, withdrawalRow,
passwordRow, realNameRow, statusRow, scenicRow,
settingRow
trainingRow, settingRow
].forEach { infoCard.addArrangedSubview($0) }
nameRow.isUserInteractionEnabled = false
@@ -202,6 +204,7 @@ final class ProfileViewController: BaseViewController {
}
private func applyViewModel() {
trainingRow.configure(value: "学习课程与答题", accessory: .chevron)
nicknameField.text = viewModel.displayNickname
uidLabel.text = "UID:\(viewModel.displayUID)"
avatarImageView.loadRemoteImage(urlString: viewModel.displayAvatarURL)
@@ -353,6 +356,10 @@ final class ProfileViewController: BaseViewController {
navigationController?.pushViewController(SettingViewController(), animated: true)
}
@objc private func trainingTapped() {
HomeRouteHandler.open(uri: "/training", from: self, storeItem: nil)
}
@objc private func logoutTapped() {
let alert = UIAlertController(title: "确定退出登录?", message: "退出后将需要重新登录", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "取消", style: .cancel))