2.10 为登录至招标采购中心的用户,增加退出功能。
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
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'
|
||||||
import { connect, history } from 'umi';
|
import { connect, history } from 'umi';
|
||||||
@ -13,68 +13,82 @@ const GlobalHeaderRight: React.FC<{}> = (props) => {
|
|||||||
// let className = styles.right;
|
// let className = styles.right;
|
||||||
let data = getSessionUserData();
|
let data = getSessionUserData();
|
||||||
const [dataMenu, setDataMenu] = React.useState<any>([]);
|
const [dataMenu, setDataMenu] = React.useState<any>([]);
|
||||||
const handelRole = (item: any)=> {
|
const handelRole = (item: any) => {
|
||||||
sessionStorage.setItem('roleData', JSON.stringify(item));
|
sessionStorage.setItem('roleData', JSON.stringify(item));
|
||||||
sessionStorage.setItem('roleAuthority', JSON.stringify([item.roleCode]));
|
sessionStorage.setItem('roleAuthority', JSON.stringify([item.roleCode]));
|
||||||
let params = {
|
let params = {
|
||||||
roleIdList:[item.roleId]
|
roleIdList: [item.roleId]
|
||||||
}
|
}
|
||||||
history.push('/Dashboard')
|
history.push('/Dashboard')
|
||||||
window.location.reload()
|
window.location.reload()
|
||||||
getMenu(params).then(res=>{
|
getMenu(params).then(res => {
|
||||||
if(res?.code == 1){
|
if (res?.code == 1) {
|
||||||
setDataMenu(res?.data)
|
setDataMenu(res?.data)
|
||||||
}else {
|
} else {
|
||||||
message.error("数据错误请联系管理员")
|
message.error("数据错误请联系管理员")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
//专家角色退出登录
|
//角色退出登录
|
||||||
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 = (
|
||||||
<Menu style={{top:"17px"}}>
|
<Menu style={{ top: "17px" }}>
|
||||||
{data?.authorityList != undefined ?
|
{data?.authorityList != undefined ?
|
||||||
data?.authorityList?.map((item: any,index:any) => (
|
data?.authorityList?.map((item: any, index: any) => (
|
||||||
<Menu.Item key={index}>
|
<Menu.Item key={index}>
|
||||||
<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>
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="top-menu">
|
<div className="top-menu">
|
||||||
<div className="left-logo">
|
<div className="left-logo">
|
||||||
<img src={logo} alt=""/>中国联通智慧供应链平台 | 招标采购中心
|
<img src={logo} alt="" />中国联通智慧供应链平台 | 招标采购中心
|
||||||
</div>
|
</div>
|
||||||
<ul className="right-btns">
|
<ul className="right-btns">
|
||||||
{/* <li><ImportOutlined /><a onClick={()=>window.open(REACT_APP_MALL_V2_URL)}>交易平台2.0</a></li> */}
|
{/* <li><ImportOutlined /><a onClick={()=>window.open(REACT_APP_MALL_V2_URL)}>交易平台2.0</a></li> */}
|
||||||
<li><HomeOutlined /><a onClick={()=>history.push('/Dashboard')}>首页</a></li>
|
<li><HomeOutlined /><a onClick={() => history.push('/Dashboard')}>首页</a></li>
|
||||||
<li><CarryOutOutlined />{moment().format("YYYY-MM-DD")}</li>
|
<li><CarryOutOutlined />{moment().format("YYYY-MM-DD")}</li>
|
||||||
{data?.organizationName == null ? null : (<li><UserSwitchOutlined />{data?.organizationName}</li>)}
|
{data?.organizationName == null ? null : (<li><UserSwitchOutlined />{data?.organizationName}</li>)}
|
||||||
<li>
|
<li>
|
||||||
<Avatar size="small" src="https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png" style={{width: '30px'}}/>
|
<Avatar size="small" src="https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png" style={{ width: '30px' }} />
|
||||||
<Dropdown overlay={droMenu}>
|
<Dropdown overlay={droMenu}>
|
||||||
<a className="antd-dropdown-link" style={{color:"#fff"}}>
|
<a className="antd-dropdown-link" style={{ color: "#fff" }}>
|
||||||
{data?.fullName} <DownOutlined/>
|
{data?.fullName} <DownOutlined />
|
||||||
</a>
|
</a>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
</li>
|
</li>
|
||||||
|
@ -2,12 +2,13 @@
|
|||||||
|
|
||||||
.top-menu {
|
.top-menu {
|
||||||
.left-logo {
|
.left-logo {
|
||||||
position:absolute;
|
position: absolute;
|
||||||
float: left;
|
float: left;
|
||||||
left: 0;
|
left: 0;
|
||||||
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%;
|
||||||
|
}
|
Reference in New Issue
Block a user