diff --git a/public/js/app.js b/public/js/app.js index 53372e6..7d45bac 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -83,7 +83,16 @@ const App = { }, afterLogin() { location.hash = '#/dashboard'; }, - logout() { Auth.logout(); }, + logout() { + // 首页/根路径为公开页: 退出仅清除登录态, 停留当前页刷新顶栏; 其他页面才回登录页 + const page = (location.hash || '#/home').replace('#/', '').split('/')[0]; + if (page === 'home' || page === '') { + Auth.reset(); + this.updateTopAuth(); + } else { + Auth.logout(); + } + }, closeModal() { document.getElementById('modal-overlay').classList.add('hidden'); }, navigate(page, param) { location.hash = `#/${page}` + (param ? `/${param}` : ''); }, diff --git a/public/js/pages/home.js b/public/js/pages/home.js index 5bdb173..2532f2d 100644 --- a/public/js/pages/home.js +++ b/public/js/pages/home.js @@ -20,7 +20,8 @@ const HomePage = { async render(tab) { const t = tab || 'report'; - return `