diff --git a/public/css/style.css b/public/css/style.css index 6c51be6..069b2cf 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -306,7 +306,7 @@ tbody tr:last-child td{border-bottom:none} .footer-inner{max-width:1280px;margin:0 auto;display:flex;justify-content:center;gap:28px;flex-wrap:wrap} .footer-inner a{color:var(--g4);text-decoration:none;transition:color .2s} .footer-inner a:hover{color:white} -#app{min-height:calc(100vh - 52px);display:flex;flex-direction:column} +#app{min-height:100vh;display:flex;flex-direction:column} #public-page,#main-layout{flex:1} /* ===== Install Page ===== */ diff --git a/public/js/app.js b/public/js/app.js index 1796417..819ca17 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -11,7 +11,8 @@ const App = { { id: 'export', label: '数据导出', icon: 'fa-download', roles: ['owner'] }, ], - init() { + async init() { + try { const s = await API.get('/install/status'); if (!s.installed) { location.hash = '#/install'; return; } } catch { location.hash = '#/install'; return; } this.loadFooter(); window.addEventListener('hashchange', () => this.route()); this.route(); @@ -32,19 +33,12 @@ const App = { closeModal() { document.getElementById('modal-overlay').classList.add('hidden'); }, navigate(page, param) { location.hash = `#/${page}` + (param ? `/${param}` : ''); }, - async route() { + route() { const hash = location.hash || '#/home'; const parts = hash.replace('#/', '').split('/'); const page = parts[0]; const param = parts.slice(1).join('/'); - if (page !== 'install') { - try { - const s = await API.get('/install/status'); - if (!s.installed) { location.hash = '#/install'; return; } - } catch { location.hash = '#/install'; return; } - } - if (page === 'verify') { const params = new URLSearchParams((location.hash.split('?')[1] || '')); const token = params.get('token'); @@ -85,6 +79,7 @@ const App = { }, showPublic(page, param) { + document.getElementById('top-bar').classList.remove('hidden'); document.getElementById('top-auth').classList.remove('hidden'); document.getElementById('main-layout').classList.add('hidden'); const pub = document.getElementById('public-page'); @@ -94,10 +89,9 @@ const App = { }, showLayout() { - document.getElementById('top-auth').classList.add('hidden'); + document.getElementById('top-bar').classList.add('hidden'); document.getElementById('public-page').classList.add('hidden'); document.getElementById('main-layout').classList.remove('hidden'); - document.getElementById('main-layout').classList.remove('hidden'); const u = Auth.user(); document.getElementById('user-info').innerHTML = `
${(u.game_name||u.username).charAt(0).toUpperCase()}
${u.game_name||u.username}
${U.ROLE[u.role]}
`; },