diff --git a/web/client/src/app.jsx b/web/client/src/app.jsx
index e0c7163..064eeb2 100644
--- a/web/client/src/app.jsx
+++ b/web/client/src/app.jsx
@@ -5,6 +5,7 @@ import Layout from './layout';
import Auth from './sections/auth';
import Example from './sections/example';
import Example1 from './sections/example1';
+import Problem from './sections/problem';
import NoMatch from './sections/noMatch';
import Console from './sections/console';
@@ -19,7 +20,7 @@ const App = props => {
diff --git a/web/client/src/index.jsx b/web/client/src/index.jsx
index da1e49c..030a629 100644
--- a/web/client/src/index.jsx
+++ b/web/client/src/index.jsx
@@ -6,4 +6,4 @@ import { render } from 'react-dom';
import App from './app';
import './index.less';
-render((), document.getElementById('PomsApp'));
\ No newline at end of file
+render((), document.getElementById('PomsApp'));
\ No newline at end of file
diff --git a/web/client/src/sections/auth/actions/auth.js b/web/client/src/sections/auth/actions/auth.js
index 23340b3..b785135 100644
--- a/web/client/src/sections/auth/actions/auth.js
+++ b/web/client/src/sections/auth/actions/auth.js
@@ -1,6 +1,6 @@
'use strict';
-import { ApiTable, AxyRequest } from '$utils'
+import { ApiTable, AxyRequest, EmisRequest } from '$utils'
export const INIT_AUTH = 'INIT_AUTH';
export function initAuth (userData) {
@@ -32,17 +32,17 @@ export function login (username, password) {
return Promise.resolve();
}
- return dispatch({
- type: LOGIN_SUCCESS,
- payload: {
- user: {
- authorized: true,
- namePresent: 'TEST'
- }
- },
- });
+ // return dispatch({
+ // type: LOGIN_SUCCESS,
+ // payload: {
+ // user: {
+ // authorized: true,
+ // namePresent: 'TEST'
+ // }
+ // },
+ // });
- return AxyRequest.post(ApiTable.login, { username, password, domain: 'anxinyun' })
+ return EmisRequest.post(ApiTable.login, { username, password, code: 'POMS' })
.then(user => {
sessionStorage.setItem('pomsUser', JSON.stringify(user));
return dispatch({
@@ -65,8 +65,9 @@ export const LOGOUT = 'LOGOUT';
export function logout () {
const user = JSON.parse(sessionStorage.getItem('pomsUser'))
user && user.token ?
- AxyRequest.post(ApiTable.logout, {
- token: user.token
+ EmisRequest.post(ApiTable.logout, {
+ token: user.token,
+ code: 'POMS'
}) : null;
sessionStorage.removeItem('pomsUser');
return {
diff --git a/web/client/src/sections/problem/actions/dataAlarm.jsx b/web/client/src/sections/problem/actions/dataAlarm.jsx
new file mode 100644
index 0000000..ff08638
--- /dev/null
+++ b/web/client/src/sections/problem/actions/dataAlarm.jsx
@@ -0,0 +1,14 @@
+'use strict';
+
+import { ApiTable ,basicAction} from '$utils'
+
+// export function getMembers (orgId) {
+// return dispatch => basicAction({
+// type: 'get',
+// dispatch: dispatch,
+// actionType: 'GET_MEMBERS',
+// url: `${ApiTable.getEnterprisesMembers.replace('{enterpriseId}', orgId)}`,
+// msg: { error: '获取用户列表失败' },
+// reducer: { name: 'members' }
+// });
+// }
diff --git a/web/client/src/sections/problem/actions/index.js b/web/client/src/sections/problem/actions/index.js
new file mode 100644
index 0000000..61e0e1a
--- /dev/null
+++ b/web/client/src/sections/problem/actions/index.js
@@ -0,0 +1,7 @@
+'use strict';
+
+import * as dataAlarm from './dataAlarm'
+
+export default {
+ ...dataAlarm
+}
\ No newline at end of file
diff --git a/web/client/src/sections/problem/containers/dataAlarm.jsx b/web/client/src/sections/problem/containers/dataAlarm.jsx
new file mode 100644
index 0000000..720ab94
--- /dev/null
+++ b/web/client/src/sections/problem/containers/dataAlarm.jsx
@@ -0,0 +1,35 @@
+import React, { useEffect, useState } from 'react';
+import { connect } from 'react-redux';
+import { IconAlertCircle } from '@douyinfe/semi-icons';
+import '../style.less'
+
+const DataAlarm = (props) => {
+ const { dispatch, actions, user, loading, socket } = props
+ const [abnormalLenght, setAbnormalLenght] = useState(1) //异常数量
+
+ useEffect(() => {
+ console.log(props);
+ }, [])
+
+ return (
+ <>
+
+ {abnormalLenght > 0 ? : ""}
+
+
+ >
+ )
+}
+
+function mapStateToProps (state) {
+ const { auth, global, members, webSocket } = state;
+ return {
+ // loading: members.isRequesting,
+ user: auth.user,
+ actions: global.actions,
+ // members: members.data,
+ // socket: webSocket.socket
+ };
+}
+
+export default connect(mapStateToProps)(DataAlarm);
diff --git a/web/client/src/sections/problem/containers/index.js b/web/client/src/sections/problem/containers/index.js
new file mode 100644
index 0000000..8accec5
--- /dev/null
+++ b/web/client/src/sections/problem/containers/index.js
@@ -0,0 +1,5 @@
+'use strict';
+
+import DataAlarm from './dataAlarm';
+
+export { DataAlarm };
\ No newline at end of file
diff --git a/web/client/src/sections/problem/index.js b/web/client/src/sections/problem/index.js
new file mode 100644
index 0000000..5a20ab9
--- /dev/null
+++ b/web/client/src/sections/problem/index.js
@@ -0,0 +1,15 @@
+'use strict';
+
+import reducers from './reducers';
+import routes from './routes';
+import actions from './actions';
+import { getNavItem } from './nav-item';
+
+export default {
+ key: 'problem',
+ name: '书写示例',
+ reducers: reducers,
+ routes: routes,
+ actions: actions,
+ getNavItem: getNavItem
+};
\ No newline at end of file
diff --git a/web/client/src/sections/problem/nav-item.jsx b/web/client/src/sections/problem/nav-item.jsx
new file mode 100644
index 0000000..279dcdc
--- /dev/null
+++ b/web/client/src/sections/problem/nav-item.jsx
@@ -0,0 +1,33 @@
+import React from 'react';
+import { IconCode } from '@douyinfe/semi-icons';
+
+export function getNavItem (user, dispatch) {
+ return (
+ [{
+ itemKey: 'problem', text: '问题',
+ items: [
+ {
+ itemKey: 'dataAlarm', text: '数据告警', icon: ,
+ items: [
+ { itemKey: 'dataLnterrupt', to: '/problem/dataAlarm/dataLnterrupt', text: '数据中断' },
+ { itemKey: 'dataAbnormal', to: '/problem/dataAlarm/dataAbnormal', text: '数据异常' },
+ { itemKey: 'strategyHit', to: '/problem/dataAlarm/strategyHit', text: '策略命中' },
+ { itemKey: 'videoAbnormal', to: '/problem/dataAlarm/videoAbnormal', text: '视频异常' },
+ ]
+ }, {
+ itemKey: 'useAlarm', text: '应用告警', icon: ,
+ items: [
+ { itemKey: 'useAbnormal', to: '/problem/useAlarm/useAbnormal', text: '应用异常' },
+ ]
+ }, {
+ itemKey: 'deviceAlarm', text: '设备告警', icon: ,
+ items: [
+ { itemKey: 'deviceAbnormal', to: '/problem/deviceAlarm/deviceAbnormal', text: '设备异常' },
+ ]
+ },
+ ]
+ },
+
+ ]
+ );
+}
\ No newline at end of file
diff --git a/web/client/src/sections/problem/reducers/index.js b/web/client/src/sections/problem/reducers/index.js
new file mode 100644
index 0000000..7ed1088
--- /dev/null
+++ b/web/client/src/sections/problem/reducers/index.js
@@ -0,0 +1,5 @@
+'use strict';
+
+export default {
+
+}
\ No newline at end of file
diff --git a/web/client/src/sections/problem/routes.js b/web/client/src/sections/problem/routes.js
new file mode 100644
index 0000000..80371fd
--- /dev/null
+++ b/web/client/src/sections/problem/routes.js
@@ -0,0 +1,61 @@
+'use strict';
+import { DataAlarm, } from './containers';
+
+export default [{
+ type: 'inner',
+ route: {
+ path: '/problem',
+ key: 'problem',
+ breadcrumb: '问题',
+ // 不设置 component 则面包屑禁止跳转
+ childRoutes: [{
+ path: '/dataAlarm',
+ key: 'dataAlarm',
+ breadcrumb: '数据告警',
+ // 不设置 component 则面包屑禁止跳转
+ childRoutes: [{
+ path: '/dataLnterrupt',
+ key: 'dataLnterrupt',
+ breadcrumb: '数据中断',
+ component: DataAlarm,
+ }, {
+ path: '/dataAbnormal',
+ key: 'dataAbnormal',
+ breadcrumb: '数据异常',
+ component: DataAlarm,
+ }, {
+ path: '/strategyHit',
+ key: 'strategyHit',
+ breadcrumb: '策略命中',
+ component: DataAlarm,
+ }, {
+ path: '/videoAbnormal',
+ key: 'videoAbnormal',
+ breadcrumb: '视频异常',
+ component: DataAlarm,
+ }]
+ }, {
+ path: '/useAlarm',
+ key: 'useAlarm',
+ breadcrumb: '应用告警',
+ // 不设置 component 则面包屑禁止跳转
+ childRoutes: [{
+ path: '/useAbnormal',
+ key: 'useAbnormal',
+ breadcrumb: '应用异常',
+ component: DataAlarm,
+ },]
+ }, {
+ path: '/deviceAlarm',
+ key: 'deviceAlarm',
+ breadcrumb: '设备告警',
+ // 不设置 component 则面包屑禁止跳转
+ childRoutes: [{
+ path: '/deviceAbnormal',
+ key: 'deviceAbnormal',
+ breadcrumb: '设备异常',
+ component: DataAlarm,
+ },]
+ }]
+ }
+}];
\ No newline at end of file
diff --git a/web/client/src/sections/problem/style.less b/web/client/src/sections/problem/style.less
new file mode 100644
index 0000000..75ecdb6
--- /dev/null
+++ b/web/client/src/sections/problem/style.less
@@ -0,0 +1,7 @@
+#example {
+ box-shadow: 3px 3px 2px black;
+}
+
+#example:hover {
+ color: yellowgreen;
+}
\ No newline at end of file
diff --git a/web/client/src/utils/index.js b/web/client/src/utils/index.js
index 1f5a1f3..0084428 100644
--- a/web/client/src/utils/index.js
+++ b/web/client/src/utils/index.js
@@ -3,7 +3,7 @@ import { isAuthorized } from './func';
import { AuthorizationCode } from './authCode';
import {
ApiTable, RouteTable,
- AxyRequest,
+ AxyRequest, EmisRequest,
basicAction, RouteRequest
} from './webapi'
@@ -14,7 +14,7 @@ export {
RouteTable,
ApiTable,
AxyRequest,
+ EmisRequest,
basicAction,
RouteRequest,
-
}
\ No newline at end of file
diff --git a/web/client/src/utils/webapi.js b/web/client/src/utils/webapi.js
index af61d7d..f7969d1 100644
--- a/web/client/src/utils/webapi.js
+++ b/web/client/src/utils/webapi.js
@@ -2,6 +2,7 @@
import { ProxyRequest, customWebUtils } from "@peace/utils";
export const AxyRequest = new ProxyRequest("_axy");
+export const EmisRequest = new ProxyRequest("_emis")
export const webUtils = new customWebUtils({
userKey: 'pomsUser'
@@ -16,8 +17,7 @@ export const ApiTable = {
logout: "logout",
};
export const RouteTable = {
- apiRoot: "/api/root",
- fileUpload: "/_upload/new",
- cleanUpUploadTrash: "/_upload/cleanup",
- };
-
\ No newline at end of file
+ apiRoot: "/api/root",
+ fileUpload: "/_upload/new",
+ cleanUpUploadTrash: "/_upload/cleanup",
+};
diff --git a/web/config.js b/web/config.js
index 848a206..827347b 100644
--- a/web/config.js
+++ b/web/config.js
@@ -14,13 +14,16 @@ args.option(['p', 'port'], '启动端口');
args.option(['u', 'api-url'], 'webapi的URL');
args.option('apiPomsUrl', 'webapi的URL 外网可访问');
args.option('apiAnxinyunUrl', '安心云 api');
+args.option('apiEmisUrl', '企业管理 api');
const flags = args.parse(process.argv);
const API_URL = process.env.API_URL || flags.apiUrl;
const API_POMS_URL = process.env.API_POMS_URL || flags.apiPomsUrl;
+const API_EMIS_URL = process.env.API_EMIS_URL || flags.apiEmisUrl;
const API_ANXINYUN_URL = process.env.API_ANXINYUN_URL || flags.apiAnxinyunUrl;
+
if (!API_URL || !API_ANXINYUN_URL) {
console.log('缺少启动参数,异常退出');
args.showHelp();
@@ -42,6 +45,12 @@ const product = {
host: API_ANXINYUN_URL,
match: /^\/_axy\//,
}
+ }, {
+ entry: require('./middlewares/proxy').entry,
+ opts: {
+ host: API_EMIS_URL,
+ match: /^\/_emis\//,
+ }
}, {
entry: require('./routes').entry,
opts: {
diff --git a/web/package.json b/web/package.json
index 202be9a..27b3bc2 100644
--- a/web/package.json
+++ b/web/package.json
@@ -7,7 +7,7 @@
"test": "mocha",
"start-vite": "cross-env NODE_ENV=developmentVite npm run start-params",
"start": "cross-env NODE_ENV=development npm run start-params",
- "start-params": "node server -p 5600 -u http://localhost:4600 --apiPomsUrl http://localhost:4600 --apiAnxinyunUrl http://localhost:4100",
+ "start-params": "node server -p 5600 -u http://localhost:4600 --apiPomsUrl http://localhost:4600 --apiAnxinyunUrl http://10.8.30.112:4100 --apiEmisUrl http://10.8.30.112:14000",
"deploy": "export NODE_ENV=production&& npm run build && node server",
"build-dev": "cross-env NODE_ENV=development&&webpack --config webpack.config.js",
"build": "cross-env NODE_ENV=production&&webpack --config webpack.config.prod.js"
@@ -79,4 +79,4 @@
"webpack-dev-server": "^3.11.2",
"webpack-hot-middleware": "^2.25.0"
}
-}
+}
\ No newline at end of file