feat: 全局用户头像徽章,所有页面右上角统一显示

- 新增 GlobalUserBadge 组件,固定在右上角,已登录显示头像+用户名,未登录显示登录按钮
- 通过 layout.tsx 全局挂载,仅在个人中心页隐藏
- userId.ts 登录/登出时派发 nowhatever_auth 事件,组件实时响应
- 移除各页面重复的用户指示器(首页、极速救场、周末契约大厅、个人中心顶栏退出按钮)
- TopNav 右侧留出空间避免与全局徽章重叠
- 头像徽章采用暗色主题风格(bg-surface/80)
This commit is contained in:
2026-02-26 14:42:40 +08:00
parent f851eed847
commit 7aa6c7f792
9 changed files with 129 additions and 110 deletions
+2
View File
@@ -31,6 +31,7 @@ export function setCachedProfile(profile: UserProfile | null): void {
} else {
localStorage.removeItem(PROFILE_KEY);
}
window.dispatchEvent(new CustomEvent("nowhatever_auth"));
}
export function isRegistered(): boolean {
@@ -60,4 +61,5 @@ export function logout(): void {
localStorage.removeItem("nowhatever_preferences");
const newId = crypto.randomUUID();
localStorage.setItem(STORAGE_KEY, newId);
window.dispatchEvent(new CustomEvent("nowhatever_auth"));
}