From 91aca00d520800457fdfb39864311976a3712cc2 Mon Sep 17 00:00:00 2001 From: SHAOJIAHAO <55341701@qq.com> Date: Wed, 24 Mar 2021 16:55:34 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=AE=8C=E5=96=84]=E5=8D=95=E4=BD=8D=E6=A0=87?= =?UTF-8?q?=E6=B3=A8=E4=BD=8D=E7=BD=AE=E5=A2=9E=E5=8A=A0touchstart?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basicinfo/basicinfo.component.html | 6 +-- .../key-unit/basicinfo/basicinfo.component.ts | 54 ++++++++++++++++++- src/styles.scss | 2 + 3 files changed, 58 insertions(+), 4 deletions(-) diff --git a/src/app/key-unit/basicinfo/basicinfo.component.html b/src/app/key-unit/basicinfo/basicinfo.component.html index 5a7606b..96b0550 100644 --- a/src/app/key-unit/basicinfo/basicinfo.component.html +++ b/src/app/key-unit/basicinfo/basicinfo.component.html @@ -41,7 +41,7 @@ * 联系人: - * 联系电话: - * 单位地址: - diff --git a/src/app/key-unit/basicinfo/basicinfo.component.ts b/src/app/key-unit/basicinfo/basicinfo.component.ts index fcbe8e1..8a764f7 100644 --- a/src/app/key-unit/basicinfo/basicinfo.component.ts +++ b/src/app/key-unit/basicinfo/basicinfo.component.ts @@ -264,7 +264,32 @@ export class BasicinfoComponent implements OnInit { this.map.setCenter([this.markerPosition.x,this.markerPosition.y]); //设置地图中心点 this.map.add(this.newPositionMarker); }) - + //点击确定 + this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionOk'),'touchstart',(event)=>{ + this.map.clearMap(); + this.isGisTopBox = true + this.isGisTopBoxTwo = false + this.newPositionMarker = new AMap.Marker({ + position: [this.markerPosition2.x,this.markerPosition2.y], + content: this.newPositionMarkerContent, + offset: new AMap.Pixel(-15, -18) + }); + this.markerPosition = this.markerPosition2 + this.map.add(this.newPositionMarker); + }) + //点击取消 + this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionClose'),'touchstart',(event)=>{ + this.isGisTopBox = true + this.isGisTopBoxTwo = false + this.map.clearMap(); + this.newPositionMarker = new AMap.Marker({ + position: [this.markerPosition.x,this.markerPosition.y], + content: this.newPositionMarkerContent, + offset: new AMap.Pixel(-15, -18) + }); + this.map.setCenter([this.markerPosition.x,this.markerPosition.y]); //设置地图中心点 + this.map.add(this.newPositionMarker); + }) }else{ // console.log('未标注单位位置') if(this.newPositionMarker){ @@ -294,6 +319,7 @@ export class BasicinfoComponent implements OnInit { } this.newPositionMarker.on('dragend', (e)=>{ this.markerPosition2 = {x: e.lnglat.lng, y: e.lnglat.lat} + }) //点击确定 this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionOk'),'click',(event)=>{ @@ -308,6 +334,18 @@ export class BasicinfoComponent implements OnInit { }); this.map.add(this.newPositionMarker); }) + this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionOk'),'touchstart',(event)=>{ + this.isGisTopBox = true + this.isGisTopBoxTwo = false + this.markerPosition = this.markerPosition2 + this.map.clearMap(); + this.newPositionMarker = new AMap.Marker({ + position: [this.markerPosition.x,this.markerPosition.y], + content: this.newPositionMarkerContent, + offset: new AMap.Pixel(-15, -18) + }); + this.map.add(this.newPositionMarker); + }) this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionClose'),'click',(event)=>{ this.map.clearMap(); this.isGisTopBox = true @@ -322,6 +360,20 @@ export class BasicinfoComponent implements OnInit { this.map.add(this.newPositionMarker); } })//取消 + this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionClose'),'touchstart',(event)=>{ + this.map.clearMap(); + this.isGisTopBox = true + this.isGisTopBoxTwo = false + if(this.markerPosition.x && this.markerPosition.x != 0){//说明之前标过点 + this.newPositionMarker = new AMap.Marker({ + position: [this.markerPosition.x,this.markerPosition.y], + content: this.newPositionMarkerContent, + offset: new AMap.Pixel(-15, -18) + }); + this.map.setCenter([this.markerPosition.x,this.markerPosition.y]); //设置地图中心点 + this.map.add(this.newPositionMarker); + } + })//取消 } diff --git a/src/styles.scss b/src/styles.scss index 9938e5b..592ebe3 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -7,7 +7,9 @@ font-family: Regular; src: url('./assets/font/SourceHanSansCN-Regular.otf'), } + html,body{ + touch-action: none; width: 100%; height:100%; margin:0 auto;