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