water-ldht/dist/static/js/chunk-795c1891.5b347b8f.js

7 lines
2.7 KiB
JavaScript
Raw Normal View History

2024-11-01 16:58:10 +08:00
/*!
* build: vue-admin-beautiful
* vue-admin-beautiful author: chuzhixin 1204505056@qq.com
* vue-admin-beautiful QQ Group(QQ群): 9724353191139183756
* time: 2024-10-10 11:14:28
*/
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-795c1891"],{"17be":function(e,t,i){"use strict";i.r(t);var a=i("f2bf");function n(e,t,i,n,o,s){return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",null,t[0]||(t[0]=[Object(a["createElementVNode"])("div",{class:"form-layer"},[Object(a["createElementVNode"])("div",{id:"map"})],-1)]))}var o={name:"BdMap",emits:["getLatAndLng"],data(){return{map:null,local:null,mk:null,keyWords:"",longitude:"",latitude:""}},created(){""!=this.longitude&&""!=this.latitude||this.initMap()},methods:{initMap(){this.$nextTick(()=>{this.map=new BMap.Map("map");const e=""==this.longitude?"118.802":this.longitude,t=""==this.latitude?"32.064":this.latitude,i=new BMap.Point(e,t);this.map.centerAndZoom(i,18),this.map.enableScrollWheelZoom(!0),this.map.addControl(new window.BMap.NavigationControl),"118.802"!=e&&"32.064"!=t?this.handleMarker(this,i):(console.log("longitude="+e),console.log("latitude="+t),this.fixedPos())})},showMap(e){this.latitude=e.latitude,this.longitude=e.longitude,this.initMap()},fixedPos(){const e=this,t=new BMap.Geolocation;this.confirmLoading=!0,t.getCurrentPosition((function(t){if(this.getStatus()==window.BMAP_STATUS_SUCCESS){e.handleMarker(e,t.point),e.addListener(e);const i=new BMap.Geocoder;i.getLocation((function(t){e.confirmLoading=!1,t&&e.$emit("tellFatherName",t.point)}))}else e.$message.error("failed"+this.getStatus())}))},setPlace(e){this.keyWords=e,this.local=new BMap.LocalSearch(this.map,{onSearchComplete:this.searchPlace}),this.local.search(this.keyWords)},searchPlace(){if(void 0!=this.local.getResults())if(this.map.clearOverlays(),this.local.getResults().getPoi(0)){const e=this.local.getResults().getPoi(0).point;this.map.centerAndZoom(e,18),this.handleMarker(this,e),this.addListener(this,e),console.log("经度:"+e.lng+"--纬度"+e.lat),this.$emit("tellFatherName",e)}else this.$message.error("未匹配到地点!");else this.$message.error("未找到搜索结果!")},handleMarker(e,t){const i=this;e.mk=new BMap.Marker(t),e.map.addOverlay(e.mk),e.mk.enableDragging(),e.map.addEventListener("dragend",(function(e){i.$emit("tellFatherName",e.point)})),e.map.panTo(t)},addListener(e){const t=this;e.map.addEventListener("click",(function(e){t.$emit("tellFatherName",e.point),t.map.clearOverlays(),t.handleMarker(t,e.point)}))}}},s=(i("502f"),i("d959")),l=i.n(s);const r=l()(o,[["render",n],["__scopeId","data-v-702190e3"]]);t["default"]=r},"486d":function(e,t,i){},"502f":function(e,t,i){"use strict";i("486d")}}]);