diff --git a/wake/Assets/Svg/AboutUs.svg b/wake/Assets/Svg/AboutUs.svg new file mode 100644 index 0000000..99925ea --- /dev/null +++ b/wake/Assets/Svg/AboutUs.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/wake/Assets/Svg/Account.svg b/wake/Assets/Svg/Account.svg new file mode 100644 index 0000000..b3ca2c6 --- /dev/null +++ b/wake/Assets/Svg/Account.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/wake/Assets/Svg/Permission.svg b/wake/Assets/Svg/Permission.svg new file mode 100644 index 0000000..de03ea1 --- /dev/null +++ b/wake/Assets/Svg/Permission.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/wake/Assets/Svg/Suport.svg b/wake/Assets/Svg/Suport.svg new file mode 100644 index 0000000..0aaf57d --- /dev/null +++ b/wake/Assets/Svg/Suport.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/wake/View/Owner/Account.swift b/wake/View/Owner/Account.swift new file mode 100644 index 0000000..c8b7aa8 --- /dev/null +++ b/wake/View/Owner/Account.swift @@ -0,0 +1,112 @@ +import SwiftUI + +/// 设置页面视图 +struct AccountView: View { + // MARK: - 属性 + + /// 环境变量 - 用于dismiss视图 + @Environment(\.dismiss) private var dismiss + + /// 状态 - 控制视图显示/隐藏 + @Binding var isAccountPresented: Bool + + // MARK: - 动画配置 + + /// 动画配置 + private let animation = Animation.spring( + response: 0.6, // 响应时间 + dampingFraction: 0.9, // 阻尼系数 + blendDuration: 0.8 // 混合时间 + ) + + // MARK: - 主体视图 + + var body: some View { + ZStack { + // Theme background color + Color.themeTextWhiteSecondary.edgesIgnoringSafeArea(.all) + + VStack(spacing: 0) { + // 简洁导航头 + SimpleNaviHeader(title: "Account & Security") { + withAnimation(animation) { + isAccountPresented = false + } + } + + // 设置项列表 + List { + // 账号与安全 + settingRow( + icon: "Account", + title: "Account & Security", + action: {} + ) + + + } + .background(Color.white) + .cornerRadius(12) + .padding() + .listStyle(PlainListStyle()) + .listRowSeparator(.hidden) + .listRowInsets(EdgeInsets()) + } + } + .background(Color.themeTextWhiteSecondary.edgesIgnoringSafeArea(.all)) + .environment(\.horizontalSizeClass, .regular) + } + + // MARK: - 私有方法 + + /// 配置TableView外观 + private func configureTableView() { + // 移除列表底部分隔线 + UITableView.appearance().tableFooterView = UIView() + // 移除列表顶部分隔线 + UITableView.appearance().tableHeaderView = UIView(frame: CGRect(x: 0, y: 0, width: 0, height: CGFloat.leastNonzeroMagnitude)) + // 移除分隔线缩进 + UITableView.appearance().separatorInset = .zero + // 移除列表顶部额外间距 + UITableView.appearance().contentInset = .zero + } + + /// 创建设置项行视图 + /// - Parameters: + /// - icon: 图标名称 + /// - title: 标题 + /// - action: 点击动作 + /// - Returns: 返回设置项行视图 + private func settingRow(icon: String, title: String, action: @escaping () -> Void) -> some View { + Button(action: action) { + HStack { + // 左侧图标 + SVGImage(svgName: icon) + .frame(width: 24, height: 24) + + // 标题 + Text(title) + .foregroundColor(.primary) + + Spacer() + + // 右侧箭头 + Image(systemName: "chevron.right") + .font(.system(size: 14)) + .foregroundColor(.gray) + } + .padding(.vertical, 12) // 增加垂直内边距 + .background(Color.white) + } + .buttonStyle(PlainButtonStyle()) + .listRowBackground(Color.white) + .listRowSeparator(.hidden) + } +} + +// MARK: - 预览 +#Preview { + NavigationView { + AccountView(isAccountPresented: .constant(true)) + } +} diff --git a/wake/View/Owner/SettingsView.swift b/wake/View/Owner/SettingsView.swift index aaedfbb..a856115 100644 --- a/wake/View/Owner/SettingsView.swift +++ b/wake/View/Owner/SettingsView.swift @@ -10,6 +10,8 @@ struct SettingsView: View { /// 状态 - 控制视图显示/隐藏 @Binding var isPresented: Bool + @State private var showAccountView = false + // MARK: - 动画配置 /// 动画配置 @@ -22,57 +24,63 @@ struct SettingsView: View { // MARK: - 主体视图 var body: some View { - VStack(spacing: 0) { - // 简洁导航头 - SimpleNaviHeader(title: "Setting") { - withAnimation(animation) { - isPresented = false + NavigationView { + ZStack { + // Theme background color + Color.themeTextWhiteSecondary.edgesIgnoringSafeArea(.all) + + VStack(spacing: 0) { + // 简洁导航头 + SimpleNaviHeader(title: "Setting") { + withAnimation(animation) { + isPresented = false + } + } + + // 设置项列表 + List { + // 账号与安全 + settingRow( + icon: "Account", + title: "Account & Security", + action: { + // Action will be handled by NavigationLink + } + ) + + // 权限管理 + settingRow( + icon: "Permission", + title: "Permission Management", + action: {} + ) + + // 支持与服务 + settingRow( + icon: "Suport", + title: "Support & Service", + action: {} + ) + + // 关于我们 + settingRow( + icon: "AboutUs", + title: "About Us", + action: {} + ) + } + .background(Color.white) + .cornerRadius(12) + .padding() + .listStyle(PlainListStyle()) + .listRowSeparator(.hidden) + .listRowInsets(EdgeInsets()) + .frame(height: CGFloat(5 * 60)) // 4 rows × 60 points each + .frame(maxWidth: .infinity) + Spacer() } } - - // 设置项列表 - List { - - // 账号与安全 - settingRow( - icon: "person.crop.circle", - title: "Account & Security", - action: {} - ) - - // 权限管理 - settingRow( - icon: "lock.shield", - title: "Permission Management", - action: {} - ) - - // 支持与服务 - settingRow( - icon: "questionmark.circle", - title: "Support & Service", - action: {} - ) - - // 关于我们 - settingRow( - icon: "info.circle", - title: "About Us", - action: {} - ) - } - // 设置列表样式为普通样式(无分组效果) - .listStyle(PlainListStyle()) - // 隐藏所有行的分割线 - .listRowSeparator(.hidden) - // 移除列表行的内边距 - .listRowInsets(EdgeInsets()) - .background(Color(.systemGroupedBackground)) } - .frame(maxWidth: .infinity, maxHeight: .infinity) - .background(Color.themeTextWhiteSecondary) - // 设置水平尺寸类别为常规宽度(regular),用于支持分屏和不同设备尺寸的布局 - .environment(\.horizontalSizeClass, .regular) } // MARK: - 私有方法 @@ -99,10 +107,8 @@ struct SettingsView: View { Button(action: action) { HStack { // 左侧图标 - Image(systemName: icon) - .font(.system(size: 24)) - .foregroundColor(.gray) - .frame(width: 40) + SVGImage(svgName: icon) + .frame(width: 22, height: 22) // 标题 Text(title) @@ -115,19 +121,16 @@ struct SettingsView: View { .font(.system(size: 14)) .foregroundColor(.gray) } - .padding(.vertical, 6) // 减少垂直内边距 - .padding(.horizontal, 12) - .background(Color(.systemGroupedBackground)) + .padding(.vertical, 12) // 增加垂直内边距 + .background(Color.white) } .buttonStyle(PlainButtonStyle()) - .listRowBackground(Color(.systemGroupedBackground)) + .listRowBackground(Color.white) .listRowSeparator(.hidden) } } // MARK: - 预览 #Preview { - NavigationView { - SettingsView(isPresented: .constant(true)) - } + SettingsView(isPresented: .constant(true)) } diff --git a/wake/WakeApp.swift b/wake/WakeApp.swift index 0b024b0..908ee99 100644 --- a/wake/WakeApp.swift +++ b/wake/WakeApp.swift @@ -53,8 +53,14 @@ struct WakeApp: App { } } else { // 未登录:显示登录界面 - LoginView() - .environmentObject(authState) + // LoginView() + // .environmentObject(authState) + NavigationStack(path: $router.path) { + BlindBoxView(mediaType: .all) + .navigationDestination(for: AppRoute.self) { route in + route.view + } + } } } }