接入微信分享 SDK 并配置 Universal Link。

集成 WechatOpenSDK、www.zhifly.cn/suixinkan/ 通用链接与邀请页分享能力,附带 AASA 部署文件与单元测试。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-02 15:02:37 +08:00
parent 5d34cda730
commit a528d9b0d7
48 changed files with 5260 additions and 506 deletions

View File

@ -12,6 +12,8 @@ Invite 模块负责首页 `registration_invitation`、`photographer_invite` 和
复制邀请链接时只由 View 层写入剪贴板ViewModel 不关心系统剪贴板状态。
点击「分享」弹出 `WeChatShareSheet`,支持分享到微信好友、朋友圈;未安装微信时走系统分享兜底。分享网页使用 `WeChatShareService.shareWebPage`,缩略图优先使用邀请二维码。
## 邀请记录
`InviteRecordViewModel` 提供“邀请记录 / 奖励记录”分段:

View File

@ -13,6 +13,7 @@ struct PhotographerInviteView: View {
@EnvironmentObject private var toastCenter: ToastCenter
@Environment(\.globalLoading) private var globalLoading
@StateObject private var viewModel = PhotographerInviteViewModel()
@State private var isPresentingShareSheet = false
var body: some View {
ScrollView {
@ -37,6 +38,17 @@ struct PhotographerInviteView: View {
.navigationBarTitleDisplayMode(.inline)
.task { await reload(showLoading: true) }
.refreshable { await reload(showLoading: false) }
.sheet(isPresented: $isPresentingShareSheet) {
WeChatShareSheet(
title: "邀请你加入随心瞰商家版",
description: viewModel.inviteCode.isEmpty ? "摄影师邀请" : "邀请码:\(viewModel.inviteCode)",
url: viewModel.inviteUrl,
thumbImage: viewModel.qrImage
) { message in
toastCenter.show(message)
}
.presentationDetents([.medium])
}
}
private var inviteCard: some View {
@ -77,8 +89,11 @@ struct PhotographerInviteView: View {
.frame(height: 44)
}
Button {
viewModel.copyInviteUrl()
toastCenter.show("链接已复制,可粘贴分享")
guard !viewModel.inviteUrl.isEmpty else {
toastCenter.show("邀请链接加载中,请稍后重试")
return
}
isPresentingShareSheet = true
} label: {
Label("分享", systemImage: "square.and.arrow.up")
.frame(maxWidth: .infinity)