feat(布局): 添加应用配置常量并更新主布局标题显示
将网站标题配置提取到单独的配置文件 根据折叠状态动态调整标题字体大小
This commit is contained in:
@ -6,6 +6,7 @@ import { clearToken, getUser as getUserLocal, setUser as setUserLocal } from '..
|
||||
import api from '../utils/axios'
|
||||
import './layout.css'
|
||||
import { PermissionProvider } from '../utils/permission'
|
||||
import { APP_CONFIG } from '../utils/config'
|
||||
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 }
|
||||
@ -457,11 +458,20 @@ export default function MainLayout() {
|
||||
style={{ background: colorBgContainer }}
|
||||
>
|
||||
<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)}
|
||||
title={leftCollapsed ? '展开菜单' : '收起菜单'}
|
||||
>
|
||||
{leftCollapsed ? '道友' : '道友管理系统'}
|
||||
{leftCollapsed ? APP_CONFIG.SITE_NAME_SHORT : APP_CONFIG.SITE_NAME}
|
||||
</div>
|
||||
<Menu
|
||||
mode="inline"
|
||||
|
||||
11
frontend/src/utils/config.ts
Normal file
11
frontend/src/utils/config.ts
Normal 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
|
||||
Reference in New Issue
Block a user