Browse Source

(*)网关管理菜单

master
wuqun 2 years ago
parent
commit
0e612bbc66
  1. 6
      code/web/client/src/sections/auth/containers/login.jsx
  2. 8
      code/web/client/src/sections/edition/containers/administer.jsx
  3. 37
      code/web/client/src/sections/edition/containers/gateway.jsx
  4. 5
      code/web/client/src/sections/edition/containers/index.js
  5. 10
      code/web/client/src/sections/edition/nav-item.jsx
  6. 19
      code/web/client/src/sections/edition/routes.js

6
code/web/client/src/sections/auth/containers/login.jsx

@ -20,7 +20,7 @@ const Login = props => {
useEffect(() => { useEffect(() => {
if (user && user.authorized) { if (user && user.authorized) {
dispatch(push('/edition')); dispatch(push('/edgeGateway/gateway'));
// localStorage.setItem('fs_iot_auth_selected_sider', JSON.stringify([])) // localStorage.setItem('fs_iot_auth_selected_sider', JSON.stringify([]))
// localStorage.setItem('fs_iot_auth_open_sider', JSON.stringify([])) // localStorage.setItem('fs_iot_auth_open_sider', JSON.stringify([]))
} }
@ -52,7 +52,7 @@ const Login = props => {
onSubmit={values => { onSubmit={values => {
dispatch(login(values.username, values.password)).then(res => { dispatch(login(values.username, values.password)).then(res => {
const data = res.payload.user const data = res.payload.user
// dispatch(actions.layout.initWebSocket({ ioUrl: apiRoot, token: data.token })) // dispatch(actions.layout.initWebSocket({ ioUrl: apiRoot, token: data.token }))
}) })
}} }}
getFormApi={formApi => form.current = formApi} getFormApi={formApi => form.current = formApi}
@ -83,7 +83,7 @@ const Login = props => {
); );
} }
function mapStateToProps (state) { function mapStateToProps(state) {
const { auth, global } = state; const { auth, global } = state;
return { return {
user: auth.user, user: auth.user,

8
code/web/client/src/sections/edition/containers/administer.jsx

@ -5,7 +5,7 @@ import { push } from 'react-router-redux';
import { Form, Button, Toast } from '@douyinfe/semi-ui'; import { Form, Button, Toast } from '@douyinfe/semi-ui';
import { IconLock, IconUser } from '@douyinfe/semi-icons'; import { IconLock, IconUser } from '@douyinfe/semi-icons';
const Administer = props => { const EditionManage = props => {
const { dispatch, user, error, actions, apiRoot, isRequesting } = props const { dispatch, user, error, actions, apiRoot, isRequesting } = props
@ -18,12 +18,12 @@ const Administer = props => {
return ( return (
<div style={{}}> <div style={{}}>
5204620542045204 版本管理
</div> </div>
); );
} }
function mapStateToProps (state) { function mapStateToProps(state) {
const { auth, global } = state; const { auth, global } = state;
return { return {
user: auth.user, user: auth.user,
@ -34,4 +34,4 @@ function mapStateToProps (state) {
} }
} }
export default connect(mapStateToProps)(Administer); export default connect(mapStateToProps)(EditionManage);

37
code/web/client/src/sections/edition/containers/gateway.jsx

@ -0,0 +1,37 @@
'use strict';
import React, { useEffect, useRef } from 'react';
import { connect } from 'react-redux';
import { push } from 'react-router-redux';
import { Form, Button, Toast, Table } from '@douyinfe/semi-ui';
import { IconLock, IconUser } from '@douyinfe/semi-icons';
const GatewayManage = props => {
const { dispatch, user, error, actions, apiRoot, isRequesting } = props
useEffect(() => {
}, [])
return (
<div style={{}}>
网关设备列表
</div>
);
}
function mapStateToProps(state) {
const { auth, global } = state;
return {
user: auth.user,
error: auth.error,
actions: global.actions,
apiRoot: global.apiRoot,
isRequesting: auth.isRequesting
}
}
export default connect(mapStateToProps)(GatewayManage);

5
code/web/client/src/sections/edition/containers/index.js

@ -1,4 +1,5 @@
'use strict'; 'use strict';
import Administer from './administer.jsx'; import EditionManage from './administer';
import GatewayManage from './gateway';
export { Administer }; export { EditionManage, GatewayManage };

10
code/web/client/src/sections/edition/nav-item.jsx

@ -1,11 +1,15 @@
import React from 'react'; import React from 'react';
import { IconCode } from '@douyinfe/semi-icons'; import { IconCheckList } from '@douyinfe/semi-icons';
export function getNavItem (user, dispatch) { export function getNavItem(user, dispatch) {
return ( return (
[ [
{ {
itemKey: 'edition', text: '版本管理', icon: <IconCode />, to: '/edition', itemKey: 'edgeGateway', text: '网关管理', to: '/edgeGateway/gateway', icon: <IconCheckList />,
items: [
{ itemKey: 'gateway', to: '/edgeGateway/gateway', text: '设备列表' },
{ itemKey: 'edition', to: '/edgeGateway/edition', text: '版本管理' }
],
}, },
] ]
); );

19
code/web/client/src/sections/edition/routes.js

@ -1,15 +1,24 @@
'use strict'; 'use strict';
import { Administer } from './containers'; import { EditionManage, GatewayManage } from './containers';
export default [ export default [
{ {
type: 'inner', type: 'inner',
route: { route: {
key: 'edition', key: 'edgeGateway',
path: "/edition", path: "/edgeGateway",
breadcrumb: '版本管理', childRoutes: [{
component: Administer, path: '/edition',
key: 'edition',
breadcrumb: '版本管理',
component: EditionManage
}, {
path: '/gateway',
key: 'gateway',
breadcrumb: '网关管理',
component: GatewayManage
}]
} }
} }
]; ];
Loading…
Cancel
Save