Commit 125efa35 authored by 邓晓峰's avatar 邓晓峰

feat: 集成三维GIS

parent 068dbe86
This diff was suppressed by a .gitattributes entry.
const slash = require('slash2');
const proxy = require('./proxy');
const defaultSetting = require('./defaultSetting');
const cesiumBuild = '../node_modules/cesium/Build/Cesium';
const pkgName = require('../package.json').name;
// eslint-disable-next-line import/order
const path = require('path');
const CESIUM_BASE_URL = `/${pkgName}`;
const { REACT_APP_ENV } = process.env;
module.exports = {
// mfsu: {},
......@@ -81,5 +86,30 @@ module.exports = {
javascriptEnabled: true,
},
workerLoader: {},
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),
},
// esbuild: {}
};
......@@ -16,10 +16,10 @@ export default {
// activeRule: '/civbase/civ_water',
// },
{
name: 'civ_pandawork',
entry: `//${window.location.hostname}:8081/civ_pandawork`,
name: 'civ_configuration',
entry: `//${window.location.hostname}:8080/civ_configuration`,
container: '#micro-container',
activeRule: '/civbase/civ_pandawork',
activeRule: '/civbase/civ_configuration',
},
{
name: 'report',
......@@ -48,6 +48,12 @@ export default {
container: '#micro-container',
activeRule: '/civbase/middleground',
},
{
name: 'civ_3d',
entry: `//${window.location.hostname}:12000/civ_3d`,
container: '#micro-container',
activeRule: '/civbase/civ_3d',
},
],
prod: [
{
......
/* 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 = 'http://192.168.12.101:8123';
module.exports = {
assetsRoot: process.env.NODE_ENV !== 'production' ? proxyURL : './',
......
......@@ -98,6 +98,7 @@ 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,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -99,6 +99,7 @@
"@ant-design/pro-utils": "^1.10.4",
"@babel/polyfill": "7.4.3",
"@babel/runtime": "^7.10.5",
"@wisdom-cesium/cesium": "^1.0.64",
"@wisdom-components/empty": "^1.4.1",
"@wisdom-map/arcgismap": "^1.0.60-0",
"@wisdom-map/util": "^1.0.27-0",
......@@ -256,6 +257,7 @@
"prettier": "1.17.0",
"querystring-browser": "^1.0.4",
"raw-loader": "^4.0.2",
"react-activation": "^0.9.9",
"react-app-polyfill": "0.2.2",
"react-error-overlay": "6.0.8",
"react-inlinesvg": "^2.3.0",
......@@ -293,7 +295,6 @@
"webpack-theme-color-replacer": "^1.3.15",
"webpackbar": "5.0.0-3",
"whatwg-fetch": "^3.0.0",
"yorkie": "^2.0.0",
"zlib": "^1.0.5"
"yorkie": "^2.0.0"
}
}
......@@ -3,11 +3,11 @@ import * as constants from '../../constants';
/**
* 兼容老接口
*/
const transformGateWay = (url) => {
if(!/^(cityinterface|CityInterface|CityServer)/) {
return url.replace(/GeteWay/, '')
const transformGateWay = url => {
if (!/^(cityinterface|CityInterface|CityServer)/) {
return url.replace(/GeteWay/, '');
}
}
};
export const API = {
AUTHORIZATION_TOKEN: '/Identity/AuthorizationToken',
......@@ -28,7 +28,8 @@ export const API = {
process.env.NODE_ENV !== 'production'
? '/cityjson?ie=utf-8'
: 'https://pv.sohu.com',
GET_ALL_GROUPS_INFO_FORUSER: '/CityInterface/rest/Services/Portal.svc/AuthorityManage/GetAllGroupsInfoForUser',
GET_ALL_GROUPS_INFO_FORUSER:
'/CityInterface/rest/Services/Portal.svc/AuthorityManage/GetAllGroupsInfoForUser',
GET_WEATHER: '/CityInterface/rest/services/CountyProduct.svc/GetWeather',
SEND_MESSAGE_CODE:
'CityInterface/rest/services/portal.svc/SendMessVerificationCode',
......@@ -87,9 +88,10 @@ const services = {
},
getUserInfo: {
url: () => {
return window.globalConfig && window.globalConfig.hasGateWay? API.GET_GATEWAY_USER_INFO: API.GET_USER_INFO
},
url: () =>
window.globalConfig && window.globalConfig.hasGateWay
? API.GET_GATEWAY_USER_INFO
: API.GET_USER_INFO,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
......@@ -218,30 +220,31 @@ export const searchAutoCity = keywords => {
return jsonp(url, params, options);
};
export const getUserInfo = (params) => {
const url = window.globalConfig && window.globalConfig.hasGateWay? API.GET_GATEWAY_USER_INFO: API.GET_USER_INFO
export const getUserInfo = params => {
const url =
window.globalConfig && window.globalConfig.hasGateWay
? API.GET_GATEWAY_USER_INFO
: API.GET_USER_INFO;
return request({
url: url,
url,
method: constants.REQUEST_METHOD_GET,
params: params,
params,
// params: param.query,
});
}
};
export const getWebSiteConfig = (params) => {
const url = window.globalConfig &&
window.globalConfig &&
window.globalConfig.hasGateWay
? API.GET_WEB_SITE_CONFIG_GEWAY
: API.GET_WEB_SITE_CONFIG;
export const getWebSiteConfig = params => {
const url =
window.globalConfig && window.globalConfig && window.globalConfig.hasGateWay
? API.GET_WEB_SITE_CONFIG_GEWAY
: API.GET_WEB_SITE_CONFIG;
return request({
url: url,
url,
method: constants.REQUEST_METHOD_GET,
params: params,
params,
// params: param.query,
});
}
};
// 更新常用页
export const savePagePartInfo = param =>
......@@ -252,5 +255,4 @@ export const savePagePartInfo = param =>
params: param.query,
});
export default services;
......@@ -23,6 +23,7 @@ import {
SLIDER_MENU_MODE,
VALIDATE_AUTH,
MAP_VIEW,
PD_VIEW,
} from './constants';
export function getConfig(data) {
......@@ -170,6 +171,13 @@ export function updageMapView(data) {
};
}
export function updatePdCesiumView(data) {
return {
type: PD_VIEW,
data,
};
}
export function logout(data) {
// eslint-disable-next-line no-undef
createStoreage.remove('PANDA_STORE');
......@@ -180,13 +188,12 @@ 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.baseURI = window.location.origin;
window.globalConfig.hasGateWay = false;
window.globalConfig.userInfo = null;
// window.globalConfig.hasGateWay = ;
}
Cookies.set('token', '', {
path: '/',
});
......@@ -211,7 +218,7 @@ export function logout(data) {
data: {
currentMenuIndex: 0,
complexConfig: {},
globalConfig: window.globalConfig
globalConfig: window.globalConfig,
},
};
}
......@@ -20,3 +20,4 @@ export const COMPLEX_PATHNAME = 'App/COMPLEX_PATHNAME';
export const GET_MICRO_MOUNTED_STATUS = 'App/GET_MICRO_MOUNTED_STATUS';
export const LOGINOUT = 'App/LOGINOUT';
export const MAP_VIEW = 'App/MAP_VIEW';
export const PD_VIEW = 'App/PD_VIEW';
......@@ -6,8 +6,10 @@ import { store, event } from 'microser-data';
import { Storage } from '@wisdom-utils/utils';
import pkg from '../../../../package.json';
import defaultSetting from '../../../../config/defaultSetting';
import generRoutes, { generFlatRoutes } from '../../../utils/routes';
import { transformWidgets } from '../../../utils/routes';
import generRoutes, {
generFlatRoutes,
transformWidgets,
} from '../../../utils/routes';
import {
CLEAR_RCENT_KEYWORD,
COMPLEX_CONFIG,
......@@ -31,6 +33,7 @@ import {
SLIDER_MENU_MODE,
VALIDATE_AUTH,
MAP_VIEW,
PD_VIEW,
} from './constants';
const proxy = require('../../../../config/proxy');
......@@ -70,14 +73,13 @@ export const initialState = fromJS({
complexConfig: {},
complexPathName: null,
microMounted: true,
mapView: null
mapView: null,
});
/* eslint-disable default-case, no-param-reassign */
const appReducer = (state = initialState, action) => {
switch (action.type) {
case GET_CONFIG:
// eslint-disable-next-line no-debugger
// eslint-disable-next-line no-underscore-dangle
window.__INITIAL_STATE__ = Object.assign(
......@@ -90,7 +92,9 @@ const appReducer = (state = initialState, action) => {
env: process.env.NODE_ENV === 'development' ? 'daily' : 'prod',
},
);
window.arcgisAssetsPath = `${window.location.origin}/${pkg.name.toLocaleLowerCase()}/assets`;
window.arcgisAssetsPath = `${
window.location.origin
}/${pkg.name.toLocaleLowerCase()}/assets`;
// eslint-disable-next-line global-require,no-underscore-dangle
window.__INITIAL_STATE__.mdi = 'SDI';
window.__INITIAL_STATE__.menu = 'banner-left';
......@@ -103,43 +107,50 @@ const appReducer = (state = initialState, action) => {
// eslint-disable-next-line no-case-declarations
const { homepage } = window.globalConfig;
const modulePkg = {};
window.globalConfig && window.globalConfig.products && Array.isArray(window.globalConfig.products) && window.globalConfig.products.map(item => {
modulePkg[item.PackageName] = item;
});
config.widgets = transformWidgets(config.widgets);
window.globalConfig &&
window.globalConfig.products &&
Array.isArray(window.globalConfig.products) &&
window.globalConfig.products.map(item => {
modulePkg[item.PackageName] = item;
});
config.widgets = transformWidgets(config.widgets);
const generMenu = generRoutes(config.widgets || [], null, 0, modulePkg);
let flatMenu = [];
if(generMenu) {
if (generMenu) {
flatMenu = generFlatRoutes(generMenu || [], null, null, modulePkg);
}
const home = flatMenu.find(item => {
let path = decodeURI(item.path).split("|");
const path = decodeURI(item.path).split('|');
let currentPath = path[0];
if(/^\//.test(currentPath)) {
if (/^\//.test(currentPath)) {
currentPath = currentPath.replace(/^\//, '');
}
return currentPath === decodeURI(homepage)
return currentPath === decodeURI(homepage);
});
let currentMenuIndex = 0;
if(home) {
const parent = home.level >= 2 ? home.parent.parent: home.level >= 3 ? home.parent.parent.parent: home.parent;
if(parent) {
currentMenuIndex = generMenu.findIndex(item => item.name === parent.label);
if (home) {
const parent =
home.level >= 2
? home.parent.parent
: home.level >= 3
? home.parent.parent.parent
: home.parent;
if (parent) {
currentMenuIndex = generMenu.findIndex(
item => item.name === parent.label,
);
currentProduct.set('currentMenuIndex', currentMenuIndex);
store.set('updateMenuIndex', currentMenuIndex)
store.set('updateMenuIndex', currentMenuIndex);
}
}
// eslint-disable-next-line no-case-declarations
// eslint-disable-next-line no-case-declarations
window.globalConfig.home = home;
// eslint-disable-next-line no-case-declarations
window.globalConfig.home = home;
Cookies.set('city', Cookies.get('city') || window.globalConfig.client);
window.globalConfig = config;
......@@ -237,13 +248,19 @@ const appReducer = (state = initialState, action) => {
return state.merge({
complexConfig: action.data.complexConfig,
currentMenuIndex: action.data.currentMenuIndex,
globalConfig: action.data.globalConfig
globalConfig: action.data.globalConfig,
});
case MAP_VIEW:
store.set('view', action.data);
return state.merge({
mapView: action.data,
});
case PD_VIEW:
store.set('pdView', action.data);
return state.merge({
pdView: action.data,
});
default:
return state;
}
......
......@@ -3,7 +3,7 @@ import React, {
useEffect,
useRef,
useState,
useContext
useContext,
} from 'react';
import {
......@@ -18,41 +18,40 @@ 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 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 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';
......@@ -670,7 +669,11 @@ const BasicLayout = props => {
renderRoutes(props.route.routes)
}
<div id="micro-container" className="subapp-container">
{
window.location.pathname.startsWith('/civbase/civ_3d') ? <KeepAlive><CesiumMap /></KeepAlive> : null
}
<div id="micro-container" className="subapp-container">
{/*<CreateBaseMap/>*/}
{props.children}
</div>
......@@ -685,6 +688,9 @@ const BasicLayout = props => {
{
renderRoutes(props.route.routes)
}
{
window.location.pathname.startsWith('/civbase/civ_3d') ? <KeepAlive><CesiumMap /></KeepAlive> : null
}
<div id="micro-container" className="subapp-container">
{/*<CreateBaseMap/>*/}
......
......@@ -5,8 +5,8 @@ import { Redirect } from '@wisdom-utils/runtime';
import { PageLoading } from '@ant-design/pro-layout';
import { event } from 'microser-data';
import { stringify } from 'querystring';
import _ from 'lodash';
import { getBaseName } from '../utils/utils';
import _ from 'lodash';
class SecurityLayout extends React.Component {
state = {
......@@ -27,19 +27,32 @@ class SecurityLayout extends React.Component {
// const queryString = stringify({
// 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);
let client = global.client || Cookies.get('city');
client = client !== 'undefined' && !_.isNull(client) && !_.isUndefined(client) ? client: 'city';
client =
client !== 'undefined' && !_.isNull(client) && !_.isUndefined(client)
? client
: 'city';
// event.emit(?'event:initConfig');
let generateType = global.generateType;
generateType = !_.isNull(generateType) && !_.isUndefined(generateType) && generateType !== 'undefined' ? `&generateType=${generateType}` : '';
let { generateType } = global;
generateType =
!_.isNull(generateType) &&
!_.isUndefined(generateType) &&
generateType !== 'undefined'
? `&generateType=${generateType}`
: '';
return (
<Redirect to={`/user/login?client=${client}${generateType}`} render={() => window.location.reload()}/>
<Redirect
to={`/user/login?client=${client}${generateType}`}
render={() => window.location.reload()}
/>
);
}
if ((!isLogin && loading) || !isReady) {
return <PageLoading />;
}
......
import React from 'react';
import {
Helmet,
HelmetProvider,
} from 'react-helmet-async';
import { Helmet, HelmetProvider } from 'react-helmet-async';
import { connect } from 'react-redux';
import { getMenuData, getPageTitle } from '@ant-design/pro-layout';
import { renderRoutes } from '../utils/routes';
import {
getMenuData,
getPageTitle,
} from '@ant-design/pro-layout';
import styles from './UserLayout.less';
const UserLayout = props => {
......
import {PdRender, parseScheme} from '@wisdom-cesium/cesium'
import { useRef , useEffect } from 'react'
import { connect } from 'react-redux'
import { actionCreators } from '@/containers/App/store';
const cesiumMap = props => {
const ref = useRef(null)
const storeRef = useRef(null)
useEffect(() => {
const mapConfig3d = props.globalConfig?.mapConfig3d
if(!(props.globalConfig.mapsettings?.areasettings && globalConfig.mapsettings?.basemaps?.length > 0)) return
if(storeRef.current) return
const {widgets} = mapConfig3d
const schemes = parseScheme.parseSchemes(mapConfig3d)
const schemeData = parseScheme.parseDatas(schemes)
const pdView = new PdRender({
el: ref.current,
widgets,
delayWidgetRender : true,
...schemeData
})
storeRef.current = pdView
props.updatePdCesiumView(pdView)
}, [props.globalConfig?.mapConfig3d ?? {}])
return (<div style={{
inset: 0,
position : "absolute"
}} ref = {ref}></div>)
}
const mapStateToProps = state => ({
globalConfig : state.getIn(['global','globalConfig'])
})
const mapDispatchToProps = dispatch => ({
updatePdCesiumView(pdView) {
dispatch(actionCreators.updatePdCesiumView(pdView))
}
})
export default connect(mapStateToProps, mapDispatchToProps)(cesiumMap)
......@@ -11,7 +11,7 @@ const ShareFrame = props => {
return (
<Iframe
url={`${state.linkUrl}?token=${token}&loginName=${userInfo.loginName}`}
url={`http://127.0.0.1:8345/report/manageView/638220756398120960?token=${token}&loginName=${userInfo.loginName}`}
width="100%"
height="100%"
id="myId"
......
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