|
|
@@ -1,5 +1,13 @@ |
|
|
|
import React, { useState } from 'react'; |
|
|
|
import { Input, Button, Form, Modal, ModalProps, message } from 'antd'; |
|
|
|
import { |
|
|
|
Input, |
|
|
|
Button, |
|
|
|
Form, |
|
|
|
Modal, |
|
|
|
ModalProps, |
|
|
|
message, |
|
|
|
Checkbox, |
|
|
|
} from 'antd'; |
|
|
|
import styles from './login.less'; |
|
|
|
import { history, useModel } from 'umi'; |
|
|
|
import { MobileFilled, LockFilled } from '@ant-design/icons'; |
|
|
@@ -27,6 +35,7 @@ export default function Login() { |
|
|
|
const [account, setAccount] = useState(''); |
|
|
|
const [password, setPassword] = useState(''); |
|
|
|
const [loading, setLoading] = useState(false); |
|
|
|
const [keepPass, setKeepPass] = useState(false); |
|
|
|
const [regModalVisible, setRegModalVisible] = useState(false); |
|
|
|
const { refresh } = useModel('@@initialState'); |
|
|
|
const buttonRef = useRef<HTMLElement>(null); |
|
|
@@ -50,7 +59,7 @@ export default function Login() { |
|
|
|
}) |
|
|
|
.success(() => { |
|
|
|
// 记录账号密码 |
|
|
|
if (isClient) { |
|
|
|
if (isClient && keepPass) { |
|
|
|
storage.set('account', account, true); |
|
|
|
storage.set('password', password, true); |
|
|
|
} |
|
|
@@ -74,9 +83,10 @@ export default function Login() { |
|
|
|
if (iAccount && iPass) { |
|
|
|
setAccount(iAccount); |
|
|
|
setPassword(iPass); |
|
|
|
setTimeout(() => { |
|
|
|
buttonRef.current?.click(); |
|
|
|
}, 500); |
|
|
|
setKeepPass(true); |
|
|
|
// setTimeout(() => { |
|
|
|
// buttonRef.current?.click(); |
|
|
|
// }, 500); |
|
|
|
} |
|
|
|
}, 0); |
|
|
|
} |
|
|
@@ -115,6 +125,13 @@ export default function Login() { |
|
|
|
onChange={(e) => setPassword(e.target.value)} |
|
|
|
/> |
|
|
|
<div className={styles.errText}>{errText}</div> |
|
|
|
<Checkbox |
|
|
|
className={styles.checkbox} |
|
|
|
checked={keepPass} |
|
|
|
onChange={(e) => setKeepPass(e.target.checked)} |
|
|
|
> |
|
|
|
记住密码 |
|
|
|
</Checkbox> |
|
|
|
<div className={styles.btnGroup}> |
|
|
|
<Button |
|
|
|
ref={buttonRef} |
|
|
|