我的页面中的头像

This commit is contained in:
2026-07-21 08:10:52 +08:00
parent e1f5130c18
commit c5f526d51d
4 changed files with 330 additions and 160 deletions
+3 -11
View File
@@ -18,7 +18,6 @@ import {
import { fetchUserProfile } from '../../lib/pay-wechat';
import { saveUserPhone, resolveDefaultUserPhone } from '../../lib/user-phone';
import {
fetchMiniWechatUserInfo,
getCachedWxProfile,
syncMiniWechatProfile,
type MiniWechatProfile,
@@ -235,15 +234,8 @@ export default function LoginPage() {
setSentHint('');
setWxLoading(true);
try {
let wxInfo: MiniWechatProfile | null = null;
if (process.env.TARO_ENV === 'weapp') {
try {
wxInfo = await fetchMiniWechatUserInfo();
} catch (e) {
toast(e instanceof Error ? e.message : '需要授权微信头像和昵称');
return;
}
}
// 头像昵称改由「我的」页 chooseAvatar / nickname 填写;登录仅换 openId
const wxInfo = getCachedWxProfile();
if (completeMode === 'wechat' && isLoggedIn()) {
const result = await bindWechatForUser(wxInfo);
@@ -258,7 +250,7 @@ export default function LoginPage() {
return;
}
if (result.ok) {
await syncMiniWechatProfile(wxInfo);
if (wxInfo) await syncMiniWechatProfile(wxInfo);
toast('微信授权成功', 'success');
finishLoginNavigate(returnTo);
return;