|
|
@ -26,7 +26,7 @@ let scrollbar |
|
|
|
const LayoutContainer = props => { |
|
|
|
const { |
|
|
|
dispatch, msg, user, copyright, children, sections, clientWidth, clientHeight, |
|
|
|
location, match, routes, history, authCrossLoading |
|
|
|
location, match, routes, history, authCrossLoading,socket |
|
|
|
} = props |
|
|
|
const [collapsed, setCollapsed] = useState(false) |
|
|
|
|
|
|
@ -79,6 +79,20 @@ const LayoutContainer = props => { |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
// websocket 使用测试 |
|
|
|
useEffect(() => { |
|
|
|
console.log(socket) |
|
|
|
if (socket) { |
|
|
|
socket.on('CAMERA_ONLINE', function (msg) { |
|
|
|
console.info(msg); |
|
|
|
}); |
|
|
|
return () => { |
|
|
|
socket.off("CAMERA_ONLINE"); |
|
|
|
} |
|
|
|
} |
|
|
|
}, [socket]) |
|
|
|
|
|
|
|
return ( |
|
|
|
<Layout id="layout"> |
|
|
|
{ |
|
|
@ -149,7 +163,7 @@ const LayoutContainer = props => { |
|
|
|
} |
|
|
|
|
|
|
|
function mapStateToProps (state) { |
|
|
|
const { global, auth, ajaxResponse } = state; |
|
|
|
const { global, auth, ajaxResponse , webSocket} = state; |
|
|
|
return { |
|
|
|
title: global.title, |
|
|
|
copyright: global.copyright, |
|
|
@ -158,7 +172,8 @@ function mapStateToProps (state) { |
|
|
|
clientWidth: global.clientWidth, |
|
|
|
clientHeight: global.clientHeight, |
|
|
|
msg: ajaxResponse.msg, |
|
|
|
user: auth.user |
|
|
|
user: auth.user, |
|
|
|
socket: webSocket.socket |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|