Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 712 B |
After Width: | Height: | Size: 226 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 434 B |
After Width: | Height: | Size: 258 B |
After Width: | Height: | Size: 453 B |
After Width: | Height: | Size: 300 B |
After Width: | Height: | Size: 1.7 KiB |
@ -1,47 +1,85 @@ |
|||||
'use strict'; |
"use strict"; |
||||
import React from 'react'; |
import React from "react"; |
||||
import { connect } from 'react-redux'; |
import { connect } from "react-redux"; |
||||
import { Nav } from '@douyinfe/semi-ui'; |
import { Nav, Avatar, Dropdown } from "@douyinfe/semi-ui"; |
||||
|
|
||||
const Header = props => { |
const Header = (props) => { |
||||
const { dispatch, history, user, actions, socket } = props |
const { dispatch, history, user, actions, socket } = props; |
||||
|
|
||||
return ( |
return ( |
||||
<div style={{ position: 'relative', height: 60, minWidth: 520 }}> |
<> |
||||
<div style={{ float: 'left', paddingLeft: 32, fontSize: 16 }}> |
<Nav |
||||
<div style={{ |
mode={"horizontal"} |
||||
lineHeight: '60px', display: 'inline-block', fontSize: 20, textShadow: '0 4px 3px rgba(0, 0, 0, 0.2)', |
onClick={({ itemKey }) => { |
||||
userSelect: 'none' |
if (itemKey == "logout") { |
||||
}}> |
dispatch(actions.auth.logout(user)); |
||||
飞尚物联 |
if (socket) { |
||||
</div> |
socket.disconnect(); |
||||
</div> |
} |
||||
<div id="nav" style={{ float: 'right' }}> |
history.push(`/signin`); |
||||
<Nav mode={'horizontal'} onClick={({ itemKey }) => { |
} |
||||
if (itemKey == 'logout') { |
}} |
||||
dispatch(actions.auth.logout(user)); |
style={{ |
||||
if (socket) { |
height: 60, |
||||
socket.disconnect() |
minWidth: 520, |
||||
} |
background: "url(/assets/images/background/header.png)", |
||||
history.push(`/signin`); |
backgroundSize: "100% 100%", |
||||
} |
color: "white", |
||||
}}> |
}} |
||||
<Nav.Sub itemKey={'user'} text={<div style={{ display: 'inline-block' }}>{user && user.namePresent}</div>}> |
header={{ |
||||
<Nav.Item itemKey={'logout'} text={'退出'} /> |
logo: ( |
||||
</Nav.Sub> |
<img |
||||
</Nav> |
src="/assets/images/background/logo.png" |
||||
</div> |
style={{ display: "inline-block", width: 280, height: 52}} |
||||
</div> |
/> |
||||
) |
), |
||||
|
text: "", |
||||
|
}} |
||||
|
footer={ |
||||
|
<Nav.Sub |
||||
|
itemKey={"user"} |
||||
|
text={ |
||||
|
<div |
||||
|
style={{ |
||||
|
marginLeft: 20, |
||||
|
display: "inline-block", |
||||
|
color: "white", |
||||
|
}} |
||||
|
> |
||||
|
<img |
||||
|
src="/assets/images/background/notice.png" |
||||
|
style={{ |
||||
|
display: "inline-block", |
||||
|
width: 18, |
||||
|
height: 18, |
||||
|
position: "relative", |
||||
|
top: 6, |
||||
|
left: -10, |
||||
|
}} |
||||
|
/> |
||||
|
|
||||
|
<Avatar size="small" color="light-blue" style={{ margin: 4 }}> |
||||
|
<img src="/assets/images/avatar/6.png" /> |
||||
|
</Avatar> |
||||
|
{user && user.namePresent} |
||||
|
</div> |
||||
|
} |
||||
|
> |
||||
|
<Nav.Item itemKey={"logout"} text={"退出"} /> |
||||
|
</Nav.Sub> |
||||
|
} |
||||
|
/> |
||||
|
</> |
||||
|
); |
||||
}; |
}; |
||||
|
|
||||
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); |
||||
|