feat: home page logout stays + wider PC layout

- logout() on home/root page: Auth.reset() only (clear state, refresh
  top bar), no redirect to login; other pages still go to login
- home page container: width:min(50vw+300px, 1440px, 96vw) replaces
  fixed max-width:800px - PC wide screens use at least half viewport,
  mobile near full width
This commit is contained in:
2026-08-22 02:47:26 +08:00
parent effc262382
commit 6c05a13ae4
2 changed files with 12 additions and 2 deletions

View File

@@ -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}` : ''); },

View File

@@ -20,7 +20,8 @@
const HomePage = {
async render(tab) {
const t = tab || 'report';
return `<div id="home-content" style="max-width:800px;margin:0 auto;padding:30px 0">
// PC 宽屏自适应: 至少占视口一半, 大屏上限 1440px; 手机端接近全宽
return `<div id="home-content" style="width:min(50vw + 300px, 1440px, 96vw);margin:0 auto;padding:30px 20px">
<div class="tab-nav">
<button class="${t==='report'?'active':''}" data-tab="report"><i class="fas fa-flag"></i> 举报</button>
<button class="${t==='suggestion'?'active':''}" data-tab="suggestion"><i class="fas fa-lightbulb"></i> 建议</button>