"use strict";(self["webpackChunk"]=self["webpackChunk"]||[]).push([[519],{2519:function(e,t,n){n.r(t),n.d(t,{default:function(){return de}});var a=function(){var e=this,t=e._self._c;return t("div",{staticClass:"tiandimap"},[t("div",{staticClass:"head-btn"},[t("div",{staticClass:"head-btn-close",attrs:{id:"cancel"},on:{click:e.onCancel}},[t("i",{staticClass:"el-icon-arrow-left",attrs:{id:"back"}})]),t("div",{staticClass:"head-btn-confirm",attrs:{id:"confirm"},on:{click:e.onConfirm}},[e._v("确定")])]),t("i",{staticClass:"el-icon-aim",attrs:{id:"local"},on:{click:e.toLocal}}),t("div",{staticClass:"map",attrs:{id:"mapDiv"}}),t("div",{staticClass:"search-body"},[t("div",{staticClass:"btn-groups"},[t("div",{staticClass:"input-wrap"},[t("el-input",{ref:"input",staticClass:"input",attrs:{id:"input",maxlength:"100",placeholder:"搜索地点"},model:{value:e.keyWords,callback:function(t){e.keyWords=t},expression:"keyWords"}}),t("i",{staticClass:"el-icon-error",attrs:{id:"clear"},on:{click:function(t){e.keyWords=""}}})],1),t("div",{staticClass:"btn",attrs:{id:"search_button"},on:{click:e.onSearch}},[e._v("搜索")])]),t("div",{staticClass:"result"},e._l(e.dataSource,(function(n){return t("div",{key:n.hotPointID||n.id,staticClass:"item",on:{click:function(t){return e.handleAddress(n)}}},[t("div",[t("div",{staticClass:"name"},[e._v(e._s(n.name))]),t("div",{staticClass:"addr"},[e._v(e._s(n.address))])]),n.lonlat==e.currentInfo.lonlat&&n.name==e.currentInfo.name?t("i",{staticClass:"el-icon-check",attrs:{id:"icon-check"},on:{click:e.toLocal}}):e._e()])})),0)])])},r=[];n(1454); /** * @preserve * gcoord 1.0.7, geographic coordinate library * Copyright (c) 2025 Jiulong Hu */ const{sin:o,cos:s,sqrt:i,abs:c,PI:l}=Math,d=6378245,u=.006693421622965823;function g(e,t){return e>=72.004&&e<=137.8347&&t>=.8293&&t<=55.8271}function h(e,t){let n=2*e-100+3*t+.2*t*t+.1*e*t+.2*i(c(e));return n+=2*(20*o(6*e*l)+20*o(2*e*l))/3,n+=2*(20*o(t*l)+40*o(t/3*l))/3,n+=2*(160*o(t/12*l)+320*o(t*l/30))/3,n}function p(e,t){let n=300+e+2*t+.1*e*e+.1*e*t+.1*i(c(e));return n+=2*(20*o(6*e*l)+20*o(2*e*l))/3,n+=2*(20*o(e*l)+40*o(e/3*l))/3,n+=2*(150*o(e/12*l)+300*o(e/30*l))/3,n}function f(e,t){let n=p(e-105,t-35),a=h(e-105,t-35);const r=t/180*l;let c=o(r);c=1-u*c*c;const g=i(c);return n=180*n/(d/g*s(r)*l),a=180*a/(d*(1-u)/(c*g)*l),[n,a]}function m(e){const[t,n]=e;if(!g(t,n))return[t,n];const a=f(t,n);return[t+a[0],n+a[1]]}function y(e){const[t,n]=e;if(!g(t,n))return[t,n];let[a,r]=[t,n],o=m([a,r]),s=o[0]-t,i=o[1]-n;while(c(s)>1e-6||c(i)>1e-6)a-=s,r-=i,o=m([a,r]),s=o[0]-t,i=o[1]-n;return[a,r]}const{sin:M,cos:k,atan2:v,sqrt:S,PI:C}=Math,G=3e3*C/180;function b(e){const[t,n]=e,a=t-.0065,r=n-.006,o=S(a*a+r*r)-2e-5*M(r*G),s=v(r,a)-3e-6*k(a*G),i=o*k(s),c=o*M(s);return[i,c]}function L(e){const[t,n]=e,a=t,r=n,o=S(a*a+r*r)+2e-5*M(r*G),s=v(r,a)+3e-6*k(a*G),i=o*k(s)+.0065,c=o*M(s)+.006;return[i,c]}const E=180/Math.PI,P=Math.PI/180,w=6378137,B=20037508.342789244;function I(e){return[e[0]*E/w,(.5*Math.PI-2*Math.atan(Math.exp(-e[1]/w)))*E]}function D(e){const t=Math.abs(e[0])<=180?e[0]:e[0]-360*(e[0]<0?-1:1),n=[w*t*P,w*Math.log(Math.tan(.25*Math.PI+.5*e[1]*P))];return n[0]>B&&(n[0]=B),n[0]<-B&&(n[0]=-B),n[1]>B&&(n[1]=B),n[1]<-B&&(n[1]=-B),n}const{abs:W}=Math,A=[12890594.86,8362377.87,5591021,3481989.83,1678043.12,0],x=[75,60,45,30,15,0],J=[[1.410526172116255e-8,898305509648872e-20,-1.9939833816331,200.9824383106796,-187.2403703815547,91.6087516669843,-23.38765649603339,2.57121317296198,-.03801003308653,17337981.2],[-7.435856389565537e-9,8983055097726239e-21,-.78625201886289,96.32687599759846,-1.85204757529826,-59.36935905485877,47.40033549296737,-16.50741931063887,2.28786674699375,10260144.86],[-3.030883460898826e-8,898305509983578e-20,.30071316287616,59.74293618442277,7.357984074871,-25.38371002664745,13.45380521110908,-3.29883767235584,.32710905363475,6856817.37],[-1.981981304930552e-8,8983055099779535e-21,.03278182852591,40.31678527705744,.65659298677277,-4.44255534477492,.85341911805263,.12923347998204,-.04625736007561,4482777.06],[3.09191371068437e-9,8983055096812155e-21,6995724062e-14,23.10934304144901,-.00023663490511,-.6321817810242,-.00663494467273,.03430082397953,-.00466043876332,2555164.4],[2.890871144776878e-9,8983055095805407e-21,-3.068298e-8,7.47137025468032,-353937994e-14,-.02145144861037,-1234426596e-14,.00010322952773,-323890364e-14,826088.5]],N=[[-.0015702102444,111320.7020616939,0x60e374c3105a3,-0x24bb4115e2e164,0x5cc55543bb0ae8,-0x7ce070193f3784,0x5e7ca61ddf8150,-0x261a578d8b24d0,0x665d60f3742ca,82.5],[.0008277824516172526,111320.7020463578,647795574.6671607,-4082003173.641316,10774905663.51142,-15171875531.51559,12053065338.62167,-5124939663.577472,913311935.9512032,67.5],[.00337398766765,111320.7020202162,4481351.045890365,-23393751.19931662,79682215.47186455,-115964993.2797253,97236711.15602145,-43661946.33752821,8477230.501135234,52.5],[.00220636496208,111320.7020209128,51751.86112841131,3796837.749470245,992013.7397791013,-1221952.21711287,1340652.697009075,-620943.6990984312,144416.9293806241,37.5],[-.0003441963504368392,111320.7020576856,278.2353980772752,2485758.690035394,6070.750963243378,54821.18345352118,9540.606633304236,-2710.55326746645,1405.483844121726,22.5],[-.0003218135878613132,111320.7020701615,.00369383431289,823725.6402795718,.46104986909093,2351.343141331292,1.58060784298199,8.77738589078284,.37238884252424,7.45]];function O(e,t,n){const a=W(t)/n[9];let r=n[0]+n[1]*W(e),o=n[2]+n[3]*a+n[4]*Math.pow(a,2)+n[5]*Math.pow(a,3)+n[6]*Math.pow(a,4)+n[7]*Math.pow(a,5)+n[8]*Math.pow(a,6);return r*=e<0?-1:1,o*=t<0?-1:1,[r,o]}function $(e){const[t,n]=e;let a=[];for(let r=0;rx[r]){a=N[r];break}return O(t,n,a)}function _(e){const[t,n]=e;let a=[];for(let r=0;r=A[r]){a=J[r];break}return O(t,n,a)}function q(e,t){if(!e)throw new Error(t)}function F(e){return!!e&&"[object Array]"===Object.prototype.toString.call(e)}function j(e){return!isNaN(Number(e))&&null!==e&&!F(e)}function U(...e){const t=e.length-1;return function(...n){let a=t,r=e[t].apply(null,n);while(a--)r=e[a].call(null,r);return r}}function Z(e,t,n=!1){if(null===e)return;let a,r,o,s,i,c,l,d,u=0,g=0;const{type:h}=e,p="FeatureCollection"===h,f="Feature"===h,m=p?e.features.length:1;for(let y=0;y=2,`Invalid input coordinate: ${e}`),q(j(e[0])&&j(e[1]),`Invalid input coordinate: ${e}`),e=e.map(Number),s=!0);const i=r;return s?i(e):(Z(e,(e=>{[e[0],e[1]]=i(e)})),e)}const te=Object.assign(Object.assign({},R),{CRSTypes:R,transform:ee});var ne=n(417);const ae=ne.A.create({timeout:6e4});ae.interceptors.request.use((async e=>("tianditu"==e.map?(e.baseURL="https://api.tianditu.gov.cn",e.params={postStr:JSON.stringify({...e.params}),type:"query",tk:"18111c7ecf3f616faf921e930914e879"}):(e.baseURL="https://restapi.amap.com","POST"===e.method.toUpperCase()&&(e.data={...e.data,key:"cf77a74920b1a49ac09a27646f578541"}),"GET"===e.method.toUpperCase()&&(e.params={key:"cf77a74920b1a49ac09a27646f578541",...e.params})),e)),(e=>Promise.reject(e)));const re=e=>ae({url:"/v3/place/text?",method:"GET",params:e}),oe=e=>ae({url:"/v2/search?",method:"GET",map:"tianditu",params:e});var se={name:"TiandiMap",data(){return{mapType:"gaode",centerMarker:null,keyWords:"",map:null,dataSource:[],currentInfo:""}},computed:{},mounted(){const e=this;document.addEventListener("UniAppJSBridgeReady",(function(){document.getElementById("confirm").addEventListener("click",(function(t){console.log("🚀 ~ document.getElementById ~ e: - confirm - 0",t),console.log("🚀 ~ document.getElementById ~ _this.currentInfo:",e.currentInfo),uni.postMessage({data:{title:"天地图-选择地址-确定",event:"confirm",info:e.currentInfo}})})),document.getElementById("cancel").addEventListener("click",(function(e){console.log("🚀 ~ document.getElementById ~ e: - cancel - 0",e),uni.postMessage({data:{title:"天地图-选择地址-取消",event:"cancel"}})}))})),console.log("this.$route.query",localStorage.getItem("Ip"),this.$route.query);const{lng:t,lat:n,address:a}=this.$route.query;this.initMap(t,n,a)},methods:{initMap(e,t,n){if(this.map=new T.Map("mapDiv"),e&&t){const a=te.transform([e,t],te.GCJ02,te.WGS84),r=new T.LngLat(a[0],a[1]);this.map.centerAndZoom(r,12),this.centerMarker=new T.Marker(r),this.map.addOverLay(this.centerMarker),this.centerMarker.enableDragging(),this.centerMarker.addEventListener("dragend",this.dragEnd),this.keyWords=n,this.getGeocoderFun(r)}else{const e=new T.LngLat(116.40969,39.89945);this.map.centerAndZoom(e,12),this.getGeoLocation()}},getGeoLocation(){const e=new T.Geolocation,t=this,n=function(e){0==this.getStatus()&&(t.map.centerAndZoom(e.lnglat,e.level),t.centerMarker=new T.Marker(e.lnglat),t.map.addOverLay(t.centerMarker),t.getGeocoderFun(e.lnglat),t.centerMarker.enableDragging(),t.centerMarker.addEventListener("dragend",t.dragEnd)),1==this.getStatus()&&(t.map.centerAndZoom(e.lnglat,e.level),t.centerMarker=new T.Marker(e.lnglat),t.map.addOverLay(t.centerMarker),t.getGeocoderFun(e.lnglat),t.centerMarker.enableDragging(),t.centerMarker.addEventListener("dragend",t.dragEnd))};e.getCurrentPosition(n)},getGeocoderFun(e){let t=new T.Geocoder;t.getLocation(e,(e=>{console.log("🚀 ~ geocoder.getLocation ~ result:",e,e.getAddress()),this.city=e.addressComponent.city,this.keyWords=e.getAddress(),this.onSearch()}))},localSearchResult(e){this.dataSource=e.pois},async onSearch(){if("tianditu"==this.mapType){const e={keyWord:this.keyWords,level:12,mapBound:"-180,-90,180,90",queryType:7,start:0,count:100};oe(e).then((e=>{console.log("🚀 ~ getPlaceByTianditu ~ res:",e),200==e.status&&(this.dataSource=e.data.pois)})).catch((e=>{console.log("🚀 ~ getPlaceByTianditu ~ err:",e)}))}else re({keywords:this.keyWords,types:"010000|020000|030000|040000|050000|060000|070000|080000|090000|100000|110000|120000|130000|140000|150000|160000|170000|180000|190000|200000",city:this.city||"厦门"}).then((e=>{const{status:t,data:n}=e;200==t&&n.pois&&(this.dataSource=n.pois.map((e=>{const t=e.location.split(","),n=te.transform([t[0],t[1]],te.GCJ02,te.WGS84);return{...e,lonlat:`${n[0]},${n[1]}`}})))})).catch((e=>{console.log("🚀 ~ err:",e)}))},onSearchByClass(){const e=e=>{this.dataSource=e.pois},t={pageCapacity:100,onSearchComplete:e},n=new T.LocalSearch(this.map,t);n.search(this.$refs.input.value)},dragStart(e){console.log("🚀 ~ dragStart ~ e:",e)},dragEnd(e){console.log("🚀 ~ dragEnd ~ e:",e),this.getGeocoderFun(e.lnglat)},toLocal(e){this.map.clearOverLays(),this.getGeoLocation()},getAddressZh(e,t){const n=this,a=new T.Geocoder;a.getLocation(new T.LngLat(e,t),(e=>{console.log("🚀 ~ geocoder.getLocation ~ result.getAddress():",e.getAddress()),n.currentInfo.address=e.getAddress()}))},handleAddress(e){const t=e.lonlat.split(",")[0],n=e.lonlat.split(",")[1],a=new T.LngLat(Number(t),Number(n));this.map.clearOverLays();const r=new T.Marker(a);this.map.addOverLay(r),this.map.panTo(a),this.getAddressZh(t,n),r.enableDragging(),r.addEventListener("dragend",this.dragEnd),this.currentInfo={...e,longitude:Number(Number(t).toFixed(6)),latitude:Number(Number(n).toFixed(6))}},onConfirm(){},onCancel(){}}},ie=se,ce=n(1656),le=(0,ce.A)(ie,a,r,!1,null,"1122598a",null),de=le.exports}}]); //# sourceMappingURL=519.e84e63c4.js.map