fix: analysis.html 添加用户昵称显示

- checkAuth 中添加 .textContent 设置
- 分析页面导航栏现在显示用户昵称
This commit is contained in:
OP
2026-06-29 00:25:43 +08:00
parent d27c855e62
commit 5d5ee9ecdc

View File

@@ -149,6 +149,7 @@ async function checkAuth(){
const res=await apiFetch('/auth/profile'); const res=await apiFetch('/auth/profile');
if(!res||!res.ok){window.location.href='/';return false;} if(!res||!res.ok){window.location.href='/';return false;}
currentUser=await res.json(); currentUser=await res.json();
$('userInfo').textContent=currentUser.nickname||currentUser.account;
if(currentUser.role==='admin')$('adminLink').style.display=''; if(currentUser.role==='admin')$('adminLink').style.display='';
return true; return true;
} }