Commit f432d5fc authored by lihonglin's avatar lihonglin

feat: arcgis地图问题处理

parent 4702d35f
......@@ -2,10 +2,10 @@ const slash = require('slash2');
const proxy = require('./proxy');
const defaultSetting = require('./defaultSetting');
const { REACT_APP_ENV } = process.env;
const cesiumBuild = "../node_modules/cesium/Build/Cesium"
const cesiumBuild = '../node_modules/cesium/Build/Cesium';
const pkgName = require('../package.json').name;
const path = require('path');
const CESIUM_BASE_URL = `/${pkgName}`
const CESIUM_BASE_URL = `/${pkgName}`;
module.exports = {
// mfsu: {},
webpack5: {},
......@@ -33,11 +33,7 @@ module.exports = {
ignoreMomentLocale: true,
nodeModulesTransform: {
type: 'none',
exclude: [
'@wisdom-map/arcgismap',
'@wisdom-map/arcgismap/lib/arcgisapi',
'swagger-ui-react',
],
exclude: ['@wisdom-map/arcgismap', 'swagger-ui-react'],
},
proxy: proxy[REACT_APP_ENV || 'dev'],
// openAPI: {
......@@ -84,25 +80,29 @@ module.exports = {
},
javascriptEnabled: true,
},
copy : [{
from : path.join(pkgName , cesiumBuild, './Workers'),
to : 'Workers',
},{
from : path.join( pkgName, cesiumBuild, 'Assets'),
to : 'Assets',
},{
from : path.join( pkgName, cesiumBuild, 'Widgets'),
to : 'Widgets',
},{
from : path.join( pkgName, cesiumBuild, 'ThirdParty'),
to : 'ThirdParty'
}
copy: [
{
from: path.join(pkgName, cesiumBuild, './Workers'),
to: 'Workers',
},
{
from: path.join(pkgName, cesiumBuild, 'Assets'),
to: 'Assets',
},
{
from: path.join(pkgName, cesiumBuild, 'Widgets'),
to: 'Widgets',
},
{
from: path.join(pkgName, cesiumBuild, 'ThirdParty'),
to: 'ThirdParty',
},
],
define : {
CESIUM_BASE_URL : JSON.stringify(CESIUM_BASE_URL).replace(/\"/g , '')
define: {
CESIUM_BASE_URL: JSON.stringify(CESIUM_BASE_URL).replace(/\"/g, ''),
},
alias: {
cesium : path.resolve(__dirname, cesiumBuild)
cesium: path.resolve(__dirname, cesiumBuild),
},
workerLoader: {},
// esbuild: {}
......
......@@ -27,15 +27,15 @@ export default {
container: '#micro-container',
activeRule: '/civbase/report',
props: {
origin: `//127.0.0.1:8345`
}
origin: `//127.0.0.1:8345`,
},
},
{
name: 'civ_webgis',
entry: `//${window.location.hostname}:8081/civ_webgis`,
container: '#micro-container',
activeRule: '/civbase/civ_webgis',
},
// {
// name: 'civ_webgis',
// entry: `//${window.location.hostname}:8080/civ_webgis`,
// container: '#micro-container',
// activeRule: '/civbase/civ_energy',
// },
{
name: 'civweb4',
entry: `//${window.location.hostname}:3020/civweb4`,
......
/* eslint-disable */
// const proxyURL = process.env.NODE_ENV !== 'production' ? 'http://192.168.10.150:8777' : window.location.origin;
const proxyURL = 'https://work.panda-water.cn';
// const proxyURL = 'https://work.panda-water.cn';
const proxyURL = 'http://192.168.12.47:8081';
module.exports = {
assetsRoot: process.env.NODE_ENV !== 'production' ? proxyURL : './',
dev: {
'/Panda_GIS': {
target: proxyURL,
changeOrigin: true,
headers: {
'Access-Control-Allow-Origin': '*',
},
pathRewrite: {
'/Panda_GIS': '/Panda_GIS',
},
},
'/CityInterface': {
target: proxyURL,
// target: 'https://panda-water.cn',
......@@ -70,6 +82,7 @@ module.exports = {
'/Publish': '/Publish',
},
},
'/PandaCore': {
target: proxyURL,
changeOrigin: true,
......@@ -84,22 +97,22 @@ module.exports = {
target: proxyURL,
changeOrigin: true,
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Origin': '*',
},
pathRewrite: {
'/PandaInformatization': '/PandaInformatization',
'/PandaInformatization': '/PandaInformatization',
},
},
'/PandaWorkFlow': {
},
'/PandaWorkFlow': {
target: proxyURL,
changeOrigin: true,
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Origin': '*',
},
pathRewrite: {
'/PandaWorkFlow': '/PandaWorkFlow',
'/PandaWorkFlow': '/PandaWorkFlow',
},
},
},
'/CityTemp': {
// target: 'http://192.168.10.150:8777',
target: proxyURL,
......@@ -133,6 +146,16 @@ module.exports = {
}
},
pre: {
'/Panda_GIS': {
target: proxyURL,
changeOrigin: true,
headers: {
'Access-Control-Allow-Origin': '*',
},
pathRewrite: {
'/Panda_GIS': '/Panda_GIS',
},
},
'/CityInterface': {
target: 'https://panda-water.cn',
changeOrigin: true,
......
......@@ -22,7 +22,7 @@
"build": "cross-env NODE_ENV=production node internals/webpack/build.js",
"build:clean": "rimraf ./build",
"openapi": "cross-env NODE_ENV=development node server/openapi/run.js",
"start": "cross-env REACT_APP_ENV=dev NODE_ENV=development node server --port=$port",
"start": "cross-env REACT_APP_ENV=dev NODE_ENV=development node --max_old_space_size=8192 server --port=$port",
"start:tunnel": "cross-env NODE_ENV=development ENABLE_TUNNEL=true node server",
"start:production": "npm run test && npm run build && npm run start:prod",
"start:prod": "cross-env NODE_ENV=production node server",
......@@ -90,8 +90,6 @@
"babel-core": "7.0.0-bridge.0"
},
"dependencies": {
"@esri/calcite-colors": "6.0.3",
"@esri/arcgis-html-sanitizer": "2.9.1",
"@amap/amap-jsapi-loader": "^1.0.1",
"@ant-design/colors": "^5.0.1",
"@ant-design/icons": "^4.0.0",
......@@ -102,9 +100,11 @@
"@ant-design/pro-utils": "^1.10.4",
"@babel/polyfill": "7.4.3",
"@babel/runtime": "^7.10.5",
"@esri/arcgis-html-sanitizer": "^2.9.1",
"@esri/calcite-colors": "^6.0.3",
"@wisdom-cesium/cesium": "^1.0.64",
"@wisdom-components/empty": "^1.4.1",
"@wisdom-map/arcgismap": "^1.0.60-0",
"@wisdom-map/arcgismap": "^1.0.75-0",
"@wisdom-map/util": "^1.0.27-0",
"@wisdom-utils/components": "0.0.14",
"@wisdom-utils/runtime": "0.0.15",
......
......@@ -3,7 +3,7 @@ import React, {
useEffect,
useRef,
useState,
useContext
useContext,
} from 'react';
import {
......@@ -18,43 +18,38 @@ import {
Dropdown,
Menu,
Tooltip,
ConfigProvider
ConfigProvider,
} from 'antd';
// import { RouteWithSubRoutes, renderRoutes } from '../utils/routes';
// import { renderRoutes } from 'react-router-config';
import { renderRoutes } from '../utils/routes'
import { PageContainer } from '@ant-design/pro-layout';
import Icon from '@ant-design/icons';
import Icon, {
// LeftOutlined,
LoadingOutlined,
// MenuFoldOutlined,
DownOutlined,
} from '@ant-design/icons';
import { store } from 'microser-data';
import classNames from 'classnames';
import { ReactSVG } from 'react-svg'
import { ReactSVG } from 'react-svg';
import Cookies from 'js-cookie';
import { connect } from 'react-redux';
import { Router, Switch } from '@wisdom-utils/runtime';
import { Router, Switch, useHistory } from '@wisdom-utils/runtime';
import keepAlive, { KeepAlive } from 'react-activation';
import RightContent from '@/components/GlobalHeader/ExtendRightContent';
import Panel from '@/components/SliderPanel/MinPanel';
import { actionCreators } from '@/containers/App/store';
// import CreateBaseMap from '@/pages/map';
import CesiumMap from '@/pages/cesiumMap'
import keepAlive, { KeepAlive } from 'react-activation'
import CreateBaseMap from '@/pages/map';
import CesiumMap from '@/pages/cesiumMap';
// import Authorized from '@/utils/Authorized';
import {
findPathByLeafId,
getBaseName,
} from '@/utils/utils';
import {
// LeftOutlined,
LoadingOutlined,
// MenuFoldOutlined,
DownOutlined
} from '@ant-design/icons';
import { findPathByLeafId, getBaseName } from '@/utils/utils';
// import { renderRoutes } from 'react-router-config';
import { useHistory } from '@wisdom-utils/runtime';
import { renderRoutes } from '../utils/routes';
import SecurityLayout from './SecurityLayout';
import Site from './Site';
import styles from './UserLayout.less';
import layoutStyles from './BasicLayout.less';
import SettingDrawer from '../components/SettingDrawer'
import SettingDrawer from '../components/SettingDrawer';
const { TabPane } = Tabs;
const { layout: defaultSetting } = require('../../config/config');
// import Login from '../pages/user/login/login';
......@@ -673,7 +668,8 @@ const BasicLayout = props => {
}
{
window.location.pathname.startsWith('/civbase/civ_3d') ? <KeepAlive><CesiumMap /></KeepAlive> : null
window.location.pathname.startsWith('/civbase/civ_3d') ? <KeepAlive><CesiumMap /></KeepAlive> : !window.location.pathname.startsWith('/civbase/civweb4') ? <CreateBaseMap options={{ type: 'ArcgisMap' }} /> : null
}
<div id="micro-container" className="subapp-container">
{/*<CreateBaseMap/>*/}
......@@ -692,7 +688,7 @@ const BasicLayout = props => {
}
{
window.location.pathname.startsWith('/civbase/civ_3d') ? <KeepAlive><CesiumMap /></KeepAlive> : null
window.location.pathname.startsWith('/civbase/civ_3d') ? <KeepAlive><CesiumMap /></KeepAlive> : !window.location.pathname.startsWith('/civbase/civweb4') ? <CreateBaseMap options={{ type: 'ArcgisMap' }} /> : null
}
<div id="micro-container" className="subapp-container">
{/*<CreateBaseMap/>*/}
......
......@@ -2,12 +2,12 @@
import 'kit_logger';
import _ from 'lodash';
import {
addGlobalUncaughtErrorHandler,
initGlobalState,
registerMicroApps,
runAfterFirstMounted,
setDefaultMountApp,
start,
addGlobalUncaughtErrorHandler,
initGlobalState,
registerMicroApps,
runAfterFirstMounted,
setDefaultMountApp,
start,
} from 'qiankun';
import { store as microStore } from 'microser-data';
......@@ -21,30 +21,30 @@ import store from './stores';
// eslint-disable-next-line no-undef
const Logger = logger('micro');
const MICRO_STATUS = {
NOT_LOADED: 'NOT_LOADED',
LOADING_SOURCE_CODE: 'LOADING_SOURCE_CODE',
NOT_BOOTSTRAPPED: 'NOT_BOOTSTRAPPED',
BOOTSTRAPPING: 'BOOTSTRAPPING',
NOT_MOUNTED: 'NOT_MOUNTED',
MOUNTING: 'MOUNTING',
MOUNTED: 'MOUNTED',
UPDATING: 'UPDATING',
UNMOUNTING: 'UNMOUNTING',
UNLOADING: 'UNLOADING',
SKIP_BECAUSE_BROKEN: 'SKIP_BECAUSE_BROKEN',
LOAD_ERROR: 'LOAD_ERROR',
NOT_LOADED: 'NOT_LOADED',
LOADING_SOURCE_CODE: 'LOADING_SOURCE_CODE',
NOT_BOOTSTRAPPED: 'NOT_BOOTSTRAPPED',
BOOTSTRAPPING: 'BOOTSTRAPPING',
NOT_MOUNTED: 'NOT_MOUNTED',
MOUNTING: 'MOUNTING',
MOUNTED: 'MOUNTED',
UPDATING: 'UPDATING',
UNMOUNTING: 'UNMOUNTING',
UNLOADING: 'UNLOADING',
SKIP_BECAUSE_BROKEN: 'SKIP_BECAUSE_BROKEN',
LOAD_ERROR: 'LOAD_ERROR',
};
export const initMicroApps = () => {
/* eslint-disable */
/* eslint-disable */
const config = window.globalConfig || {};
//createStoreage.get('globalConfig');
const application = config && config.products || [];
let products = [];
application && Array.isArray(application) && application.length > 0 && application.map(item => {
if(item.PackageName === 'report') {
if (item.PackageName === 'report') {
products.push({
name: item.PackageName,
entry: item.RouteUrl,
......@@ -67,13 +67,13 @@ export const initMicroApps = () => {
}
})
}
});
const entrys =
process.env.NODE_ENV !== 'production' ?
micorConfig.dev :
products;
micorConfig.dev :
products;
registerMicroApps(
entrys.map(item => {
item.loader = loader;
......@@ -83,40 +83,40 @@ export const initMicroApps = () => {
// eslint-
// disable-next-line no-undef
globalConfig: /civweb4/.test(item.name) ? Object.assign({}, config, {
homepage: config.homepage ? config.homepage.replace(/civweb\//, ''): config.homepage
}): config,
homepage: config.homepage ? config.homepage.replace(/civweb\//, '') : config.homepage
}) : config,
//createStoreage.get('globalConfig'),
XMLHttpRequest: window.XMLHttpRequest,
};
return item;
}), {
beforeLoad: [
app => {
store.dispatch(actionCreators.updateMicroMounted(true));
Logger.info('[LifeCycle] before load %c%s');
},
],
beforeMount: [
app => {
Logger.info(`[LifeCycle] before mount %c%s ${app.name}`);
},
],
afterMount: [
app => {
store.dispatch(actionCreators.updateMicroMounted(false));
Logger.info(`[LifeCycle] after mount %c%s ${app.name}`);
},
],
beforeUnmount: [
app => {
window.share.event.removeAllListeners('changeRoute');
Logger.info(`[LifeCycle] after unmount %c%s ${app.name}`);
window.globalConfig = {}
createStoreage.remove(`__PANDA_STORE__${location.hostname}`)
},
],
afterUnmount: [app => {}],
},
beforeLoad: [
app => {
store.dispatch(actionCreators.updateMicroMounted(true));
Logger.info('[LifeCycle] before load %c%s');
},
],
beforeMount: [
app => {
Logger.info(`[LifeCycle] before mount %c%s ${app.name}`);
},
],
afterMount: [
app => {
store.dispatch(actionCreators.updateMicroMounted(false));
Logger.info(`[LifeCycle] after mount %c%s ${app.name}`);
},
],
beforeUnmount: [
app => {
window.share.event.removeAllListeners('changeRoute');
Logger.info(`[LifeCycle] after unmount %c%s ${app.name}`);
window.globalConfig = {}
createStoreage.remove(`__PANDA_STORE__${location.hostname}`)
},
],
afterUnmount: [app => { }],
},
);
const globalStore = store.getState().toJS();
const { setGlobalState } = initGlobalState({
......@@ -126,14 +126,14 @@ export const initMicroApps = () => {
global: globalStore.global
});
const globalConfig = window.globalConfig;
globalConfig.homepage = globalConfig.homepage && /civweb4/.test(globalConfig.homepage) ? config.homepage.replace(/civweb4\//, ''): globalConfig.homepage;
globalConfig.homepage = globalConfig.homepage && /civweb4/.test(globalConfig.homepage) ? config.homepage.replace(/civweb4\//, '') : globalConfig.homepage;
console.log(globalConfig);
setGlobalState({
// eslint-disable-next-line no-undef
globalConfig: globalConfig,
globalConfig: globalConfig,
//createStoreage.get('globalConfig'),
});
microStore.set("props:globalConfig", {
globalConfig: globalConfig,
global: globalStore.global
......@@ -215,20 +215,20 @@ export const initMicroApps = () => {
export const defaultApp = () => {
// eslint-disable-next-line no-undef
const config = window.globalConfig;
if (config && config.token) {
// 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 = _.isNull(config.homepage) ? '/index': '/' + config.homepage;
// setDefaultMountApp(`/${pkg.name.toLocaleLowerCase()}/${basePath}${homepage}`);
// createStoreage.set('init_web4', true)
// }
// let homepage = config.homepage.replace('civweb4/', '');
const url = !config.home ? `/civbase/civweb4/${config.homepage.replace(/^\//, '')}`: `/civbase/${config.homepage.replace(/^\//, '')}`;
const url = !config.home ? `/civbase/civweb4/${config.homepage.replace(/^\//, '')}` : `/civbase/${config.homepage.replace(/^\//, '')}`;
setDefaultMountApp(url);
// if(config.homepage.indexOf('civweb4') > -1) createStoreage.set('init_web4', true);
}
......@@ -243,19 +243,19 @@ export const defaultApp = () => {
*/
window.app = {
modules: {},
require: function(request, method) {
if(request !== '.' && this.modules[request]) {
require: function (request, method) {
if (request !== '.' && this.modules[request]) {
console.log('method', method);
return _.isFunction(this.modules[request]) ? this.modules[request](): _.isFunction(this.modules[request][method]) && this.modules[request][method]();
return _.isFunction(this.modules[request]) ? this.modules[request]() : _.isFunction(this.modules[request][method]) && this.modules[request][method]();
}
if(request === '.') {
return
if (request === '.') {
return
}
return _.isFunction(this.modules[request]) && this.modules[request]();
},
define: function(name, context, index) {
define: function (name, context, index) {
let keys = context.keys();
for (let key of keys) {
let parts = name.indexOf('@') > -1 ? [name, ...(key.slice(1).split('/'))] : (name + key.slice(1)).split('/');
......@@ -274,7 +274,7 @@ window.app = {
this.modules[name] = this.modules[name][index];
}
},
init: function(namespace, reducers) {
init: function (namespace, reducers) {
[namespace] = reducers;
}
};
......@@ -307,7 +307,7 @@ window.app.define('@wisdom-utils/components', require.context('../node_modules/@
/**
* arcgismap
*/
// window.app.define('@wisdom-map/arcgismap', require.context('../node_modules/@wisdom-map/arcgismap/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
window.app.define('@wisdom-map/arcgismap', require.context('../node_modules/@wisdom-map/arcgismap/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
// // window.app.define('@wisdom-map/arcgismap/lib/widgets', require.context('../node_modules/@wisdom-map/arcgismap/lib/widgets', true, /^.\/(lib\/)?[^\/]+\.js$/));
// window.app.define('@wisdom-map/arcgismap/lib/arcgisapi/4.20/@arcgis/core', require.context('../node_modules/@wisdom-map/arcgismap/lib/arcgisapi/4.20/@arcgis/core', true, /^.\/(arcgisapi\/)?[^\/]+\.js$/));
// window.app.define('@wisdom-map/arcgismap/lib/arcgisapi/4.20/@arcgis/core/chunks', require.context('../node_modules/@wisdom-map/arcgismap/lib/arcgisapi/4.20/@arcgis/core/chunks', true, /^.\/(arcgisapi\/)?[^\/]+\.js$/));
......
......@@ -4,7 +4,7 @@ import { connect } from 'react-redux';
import { actionCreators } from '@/containers/App/store';
import _ from 'lodash';
// import { AMapScene } from '@wisdom-map/Amap';
// import { ArcGISMap } from '@wisdom-map/arcgismap';
import { ArcGISMap } from '@wisdom-map/arcgismap';
// import arcgisConfig from '@wisdom-map/arcgismap/lib/arcgisapi/4.20/@arcgis/core/config';
// import pkg from '../../../package.json';
// arcgisConfig.assetsPath = `${window.location.origin}/${pkg.name.toLocaleLowerCase()}/assets`;
......@@ -22,14 +22,14 @@ class Map extends React.PureComponent {
}
transformMapsetting(mapsettings) {
// let layers = mapsettings.layers;
// layers = layers.map(item => {
// item.url = /^\//.test(item.url) ? `/${item.url}`: item.url;
// return item;
// })
// return Object.assign({}, mapsettings, {
// layers: layers
// });
let layers = mapsettings.layers;
layers = layers.map(item => {
item.url = /^\//.test(item.url) ? `/${item.url}` : item.url;
return item;
})
return Object.assign({}, mapsettings, {
layers: layers
});
}
destroyAMap() {
......@@ -80,7 +80,7 @@ class Map extends React.PureComponent {
}
getArcGISMap(map) {
// this.props.updageMapView(map);
this.props.updageMapView(map);
}
show() {
......@@ -96,17 +96,17 @@ class Map extends React.PureComponent {
}
render() {
// return (
// <>
// {
// this.state.type === 'AMap' ? (
// <div {...this.state} getMapInfo={this.getAMap.bind(this)}/>
// ) : (
// <ArcGISMap config={this.state.options} getMapInfo={this.getArcGISMap.bind(this)}/>
// )
// }
// </>
// )
return (
<>
{
this.state.type === 'AMap' ? (
<div {...this.state} getMapInfo={this.getAMap.bind(this)} />
) : (
<ArcGISMap config={this.state.options} getMapInfo={this.getArcGISMap.bind(this)} />
)
}
</>
)
}
}
const mapStateToProps = state => ({});
......
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