|
@ -7,99 +7,91 @@ import { headerItems } from './contant'; |
|
|
import "./index.less"; |
|
|
import "./index.less"; |
|
|
|
|
|
|
|
|
const Header = (props) => { |
|
|
const Header = (props) => { |
|
|
const { dispatch, history, user, actions, socket, tochange } = props; |
|
|
const { dispatch, history, user, actions, socket, 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={{ |
|
|
style={{ |
|
|
height: 48, |
|
|
height: 48, |
|
|
minWidth: 520, |
|
|
minWidth: 520, |
|
|
background: '#1D2343', |
|
|
background: '#1D2343', |
|
|
backgroundSize: "100% 100%", |
|
|
backgroundSize: "100% 100%", |
|
|
color: "white", |
|
|
color: "white", |
|
|
}} |
|
|
}} |
|
|
header={{ |
|
|
header={{ |
|
|
logo: ( |
|
|
logo: ( |
|
|
<div style={{ display: 'flex' }}> |
|
|
<div style={{ display: 'flex' }}> |
|
|
<div style={{ marginLeft: 16, width: 24, height: 24 }}> |
|
|
<div style={{ marginLeft: 16, width: 24, height: 24 }}> |
|
|
<img src="/assets/images/background/username.png" alt="" style={{ width: 24, marginRight: -10 }} /> |
|
|
<img src="/assets/images/background/username.png" alt="" style={{ width: 24, marginRight: -10 }} /> |
|
|
</div> |
|
|
</div> |
|
|
<div style={{ fontFamily: 'YouSheBiaoTiHei', fontSize: 18, marginLeft: 12 }}> |
|
|
<div style={{ fontFamily: 'YouSheBiaoTiHei', fontSize: 18, marginLeft: 12 }}> |
|
|
数据中心 |
|
|
数据中心 |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
// <img |
|
|
// <img |
|
|
// src="/assets/images/install/long_logo.png" |
|
|
// src="/assets/images/install/long_logo.png" |
|
|
// style={{ display: "inline-block", width: 200, height: 40, marginLeft: -24 }} |
|
|
// style={{ display: "inline-block", width: 200, height: 40, marginLeft: -24 }} |
|
|
// /> |
|
|
// /> |
|
|
), |
|
|
), |
|
|
// text: ( |
|
|
// text: ( |
|
|
// <> |
|
|
// <> |
|
|
|
|
|
|
|
|
// {/* <SplitButtonGroup style={{ marginLeft: 10 }} aria-label="项目操作按钮组"> */} |
|
|
// {/* <SplitButtonGroup style={{ marginLeft: 10 }} aria-label="项目操作按钮组"> */} |
|
|
// <Button theme="solid" type="primary" style={{ width: 52, height: 24, background: '#005ABD' }}>全局</Button> |
|
|
// <Button theme="solid" type="primary" style={{ width: 52, height: 24, background: '#005ABD' }}>全局</Button> |
|
|
// {/* <Dropdown onVisibleChange={(v) => { }} menu={{}} trigger="click" position="bottomRight"> */} |
|
|
// {/* <Dropdown onVisibleChange={(v) => { }} menu={{}} trigger="click" position="bottomRight"> */} |
|
|
// <Button style={{ width: 16, height: 24, background: '#005ABD' }} theme="solid" type="primary" icon={<IconTreeTriangleDown />}></Button> |
|
|
// <Button style={{ width: 16, height: 24, background: '#005ABD' }} theme="solid" type="primary" icon={<IconTreeTriangleDown />}></Button> |
|
|
// {/* </Dropdown> */} |
|
|
// {/* </Dropdown> */} |
|
|
// {/* </SplitButtonGroup> */} |
|
|
// {/* </SplitButtonGroup> */} |
|
|
// </> |
|
|
// </> |
|
|
// ), |
|
|
// ), |
|
|
}} |
|
|
}} |
|
|
footer={ |
|
|
footer={ |
|
|
<> |
|
|
<> |
|
|
{headerItems.map((item, index) => { |
|
|
{headerItems.map((item, index) => { |
|
|
if (item.hasOwnProperty('items')) { |
|
|
if (item.hasOwnProperty('items')) { |
|
|
return ( |
|
|
return ( |
|
|
<Nav.Sub |
|
|
<Nav.Sub |
|
|
key={index + 'a'} |
|
|
key={index + 'a'} |
|
|
itemKey={item.itemKey} |
|
|
itemKey={item.itemKey} |
|
|
text={item.text} |
|
|
text={item.text} |
|
|
dropdownStyle={{ color: '#F2F3F5' }} |
|
|
dropdownStyle={{ color: '#F2F3F5' }} |
|
|
> |
|
|
> |
|
|
{item.hasOwnProperty('items') && item.items.map((ite, idx) => ( |
|
|
{item.hasOwnProperty('items') && item.items.map((ite, idx) => ( |
|
|
<Nav.Item key={idx + 'd'} itemKey={ite.itemKey} text={ite.text} onClick={() => { tochange(ite); }} /> |
|
|
<Nav.Item key={idx + 'd'} itemKey={ite.itemKey} text={ite.text} onClick={() => { tochange(ite); }} /> |
|
|
))} |
|
|
))} |
|
|
</Nav.Sub> |
|
|
</Nav.Sub> |
|
|
) |
|
|
) |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
return ( |
|
|
return ( |
|
|
<div key='console' style={{ display: 'inline-flex' }}> |
|
|
<div key='console' style={{ display: 'inline-flex' }}> |
|
|
<img src="/assets/images/background/console.png" style={{ width: 24, marginRight: -10 }} /> |
|
|
<img src="/assets/images/background/console.png" style={{ width: 24, marginRight: -10 }} /> |
|
|
<Nav.Item key={index + 'a'} itemKey={item.itemKey} text={item.text} onClick={() => { tochange(item) }} /> |
|
|
<Nav.Item key={index + 'a'} itemKey={item.itemKey} text={item.text} onClick={() => { tochange(item) }} /> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
) |
|
|
) |
|
|
} |
|
|
} |
|
|
})} |
|
|
})} |
|
|
{/* <div style={{ display: 'flex', alignItems: 'center' }}> |
|
|
<div style={{ display: 'flex', alignItems: 'center' }}> |
|
|
<div style={{ marginLeft: 16, width: 24, height: 24 }}> |
|
|
<div style={{ marginLeft: 16, width: 24, height: 24 }}> |
|
|
<img src="/assets/images/background/username.png" alt="" style={{ width: '100%', height: '100%' }} /> |
|
|
<img src="/assets/images/background/username.png" alt="" style={{ width: '100%', height: '100%' }} /> |
|
|
</div> |
|
|
</div> |
|
|
<div style={{ color: '#92CBFF', fontSize: 12, marginLeft: 10, cursor: "pointer" }} onClick={() => { |
|
|
<div style={{ color: '#92CBFF', fontSize: 12, marginLeft: 10, cursor: "pointer" }}>{user?.name}</div> |
|
|
dispatch(actions.auth.logout(user)); |
|
|
</div> |
|
|
if (socket) { |
|
|
|
|
|
socket.disconnect(); |
|
|
|
|
|
} |
|
|
|
|
|
history.push(`/signin`); |
|
|
|
|
|
}}> |
|
|
|
|
|
退出 |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> */} |
|
|
|
|
|
|
|
|
|
|
|
{/* <Nav.Sub |
|
|
{/* <Nav.Sub |
|
|
itemKey={"user"} |
|
|
itemKey={"user"} |
|
|
text={ |
|
|
text={ |
|
|
<div |
|
|
<div |
|
@ -145,21 +137,21 @@ const Header = (props) => { |
|
|
退出 |
|
|
退出 |
|
|
</div> |
|
|
</div> |
|
|
</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); |
|
|