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>
55 lines
1.9 KiB
Swift
55 lines
1.9 KiB
Swift
import SwiftUI
|
|
import UIKit
|
|
|
|
/// 邀请好友(mock:后端暂无邀请接口,用 user.id 当邀请码占位,对齐安卓 InviteScreen 的 mock 状态)。
|
|
struct InviteView: View {
|
|
@Environment(SessionStore.self) private var session
|
|
@State private var copied = false
|
|
|
|
private var inviteCode: String {
|
|
if let id = session.user?.id { return String(format: "%06d", id) }
|
|
return "------"
|
|
}
|
|
|
|
var body: some View {
|
|
VStack(spacing: 20) {
|
|
Image(systemName: "gift.fill")
|
|
.font(.system(size: 56))
|
|
.foregroundStyle(AppColors.brand)
|
|
Text("邀请好友一起省钱").font(.title3.bold())
|
|
Text("把傻瓜比价推荐给好友,一起比价领券")
|
|
.font(.subheadline).foregroundStyle(.secondary)
|
|
.multilineTextAlignment(.center)
|
|
|
|
VStack(spacing: 6) {
|
|
Text("我的邀请码").font(.caption).foregroundStyle(.secondary)
|
|
Text(inviteCode).font(.system(.largeTitle, design: .monospaced).bold())
|
|
}
|
|
.padding(24)
|
|
.frame(maxWidth: .infinity)
|
|
.background(AppColors.primaryBg)
|
|
.clipShape(RoundedRectangle(cornerRadius: 14))
|
|
.padding(.horizontal, 32)
|
|
|
|
Button {
|
|
UIPasteboard.general.string = inviteCode
|
|
copied = true
|
|
} label: {
|
|
Text(copied ? "已复制" : "复制邀请码")
|
|
.font(.headline)
|
|
.frame(maxWidth: .infinity)
|
|
.padding(.vertical, 14)
|
|
.background(AppColors.primary)
|
|
.foregroundStyle(.black)
|
|
.clipShape(RoundedRectangle(cornerRadius: 12))
|
|
}
|
|
.padding(.horizontal, 32)
|
|
|
|
Spacer()
|
|
}
|
|
.padding(.top, 40)
|
|
.navigationTitle("邀请好友")
|
|
.navigationBarTitleDisplayMode(.inline)
|
|
}
|
|
}
|