|
@ -5,121 +5,133 @@ import { Nav, Avatar, Dropdown } from "@douyinfe/semi-ui"; |
|
|
import "./index.less"; |
|
|
import "./index.less"; |
|
|
|
|
|
|
|
|
const Header = (props) => { |
|
|
const Header = (props) => { |
|
|
const { dispatch, history, user, actions, socket, headerItems, tochange } = props; |
|
|
const { dispatch, history, user, actions, socket, headerItems, tochange } = props; |
|
|
|
|
|
|
|
|
return ( |
|
|
return ( |
|
|
<> |
|
|
<> |
|
|
<div id="top-slider"> |
|
|
<div id="top-slider"> |
|
|
<Nav |
|
|
<Nav |
|
|
mode={"horizontal"} |
|
|
mode={"horizontal"} |
|
|
onClick={({ itemKey }) => { |
|
|
onClick={({ itemKey }) => { |
|
|
if (itemKey == "logout") { |
|
|
if (itemKey == "logout") { |
|
|
dispatch(actions.auth.logout(user)); |
|
|
dispatch(actions.auth.logout(user)); |
|
|
if (socket) { |
|
|
if (socket) { |
|
|
socket.disconnect(); |
|
|
socket.disconnect(); |
|
|
} |
|
|
} |
|
|
history.push(`/signin`); |
|
|
history.push(`/signin`); |
|
|
} |
|
|
|
|
|
}} |
|
|
|
|
|
style={{ |
|
|
|
|
|
height: 48, |
|
|
|
|
|
minWidth: 520, |
|
|
|
|
|
background: '#1D2343', |
|
|
|
|
|
backgroundSize: "100% 100%", |
|
|
|
|
|
color: "white", |
|
|
|
|
|
}} |
|
|
|
|
|
header={{ |
|
|
|
|
|
logo: ( |
|
|
|
|
|
<img |
|
|
|
|
|
src="/assets/images/background/logo.png" |
|
|
|
|
|
style={{ display: "inline-block", width: 280, height: 40 }} |
|
|
|
|
|
/> |
|
|
|
|
|
), |
|
|
|
|
|
text: ( |
|
|
|
|
|
<div style={{ fontFamily: "YouSheBiaoTiHei", color: '#FFFFFF' }}>运维管理系统</div> |
|
|
|
|
|
), |
|
|
|
|
|
}} |
|
|
|
|
|
footer={ |
|
|
|
|
|
<> |
|
|
|
|
|
{headerItems.map((item, index) => { |
|
|
|
|
|
if (item.hasOwnProperty('items')) { |
|
|
|
|
|
return ( |
|
|
|
|
|
<Nav.Sub |
|
|
|
|
|
key={index + 'a'} |
|
|
|
|
|
itemKey={item.itemKey} |
|
|
|
|
|
text={item.text} |
|
|
|
|
|
dropdownStyle={{ color: '#F2F3F5' }} |
|
|
|
|
|
> |
|
|
|
|
|
{item.hasOwnProperty('items') && item.items.map((ite, idx) => ( |
|
|
|
|
|
<Nav.Item key={idx + 'd'} itemKey={ite.itemKey} text={ite.text} onClick={() => { tochange(ite); }} /> |
|
|
|
|
|
))} |
|
|
|
|
|
</Nav.Sub> |
|
|
|
|
|
) |
|
|
|
|
|
} |
|
|
} |
|
|
else { |
|
|
}} |
|
|
return ( |
|
|
style={{ |
|
|
<Nav.Item key={index + 'a'} itemKey={item.itemKey} text={item.text} onClick={() => { tochange(item) }} /> |
|
|
height: 48, |
|
|
) |
|
|
minWidth: 520, |
|
|
} |
|
|
background: '#1D2343', |
|
|
})} |
|
|
backgroundSize: "100% 100%", |
|
|
<Nav.Sub |
|
|
color: "white", |
|
|
itemKey={"user"} |
|
|
}} |
|
|
text={ |
|
|
header={{ |
|
|
<div |
|
|
logo: ( |
|
|
style={{ |
|
|
<div style={{display:'flex',alignItems: 'center'}}> |
|
|
marginLeft: -8, |
|
|
<div> |
|
|
display: "inline-block", |
|
|
<img |
|
|
color: "white", |
|
|
src="/assets/images/background/logo.png" |
|
|
}} |
|
|
style={{ display: "inline-block", width: 24, height: 24 }} |
|
|
> |
|
|
/> |
|
|
<Avatar size="extra-small" color="light-blue" style={{ marginRight: 4 }}> |
|
|
</div> |
|
|
{user?.name?.substr(0, 1)} |
|
|
<div> |
|
|
</Avatar> |
|
|
<div style={{ fontSize: 18, fontFamily: "YouSheBiaoTiHei", color: '#FFFFFF',letterSpacing: 3 }}>运维管理系统</div> |
|
|
<div style={{ |
|
|
<div style={{ fontSize: 8, fontFamily: "YouSheBiaoTiHei", color: '#FFFFFF' }}>RUNNING MANAGEMENT SYSTEM</div> |
|
|
display: "inline-block", position: "relative", |
|
|
</div> |
|
|
top: 10, |
|
|
</div> |
|
|
left: 4, |
|
|
// <img |
|
|
marginRight: 4, |
|
|
// src="/assets/images/background/logo.png" |
|
|
}} |
|
|
// style={{ display: "inline-block", width: 280, height: 40 }} |
|
|
> |
|
|
// /> |
|
|
</div> |
|
|
), |
|
|
</div> |
|
|
// text: ( |
|
|
} |
|
|
// <div style={{ fontFamily: "YouSheBiaoTiHei", color: '#FFFFFF' }}>运维管理系统</div> |
|
|
> |
|
|
// ), |
|
|
<div style={{ width: 200, padding: 16, background: '#c7bebeeb' }}> |
|
|
}} |
|
|
<div style={{ display: "flex" }}> |
|
|
footer={ |
|
|
<Avatar size="default" color="light-blue" style={{ marginRight: 4 }}> |
|
|
<> |
|
|
{user?.name?.substr(0, 1)} |
|
|
{headerItems.map((item, index) => { |
|
|
</Avatar> |
|
|
if (item.hasOwnProperty('items')) { |
|
|
<div style={{ fontSize: 12 }}> |
|
|
return ( |
|
|
{user.name} |
|
|
<Nav.Sub |
|
|
<div title={user?.department?.map(v => v.name + '、')} style={{ width: 100, overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis' }}>{user?.department?.map(v => v.name + '、')}</div> |
|
|
key={index + 'a'} |
|
|
</div> |
|
|
itemKey={item.itemKey} |
|
|
</div> |
|
|
text={item.text} |
|
|
<div>用户中心</div> |
|
|
dropdownStyle={{ color: '#F2F3F5' }} |
|
|
<div>安全认证</div> |
|
|
> |
|
|
</div> |
|
|
{item.hasOwnProperty('items') && item.items.map((ite, idx) => ( |
|
|
<Nav.Item itemKey={"logout"} text={"退出"} style={{ textAlign: "center" }} /> |
|
|
<Nav.Item key={idx + 'd'} itemKey={ite.itemKey} text={ite.text} onClick={() => { tochange(ite); }} /> |
|
|
|
|
|
))} |
|
|
|
|
|
</Nav.Sub> |
|
|
|
|
|
) |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
return ( |
|
|
|
|
|
<Nav.Item key={index + 'a'} itemKey={item.itemKey} text={item.text} onClick={() => { tochange(item) }} /> |
|
|
|
|
|
) |
|
|
|
|
|
} |
|
|
|
|
|
})} |
|
|
|
|
|
<Nav.Sub |
|
|
|
|
|
itemKey={"user"} |
|
|
|
|
|
text={ |
|
|
|
|
|
<div |
|
|
|
|
|
style={{ |
|
|
|
|
|
marginLeft: -8, |
|
|
|
|
|
display: "inline-block", |
|
|
|
|
|
color: "white", |
|
|
|
|
|
}} |
|
|
|
|
|
> |
|
|
|
|
|
<Avatar size="extra-small" color="light-blue" style={{ marginRight: 4 }}> |
|
|
|
|
|
{user?.name?.substr(0, 1)} |
|
|
|
|
|
</Avatar> |
|
|
|
|
|
<div style={{ |
|
|
|
|
|
display: "inline-block", position: "relative", |
|
|
|
|
|
top: 10, |
|
|
|
|
|
left: 4, |
|
|
|
|
|
marginRight: 4, |
|
|
|
|
|
}} |
|
|
|
|
|
> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
} |
|
|
|
|
|
> |
|
|
|
|
|
<div style={{ width: 200, padding: 16, background: '#c7bebeeb' }}> |
|
|
|
|
|
<div style={{ display: "flex" }}> |
|
|
|
|
|
<Avatar size="default" color="light-blue" style={{ marginRight: 4 }}> |
|
|
|
|
|
{user?.name?.substr(0, 1)} |
|
|
|
|
|
</Avatar> |
|
|
|
|
|
<div style={{ fontSize: 12 }}> |
|
|
|
|
|
{user.name} |
|
|
|
|
|
<div title={user?.department?.map(v => v.name + '、')} style={{ width: 100, overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis' }}>{user?.department?.map(v => v.name + '、')}</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div>用户中心</div> |
|
|
|
|
|
<div>安全认证</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
<Nav.Item itemKey={"logout"} text={"退出"} style={{ textAlign: "center" }} /> |
|
|
|
|
|
|
|
|
{/* collapseButton collapseText */} |
|
|
{/* collapseButton collapseText */} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</Nav.Sub> |
|
|
</Nav.Sub> |
|
|
</> |
|
|
</> |
|
|
} |
|
|
} |
|
|
/> |
|
|
/> |
|
|
</div> |
|
|
</div> |
|
|
</> |
|
|
</> |
|
|
); |
|
|
); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
function mapStateToProps (state) { |
|
|
function mapStateToProps (state) { |
|
|
const { global, auth, webSocket } = state; |
|
|
const { global, auth, webSocket } = state; |
|
|
return { |
|
|
return { |
|
|
actions: global.actions, |
|
|
actions: global.actions, |
|
|
user: auth.user, |
|
|
user: auth.user, |
|
|
socket: webSocket.socket, |
|
|
socket: webSocket.socket, |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
export default connect(mapStateToProps)(Header); |
|
|
export default connect(mapStateToProps)(Header); |
|
|