From 5b56ecefeabe8bd1671b25499d819a7a5ed43e20 Mon Sep 17 00:00:00 2001 From: licuizhu <1065490369@qq.com> Date: Sat, 23 Dec 2023 12:18:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=82=B9=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.less | 3 ++- src/pages/BaseMap/index.js | 40 +++++++++++++++++++++++++++--------- src/pages/BaseMap/index.less | 3 +-- 3 files changed, 33 insertions(+), 13 deletions(-) diff --git a/src/index.less b/src/index.less index eb5bc40e..72529333 100644 --- a/src/index.less +++ b/src/index.less @@ -244,7 +244,8 @@ body { background: #FFFFFF; opacity: 1; padding: 22px 68px; - position: relative; + position: absolute; + top: 0; z-index: 999; border-bottom: 1px solid rgba(0,0,0,0.1); } diff --git a/src/pages/BaseMap/index.js b/src/pages/BaseMap/index.js index aecf1e95..f9f3332d 100644 --- a/src/pages/BaseMap/index.js +++ b/src/pages/BaseMap/index.js @@ -79,20 +79,12 @@ class BaseMap extends React.Component{ map: new GaodeMap({ pitch: 20, style: 'light', - center: [ 116.405285, 39.904989 ], + center: [ 118.405285, 39.904989 ], zoom: 3 }) }); - const drawer = new DrawPoint(scene, {}); - let newPointLocation = ''; - drawer.disable(); - drawer.on(DrawEvent.Add, (newPoint) => { - newPointLocation = newPoint.geometry.coordinates.toString(); - this.showModal(newPointLocation); - }) this.setState({ map: scene, - pointDrawer: drawer, }); } @@ -535,7 +527,35 @@ class BaseMap extends React.Component{ } enableDrawPoint = () => { - this.state.pointDrawer.enable(); + this.state.map.addImage( + 'dingwei', + 'https://gw.alipayobjects.com/mdn/rms_3bf4aa/afts/img/A*JL46TZ_iYB0AAAAAAAAAAAAAARQnAQ', + ); + const drawer = new DrawPoint(this.state.map, { + style: { + point: { + normal: { + shape: 'dingwei', + size: 10, + }, + hover: { + shape: 'dingwei', + size: 10, + }, + active: { + shape: 'dingwei', + size: 10, + }, + } + } + }); + drawer.enable(); + drawer.on(DrawEvent.Add, (newPoint) => { + this.showModal(newPoint.geometry.coordinates.toString()); + }); + this.setState({ + pointDrawer: drawer, + }); } //弹出框事件 diff --git a/src/pages/BaseMap/index.less b/src/pages/BaseMap/index.less index 77569c70..2bbe0b64 100644 --- a/src/pages/BaseMap/index.less +++ b/src/pages/BaseMap/index.less @@ -1,11 +1,10 @@ .selectWrap { - // width: 1393px; - // height: 102px; background: rgba(239,240,248,0.7); box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.2); border-radius: 10px 10px 10px 10px; opacity: 1; margin: 3% 5%; + margin-top: 8%; position: absolute; z-index: 99; width: 90%;