Merge branch 'dev' of http://59.110.10.99:53000/liuc/fe_supplier_frontend into dev
This commit is contained in:
@ -3,7 +3,7 @@ import { Form, Input, Button, Checkbox, Tabs, message } from 'antd';
|
||||
import { UserOutlined, LockOutlined, EyeInvisibleOutlined, EyeTwoTone, HomeOutlined } from '@ant-design/icons';
|
||||
import { history, useIntl } from 'umi';
|
||||
import './login.less';
|
||||
import { getCaptcha, supplierLogin, expertLogin, accountLogin, getUserinfo, findMenuList } from '@/servers/api/login';
|
||||
import { getCaptcha, supplierLogin, expertLogin, accountLogin, getUserinfo, findMenuList, queryUserOrgAll } from '@/servers/api/login';
|
||||
|
||||
import { encryptWithRsa } from '@/utils/encryptWithRsa'
|
||||
import Password from 'antd/lib/input/Password';
|
||||
@ -41,29 +41,38 @@ const LoginPage: React.FC = () => {
|
||||
if (loginRes.code === 200) {
|
||||
sessionStorage.setItem('token', loginRes.data.token);
|
||||
//存入供应商用户id
|
||||
if(activeKey === 'supplierLogin') {
|
||||
if (activeKey === 'supplierLogin') {
|
||||
sessionStorage.setItem('userId', loginRes.data.supplierUser.userId);
|
||||
} else if(activeKey === 'expertLogin') {
|
||||
} else if (activeKey === 'expertLogin') {
|
||||
//存入专家用户id
|
||||
// sessionStorage.setItem('userId', loginRes.data.expertUser.userId);
|
||||
} else if(activeKey === 'accountLogin') {
|
||||
} else if (activeKey === 'accountLogin') {
|
||||
//存入招标代理用户id
|
||||
sessionStorage.setItem('userId', loginRes.data.user.userId);
|
||||
//部门
|
||||
queryUserOrgAll().then((res) => {
|
||||
const { code, data } = res;
|
||||
if (code == 200) {
|
||||
sessionStorage.setItem('userOrgAll', JSON.stringify(data) );
|
||||
}
|
||||
})
|
||||
}
|
||||
sessionStorage.setItem('currentUser', JSON.stringify(loginRes.data));
|
||||
|
||||
getUserinfo().then( async (res) => {
|
||||
getUserinfo().then(async (res) => {
|
||||
// if(res.code == 200) {
|
||||
const roleIdList = res.authorityList.map((item:any) => {
|
||||
return item.roleId
|
||||
})
|
||||
console.log(roleIdList,'roleIdList');
|
||||
|
||||
const menuList = await findMenuList({ roleIdList });
|
||||
sessionStorage.setItem('menuList', JSON.stringify(menuList.data));
|
||||
const roleIdList = res.authorityList.map((item: any) => {
|
||||
return item.roleId
|
||||
})
|
||||
console.log(roleIdList, 'roleIdList');
|
||||
|
||||
const menuList = await findMenuList({ roleIdList });
|
||||
sessionStorage.setItem('menuList', JSON.stringify(menuList.data));
|
||||
// }
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
message.success('登录成功');
|
||||
history.push('/index');
|
||||
@ -74,7 +83,7 @@ const LoginPage: React.FC = () => {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
const fetchCaptcha = async () => {
|
||||
const res = await getCaptcha();
|
||||
@ -91,7 +100,7 @@ const LoginPage: React.FC = () => {
|
||||
|
||||
// 根据当前选中的Tab决定跳转到哪个注册页面
|
||||
const handleRegister = () => {
|
||||
switch(activeKey) {
|
||||
switch (activeKey) {
|
||||
case 'supplierLogin':
|
||||
history.push('/register/supplier');
|
||||
break;
|
||||
@ -180,14 +189,14 @@ const LoginPage: React.FC = () => {
|
||||
prefix={null}
|
||||
suffix={
|
||||
<img
|
||||
src={`data:image/png;base64,${captchaImg}`}
|
||||
src={`data:image/png;base64,${captchaImg}`}
|
||||
alt="验证码"
|
||||
style={{ cursor: 'pointer', height: 32, verticalAlign: 'middle' }}
|
||||
onClick={fetchCaptcha}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</Form.Item>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item>
|
||||
<div className='login-options'>
|
||||
@ -204,7 +213,7 @@ const LoginPage: React.FC = () => {
|
||||
<Button type="primary" htmlType="submit" className="login-form-button" loading={loading} size="large">
|
||||
{intl.formatMessage({ id: 'login.button' })}
|
||||
</Button>
|
||||
{activeKey !== 'accountLogin' && renderRegisterLink()}
|
||||
{activeKey !== 'accountLogin' && renderRegisterLink()}
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user