fix(layout): 顶栏被挤成窄条、用户区跑到中央不在右上角
根因: Layout 内层 <el-container> 用原生 <header>(非 <el-header>), element-plus 不会自动转纵向 → flex-direction 保持 row, header 与 el-main 横向并排, header 被挤成 308px 窄条(应满宽 ~992px), 用户区(头像/用户名/登出) 随 justify-content 落到屏幕中央, 不在右上角。 修复: - 内层 <el-container direction="vertical"> 强制纵向 → header 回到顶部满宽栏, el-main 在下; 用户区回到右上角 - 顶栏静态口号 "投研·回测·模拟 控制台" 换成动态面包屑(分组/页名, 按路由推断)
This commit is contained in:
@@ -14,6 +14,27 @@ const activeMenu = computed(() => {
|
|||||||
return p
|
return p
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 顶栏动态页名(按路由推断,替代静态口号占位)
|
||||||
|
const PAGE_TITLE: Array<{ match: RegExp; group: string; title: string }> = [
|
||||||
|
{ match: /^\/dashboard$/, group: '工作台', title: '工作台' },
|
||||||
|
{ match: /^\/backtest\/new$/, group: '回测', title: '新建回测' },
|
||||||
|
{ match: /^\/backtest\/optimize$/, group: '回测', title: '参数优化' },
|
||||||
|
{ match: /^\/backtest\/history$/, group: '回测', title: '历史任务' },
|
||||||
|
{ match: /^\/backtest\/progress\//, group: '回测', title: '任务进度' },
|
||||||
|
{ match: /^\/backtest\/result\//, group: '回测', title: '回测结果' },
|
||||||
|
{ match: /^\/factor\/new$/, group: '投研', title: '因子分析' },
|
||||||
|
{ match: /^\/factor\/progress\//, group: '投研', title: '因子分析进度' },
|
||||||
|
{ match: /^\/factor\/result\//, group: '投研', title: '因子分析结果' },
|
||||||
|
{ match: /^\/paper\/new$/, group: '模拟', title: '新建模拟盘' },
|
||||||
|
{ match: /^\/paper\/result\//, group: '模拟', title: '模拟盘结果' },
|
||||||
|
{ match: /^\/paper\/live\//, group: '模拟', title: '实走监控' },
|
||||||
|
{ match: /^\/paper$/, group: '模拟', title: '模拟交易' },
|
||||||
|
]
|
||||||
|
const pageMeta = computed(() => {
|
||||||
|
const p = route.path
|
||||||
|
return PAGE_TITLE.find((r) => r.match.test(p)) ?? { group: '', title: '控制台' }
|
||||||
|
})
|
||||||
|
|
||||||
function navigate(path: string): void {
|
function navigate(path: string): void {
|
||||||
router.push(path)
|
router.push(path)
|
||||||
}
|
}
|
||||||
@@ -64,9 +85,13 @@ function onLogout(): void {
|
|||||||
<div class="sidebar-foot">v2 · 量化研究台</div>
|
<div class="sidebar-foot">v2 · 量化研究台</div>
|
||||||
</aside>
|
</aside>
|
||||||
|
|
||||||
<el-container>
|
<el-container direction="vertical">
|
||||||
<header class="header">
|
<header class="header">
|
||||||
<span class="sys-name">投研 · 回测 · 模拟 控制台</span>
|
<div class="sys-crumb">
|
||||||
|
<span v-if="pageMeta.group" class="sys-group">{{ pageMeta.group }}</span>
|
||||||
|
<span v-if="pageMeta.group" class="sys-sep">/</span>
|
||||||
|
<span class="sys-name">{{ pageMeta.title }}</span>
|
||||||
|
</div>
|
||||||
<div class="user-area">
|
<div class="user-area">
|
||||||
<span class="user-avatar">{{ (auth.username ?? '?').slice(0, 1).toUpperCase() }}</span>
|
<span class="user-avatar">{{ (auth.username ?? '?').slice(0, 1).toUpperCase() }}</span>
|
||||||
<span class="user-name">{{ auth.username }}</span>
|
<span class="user-name">{{ auth.username }}</span>
|
||||||
@@ -157,6 +182,20 @@ function onLogout(): void {
|
|||||||
background: var(--bg-card);
|
background: var(--bg-card);
|
||||||
border-bottom: 1px solid var(--border);
|
border-bottom: 1px solid var(--border);
|
||||||
}
|
}
|
||||||
|
.sys-crumb {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
.sys-group {
|
||||||
|
font-size: 13px;
|
||||||
|
color: var(--text-3);
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
.sys-sep {
|
||||||
|
color: var(--border-2);
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
.sys-name {
|
.sys-name {
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
|
|||||||
Reference in New Issue
Block a user