fix: 头像上传后前端不显示真头像 (row29 续)

真因:上传成功且 setUser 写入了 avatar_url,但前端任何头像位置都没渲染 avatar_url,
只显示姓氏首字占位 → 看着像「没更新」。根因:User 类型里压根没暴露 avatar_url 字段。

修:User 类型补 avatar_url;侧栏 .user、账户菜单 .shell-account-head、设置页 av-big
三处头像改为「有 avatar_url 显 <img>,空则回退首字」;.av/.av-big 加 overflow:hidden + img 铺满规则。
后端上传 200 + 直链公读已实测正常,此为纯前端显示修复。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
zyc
2026-06-30 11:02:28 +08:00
co-authored by Claude Opus 4.8
parent b4e61ce627
commit 291a8bf394
4 changed files with 9 additions and 3 deletions
+1 -1
View File
@@ -434,7 +434,7 @@ export function SettingsPage({
<div className="lbl">头像</div>
<div className="val">
<div className="avatar-edit">
<div className="av-big">{avatarChar}</div>
<div className="av-big">{user.avatar_url ? <img src={user.avatar_url} alt="头像" /> : avatarChar}</div>
<div className="av-actions">
<button className="btn btn-sm" type="button" onClick={openAvatarModal}>上传新头像</button>
<button className="btn btn-ghost btn-sm" type="button" onClick={() => onResetAvatar?.()}>恢复默认</button>