fix(简易模式): 统一前端状态管理,修复路由守卫失效问题
**问题**: 1. login/register 未处理 run_mode,导致 authStore.runMode 不更新 2. 侧边栏使用 simpleMode.value,与路由守卫的 authStore.isSimpleMode 不一致 **修复**: 1. 在 login() 和 register() 中提取并设置 run_mode 2. 统一侧边栏使用 authStore.isSimpleMode **影响**: - 路由守卫现在可以正确工作 - 前端UI状态与后端配置保持一致 - 登录/注册后立即生效,无需刷新
This commit is contained in:
@@ -46,7 +46,7 @@
|
||||
</div>
|
||||
|
||||
<!-- Personal Section for Admin (hidden in simple mode) -->
|
||||
<div v-if="!simpleMode" class="sidebar-section">
|
||||
<div v-if="!authStore.isSimpleMode" class="sidebar-section">
|
||||
<div v-if="!sidebarCollapsed" class="sidebar-section-title">
|
||||
{{ t('nav.myAccount') }}
|
||||
</div>
|
||||
@@ -412,7 +412,7 @@ const userNavItems = computed(() => {
|
||||
{ path: '/redeem', label: t('nav.redeem'), icon: GiftIcon, hideInSimpleMode: true },
|
||||
{ path: '/profile', label: t('nav.profile'), icon: UserIcon }
|
||||
]
|
||||
return simpleMode.value ? items.filter(item => !item.hideInSimpleMode) : items
|
||||
return authStore.isSimpleMode ? items.filter(item => !item.hideInSimpleMode) : items
|
||||
})
|
||||
|
||||
// Personal navigation items (for admin's "My Account" section, without Dashboard)
|
||||
@@ -424,7 +424,7 @@ const personalNavItems = computed(() => {
|
||||
{ path: '/redeem', label: t('nav.redeem'), icon: GiftIcon, hideInSimpleMode: true },
|
||||
{ path: '/profile', label: t('nav.profile'), icon: UserIcon }
|
||||
]
|
||||
return simpleMode.value ? items.filter(item => !item.hideInSimpleMode) : items
|
||||
return authStore.isSimpleMode ? items.filter(item => !item.hideInSimpleMode) : items
|
||||
})
|
||||
|
||||
// Admin navigation items
|
||||
@@ -441,7 +441,7 @@ const adminNavItems = computed(() => {
|
||||
]
|
||||
|
||||
// 简单模式下,在系统设置前插入 API密钥
|
||||
if (simpleMode.value) {
|
||||
if (authStore.isSimpleMode) {
|
||||
const filtered = baseItems.filter(item => !item.hideInSimpleMode)
|
||||
filtered.push({ path: '/keys', label: t('nav.apiKeys'), icon: KeyIcon })
|
||||
filtered.push({ path: '/admin/settings', label: t('nav.settings'), icon: CogIcon })
|
||||
|
||||
Reference in New Issue
Block a user