98b7600797
对标安卓正式版、对接 app-server(8770)的 SwiftUI 客户端。iOS 无障碍受限、无比价核心,做自成一体:美团 CPS 导购 + 福利(签到/任务/金币)+ 查看(比价记录/省钱战绩)。 功能完整 M0-M5:脚手架、短信登录(JWT+Keychain+401 自动刷新)、首页券 feed 导购、比价记录+省钱战绩、福利、我的(资料/反馈/设置/注销)。 单 target、0 三方依赖、XcodeGen 生成工程;Debug/Release 双 plist 分流 ATS。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
39 lines
1.3 KiB
Swift
39 lines
1.3 KiB
Swift
import SwiftUI
|
|
|
|
/// 登录守卫占位:未登录时显示,点按弹出登录页。登录成功后 session 变化,父视图自动切走。
|
|
struct LoginRequiredView: View {
|
|
var message: String = "登录后查看"
|
|
@Environment(SessionStore.self) private var session
|
|
@State private var showLogin = false
|
|
|
|
var body: some View {
|
|
VStack(spacing: 20) {
|
|
Image(systemName: "person.crop.circle.badge.questionmark")
|
|
.font(.system(size: 60))
|
|
.foregroundStyle(AppColors.gray400)
|
|
|
|
Text(message)
|
|
.foregroundStyle(.secondary)
|
|
.multilineTextAlignment(.center)
|
|
.padding(.horizontal, 40)
|
|
|
|
Button {
|
|
showLogin = true
|
|
} label: {
|
|
Text("登录 / 注册")
|
|
.font(.headline)
|
|
.frame(maxWidth: .infinity)
|
|
.padding(.vertical, 14)
|
|
.background(AppColors.primary)
|
|
.foregroundStyle(.black)
|
|
.clipShape(RoundedRectangle(cornerRadius: 12))
|
|
}
|
|
.padding(.horizontal, 40)
|
|
}
|
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
.sheet(isPresented: $showLogin) {
|
|
LoginView().environment(session)
|
|
}
|
|
}
|
|
}
|