主体:多语言支持(简体中文源 + 英/日/韩)
- 基础设施:Localizable.xcstrings(String Catalog,sourceLanguage=zh-Hans)
+ pbxproj developmentRegion/knownRegions 注册 en/ja/ko
- 全部硬编码 Locale("zh_CN") → Locale.current;中文 dateFormat → Date.FormatStyle(跟随系统)
- UI 中文字面量统一为 String(appLoc:)(显式绑定所选语言 bundle+locale,即时切换)
Text 字面量走环境 \.locale + Bundle 重定向
- 549 个 catalog key 全部 en/ja/ko 翻译完成(0 未翻译)
- App 内语言切换:我的 → 语言(LanguageManager + 即时生效,无需重启)
- 双用预设(症状/监测指标/慢病)本地化:static→computed 避免缓存
注:本提交为 WIP,一并打包了并行进行的功能模块
(HealthExport 健康导出、Security/Face ID 锁、DiaryAssist 日记 AI 辅助)
及 App 图标、CLAUDE.md、docs/scripts。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
144 lines
4.9 KiB
Swift
144 lines
4.9 KiB
Swift
import SwiftUI
|
||
|
||
struct B3MetaView: View {
|
||
var onAnalyze: () -> Void
|
||
var onBack: () -> Void
|
||
|
||
@State private var selectedType = 0
|
||
private let types = [
|
||
String(appLoc: "体检报告"),
|
||
String(appLoc: "化验单"),
|
||
String(appLoc: "影像报告"),
|
||
String(appLoc: "处方"),
|
||
String(appLoc: "其他"),
|
||
]
|
||
|
||
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("预计耗时 5–8 秒 · 端侧 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)
|
||
}
|
||
}
|