feat(training): 支持课程附件预览与整页阅读

This commit is contained in:
2026-10-20 13:36:58 +08:00
parent 091d17ff21
commit b149295e66
53 changed files with 4233 additions and 632 deletions
@@ -7,6 +7,7 @@ final class TrainingResultViewController: TrainingBaseViewController {
private let taskID: String
private let attemptID: String
private let service: any TrainingDataServing
private let documentLoader: any TrainingDocumentLoading
private let viewModel: TrainingRemoteResultViewModel
private let validateIdentity: () -> Bool
private var loadFailed = false
@@ -21,10 +22,12 @@ final class TrainingResultViewController: TrainingBaseViewController {
private let actionButton = TrainingUI.button("完成,返回培训中心")
/// 使用记录 ID 读取最新本人任务,禁止通过后从旧失败记录继续重考。
init(taskID: String, attemptID: String, service: any TrainingDataServing, initialDetail: TrainingAttemptDetail? = nil) {
init(taskID: String, attemptID: String, service: any TrainingDataServing, initialDetail: TrainingAttemptDetail? = nil,
documentLoader: any TrainingDocumentLoading = TrainingDocumentLoader()) {
self.taskID = taskID
self.attemptID = attemptID
self.service = service
self.documentLoader = documentLoader
let session = AppStore.shared.session
let scope = session.accountCachePrefix
let token = session.token
@@ -281,7 +284,7 @@ final class TrainingResultViewController: TrainingBaseViewController {
if let course = navigationController.viewControllers.last(where: { ($0 as? TrainingCourseViewController)?.taskID == taskID }) {
navigationController.popToViewController(course, animated: true)
} else {
navigationController.pushViewController(TrainingCourseViewController(taskID: taskID, service: service), animated: true)
navigationController.pushViewController(TrainingCourseViewController(taskID: taskID, service: service, documentLoader: documentLoader), animated: true)
}
}