diff --git a/js/tools.js b/js/tools.js index 39132ca..23556ad 100644 --- a/js/tools.js +++ b/js/tools.js @@ -83,11 +83,15 @@ $(function () { mobileHeadImg.textContent = desktopHeadImg.textContent; } } else { - // 默认显示未登录状态 - if (desktopNoLogin) desktopNoLogin.style.display = 'flex'; - if (desktopLoginIn) desktopLoginIn.style.display = 'none'; - if (mobileNoLogin) mobileNoLogin.style.display = 'block'; - if (mobileLoginIn) mobileLoginIn.style.display = 'none'; + // 两者都隐藏 — 可能是 AJAX 尚未返回 + // 若有 jwt 则不做操作, 等 common.js AJAX 回调处理 + if (!localStorage.jwt) { + // 确认未登录, 显示登录按钮 + if (desktopNoLogin) desktopNoLogin.style.display = 'flex'; + if (desktopLoginIn) desktopLoginIn.style.display = 'none'; + if (mobileNoLogin) mobileNoLogin.style.display = 'block'; + if (mobileLoginIn) mobileLoginIn.style.display = 'none'; + } } }