feat: 登录态持久化 + 禁用按钮灰色 + 登录提示精简 + 全局美化 + 独立数据看板页
This commit is contained in:
+23
-2
@@ -475,10 +475,19 @@
|
||||
function loginEnter() {
|
||||
const gate = $('#loginGate');
|
||||
if (gate) gate.classList.add('hidden');
|
||||
try { sessionStorage.setItem('ny_authed', '1'); } catch (e) { /* 忽略隐私模式等异常 */ }
|
||||
schedule();
|
||||
loadProjects();
|
||||
}
|
||||
|
||||
function logout() {
|
||||
try { sessionStorage.removeItem('ny_authed'); } catch (e) {}
|
||||
if (state.timer) clearInterval(state.timer);
|
||||
const gate = $('#loginGate');
|
||||
if (gate) gate.classList.remove('hidden');
|
||||
showLoginGate();
|
||||
}
|
||||
|
||||
/* ---------------- 事件绑定 ---------------- */
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
|
||||
@@ -690,8 +699,20 @@
|
||||
$('#lgTest').addEventListener('click', loginTest);
|
||||
$('#lgLogin').addEventListener('click', loginEnter);
|
||||
$('#lgPwd').addEventListener('keydown', e => { if (e.key === 'Enter') loginTest(); });
|
||||
$('#btnLogout').addEventListener('click', logout);
|
||||
$('#btnDashboard').addEventListener('click', () => window.open('dashboard.php', '_blank'));
|
||||
|
||||
// 启动:先显示登录门,不直接拉取数据(防止依赖一次配置直接查看数据)
|
||||
showLoginGate();
|
||||
// 启动:本会话已认证(未重启电脑)则直接进入主界面,跳过登录门;否则显示登录门
|
||||
let authed = false;
|
||||
try { authed = sessionStorage.getItem('ny_authed') === '1'; } catch (e) {}
|
||||
if (authed) {
|
||||
const gate = $('#loginGate');
|
||||
if (gate) gate.classList.add('hidden');
|
||||
schedule();
|
||||
loadProjects();
|
||||
} else {
|
||||
// 先显示登录门,不直接拉取数据(防止依赖一次配置直接查看数据)
|
||||
showLoginGate();
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user