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

fix: message alarm

parent eeb667fe
Pipeline #21794 passed with stages
in 15 minutes 4 seconds
module.exports = {
dev: {
'/CityInterface': {
// target: 'http://192.168.10.151:8055',
target: 'http://192.168.10.151:8055',
// target: 'https://panda-water.cn',
// 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.19.103:8112',
// target: 'http://192.168.12.8:8098',
......@@ -19,11 +19,11 @@ module.exports = {
},
},
'/cityinterface': {
// target: 'http://192.168.10.151:8055',
target: 'http://192.168.10.151:8055',
// target: 'http://192.168.10.150:8050',
// target: 'https://panda-water.cn',
// 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.10.20:8888',
changeOrigin: true,
......@@ -37,10 +37,10 @@ module.exports = {
'/Publish': {
// target: 'http://192.168.12.8:8098',
// 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: 'http://192.168.19.102:8055',
target: 'https://panda-water.com',
// target: 'https://panda-water.com',
// target: 'http://192.168.10.150:8050',
changeOrigin: true,
headers: {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -99,7 +99,7 @@
"ip": "1.1.5",
"js-base64": "^3.5.2",
"js-cookie": "^2.2.1",
"kit_global_config": "^1.0.9",
"kit_global_config": "^1.0.10",
"kit_logger": "^1.0.2",
"kit_utils": "^1.3.6",
"lodash": "4.17.11",
......
......@@ -24,7 +24,7 @@ class HttpRequest {
// if(config.params&&config.params.cancelAllRequest){
// removeAllPending()
// }
config.url = this.transformURL(config.url)
// ------------------------------------------------------------------------------------
if (!config.ignoreSite && this.getSite(config)) {
config.headers['civ-site'] = this.getSite(config);
......@@ -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 = {}) {
return this.requestApi.get(url, { ...config, params });
}
......
import { params } from 'kit_utils';
export const API = {
GET_GATEWAY_CONFIG: '/Publish/OMS/GateWayConfig',
GET_CONFIG: '/CityInterface/rest/services.svc/GetConfig',
GENERATE_TOKEN: '/cityinterface/rest/services.svc/generatetoken',
GENERATE_IOT_TOKEN: 'cityinterface/rest/services.svc/generateGCKToken',
......@@ -23,6 +24,8 @@ export const API = {
};
/* eslint-disable */
export default vm => {
vm.getWateWayConfig = (data = {}, config = {}) => vm.get(API.GET_GATEWAY_CONFIG, data, config).then(res => Promise.resolve(res));
vm.getConfig = (
data = { client: params.getParams('client') || 'city', ts: Date.now() },
config = {},
......@@ -38,6 +41,7 @@ export default vm => {
config,
)
.then(res => Promise.resolve(res));
vm.generatetokenByqrcode = (data = {}, config = {}) =>
vm.get(API.GENERATE_QRCODE, data, config).then(res => Promise.resolve(res));
vm.getWebSiteConfig = (data = {}, config = {}) =>
......
......@@ -21,6 +21,7 @@ import App from './containers/App';
import { actionCreators } from './containers/App/store';
import { initMicroApps } from './micro';
import history from './utils/history';
import { isString } from './utils/utils';
const isHttps = document.location.protocol === 'https:';
const { pwa } = defaultSettings;
// eslint-disable-next-line no-restricted-globals
......@@ -52,7 +53,6 @@ const initLocale = () => {
};
const initGlobalConfig = () => {
const authValidate = false;
// eslint-disable-next-line no-undef
const config = createStoreage.get('globalConfig') || {};
if (config.title == null) {
......@@ -75,8 +75,39 @@ const initGlobalConfig = () => {
} else {
Http.getConfig()
.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 => {
render({ appContent: '', loading: true });
})
......@@ -95,7 +126,6 @@ window.share &&
window.share.event.on('triggerMicro', () => {
initMicroApps(loader);
});
initGlobalConfig();
initLocale();
......
......@@ -40,8 +40,8 @@ const Alarm = ({ message, confirmRead, config }) => {
});
};
const alarmValue = alarmContent && alarmContent.alarmValue && alarmContent.alarmValue.split(' ');
let alarmTitle = alarmContent && alarmContent.alarmValue && alarmContent.title.split(' ');
alarmTitle = alarmTitle[1];
let alarmTitle = alarmContent && alarmContent.title && alarmContent.title.split(' ') || alarmContent.alarmDevice;
alarmTitle = Array.isArray(alarmTitle) ? alarmTitle[1]: alarmTitle;
return (
<div
className={classNames(styles.scada, commonStyles.messageContainer)}
......
......@@ -2,7 +2,7 @@ import pathRegexp from 'path-to-regexp';
import { parse } from 'querystring';
import pkg from '../../package.json';
const { toString } = Object.prototype;
/* 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]*))?)$/;
......@@ -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