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(
......
......@@ -35,16 +35,12 @@ import { ReactSVG } from 'react-svg';
import Cookies from 'js-cookie';
import { connect } from 'react-redux';
import { Router, Switch, useHistory } from '@wisdom-utils/runtime';
import RightContent from '@/components/GlobalHeader/ExtendRightContent';
import Panel from '@/components/SliderPanel/MinPanel';
import CesiumMap from '../pages/cesiumMap';
import { actionCreators } from '@/containers/App/store';
import KeepAlive from 'react-activation'
// import CreateBaseMap from '@/pages/map';
import CreateBaseMap from '@/pages/map';
import CesiumMap from '@/pages/cesiumMap';
import KeepAlive from 'react-activation'
// import Authorized from '@/utils/Authorized';
import { findPathByLeafId, getBaseName } from '@/utils/utils';
// import { renderRoutes } from 'react-router-config';
......@@ -63,17 +59,17 @@ const homeSvg = () => (
<svg t="1631169883330" className="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2203" width="20" height="20"><path d="M423.9 487H221.7c-34.9 0-63.4-28.4-63.4-63.4V221.5c0-34.9 28.4-63.4 63.4-63.4h202.2c34.9 0 63.4 28.4 63.4 63.4v202.2c-0.1 34.9-28.5 63.3-63.4 63.3z m0-63.3v31.7-31.7zM221.7 221.5v202.2h202.1l0.1-202.2H221.7zM803.1 487H600.9c-34.9 0-63.4-28.4-63.4-63.4V221.5c0-34.9 28.4-63.4 63.4-63.4h202.2c34.9 0 63.4 28.4 63.4 63.4v202.2c0 34.9-28.5 63.3-63.4 63.3z m0-63.3v31.7-31.7zM600.9 221.5v202.2H803l0.1-202.2H600.9zM423.9 865.8H221.7c-34.9 0-63.4-28.4-63.4-63.4V600.3c0-34.9 28.4-63.4 63.4-63.4h202.2c34.9 0 63.4 28.4 63.4 63.4v202.2c-0.1 34.9-28.5 63.3-63.4 63.3z m0-63.3v31.7-31.7zM221.7 600.3v202.2h202.1l0.1-202.2H221.7zM736.9 865.8h-69.7c-71.4 0-129.6-58.1-129.6-129.6v-69.7c0-71.4 58.1-129.6 129.6-129.6h69.7c71.4 0 129.6 58.1 129.6 129.6v69.7c0 71.5-58.2 129.6-129.6 129.6z m-69.8-265.5c-36.5 0-66.2 29.7-66.2 66.2v69.7c0 36.5 29.7 66.2 66.2 66.2h69.7c36.5 0 66.2-29.7 66.2-66.2v-69.7c0-36.5-29.7-66.2-66.2-66.2h-69.7z" fill="#B2B2B2" p-id="2204"></path></svg>
);
const arrowSvg = ({fillColor = '#fff'}) => (
const arrowSvg = ({ fillColor = '#fff' }) => (
<svg t="1543324489942"
className="icon" viewBox="0 0 1024 1024"
version="1.1" xmlns="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/1999/xlink"
width="16" height="16">
<path d="M511.700683 639.423111 191.917496 319.596945 319.830771 319.596945 511.700683 511.715521 703.570595 319.596945 831.48387 319.596945Z" p-id="8626" fill={fillColor}></path>
className="icon" viewBox="0 0 1024 1024"
version="1.1" xmlns="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/1999/xlink"
width="16" height="16">
<path d="M511.700683 639.423111 191.917496 319.596945 319.830771 319.596945 511.700683 511.715521 703.570595 319.596945 831.48387 319.596945Z" p-id="8626" fill={fillColor}></path>
</svg>
);
const HomeIcon = props => <Icon component={homeSvg} {...props} style={{marginRight: '0px'}}/>;
const ArrowIcon = props => <Icon component={arrowSvg} {...props} />;
const HomeIcon = props => <Icon component={homeSvg} {...props} style={{ marginRight: '0px' }} />;
const ArrowIcon = props => <Icon component={arrowSvg} {...props} />;
// const { TabPane } = Tabs;
// const baseURI = isProd
......@@ -185,7 +181,7 @@ const Stations = props => {
);
};
const renderSite = ({data, config, loading, setLoading, action}) => {
const renderSite = ({ data, config, loading, setLoading, action }) => {
const [visible, setVisible] = useState(false);
let loaded = !!((data && !data.stations) || (Array.isArray(data.weathers) && data.weathers.length === 0));
if (config && config.userInfo && config.userInfo.site === '') {
......@@ -194,56 +190,56 @@ const renderSite = ({data, config, loading, setLoading, action}) => {
return (
<>
<Spin
indicator={antIcon}
spinning={loaded}
size="small"
style={{ marginLeft: '10px' }}
tip=""
wrapperClassName={styles.spinLoadding}>
<>
<Popover
placement="bottomLeft"
trigger="click"
content={
<Stations
data={data}
loading={loading}
setLoading={setLoading}
action={action}
indicator={antIcon}
spinning={loaded}
size="small"
style={{ marginLeft: '10px' }}
tip=""
wrapperClassName={styles.spinLoadding}>
<>
<Popover
placement="bottomLeft"
trigger="click"
content={
<Stations
data={data}
loading={loading}
setLoading={setLoading}
action={action}
/>
}
arrowPointAtCenter
overlayClassName={classNames(styles.stationsWrapper, styles.stationsTop)}
onVisibleChange={visible => setVisible(visible)}
>
{
Array.isArray(data.stations) ? (
<div className={layoutStyles.toggleSite}>
<img src={require('../assets/basic/site.png')} className={layoutStyles.site} />
<span className={layoutStyles.name}>{data.currentStationName}</span>
<ArrowIcon className={layoutStyles.arrow} fillColor="#fff"
style={{
transform: !visible ? `rotate(0deg)` : `rotate(180deg)`,
}}
/>
}
arrowPointAtCenter
overlayClassName={classNames(styles.stationsWrapper, styles.stationsTop)}
onVisibleChange={visible => setVisible(visible)}
>
{
Array.isArray(data.stations) ? (
<div className={layoutStyles.toggleSite}>
<img src={require('../assets/basic/site.png')} className={layoutStyles.site}/>
<span className={layoutStyles.name}>{data.currentStationName}</span>
<ArrowIcon className={layoutStyles.arrow} fillColor="#fff"
style={{
transform: !visible ? `rotate(0deg)` : `rotate(180deg)`,
}}
/>
</div>
): null
}
</Popover>
</>
</Spin>
{data.weathers && Object.keys(data.weathers).length > 0 ? (
<span
className={layoutStyles.weatcher}
style={{
borderLeft:
data.stations.length === 0 ? '0px' : '1px solid rgba(256, 256, 256, 0.3)',
}}
>
<img src={data.weathers && data.weathers.icon} className={layoutStyles.icon}/>
<span className={layoutStyles.text}>{data.weathers && data.weathers.text}</span>
</span>
) : null}
</div>
) : null
}
</Popover>
</>
</Spin>
{data.weathers && Object.keys(data.weathers).length > 0 ? (
<span
className={layoutStyles.weatcher}
style={{
borderLeft:
data.stations.length === 0 ? '0px' : '1px solid rgba(256, 256, 256, 0.3)',
}}
>
<img src={data.weathers && data.weathers.icon} className={layoutStyles.icon} />
<span className={layoutStyles.text}>{data.weathers && data.weathers.text}</span>
</span>
) : null}
</>
)
......@@ -284,13 +280,13 @@ const BasicLayout = props => {
);
const parentMenuName = initSelectRoute && initSelectRoute.parent && initSelectRoute.parent.label;
if(parentMenuName) {
if (parentMenuName) {
let currentChildrenRoute = currentRoutes.routes.find(item => item.name === parentMenuName);
if(!currentChildrenRoute) {
if (!currentChildrenRoute) {
currentChildrenRoute = initSelectRoute
}
let childrenName = currentChildrenRoute ? currentChildrenRoute.name: parentMenuName;
if(currentChildrenRoute.routes) {
let childrenName = currentChildrenRoute ? currentChildrenRoute.name : parentMenuName;
if (currentChildrenRoute.routes) {
const active = currentChildrenRoute.routes.find(item => item.name === initSelectRoute.name);
setTabActiveKey(active.path)
} else {
......@@ -298,7 +294,7 @@ const BasicLayout = props => {
}
const initSelectIndex = currentRoutes.routes.findIndex(item => item.name === childrenName);
setSelectIndex(initSelectIndex);
currentChildrenRoute && currentChildrenRoute.routes ? setChildrenRoutes(currentChildrenRoute.routes): setChildrenRoutes([currentChildrenRoute]);
currentChildrenRoute && currentChildrenRoute.routes ? setChildrenRoutes(currentChildrenRoute.routes) : setChildrenRoutes([currentChildrenRoute]);
} else {
let url = props.global && props.global.hasOwnProperty('get') && props.global.get('homepage')
......@@ -362,7 +358,7 @@ const BasicLayout = props => {
useEffect(() => {
siteAction.setGlobalConfig(props.global);
if (!Cookies.get('token')) {
let client = props.global && props.global.client;
let client = props.global && props.global.hasOwnProperty('client') ? props.global.get('client') : null;
client = client !== 'undefined' && !_.isNull(client) && !_.isUndefined(client) ? client: 'city';
let generateType = props.global && props.global.hasOwnProperty('get') ? props.global.get('generateType') : null;
generateType = !_.isNull(generateType) && !_.isUndefined(generateType) && generateType !== 'undefined' ? `&generateType=${generateType}` : '';
......@@ -388,12 +384,12 @@ const BasicLayout = props => {
* web4全屏退出,切换三级菜单高亮
*/
useEffect(() => {
if(selectIndex !== -1) {
if (selectIndex !== -1) {
const routes = currentRoutes.routes[selectIndex];
if(routes) {
if( routes && routes.routes) {
if (routes) {
if (routes && routes.routes) {
const route = routes && routes.routes && routes.routes.find(item => item.path === decodeURI(window.location.pathname.replace('/civbase', '')));
if(route && route.path) {
if (route && route.path) {
setTabActiveKey(route.path)
}
}
......@@ -427,23 +423,23 @@ const BasicLayout = props => {
const handlerSecond = (item, index) => {
let current = void 0;
if(item && item.routes) {
if (item && item.routes) {
setChildrenRoutes(item.routes);
current = item.routes[0];
} else{
} else {
setChildrenRoutes([item]);
current = item;
}
setTabActiveKey(current.path);
setSelectIndex(index);
if(current.routes) {
if (current.routes) {
setSelectedKeys([current.routes[0].href]);
window.history.pushState(null, '', `/civbase${current.routes[0].path}`);
} else {
if(/iframe/.test(current.path)) {
if (/iframe/.test(current.path)) {
history.push({
pathname:'/iframe',
pathname: '/iframe',
state: current.params
})
} else {
......@@ -470,7 +466,7 @@ const BasicLayout = props => {
const handleSelectMenuItem = (item) => {
setTabActiveKey(item);
if(item.indexOf('web_console') === -1) {
if (item.indexOf('web_console') === -1) {
window.history.pushState(null, '', `/civbase${item}`);
}
}
......@@ -486,7 +482,7 @@ const BasicLayout = props => {
};
const renderChildrenMenu = (route) => {
const routes = (route.routes || []).map(item => {
const routes = (route.routes || []).map(item => {
item.key = item.href;
return item;
});
......@@ -496,13 +492,13 @@ const BasicLayout = props => {
(routes || []).map((item, index) => {
return (
<>
<Menu.Item key={item.href}>
<Menu.Item key={item.href}>
<div>
<span></span>
<span>{item.name}</span>
</div>
</Menu.Item>
<Divider style={{width: '80%', minWidth: '80%', margin: '0 auto'}}></Divider>
<Divider style={{ width: '80%', minWidth: '80%', margin: '0 auto' }}></Divider>
</>
)
})
......@@ -514,10 +510,10 @@ const BasicLayout = props => {
<Dropdown overlay={menu} overlayClassName={`${prefixCls}-dropdown-custom-menu`}>
<div >
{
/.svg/.test(route.extData.icon) ?<ReactSVG src={route.extData.icon} style={{width: '18px', height: '18px', position: 'relative', top: '-3px'}}/>: <img src={route.extData.icon} style={{width: '18px', height: '18px'}}/>
/.svg/.test(route.extData.icon) ? <ReactSVG src={route.extData.icon} style={{ width: '18px', height: '18px', position: 'relative', top: '-3px' }} /> : <img src={route.extData.icon} style={{ width: '18px', height: '18px' }} />
}
<span style={{marginLeft: '8px'}}>{route.name} </span>
<DownOutlined style={{position: 'relative', right: '-10px'}}/>
<span style={{ marginLeft: '8px' }}>{route.name} </span>
<DownOutlined style={{ position: 'relative', right: '-10px' }} />
</div>
</Dropdown>
<Divider type="vertical" />
......@@ -525,7 +521,7 @@ const BasicLayout = props => {
)
}
const handlerIndustry = event => {
const handlerIndustry = event => {
props.global.get('userInfo.site') ? history.push(`/industry`) : void 0;
};
......@@ -540,100 +536,100 @@ const BasicLayout = props => {
{
props.global.layout !== 'blank' ? (
<div className={classNames(layoutStyles.basicLayout)}>
<div className={layoutStyles['layout-has-slider']} style={{minHeight: '100%'}}>
<div style={{
width: collapse ? '48px': '80px',
overflow: 'hidden',
flex: collapse ? '0 0 48px': '0 0 80px',
maxWidth: collapse ? '48px':'80px',
minWidth: collapse ? '48px':'80px',
transition: 'background-color 0.3s ease 0s, min-width 0.3s ease 0s, max-width 0.3s cubic-bezier(0.645, 0.045, 0.355, 1) 0s'
}}></div>
<aside className={classNames(layoutStyles.layoutSlider, layoutStyles.fixed, {
[layoutStyles.collapsed]: collapse
})}>
<div className={layoutStyles['layout-slider-childern']}>
<div className={layoutStyles.sliderMenu} style={{flex: '1 1 0%', overflow: 'hidden auto'}}>
<ul className={classNames(layoutStyles.menu)} style={{minHeight: '0px', marginBottom: '0px'}}>
<li className={classNames(layoutStyles['menu-item'])} onClick={handleToggleSystem}>
<Tooltip placement="right" title={collapse ? currentRoutes.name: ''}>
<a>
{
(currentRoutes && currentRoutes.extData && currentRoutes.extData.icon) && <img src={currentRoutes.extData.icon} />
}
{
collapse ? null: <span className={classNames(layoutStyles.text, layoutStyles.currentText)}>{currentRoutes && currentRoutes.name}</span>
}
</a>
</Tooltip>
</li>
</ul>
<div className={layoutStyles.splitLine}></div>
<ul className={classNames(layoutStyles.menu, 'menu-vertical')}>
{
currentRoutes && (currentRoutes.routes || []).filter(item => !item.hideInMenu).map((item, index) => {
return (
<React.Fragment key={index}>
<li key={index} className={classNames(layoutStyles['menu-item'], { [layoutStyles['active']]: index === selectIndex })} onClick={() => handlerSecond(item, index)}>
<Tooltip placement="right" title={collapse ? item.name: ''}>
<a>
{
item.icon ? item.icon: item.extData && /.svg/.test(item.extData.icon) ? <ReactSVG src={item.extData.icon} style={{width: '20px', height: '20px'}} className={layoutStyles.icon}/>: item.extData && <img src={item.extData.icon} />
}
{
collapse ? item.extData && <span className={classNames(layoutStyles.text)}>{(item.extData.shortName || item.name).substr(0, 2)}</span>: <span className={classNames(layoutStyles.text)}>{item.name}</span>
}
</a>
</Tooltip>
</li>
<Divider style={{border: '1px solid rgb(49, 53, 62, 0.3)', margin: '0 auto', minWidth: '80%', width: '80%'}}/>
</React.Fragment>
)
})
}
</ul>
</div>
<div className="ant-pro-sider-links" >
<ul className="ant-menu ant-menu-root ant-menu-inline ant-menu-dark ant-pro-sider-link-menu" role="menu" tabIndex="0" >
<li className="ant-menu-item ant-menu-item-only-child ant-pro-sider-collapsed-button" role="menuitem" tabIndex="-1" onClick={handlerCollapsed}>
<span className="ant-menu-title-content">
<span role="img" aria-label="menu-fold" className="anticon anticon-menu-fold">
<svg viewBox="64 64 896 896" focusable="false" width="1em" height="1em" fill="currentColor" aria-hidden="true">
<path d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM115.4 518.9L271.7 642c5.8 4.6 14.4.5 14.4-6.9V388.9c0-7.4-8.5-11.5-14.4-6.9L115.4 505.1a8.74 8.74 0 000 13.8z"></path>
</svg>
</span>
</span>
</li>
</ul>
<div aria-hidden="true" style={{display: 'none'}}></div>
</div>
</div>
</aside>
<div className={layoutStyles.layout} style={{width: 'calc(100% - 80px)'}}>
<Panel
visible={toggleSystem}
keyboard
onClose={ () => setToggleSystem(false)}
currentMenuIndex={props.currentMenuIndex}
onChange={index => handleUpdateCurrentIndex(index)}
data={props.route.routes || []}
/>
<SettingDrawer
settings={defaultSetting}
onSettingChange={config => updateSettings(config)}
publicPath={`${window.location.origin}/${basename}/theme`}
/>
<div className={classNames(layoutStyles['basicLayout-content'], {
[layoutStyles['hook_web4']]: location.pathname.startsWith('/civbase/civweb4')
})}>
<div className={layoutStyles[`${props.rootPrefix}-page-container`]} style={{paddingTop: '0px'}}>
<div className={layoutStyles[`${props.rootPrefix}-page-container-warp`]}>
<div className={layoutStyles[`${props.rootPrefix}-page-header`]} style={{position: 'fixed'}}>
<img src={require('../assets/basic/图层 998@2x.png')} style={{width: '100%'}}/>
<div className={layoutStyles['layout-has-slider']} style={{ minHeight: '100%' }}>
<div style={{
width: collapse ? '48px' : '80px',
overflow: 'hidden',
flex: collapse ? '0 0 48px' : '0 0 80px',
maxWidth: collapse ? '48px' : '80px',
minWidth: collapse ? '48px' : '80px',
transition: 'background-color 0.3s ease 0s, min-width 0.3s ease 0s, max-width 0.3s cubic-bezier(0.645, 0.045, 0.355, 1) 0s'
}}></div>
<aside className={classNames(layoutStyles.layoutSlider, layoutStyles.fixed, {
[layoutStyles.collapsed]: collapse
})}>
<div className={layoutStyles['layout-slider-childern']}>
<div className={layoutStyles.sliderMenu} style={{ flex: '1 1 0%', overflow: 'hidden auto' }}>
<ul className={classNames(layoutStyles.menu)} style={{ minHeight: '0px', marginBottom: '0px' }}>
<li className={classNames(layoutStyles['menu-item'])} onClick={handleToggleSystem}>
<Tooltip placement="right" title={collapse ? currentRoutes.name : ''}>
<a>
{
(currentRoutes && currentRoutes.extData && currentRoutes.extData.icon) && <img src={currentRoutes.extData.icon} />
}
{
collapse ? null : <span className={classNames(layoutStyles.text, layoutStyles.currentText)}>{currentRoutes && currentRoutes.name}</span>
}
</a>
</Tooltip>
</li>
</ul>
<div className={layoutStyles.splitLine}></div>
<ul className={classNames(layoutStyles.menu, 'menu-vertical')}>
{
currentRoutes && (currentRoutes.routes || []).filter(item => !item.hideInMenu).map((item, index) => {
return (
<React.Fragment key={index}>
<li key={index} className={classNames(layoutStyles['menu-item'], { [layoutStyles['active']]: index === selectIndex })} onClick={() => handlerSecond(item, index)}>
<Tooltip placement="right" title={collapse ? item.name : ''}>
<a>
{
item.icon ? item.icon : item.extData && /.svg/.test(item.extData.icon) ? <ReactSVG src={item.extData.icon} style={{ width: '20px', height: '20px' }} className={layoutStyles.icon} /> : item.extData && <img src={item.extData.icon} />
}
{
collapse ? item.extData && <span className={classNames(layoutStyles.text)}>{(item.extData.shortName || item.name).substr(0, 2)}</span> : <span className={classNames(layoutStyles.text)}>{item.name}</span>
}
</a>
</Tooltip>
</li>
<Divider style={{ border: '1px solid rgb(49, 53, 62, 0.3)', margin: '0 auto', minWidth: '80%', width: '80%' }} />
</React.Fragment>
)
})
}
</ul>
</div>
<div className="ant-pro-sider-links" >
<ul className="ant-menu ant-menu-root ant-menu-inline ant-menu-dark ant-pro-sider-link-menu" role="menu" tabIndex="0" >
<li className="ant-menu-item ant-menu-item-only-child ant-pro-sider-collapsed-button" role="menuitem" tabIndex="-1" onClick={handlerCollapsed}>
<span className="ant-menu-title-content">
<span role="img" aria-label="menu-fold" className="anticon anticon-menu-fold">
<svg viewBox="64 64 896 896" focusable="false" width="1em" height="1em" fill="currentColor" aria-hidden="true">
<path d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM115.4 518.9L271.7 642c5.8 4.6 14.4.5 14.4-6.9V388.9c0-7.4-8.5-11.5-14.4-6.9L115.4 505.1a8.74 8.74 0 000 13.8z"></path>
</svg>
</span>
</span>
</li>
</ul>
<div aria-hidden="true" style={{ display: 'none' }}></div>
</div>
</div>
</aside>
<div className={layoutStyles.layout} style={{ width: 'calc(100% - 80px)' }}>
<Panel
visible={toggleSystem}
keyboard
onClose={() => setToggleSystem(false)}
currentMenuIndex={props.currentMenuIndex}
onChange={index => handleUpdateCurrentIndex(index)}
data={props.route.routes || []}
/>
<SettingDrawer
settings={defaultSetting}
onSettingChange={config => updateSettings(config)}
publicPath={`${window.location.origin}/${basename}/theme`}
/>
<div className={classNames(layoutStyles['basicLayout-content'], {
[layoutStyles['hook_web4']]: location.pathname.startsWith('/civbase/civweb4')
})}>
<div className={layoutStyles[`${props.rootPrefix}-page-container`]} style={{ paddingTop: '0px' }}>
<div className={layoutStyles[`${props.rootPrefix}-page-container-warp`]}>
<div className={layoutStyles[`${props.rootPrefix}-page-header`]} style={{ position: 'fixed' }}>
<img src={require('../assets/basic/图层 998@2x.png')} style={{ width: '100%' }} />
<div className={layoutStyles.header}>
<a className={layoutStyles.logo} onClick={handlerIndustry}>
<img src={`${logo}`} alt="logo"/>
<img src={`${logo}`} alt="logo" />
</a>
<div className={layoutStyles.title}>{props.global.title}</div>
{
......@@ -645,28 +641,28 @@ const BasicLayout = props => {
action: siteAction,
})
}
<RightContent/>
<RightContent />
</div>
</div>
</div>
</div>
<div className={layoutStyles['menu-item-children']}>
<Tabs activeKey={tabActiveKey} defaultActiveKey={tabActiveKey} tabBarGutter={30} tabPosition="top" onTabClick={(event) => handleSelectMenuItem(event)}>
{childrenRoutes.map((item, index) => (
<div className={layoutStyles['menu-item-children']}>
<Tabs activeKey={tabActiveKey} defaultActiveKey={tabActiveKey} tabBarGutter={30} tabPosition="top" onTabClick={(event) => handleSelectMenuItem(event)}>
{childrenRoutes.map((item, index) => (
<>
<TabPane
className="only-last-children"
tab={
<>
{
item.routes ? renderChildrenMenu(item) : (
item.routes ? renderChildrenMenu(item) : (
<>
{
item.icon ? item.icon: item.extData && /.svg/.test(item.extData.icon) ? <ReactSVG src={item.extData.icon} style={{width: '18px', height: '18px'}}/>:item.extData && <img src={item.extData.icon} style={{width: '18px', height: '18px'}}/>
item.icon ? item.icon : item.extData && /.svg/.test(item.extData.icon) ? <ReactSVG src={item.extData.icon} style={{ width: '18px', height: '18px' }} /> : item.extData && <img src={item.extData.icon} style={{ width: '18px', height: '18px' }} />
}
<span className={layoutStyles['menu-item-name']}>{item.name}</span>
{
childrenRoutes.length === 1 ? null: <Divider type="vertical" />
childrenRoutes.length === 1 ? null : <Divider type="vertical" />
}
</>
......@@ -675,8 +671,8 @@ const BasicLayout = props => {
</>
}
key={item.path}
>
</TabPane>
>
</TabPane>
</>
))}
</Tabs>
......@@ -689,18 +685,22 @@ const BasicLayout = props => {
{
window.location.pathname.startsWith('/civbase/civ_3d') ? <KeepAlive><CesiumMap /></KeepAlive> : window.location.pathname.startsWith('/civbase/civ_webgis') ? <CreateBaseMap options={{ type: 'ArcgisMap' }}/> : null
}
{
window.location.pathname.startsWith('/civbase/civ_webgis') ? <CreateBaseMap /> : null
}
<div id="micro-container" className="subapp-container">
{/*<CreateBaseMap/>*/}
{props.children}
</div>
{props.children}
</PageContainer>
</div>
</div>
</div>
</div>
</div>
</div>): (
): (
<PageContainer style={{paddingTop: '0px', height: '100%'}}>
{
renderRoutes(props.route.routes)
......@@ -709,6 +709,10 @@ const BasicLayout = props => {
{
window.location.pathname.startsWith('/civbase/civ_3d') ? <KeepAlive><CesiumMap /></KeepAlive> : window.location.pathname.startsWith('/civbase/civ_webgis') ? <CreateBaseMap options={{ type: 'ArcgisMap' }}/> : null
}
{
window.location.pathname.startsWith('/civbase/civ_webgis') ? <CreateBaseMap /> : null
}
<div id="micro-container" className="subapp-container">
{/*<CreateBaseMap/>*/}
{props.children}
......@@ -717,7 +721,7 @@ const BasicLayout = props => {
)
}
</SecurityLayout>);
</SecurityLayout>);
};
const mapStateToProps = state => ({
......
......@@ -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