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;