fix(ios): AnalysisHomeView 括号结构修复
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
4d900dfec6
commit
7193dca877
@ -32,11 +32,7 @@ struct AnalysisHomeView: View {
|
|||||||
VStack(alignment: .leading, spacing: 14) {
|
VStack(alignment: .leading, spacing: 14) {
|
||||||
Text("本周学习活跃").font(.system(size: 14, weight: .bold)).foregroundColor(Color.zxF0)
|
Text("本周学习活跃").font(.system(size: 14, weight: .bold)).foregroundColor(Color.zxF0)
|
||||||
ZXWeekBarChart()
|
ZXWeekBarChart()
|
||||||
HStack {
|
HStack { Text("总计 3.5 小时").font(.system(size: 11)).foregroundColor(Color.zxF03); Spacer(); Text("日均 30 分钟").font(.system(size: 11)).foregroundColor(Color.zxF03) }
|
||||||
Text("总计 3.5 小时").font(.system(size: 11)).foregroundColor(Color.zxF03)
|
|
||||||
Spacer()
|
|
||||||
Text("日均 30 分钟").font(.system(size: 11)).foregroundColor(Color.zxF03)
|
|
||||||
}
|
|
||||||
}.padding(16).background(Color.zxFill004).overlay(RoundedRectangle(cornerRadius: 20).stroke(Color.zxBorder006, lineWidth: 1)).clipShape(RoundedRectangle(cornerRadius: 20))
|
}.padding(16).background(Color.zxFill004).overlay(RoundedRectangle(cornerRadius: 20).stroke(Color.zxBorder006, lineWidth: 1)).clipShape(RoundedRectangle(cornerRadius: 20))
|
||||||
|
|
||||||
if let streak = viewModel.streak {
|
if let streak = viewModel.streak {
|
||||||
@ -52,47 +48,26 @@ struct AnalysisHomeView: View {
|
|||||||
ForEach(viewModel.recommendations.prefix(3)) { rec in
|
ForEach(viewModel.recommendations.prefix(3)) { rec in
|
||||||
HStack(spacing: 10) {
|
HStack(spacing: 10) {
|
||||||
Image(systemName: rec.type == "review" ? "arrow.triangle.2.circlepath" : "lightbulb.fill")
|
Image(systemName: rec.type == "review" ? "arrow.triangle.2.circlepath" : "lightbulb.fill")
|
||||||
.font(.system(size: 14)).foregroundColor(Color.zxAccent)
|
.font(.system(size: 14)).foregroundColor(Color.zxAccent).frame(width: 32, height: 32).background(Color.zxAccent.opacity(0.1)).clipShape(RoundedRectangle(cornerRadius: 8))
|
||||||
.frame(width: 32, height: 32).background(Color.zxAccent.opacity(0.1)).clipShape(RoundedRectangle(cornerRadius: 8))
|
VStack(alignment: .leading, spacing: 2) { Text(rec.title ?? "").font(.system(size: 13, weight: .semibold)).foregroundColor(Color.zxF0); if let desc = rec.description { Text(desc).font(.system(size: 11)).foregroundColor(Color.zxF04).lineLimit(1) } }
|
||||||
VStack(alignment: .leading, spacing: 2) {
|
|
||||||
Text(rec.title ?? "").font(.system(size: 13, weight: .semibold)).foregroundColor(Color.zxF0)
|
|
||||||
if let desc = rec.description { Text(desc).font(.system(size: 11)).foregroundColor(Color.zxF04).lineLimit(1) }
|
|
||||||
}
|
|
||||||
Spacer()
|
Spacer()
|
||||||
if let p = rec.priority { Text(p).font(.system(size: 10, weight: .bold)).foregroundColor(p == "high" ? Color.zxCoral : Color.zxAmber).padding(.horizontal, 6).padding(.vertical, 2).background((p == "high" ? Color.zxCoral : Color.zxAmber).opacity(0.1)).clipShape(Capsule()) }
|
if let p = rec.priority { Text(p).font(.system(size: 10, weight: .bold)).foregroundColor(p == "high" ? Color.zxCoral : Color.zxAmber).padding(.horizontal, 6).padding(.vertical, 2).background((p == "high" ? Color.zxCoral : Color.zxAmber).opacity(0.1)).clipShape(Capsule()) }
|
||||||
}.padding(10).background(Color.zxFill003).clipShape(RoundedRectangle(cornerRadius: 12))
|
}.padding(10).background(Color.zxFill003).clipShape(RoundedRectangle(cornerRadius: 12))
|
||||||
}
|
}
|
||||||
}.padding(16).background(Color.zxFill004).overlay(RoundedRectangle(cornerRadius: 20).stroke(Color.zxBorder006, lineWidth: 1)).clipShape(RoundedRectangle(cornerRadius: 20))
|
}.padding(16).background(Color.zxFill004).overlay(RoundedRectangle(cornerRadius: 20).stroke(Color.zxBorder006, lineWidth: 1)).clipShape(RoundedRectangle(cornerRadius: 20))
|
||||||
}
|
}
|
||||||
VStack(alignment: .leading, spacing: 12) {
|
// AI 综合分析
|
||||||
HStack { HStack(spacing: 8) { Image(systemName: "exclamationmark.triangle.fill").font(.system(size: 14)).foregroundColor(Color.zxYellow); Text("薄弱知识点").font(.system(size: 15, weight: .bold)).foregroundColor(Color.zxF0) }; Spacer(); NavigationLink(value: Route.weakPoints) { Text("全部 \(viewModel.focusItems.count) 个").font(.system(size: 12)).foregroundColor(Color.zxPurple) }.accessibilityLabel("查看全部薄弱知识点") }
|
if let summary = viewModel.summary {
|
||||||
ForEach(viewModel.focusItems.prefix(5)) { item in
|
|
||||||
ZXWeakRow(score: item.masteryScore ?? 0, topic: item.title, lib: item.knowledgeBaseId ?? "", priority: item.priority ?? "normal")
|
|
||||||
}
|
|
||||||
if viewModel.focusItems.isEmpty && !viewModel.isLoading {
|
|
||||||
Text("暂无薄弱知识点").font(.system(size: 13)).foregroundColor(Color.zxF03)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}.padding(.horizontal, 20).padding(.bottom, 120)
|
|
||||||
}
|
|
||||||
// AI 综合分析(从 trends + recommendations 生成摘要)
|
|
||||||
if let summary = viewModel.summary, !viewModel.trends.isEmpty || !viewModel.recommendations.isEmpty {
|
|
||||||
VStack(alignment: .leading, spacing: 12) {
|
VStack(alignment: .leading, spacing: 12) {
|
||||||
HStack(spacing: 8) { Image(systemName: "brain.head.profile").font(.system(size: 14)).foregroundColor(Color.zxPurple); Text("AI 综合分析").font(.system(size: 14, weight: .bold)).foregroundColor(Color.zxF0) }
|
HStack(spacing: 8) { Image(systemName: "brain.head.profile").font(.system(size: 14)).foregroundColor(Color.zxPurple); Text("AI 综合分析").font(.system(size: 14, weight: .bold)).foregroundColor(Color.zxF0) }
|
||||||
Text(aiAnalysisText).font(.system(size: 13)).foregroundColor(Color.zxF05).lineSpacing(4)
|
Text(aiAnalysisText).font(.system(size: 13)).foregroundColor(Color.zxF05).lineSpacing(4)
|
||||||
if !viewModel.recommendations.isEmpty {
|
|
||||||
VStack(spacing: 6) {
|
|
||||||
ForEach(viewModel.recommendations.prefix(2)) { r in
|
|
||||||
HStack(spacing: 8) {
|
|
||||||
Image(systemName: "lightbulb.fill").font(.system(size: 11)).foregroundColor(Color.zxAccent)
|
|
||||||
Text(r.title ?? "").font(.system(size: 12)).foregroundColor(Color.zxF0)
|
|
||||||
Spacer()
|
|
||||||
}.padding(10).background(Color.zxFill003).clipShape(RoundedRectangle(cornerRadius: 10))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}.padding(16).background(Color.zxFill004).overlay(RoundedRectangle(cornerRadius: 20).stroke(Color.zxBorder006, lineWidth: 1)).clipShape(RoundedRectangle(cornerRadius: 20))
|
}.padding(16).background(Color.zxFill004).overlay(RoundedRectangle(cornerRadius: 20).stroke(Color.zxBorder006, lineWidth: 1)).clipShape(RoundedRectangle(cornerRadius: 20))
|
||||||
}
|
}
|
||||||
|
VStack(alignment: .leading, spacing: 12) {
|
||||||
|
HStack { HStack(spacing: 8) { Image(systemName: "exclamationmark.triangle.fill").font(.system(size: 14)).foregroundColor(Color.zxYellow); Text("薄弱知识点").font(.system(size: 15, weight: .bold)).foregroundColor(Color.zxF0) }; Spacer(); NavigationLink(value: Route.weakPoints) { Text("全部 \(viewModel.focusItems.count) 个").font(.system(size: 12)).foregroundColor(Color.zxPurple) } }
|
||||||
|
ForEach(viewModel.focusItems.prefix(5)) { item in ZXWeakRow(score: item.masteryScore ?? 0, topic: item.title, lib: item.knowledgeBaseId ?? "", priority: item.priority ?? "normal") }
|
||||||
|
if viewModel.focusItems.isEmpty && !viewModel.isLoading { Text("暂无薄弱知识点").font(.system(size: 13)).foregroundColor(Color.zxF03) }
|
||||||
|
}
|
||||||
}.padding(.horizontal, 20).padding(.bottom, 120)
|
}.padding(.horizontal, 20).padding(.bottom, 120)
|
||||||
}
|
}
|
||||||
.scrollIndicators(.hidden)
|
.scrollIndicators(.hidden)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user