登录界面重构
This commit is contained in:
BIN
src/assets/bgc.png
Normal file
BIN
src/assets/bgc.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 MiB |
BIN
src/assets/bgc1.png
Normal file
BIN
src/assets/bgc1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.0 MiB |
BIN
src/assets/bgc2.png
Normal file
BIN
src/assets/bgc2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.8 MiB |
BIN
src/assets/logincard.png
Normal file
BIN
src/assets/logincard.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 347 KiB |
@@ -4,31 +4,28 @@ import {
|
|||||||
Form,
|
Form,
|
||||||
Input,
|
Input,
|
||||||
Button,
|
Button,
|
||||||
Checkbox,
|
|
||||||
Typography,
|
Typography,
|
||||||
Space,
|
|
||||||
Card,
|
Card,
|
||||||
message
|
message,
|
||||||
|
Checkbox,
|
||||||
} from 'antd';
|
} from 'antd';
|
||||||
import {
|
import {
|
||||||
UserOutlined,
|
UserOutlined,
|
||||||
LockOutlined,
|
LockOutlined,
|
||||||
RocketOutlined,
|
|
||||||
SafetyCertificateOutlined,
|
|
||||||
ArrowRightOutlined
|
|
||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
import { motion } from 'motion/react';
|
import { motion } from 'motion/react';
|
||||||
|
import bgcImg from '../assets/bgc2.png';
|
||||||
|
import logincard from '../assets/logincard.png';
|
||||||
|
|
||||||
const { Text, Title } = Typography;
|
const { Text, Title } = Typography;
|
||||||
|
|
||||||
export default function Login() {
|
export default function Login() {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
// 账号密码登录
|
||||||
const onFinish = (values: any) => {
|
const onFinish = (values: any) => {
|
||||||
// 模拟登录逻辑
|
|
||||||
console.log('Login attempt:', values);
|
console.log('Login attempt:', values);
|
||||||
|
|
||||||
// 根据用户名模拟不同的角色用于演示
|
|
||||||
let role = 'viewer';
|
let role = 'viewer';
|
||||||
let name = '观察员';
|
let name = '观察员';
|
||||||
|
|
||||||
@@ -40,16 +37,15 @@ export default function Login() {
|
|||||||
name = '操作员';
|
name = '操作员';
|
||||||
}
|
}
|
||||||
|
|
||||||
// 存储用户信息
|
|
||||||
const userInfo = {
|
const userInfo = {
|
||||||
username: values.username,
|
username: values.username,
|
||||||
name: name,
|
name: name,
|
||||||
role: role,
|
role: role,
|
||||||
avatar: `https://api.dicebear.com/7.x/avataaars/svg?seed=${values.username}`
|
avatar: `https://api.dicebear.com7.x/avataaars/svg?seed=${values.username}`
|
||||||
};
|
};
|
||||||
|
|
||||||
localStorage.setItem('isAuthenticated', 'true');
|
localStorage.setItem('isAuthenticated', 'true');
|
||||||
localStorage.setItem('token', 'mock_token_' + Date.now()); // 模拟 Token
|
localStorage.setItem('token', 'mock_token_' + Date.now());
|
||||||
localStorage.setItem('user', JSON.stringify(userInfo));
|
localStorage.setItem('user', JSON.stringify(userInfo));
|
||||||
|
|
||||||
message.success(`欢迎回来, ${name}`);
|
message.success(`欢迎回来, ${name}`);
|
||||||
@@ -57,94 +53,113 @@ export default function Login() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="min-h-screen bg-[#001529] flex items-center justify-center p-4 relative overflow-hidden">
|
<div className="min-h-screen bg-[#F5F8FC] flex items-center justify-center p-4 relative overflow-hidden"
|
||||||
{/* Background Decor */}
|
style={{
|
||||||
<div className="absolute inset-0 overflow-hidden pointer-events-none opacity-20">
|
backgroundImage: `url(${bgcImg})`,
|
||||||
<div className="absolute top-0 left-0 w-full h-full bg-[radial-gradient(circle_at_50%_50%,#1890ff_0%,transparent_50%)] opacity-20" />
|
backgroundSize: 'cover',
|
||||||
</div>
|
backgroundPosition: 'center'
|
||||||
|
}}
|
||||||
|
>
|
||||||
<motion.div
|
<motion.div
|
||||||
initial={{ opacity: 0, y: 20 }}
|
initial={{ opacity: 0, scale: 0.95 }}
|
||||||
animate={{ opacity: 1, y: 0 }}
|
animate={{ opacity: 1, scale: 1 }}
|
||||||
style={{ width: '100%', maxWidth: 400 }}
|
transition={{ duration: 0.4 }}
|
||||||
|
className="w-full max-w-5xl"
|
||||||
>
|
>
|
||||||
<Card
|
<Card
|
||||||
bordered={false}
|
bordered={false}
|
||||||
className="shadow-2xl overflow-hidden"
|
className="shadow-xl overflow-hidden rounded-2xl"
|
||||||
styles={{ body: { padding: 0 } }}
|
styles={{ body: { padding: 0 } }}
|
||||||
>
|
>
|
||||||
{/* Header */}
|
<div className="flex flex-col md:flex-row relative">
|
||||||
<div className="bg-[#001529] p-8 text-center border-b border-white/10">
|
{/* 左侧:表单区域 */}
|
||||||
<div className="inline-flex items-center justify-center w-12 h-12 rounded bg-blue-500/10 text-[#1890ff] mb-4 border border-blue-500/20">
|
<div className="md:w-1/2 bg-white p-10 md:p-16 flex flex-col justify-center relative z-10">
|
||||||
<RocketOutlined style={{ fontSize: 24 }} />
|
<motion.div initial={{ opacity: 0, x: -20 }} animate={{ opacity: 1, x: 0 }} transition={{ delay: 0.2 }}>
|
||||||
</div>
|
<Title level={2} style={{ marginBottom: 40, color: '#111', fontWeight: 700 }}>
|
||||||
<Title level={4} style={{ color: '#fff', margin: 0, letterSpacing: 1 }}>机器人智慧服务系统</Title>
|
机器人智慧服务系统
|
||||||
<Text style={{ color: 'rgba(255,255,255,0.45)', fontSize: 10, marginTop: 4, display: 'block', letterSpacing: 2 }}>机器人智慧服务系统</Text>
|
</Title>
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Form */}
|
<Form name="login" layout="vertical" onFinish={onFinish} autoComplete="off" size="large">
|
||||||
<div className="p-8">
|
<Form.Item name="username" rules={[{ required: true, message: '请输入账号' }]}>
|
||||||
<Form
|
<Input
|
||||||
name="login"
|
prefix={<UserOutlined style={{ color: '#999' }} />}
|
||||||
layout="vertical"
|
placeholder="请输入账号"
|
||||||
onFinish={onFinish}
|
style={{ borderRadius: 8, height: 52, fontSize: 15, borderColor: '#e5e7eb' }}
|
||||||
autoComplete="off"
|
/>
|
||||||
size="large"
|
|
||||||
>
|
|
||||||
<Form.Item
|
|
||||||
label={<Text strong type="secondary" style={{ fontSize: 11, textTransform: 'uppercase' }}><UserOutlined style={{ color: '#1890ff', marginRight: 8 }} />账号名称</Text>}
|
|
||||||
name="username"
|
|
||||||
rules={[{ required: true, message: '请输入管理员账号' }]}
|
|
||||||
>
|
|
||||||
<Input placeholder="请输入管理员账号" style={{ borderRadius: 2 }} />
|
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item
|
<Form.Item name="password" rules={[{ required: true, message: '请输入密码' }]}>
|
||||||
label={<Text strong type="secondary" style={{ fontSize: 11, textTransform: 'uppercase' }}><LockOutlined style={{ color: '#1890ff', marginRight: 8 }} />访问令牌 / 密码</Text>}
|
<Input.Password
|
||||||
name="password"
|
prefix={<LockOutlined style={{ color: '#999' }} />}
|
||||||
rules={[{ required: true, message: '请输入密码' }]}
|
placeholder="请输入密码"
|
||||||
>
|
style={{ borderRadius: 8, height: 52, fontSize: 15, borderColor: '#e5e7eb' }}
|
||||||
<Input.Password placeholder="••••••••" style={{ borderRadius: 2 }} />
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<div className="flex items-center justify-between mb-6">
|
{/* 记住密码 */}
|
||||||
<Form.Item name="remember" valuePropName="checked" noStyle>
|
<Form.Item name="remember" valuePropName="checked" noStyle>
|
||||||
<Checkbox><Text type="secondary" style={{ fontSize: 12 }}>记住会话</Text></Checkbox>
|
<Checkbox>
|
||||||
|
<Text style={{ fontSize: 14, color: '#666' }}>记住密码</Text>
|
||||||
|
</Checkbox>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Button type="link" size="small" style={{ fontSize: 12 }}>找回凭据?</Button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<Form.Item>
|
|
||||||
|
|
||||||
|
<Form.Item style={{ marginTop: 20 }}>
|
||||||
<Button
|
<Button
|
||||||
type="primary"
|
type="primary"
|
||||||
htmlType="submit"
|
htmlType="submit"
|
||||||
block
|
block
|
||||||
icon={<SafetyCertificateOutlined />}
|
style={{
|
||||||
style={{ borderRadius: 2, height: 44, fontWeight: 'bold', fontSize: 14 }}
|
borderRadius: 8,
|
||||||
|
height: 52,
|
||||||
|
fontWeight: 600,
|
||||||
|
fontSize: 16,
|
||||||
|
backgroundColor: '#1677ff',
|
||||||
|
borderColor: '#1677ff',
|
||||||
|
boxShadow: '0 4px 12px rgba(22, 119, 255, 0.25)'
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
核验并进入系统 <ArrowRightOutlined />
|
登录
|
||||||
</Button>
|
</Button>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
{/* 用户协议 */}
|
||||||
|
<Form.Item
|
||||||
|
name="agreement"
|
||||||
|
valuePropName="checked"
|
||||||
|
rules={[{ validator: (_, value) => value ? Promise.resolve() : Promise.reject(new Error('请阅读并同意用户协议')) }]}
|
||||||
|
>
|
||||||
|
<Checkbox>
|
||||||
|
<Text style={{ fontSize: 14, color: '#666' }}>
|
||||||
|
我已阅读并同意 <Text type="link" style={{ padding: 0, color: "#1677ff" }}>用户协议</Text> 和 <Text type="link" style={{ padding: 0, color: "#1677ff" }}>隐私政策</Text>
|
||||||
|
</Text>
|
||||||
|
</Checkbox>
|
||||||
|
</Form.Item>
|
||||||
</Form>
|
</Form>
|
||||||
|
</motion.div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Footer */}
|
{/* 右侧:梯形斜切 + 图片铺满 */}
|
||||||
<div className="px-8 py-4 bg-gray-50 border-t border-gray-100 flex justify-between items-center">
|
<div
|
||||||
<Text type="secondary" style={{ fontSize: 10, fontFamily: 'monospace' }}>System Version: v4.2.1-stable</Text>
|
className="md:w-1/2 relative min-h-[600px] overflow-hidden"
|
||||||
<Space size={4}>
|
style={{
|
||||||
<div className="w-1.5 h-1.5 rounded-full bg-green-500 animate-pulse" />
|
// 梯形斜切效果
|
||||||
<Text strong type="secondary" style={{ fontSize: 10, textTransform: 'uppercase' }}>Server Online</Text>
|
clipPath: 'polygon(12% 0, 100% 0, 100% 100%, 0 100%)',
|
||||||
</Space>
|
}}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="absolute inset-0 w-full h-full"
|
||||||
|
style={{
|
||||||
|
backgroundImage: `url(${logincard})`,
|
||||||
|
backgroundSize: 'cover',
|
||||||
|
backgroundPosition: 'center',
|
||||||
|
backgroundRepeat: 'no-repeat',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
|
|
||||||
{/* Security Notice */}
|
|
||||||
<div className="absolute bottom-8 text-center w-full px-4">
|
|
||||||
<Text strong style={{ color: 'rgba(255,255,255,0.2)', fontSize: 10, letterSpacing: 4 }}>
|
|
||||||
AUTHORIZED PERSONNEL ONLY | ENCRYPTED LINK | TRACE ENABLED
|
|
||||||
</Text>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user