| | |
| | | } 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 ( |
| | |
| | | type="error" |
| | | showIcon |
| | | /> |
| | | ); |
| | | }; |
| | | |
| | | const Lang = () => { |
| | | const { styles } = useStyles(); |
| | | return ( |
| | | <div className={styles.lang} data-lang> |
| | | {SelectLang && <SelectLang />} |
| | | </div> |
| | | ); |
| | | }; |
| | | |
| | |
| | | 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(); |
| | |
| | | )} |
| | | <div |
| | | style={{ |
| | | display: 'flex', |
| | | justifyContent: 'space-between', |
| | | alignItems: 'center', |
| | | marginBlockEnd: 24, |
| | | }} |
| | | > |
| | |
| | | defaultMessage: '自动登录', |
| | | })} |
| | | </ProFormCheckbox> |
| | | <Lang /> |
| | | </div> |
| | | </LoginFormPage> |
| | | </div> |