feat(training): 新增已结束筛选并精简课程展示
新增已结束任务筛选与只读回顾资格,保留搜索和游标分页。移除任务小节数量及课程附件文件名、切换入口,并更新接口和界面回归测试。
This commit is contained in:
@@ -121,7 +121,7 @@ enum TrainingUI {
|
||||
}
|
||||
}
|
||||
|
||||
/// 任务卡显示截止、课程小节、提示、进度条和对应的操作入口。
|
||||
/// 任务卡显示截止、考试信息、提示、进度条和对应的操作入口。
|
||||
@MainActor
|
||||
final class TrainingTaskCell: UITableViewCell {
|
||||
static let reuseIdentifier = "TrainingTaskCell"
|
||||
@@ -188,7 +188,7 @@ final class TrainingTaskCell: UITableViewCell {
|
||||
statusLabel.text = task.learnerStatus.title
|
||||
statusLabel.textColor = task.learnerStatus == .completed ? TrainingUI.success : TrainingUI.primary
|
||||
publisherLabel.text = "发布人:\(task.publisherText)"
|
||||
metaLabel.text = task.mode == .exam ? "学习 + 考试 · \(task.course.sections.count) 节 · \(task.questions.count) 题 · \(task.passScore) 分及格" : "仅学习 · \(task.course.sections.count) 节"
|
||||
metaLabel.text = task.mode == .exam ? "学习 + 考试 · \(task.questions.count) 题 · \(task.passScore) 分及格" : "仅学习"
|
||||
hintLabel.text = presentation.hint
|
||||
progressView.progress = Float(presentation.progressPercent) / 100
|
||||
progressLabel.text = "学习进度 \(presentation.progressPercent)%"
|
||||
@@ -204,19 +204,20 @@ final class TrainingTaskCell: UITableViewCell {
|
||||
titleLabel.text = task.title
|
||||
deadlineLabel.text = task.endAt.map { "截止时间:\(TrainingUI.date($0))" } ?? "未设置截止时间"
|
||||
statusLabel.text = task.learnerStatus.title
|
||||
statusLabel.textColor = task.learnerStatus == .completed ? TrainingUI.success : TrainingUI.primary
|
||||
statusLabel.textColor = switch task.learnerStatus { case .pendingExam: TrainingUI.primary; case .completed: TrainingUI.success; case .ended: TrainingUI.muted }
|
||||
let publisher = task.publisherName?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
|
||||
publisherLabel.text = "发布人:\(publisher.isEmpty ? "未记录" : publisher)"
|
||||
metaLabel.text = task.mode == .exam ? "学习 + 考试 · \(task.sectionCount) 节 · \(task.questionCount) 题 · \(task.passScore ?? 0) 分及格" : "仅学习 · \(task.sectionCount) 节"
|
||||
metaLabel.text = task.mode == .exam ? "学习 + 考试 · \(task.questionCount) 题 · \(task.passScore ?? 0) 分及格" : "仅学习"
|
||||
let completed = task.learnerStatus == .completed
|
||||
hintLabel.text = completed ? "已完成本次学习任务" : task.learning.canStartExam ? "课程已学完,可以开始考试" : task.learning.canStudy ? "请阅读课程,完成学习要求" : "任务暂不可提交,可回顾课程内容"
|
||||
let ended = task.learnerStatus == .ended
|
||||
hintLabel.text = ended ? "任务已结束,仅可回顾课程内容" : completed ? "已完成本次学习任务" : task.learning.canStartExam ? "课程已学完,可以开始考试" : task.learning.canStudy ? "请阅读课程,完成学习要求" : "任务暂不可提交,可回顾课程内容"
|
||||
let progress = min(100, max(0, task.learning.progressPercent))
|
||||
progressView.progress = Float(progress) / 100
|
||||
progressLabel.text = "学习进度 \(progress)%"
|
||||
var configuration = actionButton.configuration
|
||||
configuration?.title = completed ? "回顾学习" : task.learning.canStartExam ? (task.learning.hasDraft ? "继续答题" : "开始考试") : task.learning.canStudy ? "去学习" : "查看课程"
|
||||
configuration?.title = ended || completed ? "回顾学习" : task.learning.canStartExam ? (task.learning.hasDraft ? "继续答题" : "开始考试") : task.learning.canStudy ? "去学习" : "查看课程"
|
||||
actionButton.configuration = configuration
|
||||
actionButton.isEnabled = task.learning.canViewCourse || task.learning.canStartExam
|
||||
actionButton.isEnabled = task.learning.canViewCourse || (!ended && task.learning.canStartExam)
|
||||
actionButton.accessibilityIdentifier = "training.task.action.\(task.id)"
|
||||
footer.axis = traitCollection.preferredContentSizeCategory.isAccessibilityCategory ? .vertical : .horizontal
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user