🐛 修复设置标签导航退出管理员页面问题

修复 2026 管理后台系统设置页的分区导航与 Hash 路由冲突,避免点击顶部标签后被 Vue Router 解析为公共路由并离开管理员页面。

- 将设置分区的普通 Hash 链接改为同页滚动按钮,不修改当前后台路由
- 保留管理员布局和登录会话,并兼容 reduced-motion 设置
- 修复公共页管理员入口显示原始 i18n key 的问题
- 已通过架构检查、Vue 类型检查和 Vite 生产构建
This commit is contained in:
2026-07-21 11:36:06 +08:00
parent b60c003ec2
commit 6d781cab58
2 changed files with 13 additions and 5 deletions
+2 -2
View File
@@ -24,8 +24,8 @@
<router-link
to="/login"
class="flex h-11 w-11 items-center justify-center rounded-lg text-sm transition duration-200 hover:bg-[#dcebed] dark:hover:bg-[#294047]"
:aria-label="t('admin.login.title')"
:title="t('admin.login.title')"
:aria-label="t('manage.login.title')"
:title="t('manage.login.title')"
:class="[
isDarkMode
? 'text-gray-400 hover:text-indigo-400'
+11 -3
View File
@@ -24,6 +24,13 @@ const {
toggleConfigFlag
} = useSystemConfig()
const scrollToSection = (section: string) => {
document.getElementById(`settings-${section}`)?.scrollIntoView({
behavior: window.matchMedia('(prefers-reduced-motion: reduce)').matches ? 'auto' : 'smooth',
block: 'start'
})
}
onMounted(() => {
void refreshConfig()
})
@@ -73,7 +80,7 @@ onMounted(() => {
class="mb-4 flex gap-2 overflow-x-auto pb-2"
:aria-label="t('manage.settings.sectionNavigation')"
>
<a
<button
v-for="section in [
['general', t('manage.settings.basicSettings')],
['storage', t('manage.settings.storageSettings')],
@@ -81,12 +88,13 @@ onMounted(() => {
['access', t('manage.settings.errorLimits')]
]"
:key="section[0]"
:href="`#settings-${section[0]}`"
type="button"
class="inline-flex min-h-11 shrink-0 items-center rounded-full border px-4 text-sm font-medium"
:class="isDarkMode ? 'border-[#40545c] bg-[#263941] text-[#d8e3e5]' : 'border-[#c8d8dc] bg-[#edf4f5] text-[#415d66]'"
@click="scrollToSection(section[0])"
>
{{ section[1] }}
</a>
</button>
</nav>
<div