Unverified Commit e5510452 authored by aiwenmo's avatar aiwenmo Committed by GitHub

Merge pull request #26 from coderTomato/dev

来自 coderTomato: 添加回车登录功能
parents 60b13d25 b68b0f85
...@@ -44,6 +44,7 @@ const Login: React.FC = () => { ...@@ -44,6 +44,7 @@ const Login: React.FC = () => {
const [userLoginState, setUserLoginState] = useState<API.LoginResult>({}); const [userLoginState, setUserLoginState] = useState<API.LoginResult>({});
const [type, setType] = useState<string>('password'); const [type, setType] = useState<string>('password');
const { initialState, setInitialState } = useModel('@@initialState'); const { initialState, setInitialState } = useModel('@@initialState');
const [isLogin, setIsLogin] = useState<boolean>(true);
const intl = useIntl(); const intl = useIntl();
...@@ -58,6 +59,9 @@ const Login: React.FC = () => { ...@@ -58,6 +59,9 @@ const Login: React.FC = () => {
}; };
const handleSubmit = async (values: API.LoginParams) => { const handleSubmit = async (values: API.LoginParams) => {
if(!isLogin) {return;}
setIsLogin(false);
setTimeout(()=>{setIsLogin(true)},200);
setSubmitting(true); setSubmitting(true);
try { try {
// 登录 // 登录
...@@ -121,6 +125,7 @@ const Login: React.FC = () => { ...@@ -121,6 +125,7 @@ const Login: React.FC = () => {
style: { style: {
width: '100%', width: '100%',
}, },
htmlType:'submit',
}, },
}} }}
onFinish={async (values) => { onFinish={async (values) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment