import { LockOutlined, UserOutlined } from "@ant-design/icons"; import { Button, Flex, Form, Input, message } from "antd"; import { useDispatch } from "react-redux"; import { useNavigate } from "react-router-dom"; import { login } from "../features/auth/authThunk"; import roleRoute from "../config/roleRouteConfig"; export default function Login() { const dispatch = useDispatch(); const navigate = useNavigate(); const onFinish = async (values) => { const res = await dispatch(login(values)).unwrap(); const path = res.roles.map((r) => roleRoute[r]).find(Boolean); if (path) { message.success("登录成功"); navigate(path); } else { message.error("系统错误"); } }; return (