#
luxiaotao1123
2024-02-26 a9230ddfb30ccb936944444e9140c2f6d327f839
#
1个文件已修改
43 ■■■■■ 已修改文件
zy-asrs-flow/src/pages/User/Login/index2.jsx 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-flow/src/pages/User/Login/index2.jsx
@@ -10,17 +10,51 @@
    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 {
@@ -136,6 +170,11 @@
                        />
                    </>
                )}
                {status !== 200 && loginType === 'account' && (
                    <LoginMessage
                        content={'账户或密码错误'}
                    />
                )}
                {loginType === 'phone' && (
                    <>
                        <ProFormText