2.10 为登录至招标采购中心的用户,增加退出功能。

This commit is contained in:
jl-zhoujl2
2023-02-10 14:06:55 +08:00
parent a9401a49de
commit b98e10aa64
2 changed files with 57 additions and 33 deletions

View File

@ -1,4 +1,4 @@
import { Avatar, Dropdown, Menu, message } from 'antd'; import { Avatar, Dropdown, Menu, message, Modal } from 'antd';
import { DownOutlined, UserOutlined, UserSwitchOutlined, CarryOutOutlined, HomeOutlined, ImportOutlined } from '@ant-design/icons'; import { DownOutlined, UserOutlined, UserSwitchOutlined, CarryOutOutlined, HomeOutlined, ImportOutlined } from '@ant-design/icons';
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
import moment from 'moment' import moment from 'moment'
@ -29,16 +29,32 @@ const GlobalHeaderRight: React.FC<{}> = (props) => {
} }
}) })
} }
//专家角色退出登录 //角色退出登录
const toLogin = () => { const toLogout = () => {
let date = { let _data = {
mall3_token: sessionStorage.getItem('Authorization') mall3_token: sessionStorage.getItem('Authorization')
} }
getLogout({ ...date }).then((res) => { Modal.info({
if (res.success) { title: '请确认是否退出?',
content: false,
onOk() {
getLogout({ ..._data }).then((res) => {
if (res?.success) {
if (data?.userType == "0") {//联通智慧门户
window.close();
} else if (data?.userType == "1") {//合作方
window.close();
} else if (data?.userType == "2") {//专家
window.location.href = "/userformal/login" window.location.href = "/userformal/login"
} }
}
}) })
},
closable: true,
centered: true,
okText: "确认退出",
className: "layout-modal-logout",
});
} }
const droMenu = ( const droMenu = (
@ -49,14 +65,12 @@ const GlobalHeaderRight: React.FC<{}> = (props) => {
<a target="_blank" rel="noopener noreferrer" onClick={() => handelRole(item)}>{item.roleName}</a> <a target="_blank" rel="noopener noreferrer" onClick={() => handelRole(item)}>{item.roleName}</a>
</Menu.Item> </Menu.Item>
)) : null} )) : null}
{data?.roleIds == "ebtp-expert" ? (
<> <>
<Menu.Divider /> <Menu.Divider />
<Menu.Item key="exit"> <Menu.Item key="exit">
<a key="1" onClick={() => toLogin()}>退</a> <a key="1" onClick={() => toLogout()}>退</a>
</Menu.Item> </Menu.Item>
</> </>
) : null}
</Menu> </Menu>
); );

View File

@ -8,6 +8,7 @@
top: 4px; top: 4px;
font-size: 16px; font-size: 16px;
font-weight: 600; font-weight: 600;
img { img {
height: 30px; height: 30px;
margin-left: 20px; margin-left: 20px;
@ -16,8 +17,10 @@
top: -2px; top: -2px;
} }
} }
.right-btns { .right-btns {
float: right; float: right;
li { li {
float: left; float: left;
line-height: 56px; line-height: 56px;
@ -25,13 +28,20 @@
color: #fff; color: #fff;
padding: 0 14px; padding: 0 14px;
list-style: none; list-style: none;
span { span {
padding-right: 6px; padding-right: 6px;
font-size: 16px; font-size: 16px;
} }
a { a {
color: #fff; color: #fff;
} }
} }
} }
} }
.layout-modal-logout .ant-modal-confirm-btns {
text-align: center;
width: 100%;
}