diff --git a/public/js/app.js b/public/js/app.js index 4d12603..f8c9b9b 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -55,7 +55,8 @@ const App = { } if (page === 'install') { this.showPublic('install'); return; } - if (page === 'home' || page === 'login' || page === 'register') { this.showPublic(page); return; } + if (page === 'home') { this.showPublic('home', param); return; } + if (page === 'login' || page === 'register') { this.showPublic(page); return; } if (!Auth.logged()) { location.hash = '#/login'; return; } this.showLayout(); @@ -83,13 +84,13 @@ const App = { } }, - showPublic(page) { + showPublic(page, param) { document.getElementById('top-auth').classList.remove('hidden'); document.getElementById('main-layout').classList.add('hidden'); const pub = document.getElementById('public-page'); pub.classList.remove('hidden'); const comp = page === 'login' ? LoginPage : page === 'register' ? RegisterPage : page === 'install' ? InstallPage : HomePage; - Promise.resolve(comp.render()).then(html => { pub.innerHTML = html; if (comp.mount) comp.mount(); }); + Promise.resolve(comp.render(param)).then(html => { pub.innerHTML = html; if (comp.mount) comp.mount(param); }); }, showLayout() { diff --git a/public/js/pages/home.js b/public/js/pages/home.js index 552f906..5649096 100644 --- a/public/js/pages/home.js +++ b/public/js/pages/home.js @@ -1,26 +1,25 @@ const HomePage = { - async render() { + async render(tab) { + const t = tab || 'report'; return `
| # | 类型 | 标题 | 状态 | 时间 | 操作 | -
|---|---|---|---|---|---|
| ${t.id} | ${U.badge(t.type,'type')} | ${U.esc(t.title)} | -${U.badge(t.status,'status')} | ${U.date(t.created_at)} | -|
| ${tick.id} | ${U.badge(tick.type,'type')} | ${U.esc(tick.title)} | +${U.badge(tick.status,'status')} | ${U.date(tick.created_at)} | +
未找到工单