Commit 72797ad3 authored by lihonglin's avatar lihonglin

feat: AMap redux配置

parent 2730f6c1
Pipeline #47127 skipped with stages
......@@ -32,7 +32,7 @@ export default {
// },
{
name: 'civ_webgis',
entry: `//${window.location.hostname}:8081/civ_webgis`,
entry: `//${window.location.hostname}:8080/civ_webgis`,
container: '#micro-container',
activeRule: '/civbase/civ_webgis',
},
......
......@@ -105,9 +105,9 @@
"@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",
"@wisdom-map/Map": "^1.0.12-9",
"@wisdom-map/arcgismap": "^1.0.79-9",
"@wisdom-map/Amap": "^1.0.49-8",
"@wisdom-map/Map": "^1.0.12-17",
"@wisdom-map/arcgismap": "^1.0.79-17",
"@wisdom-map/util": "^1.0.27-0",
"@wisdom-utils/components": "0.0.14",
"@wisdom-utils/runtime": "0.0.15",
......
......@@ -7,7 +7,7 @@ import styles from './min.less';
const Categories = props => {
const [currentIndex, setCurrentIndex] = useState(props.currentMenuIndex);
const selectCategories = (event, index) => {
debugger
event.preventDefault();
event.stopPropagation();
event.nativeEvent.stopImmediatePropagation();
......
......@@ -23,6 +23,7 @@ import {
SLIDER_MENU_MODE,
VALIDATE_AUTH,
MAP_VIEW,
AMAP_VIEW,
PD_VIEW,
} from './constants';
......@@ -164,6 +165,14 @@ export function updateMicroMounted(data) {
};
}
export function updageAMapView(data) {
return {
type: AMAP_VIEW,
data,
};
}
export function updageMapView(data) {
return {
type: MAP_VIEW,
......
......@@ -20,4 +20,5 @@ 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 AMAP_VIEW = 'App/AMAP_VIEW';
export const PD_VIEW = 'App/PD_VIEW';
......@@ -33,6 +33,7 @@ import {
SLIDER_MENU_MODE,
VALIDATE_AUTH,
MAP_VIEW,
AMAP_VIEW,
PD_VIEW,
} from './constants';
......@@ -74,6 +75,7 @@ export const initialState = fromJS({
complexPathName: null,
microMounted: true,
mapView: null,
amapView: {},
});
/* eslint-disable default-case, no-param-reassign */
......@@ -257,6 +259,11 @@ const appReducer = (state = initialState, action) => {
return state.merge({
mapView: action.data,
});
case AMAP_VIEW:
store.set('view', action.data);
return state.merge({
amapView: action.data,
});
case PD_VIEW:
store.set('pdView', action.data);
return state.merge({
......
......@@ -734,10 +734,7 @@ const BasicLayout = props => {
}
{
(mapMode === 'AMap' && <AMap/>)
}
<div id="micro-container" className="subapp-container">
......
import React, { useEffect, useState } from 'react';
import { AMapScene } from '@wisdom-map/Amap';
import { connect } from 'react-redux';
import mapSetting from './config';
import { store } from 'microser-data';
const config = {
type: '2d',
viewingMode: 'global',
proxyUrl: '',
environment: {
starsEnabled: true,
},
constraints: {
rotationEnabled: false,
tilt: {
max: 179.5,
},
collision: {
enabled: false,
},
},
viewpoint: {
camera: {
position: {
x: '0.0',
y: '0.0',
z: '0.0',
spatialReference: {
wkid: '4526.0',
},
},
heading: '0.0',
tilt: '0.0',
fov: '55.0',
},
targetGeometry: {
xmin: '0.0',
ymin: '0.0',
xmax: '0.0',
ymax: '0.0',
spatialReference: {
wkid: '4526.0',
},
},
},
basemaps: [
{
id: '高德地形',
title: '高德地形',
thumbnailUrl: 'assets/images/thumbnail/thumbnail_2.jpg',
baseLayers: [
{
title: '高德地形',
icon: '',
layerType: 'amap-v',
url: '',
opacity: '1.0',
visible: false,
useProxy: false,
proxyUrl: '',
style: '',
extent: '',
baseLayer: '',
resolution: '',
origin: '',
tileMatrix: '',
levelStart: '',
levelEnd: '',
levelEndEnlarge: false,
},
],
},
],
layers: [
{
id: 'lihonglin',
title: 'lihonglin',
icon: '',
layerType: 'PipenetLayer',
url: 'CityInterface/rest/services/MapServer.svc/lihonglin',
opacity: '1.0',
showLegend: true,
visible: true,
useProxy: true,
proxyUrl: '',
extent: '13196168.016289838,4814326.171369759,13232913.305918653,4843281.459597265',
baseLayer: '',
resolution: '',
origin: '',
tileMatrix: '',
wmtsUrl: '',
schemename: '1212',
roles: '',
areaName: '滦州市',
boundColor: '#86c8f8',
backgroundColor: '#000000',
boundWidth: '10px',
backgroundOpacity: '0.6',
basemaps: [
{
id: '高德地形',
title: '高德地形',
thumbnailUrl: 'assets/images/thumbnail/thumbnail_2.jpg',
baseLayers: [
{
title: '高德地形',
icon: '',
layerType: 'amap-v',
url: '',
opacity: '1.0',
visible: false,
useProxy: false,
proxyUrl: '',
style: '',
extent: '',
baseLayer: '',
resolution: '',
origin: '',
tileMatrix: '',
levelStart: '',
levelEnd: '',
levelEndEnlarge: false,
},
],
},
],
levelStart: '',
},
],
areasettings: {
boundColor: '#86c8f8',
boundWidth: '10px',
backgroundColor: '#000000',
backgroundOpacity: '0.6',
areaName: '滦州市',
extent: '13196168.016289838,4814326.171369759,13232913.305918653,4843281.459597265',
rings: '',
},
}
const AMap = props => {
const AMap = (props) => {
const getMap = (obj, current) => {
// setAMapObj(obj);
// setCurrentMapObj(current);
props.updageAMapView({
Amap:obj,
map:current
});
};
const mapOptions = {
config:props.global.mapsettings,
theme:'amap://styles/74fae00a851749793870b658f9f22d55'
}
return (
<>
<div style={{
position: 'absolute',
top: 0,
right: 0,
bottom: 0,
left: 0,
}}>
<AMapScene
config={config}
{...mapOptions}
getMapInfo={getMap}
theme={mapSetting.mapSettings.mapStyle}
/>
</>
</div>
);
};
const mapStateToProps = state => ({
global: state.getIn(['global', 'globalConfig'])
});
const mapDispatchToProps = dispatch => ({
updageAMapView(amapView) {
dispatch(actionCreators.updageAMapView(amapView));
},
});
export default connect(
mapStateToProps,
mapDispatchToProps,
)(AMap);
// const mapStateToProps = state => ({
// view: state.getIn(['global', 'amapView']),
// });
export default AMap;
// export default Topic;
......@@ -35,7 +35,9 @@ class CreateMap extends React.Component {
return (
<>
<MapComponent {...props} getMapInfo={this.getView} />
<MapComponent {...props}
getMapInfo={this.getView}
/>
</>
);
}
......
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