修改主题色
This commit is contained in:
@ -9,27 +9,32 @@ import './index.less';
|
||||
import { getMenu, getLogout } from './services'
|
||||
import { getSessionUserData } from "@/utils/session";
|
||||
import { getToSecondUrl } from '@/pages/LoadingPage/service';
|
||||
import userIcon from '@/assets/user.svg';
|
||||
import homeIcon from '@/assets/home.svg';
|
||||
import shutdownIcon from '@/assets/shutdown.svg';
|
||||
import { logout } from './services';
|
||||
import cookie from 'react-cookies';
|
||||
|
||||
const GlobalHeaderRight: React.FC<{}> = (props) => {
|
||||
// let className = styles.right;
|
||||
let data = getSessionUserData();
|
||||
const data = getSessionUserData();
|
||||
const [dataMenu, setDataMenu] = React.useState<any>([]);
|
||||
const urlRef = useRef(null);
|
||||
const handelRole = (item: any) => {
|
||||
sessionStorage.setItem('roleData', JSON.stringify(item));
|
||||
sessionStorage.setItem('roleAuthority', JSON.stringify([item.roleCode]));
|
||||
let params = {
|
||||
const params = {
|
||||
roleIdList: [item.roleId]
|
||||
}
|
||||
history.push('/Dashboard')
|
||||
window.location.reload()
|
||||
getMenu(params).then(res => {
|
||||
if (res?.code == 1) {
|
||||
setDataMenu(res?.data)
|
||||
} else {
|
||||
message.error("数据错误请联系管理员")
|
||||
}
|
||||
})
|
||||
// getMenu(params).then(res => {
|
||||
// if (res?.code == 1) {
|
||||
// setDataMenu(res?.data)
|
||||
// } else {
|
||||
// message.error("数据错误请联系管理员")
|
||||
// }
|
||||
// })
|
||||
}
|
||||
//角色退出登录
|
||||
const toLogout = () => {
|
||||
@ -40,15 +45,21 @@ const GlobalHeaderRight: React.FC<{}> = (props) => {
|
||||
title: '请确认是否退出?',
|
||||
content: false,
|
||||
onOk() {
|
||||
getLogout().then((res) => {
|
||||
logout().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"
|
||||
}
|
||||
// if (data?.userType == "0") {//联通智慧门户
|
||||
// window.close();
|
||||
// } else if (data?.userType == "1") {//合作方
|
||||
// window.close();
|
||||
// } else if (data?.userType == "2") {//专家
|
||||
// window.location.href = "/userformal/login"
|
||||
// }
|
||||
message.success('退出登录成功');
|
||||
sessionStorage.clear();
|
||||
cookie.remove('mall3_token');
|
||||
setTimeout(() => {
|
||||
history.push('/internal-login');
|
||||
}, 1000);
|
||||
}
|
||||
})
|
||||
},
|
||||
@ -62,17 +73,17 @@ const GlobalHeaderRight: React.FC<{}> = (props) => {
|
||||
const droMenu = (
|
||||
<Menu style={{ top: "17px" }}>
|
||||
{data?.authorityList != undefined ?
|
||||
data?.authorityList?.map((item: any, index: any) => (
|
||||
<Menu.Item key={index}>
|
||||
data?.authorityList?.map((item: any) => (
|
||||
<Menu.Item key={item.roleId}>
|
||||
<a target="_blank" rel="noopener noreferrer" onClick={() => handelRole(item)}>{item.roleName}</a>
|
||||
</Menu.Item>
|
||||
)) : null}
|
||||
<>
|
||||
{/* <>
|
||||
<Menu.Divider />
|
||||
<Menu.Item key="exit">
|
||||
<a key="1" onClick={() => toLogout()}>退出登录</a>
|
||||
</Menu.Item>
|
||||
</>
|
||||
</> */}
|
||||
</Menu>
|
||||
);
|
||||
|
||||
@ -89,21 +100,35 @@ const GlobalHeaderRight: React.FC<{}> = (props) => {
|
||||
return (
|
||||
<div className="top-menu">
|
||||
<div className="left-logo">
|
||||
<img src={logo} alt="" />中国联通智慧供应链平台 | 招标采购中心
|
||||
<div className="logo-container" style={{ display: 'flex', alignItems: 'center' }}>
|
||||
<div className="logo-img">
|
||||
<img src={logo} alt="" />
|
||||
</div>
|
||||
<div className="logo-text" style={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-start', gap: '0' }}>
|
||||
<span style={{ lineHeight: '1', fontSize: '24px' }}>采购平台供应商统一管理系统</span>
|
||||
<span style={{ lineHeight: '1', fontSize: '14px', fontWeight: 'normal' }}>CHINA COSCO SHIPPING CORPORATION LIMITED</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<ul className="right-btns">
|
||||
<li><ImportOutlined /><a onClick={() => { urlRef.current && window.open(urlRef.current); }}>交易平台2.0</a></li>
|
||||
<li><HomeOutlined /><a onClick={() => history.push('/Dashboard')}>首页</a></li>
|
||||
<li><CarryOutOutlined />{moment().format("YYYY-MM-DD")}</li>
|
||||
{data?.organizationName == null ? null : (<li><UserSwitchOutlined />{data?.organizationName}</li>)}
|
||||
{/* <li><ImportOutlined /><a onClick={() => { urlRef.current && window.open(urlRef.current); }}>交易平台2.0</a></li> */}
|
||||
<li>
|
||||
<Avatar size="small" src="https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png" style={{ width: '30px' }} />
|
||||
<Avatar size="small" src={userIcon} style={{ width: '30px' }} />
|
||||
<Dropdown overlay={droMenu}>
|
||||
<a className="antd-dropdown-link" style={{ color: "#fff" }}>
|
||||
<a className="antd-dropdown-link" style={{ color: "#fff", verticalAlign: 'middle' }}>
|
||||
{data?.fullName} <DownOutlined />
|
||||
</a>
|
||||
</Dropdown>
|
||||
</li>
|
||||
<li>
|
||||
<img src={homeIcon} style={{width: 22, cursor: 'pointer'}} alt="dashboard" onClick={() => history.push('/Dashboard')}/>
|
||||
</li>
|
||||
<li>
|
||||
<img src={shutdownIcon} style={{width: 20, cursor: 'pointer'}} alt="shutdown" onClick={() => toLogout()}/>
|
||||
</li>
|
||||
{/* <li><CarryOutOutlined />{moment().format("YYYY-MM-DD")}</li> */}
|
||||
{/* {data?.organizationName == null ? null : (<li><UserSwitchOutlined />{data?.organizationName}</li>)} */}
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
Reference in New Issue
Block a user