fix: 恢复用户菜单(修改昵称/修改密码)

- userInfo 添加 onclick 触发用户菜单
- 添加 userMenu 下拉菜单(修改昵称/修改密码)
- 点击页面其他位置关闭菜单
This commit is contained in:
OP
2026-06-29 00:28:42 +08:00
parent 5d5ee9ecdc
commit c5697f8b7b
2 changed files with 17 additions and 3 deletions

View File

@@ -90,7 +90,13 @@ body{font-family:-apple-system,BlinkMacSystemFont,"SF Pro Display","PingFang SC"
<div class="notif-list" id="notifList"><div class="notif-empty">暂无通知</div></div>
</div>
</div>
<span class="user-info" id="userInfo"></span>
<div class="export-wrap">
<span class="user-info" id="userInfo" onclick="toggleUserMenu(event)"></span>
<div class="export-menu" id="userMenu">
<a href="#" onclick="showChangeNick(event)">修改昵称</a>
<a href="#" onclick="showChangePwd(event)">修改密码</a>
</div>
</div>
<a href="/admin.html" class="admin-link" id="adminLink" style="display:none">管理</a>
<div class="export-wrap">
<button class="hdr-btn" onclick="toggleExport(event)">导出</button>
@@ -144,6 +150,7 @@ async function apiFetch(path,opts={}){
return res;
}
function toggleUserMenu(e){e.stopPropagation();$('userMenu').classList.toggle('show');}
async function checkAuth(){
if(!token){window.location.href='/';return false;}
const res=await apiFetch('/auth/profile');