Commit 4bfa0ce4 authored by 邓晓峰's avatar 邓晓峰

fix: api request bug

parent 6aa8abe3
This diff is collapsed.
......@@ -2,10 +2,10 @@ module.exports = {
dev: {
'/CityInterface': {
// 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: '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',
......@@ -21,9 +21,9 @@ module.exports = {
'/cityinterface': {
// target: 'http://192.168.10.151:8055',
// 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: '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,
......@@ -38,9 +38,9 @@ module.exports = {
// target: 'http://192.168.12.8:8098',
// target: 'http://192.168.10.20:8888',
// 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: 'https://panda-water.com',
// target: 'https://panda-water.com',
// target: 'http://192.168.10.150:8050',
changeOrigin: true,
headers: {
......
......@@ -7150,6 +7150,62 @@
"@xtuc/long": "4.2.2"
}
},
"@wisdom-utils/components": {
"version": "0.0.4",
"resolved": "https://g.civnet.cn:4873/@wisdom-utils%2fcomponents/-/components-0.0.4.tgz",
"integrity": "sha512-+G/0eSHsney5VePzjAPmXcW8xKclUnac+h+Xi7xxXAfHGYn8ruYj4a3eT9XcnvqDSHvEHSIRH23a8weTdIDjzw=="
},
"@wisdom-utils/utils": {
"version": "0.0.19",
"resolved": "https://g.civnet.cn:4873/@wisdom-utils%2futils/-/utils-0.0.19.tgz",
"integrity": "sha512-Y8zEIaDfZ/D0M8sb0KJoikRoT/x7rUKrbxC8UZkNwmrQqm+yyALPV2GqfTXYHHYCvgQ+zpD/E3uP3leKCAJ97Q==",
"requires": {
"axios": "^0.21.1",
"cookie": "^0.4.1",
"eventemitter3": "^4.0.7",
"intersection-observer": "^0.7.0",
"jsonp": "^0.2.1",
"lodash.debounce": "^4.0.8",
"lodash.isequal": "^4.5.0",
"lodash.throttle": "^4.1.1",
"query-string": "^6.13.8"
},
"dependencies": {
"axios": {
"version": "0.21.1",
"resolved": "https://g.civnet.cn:4873/axios/-/axios-0.21.1.tgz",
"integrity": "sha1-IlY0gZYvTWvemnbVFu8OXTwJsrg=",
"requires": {
"follow-redirects": "^1.10.0"
}
},
"cookie": {
"version": "0.4.1",
"resolved": "https://g.civnet.cn:4873/cookie/-/cookie-0.4.1.tgz",
"integrity": "sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA=="
},
"follow-redirects": {
"version": "1.13.1",
"resolved": "https://g.civnet.cn:4873/follow-redirects/-/follow-redirects-1.13.1.tgz",
"integrity": "sha1-X2m4Ezds7k/QR0o6uoNd8Eq3Y7c="
},
"query-string": {
"version": "6.13.8",
"resolved": "https://g.civnet.cn:4873/query-string/-/query-string-6.13.8.tgz",
"integrity": "sha1-jPIxdZyFSE2jzwWoUYENjoJcEVk=",
"requires": {
"decode-uri-component": "^0.2.0",
"split-on-first": "^1.0.0",
"strict-uri-encode": "^2.0.0"
}
},
"strict-uri-encode": {
"version": "2.0.0",
"resolved": "https://g.civnet.cn:4873/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz",
"integrity": "sha1-ucczDHBChi9rFC3CdLvMWGbONUY="
}
}
},
"@xobotyi/scrollbar-width": {
"version": "1.9.5",
"resolved": "https://g.civnet.cn:4873/@xobotyi%2fscrollbar-width/-/scrollbar-width-1.9.5.tgz",
......@@ -11275,8 +11331,7 @@
"decode-uri-component": {
"version": "0.2.0",
"resolved": "https://g.civnet.cn:4873/decode-uri-component/-/decode-uri-component-0.2.0.tgz",
"integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=",
"dev": true
"integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU="
},
"decompress-response": {
"version": "3.3.0",
......@@ -13436,8 +13491,7 @@
"eventemitter3": {
"version": "4.0.7",
"resolved": "https://g.civnet.cn:4873/eventemitter3/-/eventemitter3-4.0.7.tgz",
"integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==",
"dev": true
"integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw=="
},
"events": {
"version": "3.2.0",
......@@ -16492,8 +16546,7 @@
"intersection-observer": {
"version": "0.7.0",
"resolved": "https://g.civnet.cn:4873/intersection-observer/-/intersection-observer-0.7.0.tgz",
"integrity": "sha1-7ha+6XjbU1FurS8KgVSwm0ALvck=",
"dev": true
"integrity": "sha1-7ha+6XjbU1FurS8KgVSwm0ALvck="
},
"intl": {
"version": "1.2.5",
......@@ -18548,7 +18601,6 @@
"version": "0.2.1",
"resolved": "https://g.civnet.cn:4873/jsonp/-/jsonp-0.2.1.tgz",
"integrity": "sha1-pltPoPEL2nGaBUQep7lMVfPhW64=",
"dev": true,
"requires": {
"debug": "^2.1.3"
}
......@@ -18606,9 +18658,9 @@
"dev": true
},
"kit_global_config": {
"version": "1.0.10",
"resolved": "https://g.civnet.cn:4873/kit_global_config/-/kit_global_config-1.0.10.tgz",
"integrity": "sha512-o55fr6HmSmQotg3Qbv4IonQRUYcwfW/8N22ScCNAIOi3/zEB3qDMdPOj1p64yYwr7nJwtZjEBEDtA2vQ/iYM1Q==",
"version": "1.0.12",
"resolved": "https://g.civnet.cn:4873/kit_global_config/-/kit_global_config-1.0.12.tgz",
"integrity": "sha512-gFp7NhmlLsNE2V8QC7b1NKVUeWmPSDH8EUlbfEH5/9Y6Zzydsyy2bJEdbXmHf3N8/6Yb7W0IpdOZqdtB7KEf6A==",
"requires": {
"@babel/runtime": "^7.10.5",
"js-base64": "^3.5.2",
......@@ -19375,8 +19427,7 @@
"lodash.debounce": {
"version": "4.0.8",
"resolved": "https://g.civnet.cn:4873/lodash.debounce/-/lodash.debounce-4.0.8.tgz",
"integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=",
"dev": true
"integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168="
},
"lodash.defaultsdeep": {
"version": "4.6.1",
......@@ -19393,8 +19444,7 @@
"lodash.isequal": {
"version": "4.5.0",
"resolved": "https://g.civnet.cn:4873/lodash.isequal/-/lodash.isequal-4.5.0.tgz",
"integrity": "sha1-QVxEePK8wwEgwizhDtMib30+GOA=",
"dev": true
"integrity": "sha1-QVxEePK8wwEgwizhDtMib30+GOA="
},
"lodash.ismatch": {
"version": "4.4.0",
......@@ -19448,8 +19498,7 @@
"lodash.throttle": {
"version": "4.1.1",
"resolved": "https://g.civnet.cn:4873/lodash.throttle/-/lodash.throttle-4.1.1.tgz",
"integrity": "sha1-wj6RtxAkKscMN/HhzaknTMOb8vQ=",
"dev": true
"integrity": "sha1-wj6RtxAkKscMN/HhzaknTMOb8vQ="
},
"lodash.toarray": {
"version": "4.4.0",
......@@ -27499,8 +27548,7 @@
"split-on-first": {
"version": "1.1.0",
"resolved": "https://g.civnet.cn:4873/split-on-first/-/split-on-first-1.1.0.tgz",
"integrity": "sha512-43ZssAJaMusuKWL8sKUBQXHWOpq8d6CfN/u1p4gUzfJkM05C8rxTmYrkIPTXapZpORA6LkkzcUulJ8FqA7Uudw==",
"dev": true
"integrity": "sha512-43ZssAJaMusuKWL8sKUBQXHWOpq8d6CfN/u1p4gUzfJkM05C8rxTmYrkIPTXapZpORA6LkkzcUulJ8FqA7Uudw=="
},
"split-string": {
"version": "3.1.0",
......@@ -84,6 +84,8 @@
"dependencies": {
"@babel/polyfill": "7.4.3",
"@babel/runtime": "^7.10.5",
"@wisdom-utils/components": "0.0.4",
"@wisdom-utils/utils": "0.0.19",
"animate.css": "^4.1.1",
"chalk": "2.4.2",
"compression": "1.7.4",
......@@ -99,7 +101,7 @@
"ip": "1.1.5",
"js-base64": "^3.5.2",
"js-cookie": "^2.2.1",
"kit_global_config": "^1.0.10",
"kit_global_config": "^1.0.12",
"kit_logger": "^1.0.2",
"kit_utils": "^1.3.6",
"lodash": "4.17.11",
......
import axios from 'axios';
import uuid from 'uuid';
import 'kit_logger';
const baseURL =
process.env.NODE_ENV === 'development'
? window.location.origin
: window.location.origin;
axios.defaults.withCredentials = true;
// eslint-disable-next-line no-undef
const Logger = logger('Http');
const pending = []; // 声明一个数组用于存储每个ajax请求的取消函数和ajax标识
const cancelToken = axios.CancelToken;
class HttpRequest {
constructor(props) {
this.requestApi = axios.create({
baseURL,
timeout: 30000,
headers: {
'Content-Type': 'application/json;charset=UTF-8',
},
});
this.requestApi.interceptors.request.use(
config => {
// 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);
// config.headers['civ-site'] = "192_168_19_105_site_c8de50fc";
}
this.removePending(config); // 在一个ajax发送前执行一下取消操作
// eslint-disable-next-line new-cap
config.cancelToken = new cancelToken(c => {
const uid = uuid.v1();
config.uuid = uid;
pending.push({ uuid: uid, f: c });
});
// -----------------------------------------------------------------------------------------
return config;
},
function(error) {
Logger.log('request error', error);
return Promise.reject(error);
},
);
this.requestApi.interceptors.response.use(
response => {
// ------------------------------------------------------------------------------------------
this.removePending(response.config); // 在一个ajax响应后再执行一下取消操作,把已经完成的请求从pending中移除
// ------------------------------------------------------------------------------------------
if (response.status === 200) {
return response.data;
}
return response;
},
function(error) {
if (error && error.response) {
switch (error.response.status) {
case 400:
error.message = '错误请求';
break;
case 401:
error.message = '未授权,请重新登录';
break;
case 403:
error.message = '拒绝访问';
break;
case 404:
error.message = '请求错误,未找到该资源';
break;
case 405:
error.message = '请求方法未允许';
break;
case 408:
error.message = '请求超时';
break;
case 500:
error.message = '服务器端出错';
break;
case 501:
error.message = '网络未实现';
break;
case 502:
error.message = '网络错误';
break;
case 503:
error.message = '服务不可用';
break;
case 504:
error.message = '网络超时';
break;
case 505:
error.message = 'http版本不支持该请求';
break;
default:
// eslint-disable-next-line no-undef
error.message = `连接错误${err.response.status}`;
}
} else {
error.message = '连接到服务器失败';
}
return Promise.reject(error);
},
);
}
removePending(ever) {
for (const p in pending) {
if (pending[p].uuid === ever.uuid) {
// 当当前请求在数组中存在时执行函数体
pending[p].f(); // 执行取消操作
pending.splice(p, 1); // 把这条记录从数组中移除
}
}
}
removeAllPending() {
// eslint-disable-next-line guard-for-in
for (const p in pending) {
pending[p].f(); // 执行取消操作
pending.splice(p, 1); // 把这条记录从数组中移除
}
}
getSite(config) {
return window.globalConfig &&
window.globalConfig.userInfo &&
window.globalConfig.userInfo.site &&
!config.ignoreSite
? window.globalConfig.userInfo.site
: '';
}
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 });
}
post(url, data, config = {}) {
return this.requestApi.post(url, { ...data, ...config });
}
delete(url, params, config = {}) {
return this.requestApi.delete(url, { ...config, params });
}
put(url, params, config = {}) {
return this.requestApi.delete(url, params, config);
}
}
const http = new HttpRequest();
export default http;
const REQUEST_HTTP = 'http';
const REQUEST_POP = 'pop';
const REQUEST_METHOD_GET = 'get';
const REQUEST_METHOD_POST = 'post';
const REQUEST_METHOD_PUT = 'put';
const REQUEST_METHOD_DELETE = 'delete';
export default {
REQUEST_HTTP,
REQUEST_POP,
REQUEST_METHOD_GET,
REQUEST_METHOD_POST,
REQUEST_METHOD_PUT,
REQUEST_METHOD_DELETE,
};
import http from './apiConfig';
import BaseService from './baseService';
import NotificationService from './notificationService';
BaseService(http);
NotificationService(http);
export default http;
import jsonp from './jsonpConfig';
export function searchAutoCity(keywords) {
const url = 'https://restapi.amap.com/v3/assistant/inputtips';
const options = {
callback: `jsonp_${new Date().getTime()}`,
};
const params = Object.assign(
{},
{
s: 'rsv3',
key: 'e83f64300a2a55a33fa8e4ab9a46bca6',
platform: 'JS',
logversion: '2.0',
csid: '5A098355-8164-41D5-A2DC-78E1471CCD28',
appname: window.location.href,
sdkversion: '1.4.15',
keywords,
},
);
return jsonp(url, params, options);
}
import originJsonp from 'jsonp';
export default function jsonp(url, data, option) {
url += (url.indexOf('?') < 0 ? '?' : '&') + param(data);
return new Promise((resolve, reject) => {
// eslint-disable-next-line no-shadow
originJsonp(url, option, (err, data) => {
if (!err) {
resolve(data);
} else {
reject(err);
}
});
});
}
export function param(data) {
let url = '';
// eslint-disable-next-line guard-for-in
for (const k in data) {
const value = data[k] !== undefined ? data[k] : '';
url += `&${k}=${encodeURIComponent(value)}`;
}
return url ? url.substring(1) : '';
}
import { params } from 'kit_utils';
import { service, jsonp } from '@wisdom-utils/utils';
import constants from '../constants';
export const API = {
GET_GATEWAY_CONFIG: '/Publish/OMS/GateWayConfig',
GET_CONFIG: '/CityInterface/rest/services.svc/GetConfig',
......@@ -22,68 +22,118 @@ export const API = {
'CityInterface/rest/services/OMS.svc/U_UpdatePasswordQuickGCK',
FILE_DOWNLOAD: '"/cityinterface/rest/services/filedownload.svc/download',
};
/* 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 = {},
) => vm.get(API.GET_CONFIG, data, config).then(res => Promise.resolve(res));
const services = service({
getWateWayConfig: {
url: API.GET_GATEWAY_CONFIG,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
queryConfig: {
url: API.GET_CONFIG,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
generateToken: {
url:
(window.globalConfig && window.globalConfig.loginTemplate) ===
'Dark - IOTMultiLogin.html'
? API.GENERATE_IOT_TOKEN
: API.GENERATE_TOKEN,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
generatetokenByqrcode: {
url: API.GENERATE_QRCODE,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
vm.generateToken = (data = {}, config = {}) =>
vm
.get(
window.globalConfig.loginTemplate === 'Dark - IOTMultiLogin.html'
? API.GENERATE_IOT_TOKEN
: API.GENERATE_TOKEN,
data,
config,
)
.then(res => Promise.resolve(res));
getWebSiteConfig: {
url: API.GET_WEB_SITE_CONFIG,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
vm.generatetokenByqrcode = (data = {}, config = {}) =>
vm.get(API.GENERATE_QRCODE, data, config).then(res => Promise.resolve(res));
vm.getWebSiteConfig = (data = {}, config = {}) =>
vm
.get(API.GET_WEB_SITE_CONFIG, data, config)
.then(res => Promise.resolve(res));
getUserInfo: {
url: API.GET_USER_INFO,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
vm.getUserInfo = (data = {}, config = {}) =>
vm.get(API.GET_USER_INFO, data, config).then(res => Promise.resolve(res));
getOA: {
url: API.GET_OA,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
vm.getOA = (data = {}) =>
vm.get(API.GET_OA, data).then(res => Promise.resolve(res));
writeLogs: {
url: API.GET_LOGS,
method: constants.REQUEST_METHOD_POST,
type: constants.REQUEST_HTTP,
},
vm.writeLogs = (data = {}, config = {}) =>
vm.post(API.GET_LOGS, data, config).then(res => Promise.resolve(res));
getCity: {
url: API.GET_CITY,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
vm.getCity = () => vm.get(API.GET_CITY).then(res => Promise.resolve(res));
generateTokenQuick: {
url: API.GENERATE_TOKEN_CHANGE,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
vm.generateTokenQuick = (data = {}) =>
vm.get(API.GENERATE_TOKEN_CHANGE, data).then(res => Promise.resolve(res));
getAllGroupsInfoForUser: {
url: API.GET_ALL_GROUPS_INFO_FORUSER,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
vm.getAllGroupsInfoForUser = (data = {}, config) =>
vm
.get(API.GET_ALL_GROUPS_INFO_FORUSER, data, config)
.then(res => Promise.resolve(res));
getWeather: {
url: API.GET_WEATHER,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
vm.getWeather = (data = {}, config) =>
vm.get(API.GET_WEATHER, data, config).then(res => Promise.resolve(res));
sendMessVerificationCode: {
url: API.SEND_MESSAGE_CODE,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
vm.sendMessVerificationCode = (data = {}, config = {}) =>
vm
.get(API.SEND_MESSAGE_CODE, data, config)
.then(res => Promise.resolve(res));
changePassword: {
url:
(window.globalConfig && window.globalConfig.loginTemplate) ===
'Dark - IOTMultiLogin.html'
? API.IOT_CHANGE_PASSWORD
: API.CHANGE_PASSWORD,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
});
vm.changePassword = (data = {}, config = {}) =>
vm
.get(
window.globalConfig.loginTemplate === 'Dark - IOTMultiLogin.html'
? API.IOT_CHANGE_PASSWORD
: API.CHANGE_PASSWORD,
data,
config,
)
.then(res => Promise.resolve(res));
export const searchAutoCity = keywords => {
const url = 'https://restapi.amap.com/v3/assistant/inputtips';
const options = {
callback: `jsonp_${new Date().getTime()}`,
};
const params = Object.assign(
{},
{
s: 'rsv3',
key: 'e83f64300a2a55a33fa8e4ab9a46bca6',
platform: 'JS',
logversion: '2.0',
csid: '5A098355-8164-41D5-A2DC-78E1471CCD28',
appname: window.location.href,
sdkversion: '1.4.15',
keywords,
},
);
return jsonp(url, params, options);
};
export default services;
import qs from 'qs';
import { service } from '@wisdom-utils/utils';
import constants from '../constants';
const API = {
GET_INFORMATION:
......@@ -10,22 +11,28 @@ const API = {
POST_ADD_OPTIONS:
'/CityInterface/rest/services/WisdomUnion.svc/CustomerManage/AddOption',
};
/* eslint-disable */
export default vm => {
vm.getInformationInfo = (data = {}) =>
vm.get(API.GET_INFORMATION, data).then(res => Promise.resolve(res));
vm.getMqttSiteCode = (data = {}) =>
vm.get(API.GET_MQTT_SITE_CODE, data).then(res => Promise.resolve(res));
const notificationService = service({
getInformationInfo: {
url: API.GET_INFORMATION,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
getMqttSiteCode: {
url: API.GET_MQTT_SITE_CODE,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
postInformationStatus: {
url: API.POST_INFORMATION_STATUS,
method: constants.REQUEST_METHOD_POST,
type: constants.REQUEST_HTTP,
},
postAddOptions: {
url: API.POST_ADD_OPTIONS,
method: constants.REQUEST_METHOD_POST,
type: constants.REQUEST_HTTP,
},
});
vm.postInformationStatus = (params = {}) => {
const paramsStr = qs.stringify(params, { arrayFormat: 'brackets' });
return vm
.post(`${API.POST_INFORMATION_STATUS}?${paramsStr}`)
.then(res => Promise.resolve(res));
};
vm.postAddOptions = (params = {}) => {
return vm.post(API.POST_ADD_OPTIONS, params).then(res => Promise.resolve(res))
}
};
export default notificationService;
......@@ -14,7 +14,6 @@ import { params, Storeage } from 'kit_utils';
import { Provider } from 'react-redux';
import { message, Button, ConfigProvider, notification } from 'antd';
import defaultSettings from '../config/defaultSetting';
import Http from './api';
import Container from './components/Container';
import configureStore from './configureStore';
import App from './containers/App';
......@@ -22,12 +21,13 @@ import { actionCreators } from './containers/App/store';
import { initMicroApps } from './micro';
import history from './utils/history';
import { isString } from './utils/utils';
import services from './api/service/base';
const isHttps = document.location.protocol === 'https:';
const { pwa } = defaultSettings;
// eslint-disable-next-line no-restricted-globals
const namespace = `__PANDA_STORE__${location.hostname}`;
window.createStoreage = new Storeage(namespace);
window.Http = Http;
// eslint-disable-next-line no-underscore-dangle
const initialState = Immutable.Map();
const store = configureStore(initialState, history);
const MOUNT_NODE = document.getElementById('app');
......@@ -73,17 +73,15 @@ const initGlobalConfig = () => {
store.dispatch(actionCreators.getConfig(config));
render({ appContent: '', loading: true });
} else {
Http.getConfig()
services
.queryConfig({ client: params.getParams('client') || 'city' })
.then(res => {
if (res) {
const data = res;
store.dispatch(
actionCreators.getConfig(
Object.assign({}, data),
),
);
store.dispatch(actionCreators.getConfig(Object.assign({}, data)));
// eslint-disable-next-line no-shadow
Http.getWateWayConfig()
services
.getWateWayConfig()
// eslint-disable-next-line no-shadow
.then(res => {
const hasGateWay =
......
import React from 'react';
import { BaseComponent } from '@wisdom-utils/components';
import mousetrap from 'mousetrap';
import propTypes from 'prop-types';
/* eslint-disable */
export default class HandlerMap extends React.Component {
export default class HandlerMap extends BaseComponent {
componentDidMount() {
const { keyHandlerMap } = this.props;
if (keyHandlerMap) {
......
......@@ -3,9 +3,8 @@ import React from 'react';
import { Avatar, Form, Input, message, Modal, Popover, Spin } from 'antd';
import Cookies from 'js-cookie';
import { withRouter } from 'react-router-dom';
import { API } from '../../api/baseService';
import styles from './index.less';
import services from '../../api/service/base';
const formItemLayout = {
labelCol: {
......@@ -87,7 +86,7 @@ class AvatarDropdown extends React.Component {
newpassword: res.newPwd,
token: window.globalConfig.token,
};
Http.changePassword(params)
services.changePassword(params)
.then(res => {
if (res.success) {
message.success('修改密码成功');
......@@ -128,14 +127,14 @@ class AvatarDropdown extends React.Component {
userInfo.UserImge &&
userInfo.UserImge.indexOf('个人信息') > -1
) {
image = `${API.FILE_DOWNLOAD}/${userInfo.UserImge}`;
image = `/cityinterface/rest/services/filedownload.svc/download/${userInfo.UserImge}`;
} else if (
userInfo.UserImge &&
userInfo.UserImge !== '' &&
userInfo.UserImge !== 'default_user.png'
) {
image = userInfo.UserImge;
} else if (userInfo.WxImage && userInfo.WxImage != '') {
} else if (userInfo.WxImage && userInfo.WxImage !== '') {
image = userInfo.WxImage;
}
return image;
......
......@@ -9,6 +9,7 @@ import { ERR_OK, MESSAGE_TYPE, NEW_MESSAGE } from '../Notifier/constants';
import styles from './index.less';
import { findPathByWidget, isJSON } from '../../utils/utils';
import { actionCreators } from '../../containers/App/store';
import service from '../../api/service/notification';
class NoticeIconView extends Component {
constructor(props) {
......@@ -134,21 +135,23 @@ class NoticeIconView extends Component {
handlerOptions = value => {
// eslint-disable-next-line no-undef
Http.postAddOptions({
UserName: this.props.global.userInfo.fullName,
Type: '其他问题',
System: '熊猫智联',
Content: value.content,
Phone: value.phone,
UserID: this.props.global.userInfo.OID,
Picture: '',
}).then(res => {
if (res.statusCode === ERR_OK) {
this.setState({
sysTopVisible: false,
});
}
});
service
.postAddOptions({
UserName: this.props.global.userInfo.fullName,
Type: '其他问题',
System: '熊猫智联',
Content: value.content,
Phone: value.phone,
UserID: this.props.global.userInfo.OID,
Picture: '',
})
.then(res => {
if (res.statusCode === ERR_OK) {
this.setState({
sysTopVisible: false,
});
}
});
};
renderSysPlatform = message => {
......
......@@ -21,6 +21,7 @@ import {
VIDEO_LEVEL,
} from './constants';
import createMessage from './message';
import service from '../../api/service/notification';
/* eslint-disable */
// eslint-disable-next-line no-undef
const Logger = logger('mqtt');
......@@ -129,7 +130,7 @@ class Notifier {
if (isAll) hisIDs = this.messageCache.messages.map(item => item.id);
const self = this;
// eslint-disable-next-line no-undef
Http.postInformationStatus({
service.postInformationStatus({
userID: this.userInfo.OID,
hisID: hisIDs.join(','),
isAll: isAll ? 1 : '',
......@@ -497,7 +498,7 @@ class Notifier {
// 工具类
async loadHisMessages(pageIndex, pageSize) {
const self = this;
return Http.getInformationInfo({
return service.getInformationInfo({
userID: self.getUserInfo().OID,
pageIndex,
pageSize,
......@@ -506,7 +507,7 @@ class Notifier {
if (res) {
const result = {
totalCount: res.totalRcdNum,
messages: res.getMe.map(this.parseHisToMessage.bind(this)),
messages: (Array.isArray(res.getMe) ? res.getMe: []) .map(this.parseHisToMessage.bind(this)),
};
self.messageCache.totalCount = result.totalCount;
(result.messages || []).forEach(message => {
......@@ -530,7 +531,7 @@ class Notifier {
async getMqttSiteCode() {
const self = this;
return Http.getMqttSiteCode({ 'request.preventCache': Date.now() }).then(
return service.getMqttSiteCode({ 'request.preventCache': Date.now() }).then(
res => {
if (res && res.say.statusCode === ERR_OK) {
let mqttConfig = {
......
......@@ -133,42 +133,6 @@ const Modal = props => {
return ret.length > 0 ? ret : [];
};
// const transformSeachProductList = () => {
// return (
// <div className={styles.resultContainer}>
// {
// searchProduct.map((item, index) => {
// const match = props.matchValue(item.name, keyword)
// const name = keyword!== "" && match ? (
// <div className={styles.withHightLight}>
// {
// item.name.substring(0, match[0])
// }
// <em>
// {
// item.name.substring(match[0], match[1] + 1)
// }
// </em>
// {
// item.name.substring(match[1] + 1)
// }
// </div>
// ): item.name;
// return (
// <a className={styles.item} key={index}>
// <span className={styles.title}>
// {name}
// <RightCircleOutlined/>
// </span>
// <span className={styles.subtitle}>产品功能入口</span>
// </a>
// )
// })
// }
// </div>
// )
// }
const goFeature = (event, item) => {
event.persist && event.persist();
event && event.stopPropagation();
......
......@@ -67,11 +67,20 @@ const appReducer = (state = initialState, action) => {
switch (action.type) {
case GET_CONFIG:
// eslint-disable-next-line no-debugger
debugger
// eslint-disable-next-line no-underscore-dangle
window.__INITIAL_STATE__ = Object.assign({}, action.data, {
allWidgets: action.data.widgets || [],
});
window.__INITIAL_STATE__ = Object.assign(
{},
// eslint-disable-next-line no-underscore-dangle
action.data,
{
allWidgets: action.data.widgets || [],
baseURL: {
dev: window.location.origin,
prod: window.location.origin,
},
env: process.env.NODE_ENV === 'development' ? 'daily' : 'prod',
},
);
// eslint-disable-next-line global-require
if (!window.globalConfig) {
// eslint-disable-next-line global-require
......
......@@ -126,7 +126,7 @@ const StationsItem = (item, action) => {
>
{item.groupName}
{item.promoteTip && HOT.includes(item.promoteTip) && (
<div imgType={item.promoteTip}>{item.promoteTip}</div>
<div title={`${item.promoteTip}`}>{item.promoteTip}</div>
)}
</a>
</li>
......
This diff is collapsed.
......@@ -224,7 +224,7 @@
color: #23527c !important;
transition: color 0.3s;
}
div[imgType] {
div[title] {
display: inline-block;
color: #fff;
text-align: center;
......@@ -233,26 +233,26 @@
position: absolute;
top: -10px;
}
div[imgType='县'] {
div[title='县'] {
width: 30px;
height: 24px;
background: url(https://panda-water.cn/web4/assets/images/云平台/县.png)
center center no-repeat;
}
div[imgType='市'] {
div[title='市'] {
width: 30px;
height: 24px;
background: url(https://panda-water.cn/web4/assets/images/云平台/市.png)
center center no-repeat;
}
div[imgType='市'] {
div[title='市'] {
width: 30px;
height: 24px;
background: url(https://panda-water.cn/web4/assets/images/云平台/市.png)
center center no-repeat;
}
div[imgType='HOT'],
div[imgType='New'] {
div[title='HOT'],
div[title='New'] {
width: 41px;
height: 24px;
background: url(https://panda-water.cn/web4/assets/images/云平台/HOT.png)
......@@ -373,7 +373,7 @@
:global(.ant-menu-dark .ant-menu-item, .ant-menu-dark
.ant-menu-item-group-title, .ant-menu-dark
.ant-menu-item
> a, .ant-menu-dark .ant-menu-item > span > a) {
> a, .ant-menu-dark .ant-menu-item> span > a) {
width: 48px;
display: flex;
flex-direction: column;
......
......@@ -6,6 +6,7 @@ import 'kit_logger';
import styles from './index.less';
import LoginContext from './LoginContext';
import ItemMap from './map';
import services from '../../../../../api/service/base';
const FormItem = Form.Item;
// eslint-disable-next-line no-undef
......@@ -48,15 +49,12 @@ const LoginItem = props => {
const onGetCaptcha = useCallback(mobile => {
// eslint-disable-next-line no-undef
Http.sendMessVerificationCode(
{
services
.sendMessVerificationCode({
phoneNumber: mobile,
},
{
ignoreSite: true,
cacheBust: true,
},
)
})
.then(res => {
if (res) {
setExt(res.ext);
......
This diff is collapsed.
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