用户端小程序修改

This commit is contained in:
2026-07-12 20:24:03 +08:00
parent e2dfb08de3
commit b267e885be
16 changed files with 551 additions and 214 deletions
+4 -2
View File
@@ -61,7 +61,9 @@ export type WechatBindResult =
| { ok: true; profile?: UserProfile }
| { ok: false; needBindPhone: true; wxSessionKey: string };
export async function bindWechatForUser(): Promise<WechatBindResult> {
export async function bindWechatForUser(
prefetchedWxProfile?: { nickname?: string; avatarUrl?: string } | null,
): Promise<WechatBindResult> {
const res = await Taro.login();
if (!res.code) {
throw new Error(res.errMsg || '微信授权失败');
@@ -73,7 +75,7 @@ export async function bindWechatForUser(): Promise<WechatBindResult> {
if (data.needBindPhone && data.wxSessionKey) {
return { ok: false, needBindPhone: true, wxSessionKey: data.wxSessionKey };
}
await syncMiniWechatProfile();
await syncMiniWechatProfile(prefetchedWxProfile);
const profile = await fetchUserProfile();
return { ok: true, profile };
}