Commit aa701b02 authored by lihonglin's avatar lihonglin

feat: arcgis支持

parents 3f7ef70e 7b889aef
Pipeline #46477 passed with stages
in 45 seconds
......@@ -4,9 +4,9 @@ const defaultSetting = require('./defaultSetting');
const cesiumBuild = '../node_modules/cesium/Build/Cesium';
const pkgName = require('../package.json').name;
// eslint-disable-next-line import/order
const { REACT_APP_ENV } = process.env;
const path = require('path');
const CESIUM_BASE_URL = `/${pkgName}`;
const { REACT_APP_ENV } = process.env;
module.exports = {
// mfsu: {},
webpack5: {},
......@@ -87,6 +87,30 @@ 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',
},
],
define: {
CESIUM_BASE_URL: JSON.stringify(CESIUM_BASE_URL).replace(/\"/g, ''),
},
alias: {
cesium: path.resolve(__dirname, cesiumBuild),
},
workerLoader: {},
copy: [
{
......
......@@ -27,8 +27,8 @@ export default {
container: '#micro-container',
activeRule: '/civbase/report',
props: {
origin: `//127.0.0.1:8345`
}
origin: `//127.0.0.1:8345`,
},
},
{
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:8686';
// 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,
......
......@@ -20,25 +20,18 @@ module.exports = opts => {
const preset = {
presets: [
opts.env && [
'@babel/preset-env',
require('@umijs/deps/compiled/babel/preset-env'),
{
...mergeConfig(defaultEnvConfig,{}),
modules: false,
...opts.env
},
],
// opts.react && ['@babel/preset-react'],
// opts.typescript && [
// '@babel/preset-typescript',
// {
// allowNamespaces: true,
// },
// ],
].filter(Boolean),
plugins: [
['@babel/plugin-proposal-optional-chaining', { loose: false }],
['@babel/plugin-proposal-nullish-coalescing-operator', { loose: false }],
'@babel/plugin-syntax-top-level-await',
require('@umijs/deps/compiled/babel/plugin-syntax-top-level-await').default,
['@babel/plugin-transform-destructuring', { loose: false }],
// opts.typescript && ['babel-plugin-transform-typescript-metadata'],
['@babel/plugin-proposal-decorators', { legacy: true }],
......@@ -58,7 +51,7 @@ module.exports = opts => {
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-transform-react-jsx',
opts.transformRuntime && [
'@babel/plugin-transform-runtime',
require('@umijs/deps/compiled/babel/plugin-transform-runtime').default,
{
version: require('@babel/runtime/package.json').version,
absoluteRuntime: dirname(
......@@ -98,11 +91,23 @@ module.exports = opts => {
'@umijs/babel-plugin-import-to-await-require',
opts.importToAwaitRequire,
],
'react-activation/babel'
// opts.lockCoreJS3 && [
// '@umijs/babel-plugin-lock-core-js-3',
// opts.lockCoreJS3,
// ],
'react-activation/babel',
opts.lockCoreJS3 && [
'@umijs/babel-plugin-lock-core-js-3',
opts.lockCoreJS3,
],
opts.noAnonymousDefaultExport && [
require.resolve('@umijs/babel-plugin-no-anonymous-default-export'),
],
[
require('@umijs/deps/compiled/babel/plugin-proposal-record-and-tuple')
.default,
{
syntaxType: 'hash',
polyfillModuleName: '@umijs/deps/reexported/record-tuple-polyfill',
importPolyfill: true,
},
],
].filter(Boolean),
env: {
production: {
......
......@@ -215,7 +215,7 @@ module.exports = options => {
chainConfig.module
.rule('js')
.test(/\.(js|mjs|jsx|ts|tsx)$/)
.include.add([cwd, ...(process.env.APP_ROOT ? [process.cwd()] : [])])
.include.add([/node_modules\/@esri/, cwd, ...(process.env.APP_ROOT ? [process.cwd()] : [])])
.end()
.exclude.add(/node_modules/)
.add(/\.mfsu/)
......
......@@ -22,7 +22,7 @@
"build": "cross-env NODE_ENV=production node --max_old_space_size=4096 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",
......@@ -93,13 +93,16 @@
"@amap/amap-jsapi-loader": "^1.0.1",
"@ant-design/colors": "^5.0.1",
"@ant-design/icons": "^4.0.0",
"@ant-design/pro-form": "^1.42.1",
"@ant-design/pro-layout": "^6.24.1",
"@ant-design/pro-skeleton": "^1.0.0-beta.2",
"@ant-design/pro-table": "^2.5.3",
"@ant-design/pro-utils": "^1.10.4",
"@babel/polyfill": "7.4.3",
"@babel/runtime": "^7.10.5",
"@wisdom-cesium/cesium": "^1.0.64",
"@esri/arcgis-html-sanitizer": "2.9.1",
"@esri/calcite-colors": "6.0.3",
"@wisdom-cesium/cesium": "^1.0.75",
"@wisdom-components/basictable": "^1.5.16",
"@wisdom-components/empty": "^1.4.1",
"@wisdom-map/Amap": "^1.0.49-3",
......@@ -136,6 +139,7 @@
"qrcode.react": "^1.0.0",
"rc-cascader": "^2.3.2",
"react": "16.12.0",
"react-activation": "^0.9.9",
"react-dom": "16.12.0",
"react-draggable": "^4.4.3",
"react-helmet": "6.0.0-beta",
......@@ -291,7 +295,7 @@
"traverse": "^0.6.6",
"umi-webpack-bundle-analyzer": "3.6.0",
"url-loader": "1.1.2",
"webpack": "^5.65.0",
"webpack": "^5.70.0",
"webpack-chain": "6.5.1",
"webpack-cli": "4.2.0",
"webpack-dev-middleware": "5.3.0",
......
// eslint-disable-next-line import/extensions
// import arcgisConfig from '@wisdom-map/arcgismap/lib/arcgisapi/4.20/@arcgis/core/config';
import React from 'react';
// eslint-disable-next-line import/extensions
import { ArcGISMap as MapComponent } from '@wisdom-map/arcgismap';
// import MapComponent from './lib/index.js';
// eslint-disable-next-line react/prefer-stateless-function
export default class ArcGISMap extends React.Component {
render() {
// arcgisConfig.assetsPath = `${window.location.origin
// }/${pkg.name.toLocaleLowerCase()}/assets`;
return <MapComponent {...this.props} />;
}
}
@import '~antd/es/style/themes/default.less';
.view {
position: absolute;
top:0;
right: 0;
bottom: 0;
left: 0;
.loadingBox{
position: absolute;
left: calc(50% - 40px);
top: calc(50% - 23px);
color: @text-color;
}
.mapBox {
width: 100%;
height: 100%;
}
}
......@@ -60,7 +60,8 @@ export const initGlobalConfig = () => {
}
});
// eslint-disable-next-line react-hooks/rules-of-hooks
const client = params.getParams('client') || Cookies.get('city')
let client = params.getParams('client') || Cookies.get('city')
client = client && client !== 'undefined' ? client : 'city';
appService
.queryConfig({
client: client || 'city',
......@@ -72,7 +73,7 @@ export const initGlobalConfig = () => {
store.dispatch(actionCreators.getConfig(Object.assign({})));
const data = res;
if (!data.client) {
data.client = params.getParams('client') || Cookies.get('city');
data.client = client;
}
// Cookies.set('city', data.client);
store.dispatch(
......
This diff is collapsed.
......@@ -2,11 +2,11 @@
import 'kit_logger';
import _ from 'lodash';
import {
addGlobalUncaughtErrorHandler,
registerMicroApps,
runAfterFirstMounted,
setDefaultMountApp,
start,
addGlobalUncaughtErrorHandler,
registerMicroApps,
runAfterFirstMounted,
setDefaultMountApp,
start,
} from 'qiankun';
import { store as microStore } from 'microser-data';
......@@ -21,30 +21,30 @@ import actions from './actions';
// 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,50 +83,50 @@ 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 globalConfig = window.globalConfig;
// globalConfig.homepage = globalConfig.homepage && /civweb4/.test(globalConfig.homepage) ? config.homepage.replace(/civweb4\//, ''): globalConfig.homepage;
actions.setGlobalState({
// eslint-disable-next-line no-undef
globalConfig: globalConfig,
globalConfig: globalConfig,
//createStoreage.get('globalConfig'),
});
microStore.set("props:globalConfig", {
globalConfig: globalConfig,
global: globalStore.global
......@@ -208,20 +208,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(/^\//, '').replace(/^civweb4\//, '')}`: `/civbase/${config.homepage.replace(/^\//, '')}`;
const url = !config.home ? `/civbase/civweb4/${config.homepage.replace(/^\//, '').replace(/^civweb4\//, '')}` : `/civbase/${config.homepage.replace(/^\//, '')}`;
setDefaultMountApp(url);
// if(config.homepage.indexOf('civweb4') > -1) createStoreage.set('init_web4', true);
}
......@@ -236,19 +236,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('/');
......@@ -267,7 +267,7 @@ window.app = {
this.modules[name] = this.modules[name][index];
}
},
init: function(namespace, reducers) {
init: function (namespace, reducers) {
[namespace] = reducers;
}
};
......@@ -487,6 +487,7 @@ window.app.define('@wisdom-utils/components', require.context('../node_modules/@
window.app.define('@ant-design/pro-form', require.context('../node_modules/@ant-design/pro-form/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
window.app.define('classnames', require.context('classnames', true, /^.\/index\.js$/), 'index.js');
window.app.define('@ant-design/icons', require.context('../node_modules/@ant-design/icons/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
......
......@@ -15,7 +15,6 @@ const cesiumMap = props => {
const pdView = new PdRender({
el: ref.current,
widgets,
delayWidgetRender : true,
...schemeData
})
storeRef.current = pdView
......
/* eslint-disable */
import React from 'react';
import { Spin } from 'antd';
import { connect } from 'react-redux';
import { actionCreators } from '@/containers/App/store';
import _ from 'lodash';
......@@ -12,13 +13,7 @@ import { ArcGISMap } from '@wisdom-map/arcgismap';
class Map extends React.PureComponent {
constructor(props) {
super(props);
this.options = _.merge({}, props.options);
this.state = {
type: props.options.type,
loading: true,
options: this.transformMapsetting(window.globalConfig.mapsettings),
widgets: window.globalConfig.uiwidgets,
}
this.mapManganerRef = React.createRef();
}
transformMapsetting(mapsettings) {
......@@ -109,6 +104,7 @@ class Map extends React.PureComponent {
)
}
}
const mapStateToProps = state => ({});
const mapDispatchToProps = dispatch => ({
......@@ -120,4 +116,4 @@ const mapDispatchToProps = dispatch => ({
export default connect(
mapStateToProps,
mapDispatchToProps,
)(Map);
)(CreateMap);
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