- Symptom @Model with severity 1-5 clamp, isOngoing, duration helpers - SymptomStartSheet / SymptomEndSheet / OngoingSymptomsCard - RecordSheet 加 .symptom kind 入口 - RootView 增加 'records' tab + ArchiveListView placeholder - HomeView 顶部加 OngoingSymptomsCard - ModelsSchemaTests: 2 个 Symptom 烟测(ongoing predicate + severity clamp) Note: Symptom 是 CLAUDE.md §10 清单外的新功能,由产品负责人决定加入。 ArchiveListView 仍是 placeholder,真实 C1 实现按计划在 W4。
111 lines
3.9 KiB
Swift
111 lines
3.9 KiB
Swift
import SwiftUI
|
|
|
|
enum RecordKind: String, Identifiable, CaseIterable {
|
|
case quick, archive, diary, symptom
|
|
var id: String { rawValue }
|
|
|
|
var title: String {
|
|
switch self {
|
|
case .quick: return "异常项快拍"
|
|
case .archive: return "关键报告归档"
|
|
case .diary: return "文字日记"
|
|
case .symptom: return "症状开始"
|
|
}
|
|
}
|
|
var subtitle: String {
|
|
switch self {
|
|
case .quick: return "只记录单个或几项异常指标"
|
|
case .archive: return "完整保存整份报告(可多页)"
|
|
case .diary: return "记录心情、用药、其他"
|
|
case .symptom: return "开始一个持续症状,结束时再点结束"
|
|
}
|
|
}
|
|
var icon: String {
|
|
switch self {
|
|
case .quick: return "camera.fill"
|
|
case .archive: return "doc.fill"
|
|
case .diary: return "pencil"
|
|
case .symptom: return "waveform.path.ecg"
|
|
}
|
|
}
|
|
var accent: Color {
|
|
switch self {
|
|
case .quick: return Tj.Palette.brick
|
|
case .archive: return Tj.Palette.ink
|
|
case .diary: return Tj.Palette.leaf
|
|
case .symptom: return Tj.Palette.amber
|
|
}
|
|
}
|
|
}
|
|
|
|
struct RecordSheet: View {
|
|
var onPick: (RecordKind) -> Void
|
|
|
|
var body: some View {
|
|
VStack(spacing: 0) {
|
|
Capsule()
|
|
.fill(Tj.Palette.line)
|
|
.frame(width: 40, height: 4)
|
|
.padding(.top, 10)
|
|
.padding(.bottom, 16)
|
|
|
|
HStack {
|
|
Text("记录什么?")
|
|
.font(.tjH2())
|
|
.foregroundStyle(Tj.Palette.text)
|
|
Spacer()
|
|
Text("本地处理 · 永不上传")
|
|
.font(.system(size: 12))
|
|
.foregroundStyle(Tj.Palette.text3)
|
|
}
|
|
.padding(.bottom, 14)
|
|
|
|
VStack(spacing: 10) {
|
|
ForEach(RecordKind.allCases) { kind in
|
|
Button {
|
|
onPick(kind)
|
|
} label: {
|
|
HStack(spacing: 14) {
|
|
ZStack {
|
|
RoundedRectangle(cornerRadius: Tj.Radius.sm, style: .continuous)
|
|
.fill(kind.accent)
|
|
Image(systemName: kind.icon)
|
|
.font(.system(size: 18, weight: .medium))
|
|
.foregroundStyle(Tj.Palette.paper)
|
|
}
|
|
.frame(width: 44, height: 44)
|
|
|
|
VStack(alignment: .leading, spacing: 2) {
|
|
Text(kind.title)
|
|
.font(.system(size: 15, weight: .semibold))
|
|
.foregroundStyle(Tj.Palette.text)
|
|
Text(kind.subtitle)
|
|
.font(.system(size: 12))
|
|
.foregroundStyle(Tj.Palette.text3)
|
|
}
|
|
Spacer()
|
|
Image(systemName: "chevron.right")
|
|
.font(.system(size: 14, weight: .medium))
|
|
.foregroundStyle(Tj.Palette.text3)
|
|
}
|
|
.padding(16)
|
|
.tjCard()
|
|
}
|
|
.buttonStyle(.plain)
|
|
}
|
|
}
|
|
.padding(.bottom, 22)
|
|
}
|
|
.padding(.horizontal, 18)
|
|
.background(
|
|
Tj.Palette.sand
|
|
.clipShape(RoundedRectangle(cornerRadius: Tj.Radius.xl, style: .continuous))
|
|
.ignoresSafeArea(edges: .bottom)
|
|
)
|
|
.presentationDetents([.fraction(0.68)])
|
|
.presentationDragIndicator(.hidden)
|
|
.presentationBackground(Tj.Palette.sand)
|
|
.presentationCornerRadius(Tj.Radius.xl)
|
|
}
|
|
}
|