login page
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import { Form, Input, Button, Checkbox, Card, Typography } from 'antd';
|
||||
import { UserOutlined, LockOutlined, EyeInvisibleOutlined, EyeTwoTone } from '@ant-design/icons';
|
||||
import { history } from '@umijs/max';
|
||||
import { history, Helmet } from '@umijs/max';
|
||||
import cookie from 'react-cookies';
|
||||
import CaptchaInput from '@/components/CaptchaInput';
|
||||
import styles from './internal.less';
|
||||
@ -29,13 +29,21 @@ const InternalLogin: React.FC = () => {
|
||||
account: values.username,
|
||||
password: values.password,
|
||||
captcha: values.captcha,
|
||||
remember: values.remember,
|
||||
}
|
||||
try {
|
||||
setLoading(true);
|
||||
const res = await internalUserLogin(params);
|
||||
setLoading(false);
|
||||
if (res?.code === 200) {
|
||||
sessionStorage.setItem('Authorization', res?.data?.token || '');
|
||||
if (values.remember) {
|
||||
localStorage.setItem('remember_user', JSON.stringify({
|
||||
username: values.username,
|
||||
password: values.password,
|
||||
}));
|
||||
} else {
|
||||
localStorage.removeItem('remember_user');
|
||||
}
|
||||
history.push('/redirect');
|
||||
} else {
|
||||
captchaRef.current?.refresh();
|
||||
@ -48,8 +56,6 @@ const InternalLogin: React.FC = () => {
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('登录失败:', error);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
@ -137,6 +143,9 @@ const InternalLogin: React.FC = () => {
|
||||
|
||||
return (
|
||||
<div className={styles.loginContainer}>
|
||||
<Helmet>
|
||||
<title>登录</title>
|
||||
</Helmet>
|
||||
<Card className={styles.loginCard}>
|
||||
<Title level={2} style={{ textAlign: 'center', lineHeight: '80px', fontSize: 32, fontWeight: 700, marginBottom: 0 }}>
|
||||
电子招投标平台
|
||||
|
Reference in New Issue
Block a user