Files
kangkang/体己/Features/Archive/B3MetaView.swift
link2026 c050865db5 feat(ui): UI 骨架基线 — 3 Tab + RecordSheet + Quick/Archive 流程占位
替换 Xcode 默认模板:
- 删除 ContentView/Item/__App
- 新增 App/TijiApp(SwiftData ModelContainer)、RootView(3 Tab + RecordSheet)
- DesignSystem:Tokens(色板/字体/圆角)+ Components(卡片/按钮/Chip)
- Models:Indicator / Report / DiaryEntry @Model 初版
- Features:Home / Quick(A1-A3)/ Archive(B1-B5)/ Record / Trends / Me 静态 UI

W2 AI 基座工作将在此基线上叠加。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 14:49:21 +08:00

138 lines
4.8 KiB
Swift
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import SwiftUI
struct B3MetaView: View {
var onAnalyze: () -> Void
var onBack: () -> Void
@State private var selectedType = 0
private let types = ["体检报告", "化验单", "影像报告", "处方", "其他"]
var body: some View {
VStack(spacing: 0) {
header
ScrollView(showsIndicators: false) {
VStack(alignment: .leading, spacing: 0) {
Text("报告类型")
.font(.system(size: 11))
.tracking(0.5)
.foregroundStyle(Tj.Palette.text3)
.padding(.bottom, 8)
typeChips.padding(.bottom, 20)
FormRow(label: "报告日期", value: "2026 / 05 / 25", subtle: false)
FormRow(label: "出具机构", value: "协和医院体检中心", subtle: true)
FormRow(label: "备注", value: "春季年度体检", subtle: true)
Text("已拍页面3 页)")
.font(.system(size: 11))
.tracking(0.5)
.foregroundStyle(Tj.Palette.text3)
.padding(.top, 20)
.padding(.bottom, 10)
HStack(spacing: 10) {
ForEach(1...3, id: \.self) { n in
PageCard(index: n)
}
}
}
.padding(.horizontal, 18)
.padding(.bottom, 18)
}
VStack(spacing: 8) {
Button(action: onAnalyze) {
Text("开始 AI 解读").frame(maxWidth: .infinity)
}
.buttonStyle(TjPrimaryButton())
Text("预计耗时 58 秒 · 端侧 SME2 加速")
.font(.system(size: 11))
.foregroundStyle(Tj.Palette.text3)
}
.padding(.horizontal, 18)
.padding(.bottom, 14)
}
.background(Tj.Palette.sand.ignoresSafeArea())
}
private var header: some View {
HStack(spacing: 6) {
Button(action: onBack) {
Image(systemName: "chevron.left")
.font(.system(size: 18, weight: .semibold))
.foregroundStyle(Tj.Palette.text)
.frame(width: 36, height: 36)
}
Text("归档信息")
.font(.system(size: 15, weight: .semibold))
.foregroundStyle(Tj.Palette.text)
Spacer()
}
.padding(.horizontal, 12)
.padding(.top, 4)
.padding(.bottom, 8)
}
private var typeChips: some View {
let columns = [GridItem(.adaptive(minimum: 60, maximum: 200), spacing: 8)]
return LazyVGrid(columns: columns, alignment: .leading, spacing: 8) {
ForEach(Array(types.enumerated()), id: \.offset) { idx, t in
Button { selectedType = idx } label: {
Text(t)
.font(.system(size: 12, weight: .medium))
.foregroundStyle(idx == selectedType ? Tj.Palette.paper : Tj.Palette.text2)
.padding(.horizontal, 12)
.padding(.vertical, 6)
.background(
Capsule().fill(idx == selectedType ? Tj.Palette.ink : Tj.Palette.sand2)
)
}
.buttonStyle(.plain)
}
}
}
}
private struct FormRow: View {
let label: String
let value: String
let subtle: Bool
var body: some View {
HStack {
Text(label).font(.system(size: 13)).foregroundStyle(Tj.Palette.text2)
Spacer()
HStack(spacing: 6) {
Text(value)
.font(.system(size: 13))
.foregroundStyle(subtle ? Tj.Palette.text3 : Tj.Palette.text)
Image(systemName: "chevron.right")
.font(.system(size: 11, weight: .medium))
.foregroundStyle(Tj.Palette.text3)
}
}
.padding(.vertical, 12)
.overlay(alignment: .top) {
Rectangle().fill(Tj.Palette.lineSoft).frame(height: 1)
}
}
}
private struct PageCard: View {
let index: Int
var body: some View {
ZStack {
RoundedRectangle(cornerRadius: Tj.Radius.sm, style: .continuous)
.fill(Tj.Palette.paper)
.shadow(color: Color(red: 0.196, green: 0.157, blue: 0.098).opacity(0.06),
radius: 2, x: 0, y: 1)
TjPlaceholder(label: "p.\(index)", radius: 4)
.padding(6)
}
.aspectRatio(0.72, contentMode: .fit)
}
}