| import React from 'react'; |
| import { Card, Table, Button, Space, Typography } from 'antd'; |
| import { UserOutlined, UploadOutlined, SettingOutlined } from '@ant-design/icons'; |
| |
| const { Title } = Typography; |
| |
| const AdminPanel = () => { |
| // 模拟用户数据 |
| const users = [ |
| { key: '1', username: 'admin', role: '管理员', status: '正常', registrationDate: '2023-01-01' }, |
| { key: '2', username: 'user1', role: '新人', status: '正常', registrationDate: '2023-02-15' }, |
| { key: '3', username: 'user2', role: '老手', status: '禁用', registrationDate: '2023-03-20' }, |
| { key: '4', username: 'user3', role: '黑户', status: '封禁', registrationDate: '2023-04-10' }, |
| { key: '5', username: 'mod1', role: '版主', status: '正常', registrationDate: '2023-05-05' }, |
| ]; |
| |
| const columns = [ |
| { title: '用户名', dataIndex: 'username', key: 'username' }, |
| { title: '角色', dataIndex: 'role', key: 'role' }, |
| { title: '状态', dataIndex: 'status', key: 'status' }, |
| { title: '注册日期', dataIndex: 'registrationDate', key: 'registrationDate' }, |
| { |
| title: '操作', |
| key: 'action', |
| render: (_, record) => ( |
| <Space size="middle"> |
| <Button type="link">编辑</Button> |
| <Button type="link" danger>禁用</Button> |
| </Space> |
| ), |
| }, |
| ]; |
| |
| return ( |
| <div className="p-6"> |
| <Title level={2}>管理员控制面板</Title> |
| <div className="flex gap-4 mb-6"> |
| <Card title="用户统计" className="w-1/3"> |
| <div className="flex items-center"> |
| <UserOutlined className="text-2xl mr-2" /> |
| <span className="text-xl">5 名用户</span> |
| </div> |
| </Card> |
| <Card title="资源统计" className="w-1/3"> |
| <div className="flex items-center"> |
| <UploadOutlined className="text-2xl mr-2" /> |
| <span className="text-xl">25 个资源</span> |
| </div> |
| </Card> |
| <Card title="系统状态" className="w-1/3"> |
| <div className="flex items-center"> |
| <SettingOutlined className="text-2xl mr-2" /> |
| <span className="text-xl">运行正常</span> |
| </div> |
| </Card> |
| </div> |
| <Card title="用户管理"> |
| <Table columns={columns} dataSource={users} /> |
| </Card> |
| </div> |
| ); |
| }; |
| |
| export default AdminPanel; |