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 React, { useEffect } from 'react';
import moment from 'moment'
@ -29,16 +29,32 @@ const GlobalHeaderRight: React.FC<{}> = (props) => {
}
})
}
//专家角色退出登录
const toLogin = () => {
let date = {
//角色退出登录
const toLogout = () => {
let _data = {
mall3_token: sessionStorage.getItem('Authorization')
}
getLogout({ ...date }).then((res) => {
if (res.success) {
Modal.info({
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"
}
}
})
},
closable: true,
centered: true,
okText: "确认退出",
className: "layout-modal-logout",
});
}
const droMenu = (
@ -49,14 +65,12 @@ const GlobalHeaderRight: React.FC<{}> = (props) => {
<a target="_blank" rel="noopener noreferrer" onClick={() => handelRole(item)}>{item.roleName}</a>
</Menu.Item>
)) : null}
{data?.roleIds == "ebtp-expert" ? (
<>
<Menu.Divider />
<Menu.Item key="exit">
<a key="1" onClick={() => toLogin()}>退</a>
<a key="1" onClick={() => toLogout()}>退</a>
</Menu.Item>
</>
) : null}
</Menu>
);

View File

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