feat(布局): 添加应用配置常量并更新主布局标题显示

将网站标题配置提取到单独的配置文件
根据折叠状态动态调整标题字体大小
This commit is contained in:
2025-08-29 00:01:56 +08:00
parent f05eb0aeab
commit af68d94efa
2 changed files with 23 additions and 2 deletions

View File

@ -6,6 +6,7 @@ import { clearToken, getUser as getUserLocal, setUser as setUserLocal } from '..
import api from '../utils/axios' import api from '../utils/axios'
import './layout.css' import './layout.css'
import { PermissionProvider } from '../utils/permission' import { PermissionProvider } from '../utils/permission'
import { APP_CONFIG } from '../utils/config'
const { Header, Sider, Content } = Layout const { Header, Sider, Content } = Layout
interface MenuItemResp { id: number; parent_id?: number | null; name: string; path?: string | null; component?: string | null; type: number; icon?: string | null; order_no: number; visible: boolean; status: number; perms?: string | null; keep_alive?: boolean } interface MenuItemResp { id: number; parent_id?: number | null; name: string; path?: string | null; component?: string | null; type: number; icon?: string | null; order_no: number; visible: boolean; status: number; perms?: string | null; keep_alive?: boolean }
@ -457,11 +458,20 @@ export default function MainLayout() {
style={{ background: colorBgContainer }} style={{ background: colorBgContainer }}
> >
<div <div
style={{ height: 64, display: 'flex', alignItems: 'center', justifyContent: 'center', fontWeight: 600, cursor: 'pointer', userSelect: 'none' }} style={{
height: 64,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
fontWeight: 600,
fontSize: leftCollapsed ? '16px' : '18px',
cursor: 'pointer',
userSelect: 'none'
}}
onClick={() => setLeftCollapsed(c => !c)} onClick={() => setLeftCollapsed(c => !c)}
title={leftCollapsed ? '展开菜单' : '收起菜单'} title={leftCollapsed ? '展开菜单' : '收起菜单'}
> >
{leftCollapsed ? '道友' : '道友管理系统'} {leftCollapsed ? APP_CONFIG.SITE_NAME_SHORT : APP_CONFIG.SITE_NAME}
</div> </div>
<Menu <Menu
mode="inline" mode="inline"

View File

@ -0,0 +1,11 @@
// 前端系统配置常量
export const APP_CONFIG = {
// 网站标题配置
SITE_NAME: '道友管理系统',
SITE_NAME_SHORT: '道友',
// 其他系统配置可以在这里添加
// 如: API_VERSION: 'v1', DEFAULT_PAGE_SIZE: 10 等
} as const
export default APP_CONFIG