import { Layout as AntLayout, Menu, Dropdown, Space, Button, theme } from 'antd'; import { VideoCameraOutlined, SettingOutlined, FileTextOutlined, UserOutlined, LogoutOutlined, } from '@ant-design/icons'; import { Outlet, useLocation, useNavigate } from 'react-router-dom'; import { useAuthStore } from '../store/auth'; const { Header, Sider, Content, Footer } = AntLayout; export default function Layout() { const location = useLocation(); const navigate = useNavigate(); const { user, clearAuth } = useAuthStore(); const { token: { colorBgContainer, borderRadiusLG }, } = theme.useToken(); const menuItems = [ { key: '/videos', icon: , label: '视频库' }, { key: '/accounts', icon: , label: '账号配置' }, { key: '/logs', icon: , label: '操作日志' }, ]; const handleMenuClick = ({ key }: { key: string }) => { navigate(key); }; const handleLogout = () => { clearAuth(); navigate('/login'); }; const userMenuItems = [ { key: 'user', label: user?.username, disabled: true }, { key: 'role', label: `角色: ${user?.role === 'admin' ? '管理员' : '只读'}`, disabled: true }, { type: 'divider' as const }, { key: 'logout', icon: , label: '退出登录', onClick: handleLogout }, ]; return (
火炬VOD管理器
); }