|
@@ -5,7 +5,7 @@ import ProForm, { ProFormCheckbox, ProFormText } from '@ant-design/pro-form'
|
|
|
import { useIntl, Link, history, FormattedMessage, SelectLang, useModel, useRequest } from 'umi'
|
|
|
import { login } from '@/services/api/login'
|
|
|
import { queryAcountList } from '@/services/api/institution'
|
|
|
-
|
|
|
+import consts from '@/utils/consts'
|
|
|
import styles from './index.less'
|
|
|
|
|
|
const LoginMessage: React.FC<{
|
|
@@ -22,14 +22,14 @@ const LoginMessage: React.FC<{
|
|
|
)
|
|
|
|
|
|
/** 此方法会跳转到 redirect 参数所在的位置 */
|
|
|
-// const goto = () => {
|
|
|
-// if (!history) return
|
|
|
-// setTimeout(() => {
|
|
|
-// const { query } = history.location
|
|
|
-// const { redirect } = query as { redirect: string }
|
|
|
-// history.push(redirect || '/')
|
|
|
-// }, 10)
|
|
|
-// }
|
|
|
+const goto = () => {
|
|
|
+ if (!history) return
|
|
|
+ setTimeout(() => {
|
|
|
+ const { query } = history.location
|
|
|
+ const { redirect } = query as { redirect: string }
|
|
|
+ history.push(redirect || '/')
|
|
|
+ }, 10)
|
|
|
+}
|
|
|
|
|
|
const Login: React.FC = () => {
|
|
|
// const { setAuthToken } = useModel('user')
|
|
@@ -44,7 +44,7 @@ const Login: React.FC = () => {
|
|
|
...initialState,
|
|
|
currentUser: result.items
|
|
|
})
|
|
|
- // goto()
|
|
|
+ goto()
|
|
|
}
|
|
|
})
|
|
|
|
|
@@ -107,7 +107,7 @@ const Login: React.FC = () => {
|
|
|
// message.error(defaultLoginFailureMessage)
|
|
|
// }
|
|
|
}
|
|
|
- const { status, type: loginType } = userLoginState
|
|
|
+ const { code } = userLoginState
|
|
|
|
|
|
return (
|
|
|
<div className={styles.container}>
|
|
@@ -160,14 +160,7 @@ const Login: React.FC = () => {
|
|
|
/>
|
|
|
</Tabs>
|
|
|
|
|
|
- {status === 'error' && loginType === 'account' && (
|
|
|
- <LoginMessage
|
|
|
- content={intl.formatMessage({
|
|
|
- id: 'pages.login.accountLogin.errorMessage',
|
|
|
- defaultMessage: '账户或密码错误(admin/ant.design)'
|
|
|
- })}
|
|
|
- />
|
|
|
- )}
|
|
|
+ {code === consts.RET_CODE.ERROR && <LoginMessage content={'账户或密码错误'} />}
|
|
|
{type === 'account' && (
|
|
|
<>
|
|
|
<ProFormText
|