优化前端控制台样式并更新文档

This commit is contained in:
2026-05-21 00:25:39 +08:00
parent d3f1f97a83
commit 387681a6ab
6 changed files with 235 additions and 60 deletions

View File

@@ -7,15 +7,6 @@ import {
Files,
Grid,
} from '@element-plus/icons-vue';
import { computed } from 'vue';
import { useRoute } from 'vue-router';
import { useAppStore } from '@/stores/app';
const route = useRoute();
const appStore = useAppStore();
const pageTitle = computed(() => String(route.meta.title ?? 'Common Agent'));
const menuItems = [
{ path: '/dashboard', label: '工作台', icon: DataBoard },
@@ -47,13 +38,6 @@ const menuItems = [
</el-aside>
<el-container>
<el-header class="admin-header">
<div>
<h1>{{ pageTitle }}</h1>
<p>{{ appStore.environmentName }}</p>
</div>
</el-header>
<el-main class="admin-main">
<RouterView />
</el-main>

View File

@@ -0,0 +1,29 @@
import { mount } from '@vue/test-utils';
import ElementPlus from 'element-plus';
import { createPinia } from 'pinia';
import { describe, expect, it, vi } from 'vitest';
import AdminLayout from '../AdminLayout.vue';
vi.mock('vue-router', () => ({
useRoute: () => ({ meta: { title: '系统枚举' } }),
}));
describe('AdminLayout', () => {
it('does not render a duplicate page header above the main page content', () => {
const wrapper = mount(AdminLayout, {
global: {
plugins: [createPinia(), ElementPlus],
mocks: {
$route: { path: '/system/enums' },
},
stubs: {
RouterView: { template: '<main data-test="router-view" />' },
},
},
});
expect(wrapper.find('.admin-header').exists()).toBe(false);
expect(wrapper.find('[data-test="router-view"]').exists()).toBe(true);
});
});