feat: 后台语言包合并默认中文、日夜主题切换、官方侧栏收缩、追溯码分组与批量
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -7,8 +7,7 @@
|
||||
:collapsed-width="64"
|
||||
:width="224"
|
||||
:native-scrollbar="false"
|
||||
:inverted="true"
|
||||
show-trigger="bar"
|
||||
show-trigger="arrow-circle"
|
||||
@collapse="collapsed = true"
|
||||
@expand="collapsed = false"
|
||||
>
|
||||
@@ -17,7 +16,6 @@
|
||||
<span v-show="!collapsed" class="brand-name text-ellipsis">{{ appName }}</span>
|
||||
</div>
|
||||
<n-menu
|
||||
:inverted="true"
|
||||
:collapsed="collapsed"
|
||||
:collapsed-width="64"
|
||||
:value="activeKey"
|
||||
@@ -28,18 +26,10 @@
|
||||
|
||||
<n-layout>
|
||||
<n-layout-header bordered class="header">
|
||||
<n-button quaternary circle @click="collapsed = !collapsed">
|
||||
<template #icon><n-icon :component="MenuOutline" /></template>
|
||||
</n-button>
|
||||
<div class="header-title text-ellipsis">{{ currentTitle }}</div>
|
||||
<div class="spacer" />
|
||||
<n-select
|
||||
v-model:value="currentLocale"
|
||||
:options="localeOptions"
|
||||
size="small"
|
||||
style="width: 110px"
|
||||
@update:value="changeLocale"
|
||||
/>
|
||||
<theme-switch />
|
||||
<lang-switch />
|
||||
<n-dropdown :options="userOptions" @select="onUser">
|
||||
<n-button quaternary>
|
||||
<template #icon><n-icon :component="PersonCircleOutline" /></template>
|
||||
@@ -74,26 +64,23 @@ import {
|
||||
ListOutline,
|
||||
PeopleOutline,
|
||||
SettingsOutline,
|
||||
MenuOutline,
|
||||
PersonCircleOutline,
|
||||
LogOutOutline,
|
||||
KeyOutline,
|
||||
} from '@vicons/ionicons5';
|
||||
import { useAuthStore } from '@/stores/auth';
|
||||
import { settingsApi } from '@/api';
|
||||
import { SUPPORTED_LOCALES, setLocale } from '@/locales';
|
||||
import { dialog } from '@/utils/feedback';
|
||||
import LangSwitch from '@/components/LangSwitch.vue';
|
||||
import ThemeSwitch from '@/components/ThemeSwitch.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const { t, locale } = useI18n();
|
||||
const { t } = useI18n();
|
||||
const auth = useAuthStore();
|
||||
|
||||
const collapsed = ref(window.innerWidth < 900);
|
||||
const appName = ref(t('pages.login.title'));
|
||||
const currentLocale = ref(locale.value);
|
||||
|
||||
const localeOptions = SUPPORTED_LOCALES.map((l) => ({ label: l.label, value: l.value }));
|
||||
|
||||
function renderIcon(icon: unknown) {
|
||||
return () => h(NIcon, null, { default: () => h(icon as never) });
|
||||
@@ -113,15 +100,8 @@ const menuOptions = computed<MenuOption[]>(() => {
|
||||
return items.filter((i) => !i.superOnly || auth.isSuperAdmin);
|
||||
});
|
||||
|
||||
const activeKey = computed(() => {
|
||||
if (route.name === 'artwork-detail') return 'artworks';
|
||||
return route.name as string;
|
||||
});
|
||||
|
||||
const currentTitle = computed(() => {
|
||||
const key = activeKey.value;
|
||||
return key ? t(`menu.${key}`) : '';
|
||||
});
|
||||
const activeKey = computed(() => (route.name === 'artwork-detail' ? 'artworks' : (route.name as string)));
|
||||
const currentTitle = computed(() => (activeKey.value ? t(`menu.${activeKey.value}`) : ''));
|
||||
|
||||
const userOptions = computed(() => [
|
||||
{ label: t('menu.profile'), key: 'profile', icon: renderIcon(KeyOutline) },
|
||||
@@ -132,11 +112,6 @@ function onMenu(key: string) {
|
||||
router.push({ name: key });
|
||||
}
|
||||
|
||||
function changeLocale(val: string) {
|
||||
setLocale(val);
|
||||
currentLocale.value = val;
|
||||
}
|
||||
|
||||
function onUser(key: string) {
|
||||
if (key === 'profile') {
|
||||
router.push({ name: 'profile' });
|
||||
@@ -177,8 +152,6 @@ onUnmounted(() => window.removeEventListener('resize', resizeHandler));
|
||||
gap: 10px;
|
||||
height: 56px;
|
||||
padding: 0 16px;
|
||||
color: #fff;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.08);
|
||||
}
|
||||
.brand-logo {
|
||||
display: inline-flex;
|
||||
@@ -187,26 +160,26 @@ onUnmounted(() => window.removeEventListener('resize', resizeHandler));
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: 8px;
|
||||
background: #2e5496;
|
||||
background: var(--brand);
|
||||
color: #fff;
|
||||
font-weight: 700;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.brand-name {
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
color: var(--brand);
|
||||
}
|
||||
.header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
gap: 10px;
|
||||
height: 56px;
|
||||
padding: 0 16px;
|
||||
background: #fff;
|
||||
}
|
||||
.header-title {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #1f2937;
|
||||
max-width: 40vw;
|
||||
}
|
||||
.spacer {
|
||||
@@ -214,7 +187,6 @@ onUnmounted(() => window.removeEventListener('resize', resizeHandler));
|
||||
}
|
||||
.content {
|
||||
height: calc(100vh - 56px);
|
||||
background: #f0f2f5;
|
||||
}
|
||||
.fade-enter-active,
|
||||
.fade-leave-active {
|
||||
|
||||
Reference in New Issue
Block a user