Browse Source

Merge branch 'dev_trial' of https://gitea.free-sun.vip/free-sun/FS-IOT into dev_trial

release_0.0.2
巴林闲侠 3 years ago
parent
commit
8deb57ba1f
  1. 2
      code/VideoAccess-VCMP/web/client/src/app.jsx
  2. 21
      code/VideoAccess-VCMP/web/client/src/layout/containers/layout/index.jsx
  3. 4
      code/VideoAccess-VCMP/web/client/src/layout/index.jsx
  4. 1
      code/VideoAccess-VCMP/web/client/src/sections/example/containers/example.jsx

2
code/VideoAccess-VCMP/web/client/src/app.jsx

@ -25,7 +25,7 @@ const App = props => {
return ( return (
<Layout <Layout
title={projectName} title={projectName}
sections={[ sections={[Example,
Auth, Monitor, EquipmentWarehouse, AiAbility, offline, Auth, Monitor, EquipmentWarehouse, AiAbility, offline,
openness, journaling, archive, application, member, system openness, journaling, archive, application, member, system
]} ]}

21
code/VideoAccess-VCMP/web/client/src/layout/containers/layout/index.jsx

@ -26,7 +26,7 @@ let scrollbar
const LayoutContainer = props => { const LayoutContainer = props => {
const { const {
dispatch, msg, user, copyright, children, sections, clientWidth, clientHeight, dispatch, msg, user, copyright, children, sections, clientWidth, clientHeight,
location, match, routes, history, authCrossLoading location, match, routes, history, authCrossLoading,socket
} = props } = props
const [collapsed, setCollapsed] = useState(false) 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 ( return (
<Layout id="layout"> <Layout id="layout">
{ {
@ -149,7 +163,7 @@ const LayoutContainer = props => {
} }
function mapStateToProps (state) { function mapStateToProps (state) {
const { global, auth, ajaxResponse } = state; const { global, auth, ajaxResponse , webSocket} = state;
return { return {
title: global.title, title: global.title,
copyright: global.copyright, copyright: global.copyright,
@ -158,7 +172,8 @@ function mapStateToProps (state) {
clientWidth: global.clientWidth, clientWidth: global.clientWidth,
clientHeight: global.clientHeight, clientHeight: global.clientHeight,
msg: ajaxResponse.msg, msg: ajaxResponse.msg,
user: auth.user user: auth.user,
socket: webSocket.socket
}; };
} }

4
code/VideoAccess-VCMP/web/client/src/layout/index.jsx

@ -84,6 +84,10 @@ const Root = props => {
} }
} }
useEffect(async () => { useEffect(async () => {
let innerRoutes = [] let innerRoutes = []
let outerRoutes = [] let outerRoutes = []

1
code/VideoAccess-VCMP/web/client/src/sections/example/containers/example.jsx

@ -6,6 +6,7 @@ const { Meta } = Card;
const Example = (props) => { const Example = (props) => {
const { dispatch, actions, user, loading, socket } = props const { dispatch, actions, user, loading, socket } = props
console.log(props)
useEffect(() => { useEffect(() => {
// ACTION // ACTION

Loading…
Cancel
Save