diff --git a/public/js/app.js b/public/js/app.js index da8bffa..35412df 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -103,11 +103,15 @@ const App = { }, showPublic(page, param) { - document.getElementById('top-bar').classList.remove('hidden'); document.getElementById('main-layout').classList.add('hidden'); const pub = document.getElementById('public-page'); pub.classList.remove('hidden'); - if (page !== 'home') this.updateTopAuth(); + if (page === 'home') { + document.getElementById('top-bar').classList.add('hidden'); + } else { + document.getElementById('top-bar').classList.remove('hidden'); + this.updateTopAuth(); + } const comp = page === 'login' ? LoginPage : page === 'register' ? RegisterPage : page === 'install' ? InstallPage : HomePage; comp.render(param).then(html => { pub.innerHTML = html; if (comp.mount) comp.mount(param); }).catch(() => { pub.innerHTML = '
'; diff --git a/public/js/pages/home.js b/public/js/pages/home.js index df1563c..7dc1e8f 100644 --- a/public/js/pages/home.js +++ b/public/js/pages/home.js @@ -1,22 +1,20 @@ const HomePage = { - async render() { - return `
`; + async render(tab) { + const t = tab || 'report'; + return `
+
+ + + + +
+
+
`; }, mount(tab) { const t = tab || 'report'; - const topAuth = document.getElementById('top-auth'); - topAuth.innerHTML = ` 登录 - 注册 - | - - - - `; - topAuth.style.display = 'flex'; - - topAuth.querySelectorAll('[data-tab]').forEach(b => { b.onclick = () => App.navigate('home', b.dataset.tab); }); - + document.querySelectorAll('#home-content .tab-nav button').forEach(b => { b.onclick = () => App.navigate('home', b.dataset.tab); }); const ct = document.getElementById('home-tab'); if (t === 'tracking') this.renderTracking(ct); else TicketCreate.render(ct, { type: t, prefill: {}, backLink: null });