diff --git a/frontend/app.js b/frontend/app.js index e7a78f4..8251521 100644 --- a/frontend/app.js +++ b/frontend/app.js @@ -1003,6 +1003,7 @@ handleDragLeave(e) { this.stopTokenRefresh(); localStorage.removeItem('user'); localStorage.removeItem('lastView'); + localStorage.removeItem('adminTab'); this.showResendVerify = false; this.resendVerifyEmail = ''; @@ -1066,6 +1067,14 @@ handleDragLeave(e) { targetView = 'files'; } + // 恢复管理员标签页 + if (this.user.is_admin) { + const savedAdminTab = localStorage.getItem('adminTab'); + if (savedAdminTab && ['overview', 'settings', 'monitor', 'users', 'tools'].includes(savedAdminTab)) { + this.adminTab = savedAdminTab; + } + } + // 强制切换到目标视图并加载数据 this.switchView(targetView, true); } @@ -2886,6 +2895,12 @@ handleDragLeave(e) { if (this.isLoggedIn && this.isViewAllowed(newView)) { localStorage.setItem('lastView', newView); } + }, + // 记住管理员当前标签页 + adminTab(newTab) { + if (this.isLoggedIn && this.user?.is_admin) { + localStorage.setItem('adminTab', newTab); + } } } }).mount('#app');