Commit 3d4ff7d3 authored by 邓晓峰's avatar 邓晓峰

fix: 添加fetch补丁

parents 17946f3d 41110ab9
Pipeline #39182 passed with stages
in 23 minutes 58 seconds
...@@ -16,10 +16,10 @@ export default { ...@@ -16,10 +16,10 @@ export default {
// activeRule: '/civbase/civ_water', // activeRule: '/civbase/civ_water',
// }, // },
{ {
name: 'civ_water', name: 'civ_pandawork',
entry: `//${window.location.hostname}:8081/civ_water`, entry: `//${window.location.hostname}:8082/civ_pandawork`,
container: '#micro-container', container: '#micro-container',
activeRule: '/civbase/civ_water', activeRule: '/civbase/civ_pandawork',
}, },
// { // {
// name: 'civ_webgis', // name: 'civ_webgis',
......
/* eslint-disable */ /* eslint-disable */
// const proxyURL = process.env.NODE_ENV !== 'production' ? 'http://192.168.10.150:8777' : window.location.origin; // const proxyURL = process.env.NODE_ENV !== 'production' ? 'http://192.168.10.150:8777' : window.location.origin;
const proxyURL = 'http://192.168.10.150:8669'; const proxyURL = 'https://work.panda-water.cn';
module.exports = { module.exports = {
assetsRoot: process.env.NODE_ENV !== 'production' ? proxyURL : './', assetsRoot: process.env.NODE_ENV !== 'production' ? proxyURL : './',
dev: { dev: {
......
...@@ -23,7 +23,8 @@ module.exports = opts => { ...@@ -23,7 +23,8 @@ module.exports = opts => {
'@babel/preset-env', '@babel/preset-env',
{ {
...mergeConfig(defaultEnvConfig,{}), ...mergeConfig(defaultEnvConfig,{}),
modules: false modules: false,
...opts.env
}, },
], ],
// opts.react && ['@babel/preset-react'], // opts.react && ['@babel/preset-react'],
...@@ -56,17 +57,17 @@ module.exports = opts => { ...@@ -56,17 +57,17 @@ module.exports = opts => {
'@babel/plugin-proposal-logical-assignment-operators', '@babel/plugin-proposal-logical-assignment-operators',
'@babel/plugin-syntax-dynamic-import', '@babel/plugin-syntax-dynamic-import',
'@babel/plugin-transform-react-jsx', '@babel/plugin-transform-react-jsx',
// opts.transformRuntime && [ opts.transformRuntime && [
// '@babel/plugin-transform-runtime', '@babel/plugin-transform-runtime',
// { {
// version: require('@babel/runtime/package.json').version, version: require('@babel/runtime/package.json').version,
// absoluteRuntime: dirname( absoluteRuntime: dirname(
// require.resolve('@babel/runtime/package.json'), require.resolve('@babel/runtime/package.json'),
// ), ),
// useESModules: true, useESModules: true,
// ...toObject(opts.transformRuntime), ...toObject(opts.transformRuntime),
// }, },
// ], ],
[ [
'babel-plugin-transform-react-remove-prop-types', 'babel-plugin-transform-react-remove-prop-types',
{ {
......
...@@ -6320,9 +6320,9 @@ ...@@ -6320,9 +6320,9 @@
} }
}, },
"@wisdom-utils/utils": { "@wisdom-utils/utils": {
"version": "0.0.54", "version": "0.0.63",
"resolved": "https://g.civnet.cn:4873/@wisdom-utils%2futils/-/utils-0.0.54.tgz", "resolved": "https://g.civnet.cn:4873/@wisdom-utils%2futils/-/utils-0.0.63.tgz",
"integrity": "sha512-8VDN3nhybSq2MiC7glgmNm+v9kvYnHOzvTuAKEA15ZbRNejTDr3STdZMW6NukF8+/zRixovdAJj80WkbBrXc4Q==", "integrity": "sha512-fdsvk7qjpZzmeBeWWGhJvHbiwf0E3adq7LsWP3nI487TDjE6AJ4Us0TSR8o1ih81lA5scYCnotKWCvC0EK5Dzw==",
"requires": { "requires": {
"@ahooksjs/use-request": "^2.0.0", "@ahooksjs/use-request": "^2.0.0",
"axios": "^0.21.1", "axios": "^0.21.1",
...@@ -16736,9 +16736,9 @@ ...@@ -16736,9 +16736,9 @@
} }
}, },
"kit_global_config": { "kit_global_config": {
"version": "1.0.36", "version": "1.0.37",
"resolved": "https://g.civnet.cn:4873/kit_global_config/-/kit_global_config-1.0.36.tgz", "resolved": "https://g.civnet.cn:4873/kit_global_config/-/kit_global_config-1.0.37.tgz",
"integrity": "sha512-xAx5ihBHaV40AnA9t8qbqE9z7iTrgHFCmlsTIbygAMYRMGvpOpqvybInZaE3nAD0QXTA96fnrUCYkZD8GNu4AQ==", "integrity": "sha512-Te8jwqxDqFy2nmzl7cTCAEZ+jciyBzjrO3wa70XthPTxFD8IGlRmnNRC+nj9gWhUGl/5nOIMz5q8yX2hkAgyhA==",
"requires": { "requires": {
"@babel/runtime": "^7.10.5", "@babel/runtime": "^7.10.5",
"js-base64": "^3.5.2", "js-base64": "^3.5.2",
...@@ -104,7 +104,7 @@ ...@@ -104,7 +104,7 @@
"@wisdom-map/util": "^1.0.27-0", "@wisdom-map/util": "^1.0.27-0",
"@wisdom-utils/components": "0.0.14", "@wisdom-utils/components": "0.0.14",
"@wisdom-utils/runtime": "0.0.15", "@wisdom-utils/runtime": "0.0.15",
"@wisdom-utils/utils": "0.0.54", "@wisdom-utils/utils": "0.0.63",
"animate.css": "^4.1.1", "animate.css": "^4.1.1",
"antd": "^4.16.13", "antd": "^4.16.13",
"compression": "1.7.4", "compression": "1.7.4",
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
"immutable": "^4.0.0-rc.12", "immutable": "^4.0.0-rc.12",
"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.36", "kit_global_config": "^1.0.37",
"kit_logger": "^1.0.2", "kit_logger": "^1.0.2",
"kit_utils": "^1.3.11", "kit_utils": "^1.3.11",
"lodash": "4.17.11", "lodash": "4.17.11",
......
...@@ -4,11 +4,20 @@ import { instanceRequest, service } from '@wisdom-utils/utils'; ...@@ -4,11 +4,20 @@ import { instanceRequest, service } from '@wisdom-utils/utils';
import AppService from './service/base'; import AppService from './service/base';
import notificationService from './service/notification'; import notificationService from './service/notification';
const { warning } = Modal; const { warning } = Modal;
// eslint-disable-next-line no-return-await // eslint-disable-next-line no-return-await
instanceRequest.reportCodeError = true; instanceRequest.reportCodeError = true;
instanceRequest.transformRequestURL = function(url) {
const excludeURL = ['/PandaCore/GCK/Basis/GateWayConfig', '/CityInterface/rest/services.svc/GetConfig'];
if(excludeURL.includes(url)) {
return url;
}
if (window.globalConfig && window.globalConfig.hasGateWay && /^\/(cityinterface|CityInterface|CityServer|PandaInformatization)/.test(url)) {
return /\/CityInterface\/rest\/services.svc\/GetConfig/.test(url) ? url ? /^\/GateWay/.test(url) ? url : '/GateWay' + url: '/GateWay' + url: '/GateWay' + url;
}
return url;
}
const codeMessage = { const codeMessage = {
200: '服务器成功返回请求的数据。', 200: '服务器成功返回请求的数据。',
201: '新建或修改数据成功。', 201: '新建或修改数据成功。',
...@@ -63,6 +72,7 @@ instanceRequest.setErrorHandler(error => { ...@@ -63,6 +72,7 @@ instanceRequest.setErrorHandler(error => {
return response; return response;
}); });
console.log("instanceRequest", instanceRequest)
const appService = service(AppService); const appService = service(AppService);
const noticeService = service(notificationService); const noticeService = service(notificationService);
export { appService, noticeService }; export { appService, noticeService };
...@@ -12,6 +12,7 @@ import 'sanitize.css/sanitize.css'; ...@@ -12,6 +12,7 @@ import 'sanitize.css/sanitize.css';
// import './vm'; // import './vm';
import React from 'react'; import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import { event } from 'microser-data';
import 'whatwg-fetch'; import 'whatwg-fetch';
import { Button, ConfigProvider, message, notification } from 'antd'; import { Button, ConfigProvider, message, notification } from 'antd';
import { ConnectedRouter } from 'connected-react-router/immutable'; import { ConnectedRouter } from 'connected-react-router/immutable';
...@@ -182,6 +183,7 @@ const initGlobalConfig = () => { ...@@ -182,6 +183,7 @@ const initGlobalConfig = () => {
render({ appContent: '', loading: true }); render({ appContent: '', loading: true });
}) })
.catch(error => { .catch(error => {
console.log(error);
store.dispatch(actionCreators.getConfigError(error)); store.dispatch(actionCreators.getConfigError(error));
}); });
} }
...@@ -229,7 +231,7 @@ initLocale(); ...@@ -229,7 +231,7 @@ initLocale();
window.share && window.share.event && window.share.event.on('triggerMicro', () => { window.share && window.share.event && window.share.event.on('triggerMicro', () => {
initMicroApps(loader, store); initMicroApps(loader, store);
}); });
window.share && window.share.event && window.share.event.on('initConfig', () => { event.on('initConfig', () => {
initGlobalConfig(); initGlobalConfig();
}); });
......
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
import { event } from 'microser-data';
import { import {
CLEAR_RCENT_KEYWORD, CLEAR_RCENT_KEYWORD,
COMPLEX_CONFIG, COMPLEX_CONFIG,
...@@ -179,9 +179,14 @@ export function logout(data) { ...@@ -179,9 +179,14 @@ export function logout(data) {
}); });
window.globalConfig.token = null; window.globalConfig.token = null;
window.globalConfig.access_token = null; window.globalConfig.access_token = null;
window.globalConfig.apiGatewayDomain = window.location.origin;
window.globalConfig.baseURI = window.location.origin;
window.globalConfig.hasGateWay = false; window.globalConfig.hasGateWay = false;
window.globalConfig.userInfo = null;
// window.globalConfig.hasGateWay = ;
} }
Cookies.set('token', '', { Cookies.set('token', '', {
path: '/', path: '/',
}); });
...@@ -199,11 +204,13 @@ export function logout(data) { ...@@ -199,11 +204,13 @@ export function logout(data) {
localStorage.removeItem('access_token'); localStorage.removeItem('access_token');
// eslint-disable-next-line no-undef,no-restricted-globals // eslint-disable-next-line no-undef,no-restricted-globals
createStoreage.remove(`__PANDA_STORE__${location.hostname}`); createStoreage.remove(`__PANDA_STORE__${location.hostname}`);
event.emit('initConfig');
return { return {
type: LOGINOUT, type: LOGINOUT,
data: { data: {
currentMenuIndex: 0, currentMenuIndex: 0,
complexConfig: {}, complexConfig: {},
globalConfig: window.globalConfig
}, },
}; };
} }
...@@ -232,6 +232,7 @@ const appReducer = (state = initialState, action) => { ...@@ -232,6 +232,7 @@ const appReducer = (state = initialState, action) => {
return state.merge({ return state.merge({
complexConfig: action.data.complexConfig, complexConfig: action.data.complexConfig,
currentMenuIndex: action.data.currentMenuIndex, currentMenuIndex: action.data.currentMenuIndex,
globalConfig: action.data.globalConfig
}); });
case MAP_VIEW: case MAP_VIEW:
store.set('view', action.data); store.set('view', action.data);
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
event: new EventEmitter(), event: new EventEmitter(),
}; };
window.share.event.setMaxListeners(1000); window.share.event.setMaxListeners(50000);
window.umi_plugin_ant_themeVar = [ window.umi_plugin_ant_themeVar = [
{ key: 'dark', fileName: 'dark.css', theme: 'dark' }, { key: 'dark', fileName: 'dark.css', theme: 'dark' },
......
...@@ -463,7 +463,10 @@ const BasicLayout = props => { ...@@ -463,7 +463,10 @@ const BasicLayout = props => {
useEffect(() => { useEffect(() => {
siteAction.setGlobalConfig(props.global); siteAction.setGlobalConfig(props.global);
if (!Cookies.get('token')) { if (!Cookies.get('token')) {
history.replace(`/user/login?client=${props.global.get('client')}`); debugger
let client = props.global.get('client');
client = _.isNull(client) || _.isUndefined(client) || client === 'undefined' ? client: 'city';
history.replace(`/user/login?client=${client}`);
props.logout(); props.logout();
return; return;
} }
......
...@@ -323,7 +323,9 @@ const BasicLayout = props => { ...@@ -323,7 +323,9 @@ const BasicLayout = props => {
useEffect(() => { useEffect(() => {
siteAction.setGlobalConfig(props.global); siteAction.setGlobalConfig(props.global);
if (!Cookies.get('token')) { if (!Cookies.get('token')) {
history.replace(`/user/login?client=${props.global.get('client')}`); let client = props.global.get('client');
client = client !== 'undefined' || !_.isNull(client) || !_.isUndefined(client) ? client: 'city';
history.replace(`/user/login?client=${client}`);
props.logout(); props.logout();
return; return;
} }
......
...@@ -27,12 +27,13 @@ class SecurityLayout extends React.Component { ...@@ -27,12 +27,13 @@ class SecurityLayout extends React.Component {
// const queryString = stringify({ // const queryString = stringify({
// redirect: window.location.href, // redirect: window.location.href,
// }); // });
if(_.isNull(global.token) || (global.hasGateWay && _.isNull(global.access_token))) { if(_.isNull(global.token) || (global.hasGateWay && _.isNull(global.access_token))) {
this.props.updateCurrentIndex && this.props.updateCurrentIndex(0); this.props.updateCurrentIndex && this.props.updateCurrentIndex(0);
window.share && window.share.event && window.share.event.emit('initConfig')
const client = global.client !== 'undefined' || !_.isNull(global.client) || !_.isUndefined(global.client) ? global.client: 'city';
return ( return (
<Redirect to={`/user/login?client=${global.client}`} /> <Redirect to={`/user/login?client=${client}`} />
); );
} }
......
...@@ -41,7 +41,7 @@ export const initMicroApps = (loader, store) => { ...@@ -41,7 +41,7 @@ export const initMicroApps = (loader, store) => {
application && Array.isArray(application) && application.length > 0 && application.map(item => { application && Array.isArray(application) && application.length > 0 && application.map(item => {
products.push({ products.push({
name: item.PackageName, name: item.PackageName,
entry: "//" + window.location.host + (`/${item.PackageName}`), entry: window.location.protocol + "//" + window.location.host + (`/${item.PackageName}`),
container: '#micro-container', container: '#micro-container',
activeRule: genActiveRule(`/civbase/${item.PackageName}`), activeRule: genActiveRule(`/civbase/${item.PackageName}`),
props: { props: {
...@@ -117,7 +117,7 @@ export const initMicroApps = (loader, store) => { ...@@ -117,7 +117,7 @@ export const initMicroApps = (loader, store) => {
excludeAssetFilter: url => excludeAssetFilter: url =>
url.indexOf('framework/highcharts') !== -1 || url.indexOf('framework/highcharts') !== -1 ||
// url.indexOf('framework/amap/AMap.UI') !== -1 || // url.indexOf('framework/amap/AMap.UI') !== -1 ||
url.indexOf('framework/amap/init.js') !== -1 || // url.indexOf('framework/amap/init.js') !== -1 ||
url.indexOf('jquery') !== -1 || url.indexOf('jquery') !== -1 ||
url.indexOf('managers/MapManager.js') !== -1 || url.indexOf('managers/MapManager.js') !== -1 ||
url.indexOf('jquery.mCustomScrollbar.js') !== -1 || url.indexOf('jquery.mCustomScrollbar.js') !== -1 ||
...@@ -182,24 +182,11 @@ export const defaultApp = () => { ...@@ -182,24 +182,11 @@ export const defaultApp = () => {
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
const config = createStoreage.get('globalConfig'); const config = createStoreage.get('globalConfig');
if (config && config.token) { if (config && config.token) {
const basePath =config.homepage !== '' && FILTER_FOLER_REG.test(config.homepage) ?'civweb4' :'civweb4';
// console.log(config)
// // const startWith = config.homepage ? config.homepage.split('/') : [];
// // console.log(findPathByLeafId(config.homepage, '', 'url'))
const basePath =
config.homepage !== '' && FILTER_FOLER_REG.test(config.homepage) ?
'civweb4' :
'civweb4';
// const defaultURL =
// config.homepage === '' ?
// `/${pkg.name.toLocaleLowerCase()}/${basePath}?client=${config.client}` :
// `/${pkg.name.toLocaleLowerCase()}/${basePath}/${config.homepage}`;
// console.log("config.home.path", config.home.path)
if(config && config.home) { if(config && config.home) {
setDefaultMountApp(`/civbase/${config.home.path.replace(/^\//, '')}`); setDefaultMountApp(`/civbase/${config.home.path.replace(/^\//, '')}`);
} else { } else {
const homepage = config.homepage ? '/' + config.homepage: ''; const homepage = _.isNull(config.homepage) ? '': '/' + config.homepage;
setDefaultMountApp(`/${pkg.name.toLocaleLowerCase()}/${basePath}${homepage}`); setDefaultMountApp(`/${pkg.name.toLocaleLowerCase()}/${basePath}${homepage}`);
createStoreage.set('init_web4', true) createStoreage.set('init_web4', true)
} }
......
...@@ -757,7 +757,7 @@ class Login { ...@@ -757,7 +757,7 @@ class Login {
Cookies.set('city', self.globalConfig.client) Cookies.set('city', self.globalConfig.client)
} }
if (isRememberPWD) { if (isRememberPWD) {
Cookies.set(self.globalConfig.client, token, { Cookies.set('city', self.globalConfig.client, {
expires: exp / (24 * 60 * 60 * 1000), expires: exp / (24 * 60 * 60 * 1000),
path: '/', path: '/',
}); });
...@@ -798,7 +798,7 @@ class Login { ...@@ -798,7 +798,7 @@ class Login {
return data return data
} else { } else {
message.error({ message.error({
duration: 300, duration: 3,
content: `授权失败:${res.msg}` content: `授权失败:${res.msg}`
}); });
self.events.emit('loginError', res.msg); self.events.emit('loginError', res.msg);
......
...@@ -127,6 +127,9 @@ export function simpleNormalizeChildren(children) { ...@@ -127,6 +127,9 @@ export function simpleNormalizeChildren(children) {
export const generFlatRoutes = (widgets, parent, subSystem, modulePkg) => { export const generFlatRoutes = (widgets, parent, subSystem, modulePkg) => {
const treeKeys = []; const treeKeys = [];
const flatMenu = []; const flatMenu = [];
if(!widgets || Array.isArray(widgets) && widgets.length === 0) {
return [];
}
(widgets || []).forEach(item => { (widgets || []).forEach(item => {
if (item.hasOwnProperty('routes')) { if (item.hasOwnProperty('routes')) {
const route = generFlatRoutes(item.routes, item, item.name, modulePkg); const route = generFlatRoutes(item.routes, item, item.name, modulePkg);
......
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