| | |
| | | ProFormCheckbox, |
| | | ProFormText, |
| | | } from '@ant-design/pro-components'; |
| | | import { Button, Divider, Space, Tabs, message, theme } from 'antd'; |
| | | import { Button, Divider, Alert, Tabs, message, theme } from 'antd'; |
| | | import { useState } from 'react'; |
| | | import { FormattedMessage, history, SelectLang, useIntl, useModel, Helmet } from '@umijs/max'; |
| | | import { flushSync } from 'react-dom'; |
| | | import { request } from '@umijs/max'; |
| | | import { setToken } from '@/utils/token-util' |
| | | import { PROJECT_NAME } from '@/config/setting' |
| | | |
| | | import logo from './logo.png' |
| | | |
| | | const LoginMessage = ({ content }) => { |
| | | return ( |
| | | <Alert |
| | | style={{ |
| | | marginBottom: 24, |
| | | }} |
| | | message={content} |
| | | type="error" |
| | | showIcon |
| | | /> |
| | | ); |
| | | }; |
| | | |
| | | const Page = () => { |
| | | const intl = useIntl(); |
| | | const { initialState, setInitialState } = useModel('@@initialState'); |
| | | const { token } = theme.useToken(); |
| | | |
| | | const [loginType, setLoginType] = useState('account'); |
| | | const { token } = theme.useToken(); |
| | | const [userLoginState, setUserLoginState] = useState({}); |
| | | const [status, setStatus] = useState(200); |
| | | |
| | | console.log(initialState.memo); |
| | | |
| | | const fetchUserInfo = async () => { |
| | | const userInfo = await initialState?.fetchUserInfo?.(); |
| | | if (userInfo) { |
| | | flushSync(() => { |
| | | setInitialState((s) => ({ |
| | | ...s, |
| | | currentUser: userInfo, |
| | | })); |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | const handleSubmit = async (values) => { |
| | | try { |
| | |
| | | /> |
| | | </> |
| | | )} |
| | | {status !== 200 && loginType === 'account' && ( |
| | | <LoginMessage |
| | | content={'账户或密码错误'} |
| | | /> |
| | | )} |
| | | {loginType === 'phone' && ( |
| | | <> |
| | | <ProFormText |