feat: 项目基本架构和组件引入、新增玩家服务中心入口和运营后台管理员入口。

This commit is contained in:
Stev_Wang
2025-12-12 00:14:36 +08:00
parent 209f50e4c4
commit f5906044d8
23 changed files with 5416 additions and 129 deletions

191
src/pages/AdminLogin.tsx Normal file
View File

@@ -0,0 +1,191 @@
import React, { useState } from 'react';
import { Form, Input, Button, Card, Typography, message, Space, Checkbox } from 'antd';
import { UserOutlined, LockOutlined, SafetyOutlined } from '@ant-design/icons';
import { useNavigate } from 'react-router-dom';
const { Title, Text } = Typography;
/**
* 运营管理系统后台登录页面
* 路径:/admin
*/
const AdminLogin: React.FC = () => {
const [loading, setLoading] = useState(false);
const navigate = useNavigate();
/**
* 处理登录表单提交
* @param values - 表单值(故意未使用)
*/
const handleLogin = async (values: {
username: string;
password: string;
remember?: boolean;
}) => {
setLoading(true);
try {
// 模拟登录请求
await new Promise(resolve => setTimeout(resolve, 1200));
// 这里应该是实际的API调用
// const response = await loginAdmin(values);
// 模拟登录成功
message.success('登录成功!欢迎进入运营管理系统!');
navigate('/admin/dashboard');
} catch {
// 故意使用 values 参数以避免 TypeScript 未使用警告
void values;
message.error('登录失败,请检查用户名和密码!');
} finally {
setLoading(false);
}
};
return (
<div style={{
minHeight: '100vh',
background: 'linear-gradient(135deg, #1e3c72 0%, #2a5298 100%)',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
padding: '20px'
}}>
<Card
style={{
width: '100%',
maxWidth: '450px',
boxShadow: '0 10px 40px rgba(0, 0, 0, 0.15)',
borderRadius: '16px',
border: '1px solid rgba(255, 255, 255, 0.1)'
}}
styles={{ body: { padding: '48px 40px' } }}
>
<Space orientation="vertical" size="large" style={{ width: '100%' }}>
{/* 系统标题 */}
<div style={{ textAlign: 'center' }}>
<div style={{
width: '72px',
height: '72px',
background: 'linear-gradient(45deg, #1890ff, #722ed1)',
borderRadius: '16px',
margin: '0 auto 20px',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
fontSize: '32px',
color: 'white'
}}>
<SafetyOutlined />
</div>
<Title level={2} style={{ margin: 0, color: '#1f2937' }}>
</Title>
<Text type="secondary" style={{ fontSize: '16px' }}>
西
</Text>
</div>
{/* 安全提示 */}
<div style={{
background: '#f6ffed',
border: '1px solid #b7eb8f',
borderRadius: '8px',
padding: '12px 16px',
textAlign: 'center'
}}>
<Text style={{ color: '#52c41a', fontSize: '14px' }}>
🔒 使
</Text>
</div>
{/* 登录表单 */}
<Form
name="admin-login"
onFinish={handleLogin}
autoComplete="off"
size="large"
initialValues={{ remember: false }}
>
<Form.Item
name="username"
rules={[
{ required: true, message: '请输入管理员账号!' },
{ min: 3, message: '账号至少3个字符' }
]}
>
<Input
prefix={<UserOutlined style={{ color: '#8c8c8c' }} />}
placeholder="管理员账号"
style={{
borderRadius: '10px',
border: '1px solid #d9d9d9'
}}
/>
</Form.Item>
<Form.Item
name="password"
rules={[
{ required: true, message: '请输入密码!' },
{ min: 6, message: '密码至少6个字符' }
]}
>
<Input.Password
prefix={<LockOutlined style={{ color: '#8c8c8c' }} />}
placeholder="密码"
style={{
borderRadius: '10px',
border: '1px solid #d9d9d9'
}}
/>
</Form.Item>
<Form.Item>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<Form.Item name="remember" valuePropName="checked" style={{ margin: 0 }}>
<Checkbox></Checkbox>
</Form.Item>
<a href="#" style={{ color: '#1890ff' }}>
</a>
</div>
</Form.Item>
<Form.Item>
<Button
type="primary"
htmlType="submit"
loading={loading}
style={{
width: '100%',
height: '48px',
borderRadius: '10px',
fontSize: '16px',
fontWeight: '500',
background: 'linear-gradient(45deg, #1890ff, #722ed1)',
border: 'none',
boxShadow: '0 4px 12px rgba(24, 144, 255, 0.3)'
}}
>
{loading ? '登录中...' : '登录管理后台'}
</Button>
</Form.Item>
</Form>
{/* 底部信息 */}
<div style={{ textAlign: 'center' }}>
<Text type="secondary" style={{ fontSize: '12px' }}>
v1.0.0 |
<a href="#" style={{ color: '#1890ff', marginLeft: '4px' }}>
</a>
</Text>
</div>
</Space>
</Card>
</div>
);
};
export default AdminLogin;