
- 在AppSettingFeature中新增登出确认和关于我们弹窗的状态和Action。 - 更新AppSettingView以支持登出确认和关于我们弹窗的逻辑。 - 替换多个视图中的NSLocalizedString为LocalizedString,提升本地化一致性。 - 在Localizable.strings中新增相关本地化文本,确保多语言支持。
92 lines
2.9 KiB
Swift
92 lines
2.9 KiB
Swift
import SwiftUI
|
||
import ComposableArchitecture
|
||
|
||
struct SplashView: View {
|
||
let store: StoreOf<SplashFeature>
|
||
|
||
var body: some View {
|
||
ZStack {
|
||
Group {
|
||
// 根据导航目标显示不同页面
|
||
if let navigationDestination = store.navigationDestination {
|
||
switch navigationDestination {
|
||
case .login:
|
||
// 显示登录页面
|
||
LoginView(
|
||
store: Store(
|
||
initialState: LoginFeature.State()
|
||
) {
|
||
LoginFeature()
|
||
},
|
||
onLoginSuccess: {
|
||
// 登录成功后导航到主页面
|
||
store.send(.navigateToMain)
|
||
}
|
||
)
|
||
case .main:
|
||
// 显示主应用页面
|
||
MainView(
|
||
store: Store(
|
||
initialState: MainFeature.State()
|
||
) {
|
||
MainFeature()
|
||
},
|
||
onLogout: {
|
||
store.send(.navigateToLogin)
|
||
}
|
||
)
|
||
}
|
||
} else {
|
||
// 显示启动画面
|
||
splashContent
|
||
}
|
||
}
|
||
.onAppear {
|
||
store.send(.onAppear)
|
||
}
|
||
|
||
// API Loading 效果视图 - 显示在所有内容之上
|
||
APILoadingEffectView()
|
||
}
|
||
}
|
||
|
||
// 启动画面内容
|
||
private var splashContent: some View {
|
||
ZStack {
|
||
// 背景图片 - 全屏显示
|
||
Image("bg")
|
||
.resizable()
|
||
.aspectRatio(contentMode: .fill)
|
||
.ignoresSafeArea(.all)
|
||
|
||
VStack(spacing: 32) {
|
||
Spacer()
|
||
.frame(height: 200) // 与 storyboard 中的约束对应
|
||
|
||
// Logo 图片 - 100x100
|
||
Image("logo")
|
||
.resizable()
|
||
.aspectRatio(contentMode: .fit)
|
||
.frame(width: 100, height: 100)
|
||
|
||
// 应用标题 - 白色,40pt字体
|
||
Text(LocalizedString("splash.title", comment: "E-Parti"))
|
||
.font(.system(size: 40, weight: .regular))
|
||
.foregroundColor(.white)
|
||
|
||
Spacer()
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
//#Preview {
|
||
// SplashView(
|
||
// store: Store(
|
||
// initialState: SplashFeature.State()
|
||
// ) {
|
||
// SplashFeature()
|
||
// }
|
||
// )
|
||
//}
|