Commit 6921fe7f authored by 邓晓峰's avatar 邓晓峰

fix: message alarm

parent eeb667fe
Pipeline #21794 passed with stages
in 15 minutes 4 seconds
module.exports = { module.exports = {
dev: { dev: {
'/CityInterface': { '/CityInterface': {
// target: 'http://192.168.10.151:8055', target: 'http://192.168.10.151:8055',
// target: 'https://panda-water.cn', // target: 'https://panda-water.cn',
// target: 'http://192.168.19.102:8055', // target: 'http://192.168.19.102:8055',
target: 'https://panda-water.com', // target: 'https://panda-water.com',
// target: 'http://192.168.10.150:8050', // target: 'http://192.168.10.150:8050',
// target: 'http://192.168.19.103:8112', // target: 'http://192.168.19.103:8112',
// target: 'http://192.168.12.8:8098', // target: 'http://192.168.12.8:8098',
...@@ -19,11 +19,11 @@ module.exports = { ...@@ -19,11 +19,11 @@ module.exports = {
}, },
}, },
'/cityinterface': { '/cityinterface': {
// target: 'http://192.168.10.151:8055', target: 'http://192.168.10.151:8055',
// target: 'http://192.168.10.150:8050', // target: 'http://192.168.10.150:8050',
// target: 'https://panda-water.cn', // target: 'https://panda-water.cn',
// target: 'http://192.168.19.102:8055', // target: 'http://192.168.19.102:8055',
target: 'https://panda-water.com', // target: 'https://panda-water.com',
// target: 'http://192.168.12.8:8098', // target: 'http://192.168.12.8:8098',
// target: 'http://192.168.10.20:8888', // target: 'http://192.168.10.20:8888',
changeOrigin: true, changeOrigin: true,
...@@ -37,10 +37,10 @@ module.exports = { ...@@ -37,10 +37,10 @@ module.exports = {
'/Publish': { '/Publish': {
// target: 'http://192.168.12.8:8098', // target: 'http://192.168.12.8:8098',
// target: 'http://192.168.10.20:8888', // target: 'http://192.168.10.20:8888',
// target: 'http://192.168.10.151:8055', target: 'http://192.168.10.151:8055',
// target: 'https://panda-water.cn', // target: 'https://panda-water.cn',
// target: 'http://192.168.19.102:8055', // target: 'http://192.168.19.102:8055',
target: 'https://panda-water.com', // target: 'https://panda-water.com',
// target: 'http://192.168.10.150:8050', // target: 'http://192.168.10.150:8050',
changeOrigin: true, changeOrigin: true,
headers: { headers: {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
"ip": "1.1.5", "ip": "1.1.5",
"js-base64": "^3.5.2", "js-base64": "^3.5.2",
"js-cookie": "^2.2.1", "js-cookie": "^2.2.1",
"kit_global_config": "^1.0.9", "kit_global_config": "^1.0.10",
"kit_logger": "^1.0.2", "kit_logger": "^1.0.2",
"kit_utils": "^1.3.6", "kit_utils": "^1.3.6",
"lodash": "4.17.11", "lodash": "4.17.11",
......
...@@ -24,7 +24,7 @@ class HttpRequest { ...@@ -24,7 +24,7 @@ class HttpRequest {
// if(config.params&&config.params.cancelAllRequest){ // if(config.params&&config.params.cancelAllRequest){
// removeAllPending() // removeAllPending()
// } // }
config.url = this.transformURL(config.url)
// ------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------
if (!config.ignoreSite && this.getSite(config)) { if (!config.ignoreSite && this.getSite(config)) {
config.headers['civ-site'] = this.getSite(config); config.headers['civ-site'] = this.getSite(config);
...@@ -134,6 +134,18 @@ class HttpRequest { ...@@ -134,6 +134,18 @@ class HttpRequest {
: ''; : '';
} }
transformURL(url) {
if (window.globalConfig && window.globalConfig.hasGateWay) {
let u = url.replace(
/CityInterface\/rest|cityinterface\/rest/,
'CityInterface',
);
u = /^\//.test(u) ? u : `/${u}`;
return `Publish/GateWay${u}`;
}
return url;
}
get(url, params, config = {}) { get(url, params, config = {}) {
return this.requestApi.get(url, { ...config, params }); return this.requestApi.get(url, { ...config, params });
} }
......
import { params } from 'kit_utils'; import { params } from 'kit_utils';
export const API = { export const API = {
GET_GATEWAY_CONFIG: '/Publish/OMS/GateWayConfig',
GET_CONFIG: '/CityInterface/rest/services.svc/GetConfig', GET_CONFIG: '/CityInterface/rest/services.svc/GetConfig',
GENERATE_TOKEN: '/cityinterface/rest/services.svc/generatetoken', GENERATE_TOKEN: '/cityinterface/rest/services.svc/generatetoken',
GENERATE_IOT_TOKEN: 'cityinterface/rest/services.svc/generateGCKToken', GENERATE_IOT_TOKEN: 'cityinterface/rest/services.svc/generateGCKToken',
...@@ -23,6 +24,8 @@ export const API = { ...@@ -23,6 +24,8 @@ export const API = {
}; };
/* eslint-disable */ /* eslint-disable */
export default vm => { export default vm => {
vm.getWateWayConfig = (data = {}, config = {}) => vm.get(API.GET_GATEWAY_CONFIG, data, config).then(res => Promise.resolve(res));
vm.getConfig = ( vm.getConfig = (
data = { client: params.getParams('client') || 'city', ts: Date.now() }, data = { client: params.getParams('client') || 'city', ts: Date.now() },
config = {}, config = {},
...@@ -38,6 +41,7 @@ export default vm => { ...@@ -38,6 +41,7 @@ export default vm => {
config, config,
) )
.then(res => Promise.resolve(res)); .then(res => Promise.resolve(res));
vm.generatetokenByqrcode = (data = {}, config = {}) => vm.generatetokenByqrcode = (data = {}, config = {}) =>
vm.get(API.GENERATE_QRCODE, data, config).then(res => Promise.resolve(res)); vm.get(API.GENERATE_QRCODE, data, config).then(res => Promise.resolve(res));
vm.getWebSiteConfig = (data = {}, config = {}) => vm.getWebSiteConfig = (data = {}, config = {}) =>
......
...@@ -21,6 +21,7 @@ import App from './containers/App'; ...@@ -21,6 +21,7 @@ import App from './containers/App';
import { actionCreators } from './containers/App/store'; import { actionCreators } from './containers/App/store';
import { initMicroApps } from './micro'; import { initMicroApps } from './micro';
import history from './utils/history'; import history from './utils/history';
import { isString } from './utils/utils';
const isHttps = document.location.protocol === 'https:'; const isHttps = document.location.protocol === 'https:';
const { pwa } = defaultSettings; const { pwa } = defaultSettings;
// eslint-disable-next-line no-restricted-globals // eslint-disable-next-line no-restricted-globals
...@@ -52,7 +53,6 @@ const initLocale = () => { ...@@ -52,7 +53,6 @@ const initLocale = () => {
}; };
const initGlobalConfig = () => { const initGlobalConfig = () => {
const authValidate = false;
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
const config = createStoreage.get('globalConfig') || {}; const config = createStoreage.get('globalConfig') || {};
if (config.title == null) { if (config.title == null) {
...@@ -75,8 +75,39 @@ const initGlobalConfig = () => { ...@@ -75,8 +75,39 @@ const initGlobalConfig = () => {
} else { } else {
Http.getConfig() Http.getConfig()
.then(res => { .then(res => {
store.dispatch(actionCreators.getConfig(res)); if (res) {
const data = res;
store.dispatch(
actionCreators.getConfig(
Object.assign({}, data),
),
);
// eslint-disable-next-line no-shadow
Http.getWateWayConfig()
// eslint-disable-next-line no-shadow
.then(res => {
const hasGateWay =
res && res.data && isString(res.data)
? JSON.parse(res.data)
: res.data;
// eslint-disable-next-line no-debugger
if (res.code === 0) {
store.dispatch(
actionCreators.getConfig(
Object.assign({}, data, {
hasGateWay,
}),
),
);
}
})
.catch(error => {
store.dispatch(actionCreators.getConfigError(error));
store.dispatch(actionCreators.getConfig(Object.assign({}, data)));
});
}
}) })
// eslint-disable-next-line no-shadow
.then(res => { .then(res => {
render({ appContent: '', loading: true }); render({ appContent: '', loading: true });
}) })
...@@ -95,7 +126,6 @@ window.share && ...@@ -95,7 +126,6 @@ window.share &&
window.share.event.on('triggerMicro', () => { window.share.event.on('triggerMicro', () => {
initMicroApps(loader); initMicroApps(loader);
}); });
initGlobalConfig(); initGlobalConfig();
initLocale(); initLocale();
......
...@@ -40,8 +40,8 @@ const Alarm = ({ message, confirmRead, config }) => { ...@@ -40,8 +40,8 @@ const Alarm = ({ message, confirmRead, config }) => {
}); });
}; };
const alarmValue = alarmContent && alarmContent.alarmValue && alarmContent.alarmValue.split(' '); const alarmValue = alarmContent && alarmContent.alarmValue && alarmContent.alarmValue.split(' ');
let alarmTitle = alarmContent && alarmContent.alarmValue && alarmContent.title.split(' '); let alarmTitle = alarmContent && alarmContent.title && alarmContent.title.split(' ') || alarmContent.alarmDevice;
alarmTitle = alarmTitle[1]; alarmTitle = Array.isArray(alarmTitle) ? alarmTitle[1]: alarmTitle;
return ( return (
<div <div
className={classNames(styles.scada, commonStyles.messageContainer)} className={classNames(styles.scada, commonStyles.messageContainer)}
......
...@@ -2,7 +2,7 @@ import pathRegexp from 'path-to-regexp'; ...@@ -2,7 +2,7 @@ import pathRegexp from 'path-to-regexp';
import { parse } from 'querystring'; import { parse } from 'querystring';
import pkg from '../../package.json'; import pkg from '../../package.json';
const { toString } = Object.prototype;
/* eslint no-useless-escape:0 import/prefer-default-export:0 */ /* eslint no-useless-escape:0 import/prefer-default-export:0 */
const reg = /(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/; const reg = /(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/;
...@@ -127,3 +127,7 @@ export function isJSON(str) { ...@@ -127,3 +127,7 @@ export function isJSON(str) {
} }
} }
} }
export function isString(str) {
return toString.call(str) === '[object String]';
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment