#
Junjie
2024-10-17 d835d1b51f832889929cdf69010034a30ef44d02
zy-asrs-flow/src/pages/User/Login/index.jsx
@@ -13,15 +13,23 @@
} from '@ant-design/pro-components';
import { Button, Divider, Alert, Tabs, message, theme, Form } from 'antd';
import { useState, useEffect } from 'react';
import { FormattedMessage, history, SelectLang, useIntl, useModel, Helmet } from '@umijs/max';
import { FormattedMessage, history, SelectLang, useIntl, useModel, request } from '@umijs/max';
import { flushSync } from 'react-dom';
import { request } from '@umijs/max';
import { createStyles } from 'antd-style';
import { setToken } from '@/utils/token-util'
import { PROJECT_NAME } from '@/config/setting'
import Http from '@/utils/http';
import logo from '/public/img/logo.png'
import logoBg from '/public/login-bg.mp4'
const useStyles = createStyles(({ token }) => {
    return {
        lang: {
        }
    }
})
const LoginMessage = ({ content }) => {
    return (
@@ -33,6 +41,15 @@
            type="error"
            showIcon
        />
    );
};
const Lang = () => {
    const { styles } = useStyles();
    return (
        <div className={styles.lang} data-lang>
            {SelectLang && <SelectLang />}
        </div>
    );
};
@@ -73,15 +90,17 @@
    useEffect(() => {
        const fetchHostList = async () => {
            const resp = await Http.doGet('api/auth/host');
            const list = resp.data.map(item => ({
                label: item.name,
                value: item.id
            }));
            setHostList(list);
            if (list && list.length > 0) {
                form.setFieldsValue({
                    hostId: list[0].value
                });
            if (resp?.data) {
                const list = resp.data.map(item => ({
                    label: item.name,
                    value: item.id
                }));
                setHostList(list);
                if (list && list.length > 0) {
                    form.setFieldsValue({
                        hostId: list[0].value
                    });
                }
            }
        }
        fetchHostList();
@@ -368,6 +387,9 @@
                )}
                <div
                    style={{
                        display: 'flex',
                        justifyContent: 'space-between',
                        alignItems: 'center',
                        marginBlockEnd: 24,
                    }}
                >
@@ -383,6 +405,7 @@
                            defaultMessage: '自动登录',
                        })}
                    </ProFormCheckbox>
                    <Lang />
                </div>
            </LoginFormPage>
        </div>