import{U as y,d as P,O as k,V as O,o as C,a as z,g as I,R as x,W as N}from"./index-1d4a9afa.js";import{M as R}from"./index-6b314488.js";const T={};var b={},B={get exports(){return b},set exports(A){b=A}};(function(A,a){(function(M,L){A.exports=L()})(y,function(){function M(n){var l=[];return n.AMapUI&&l.push(L(n.AMapUI)),n.Loca&&l.push(h(n.Loca)),Promise.all(l)}function L(n){return new Promise(function(l,t){var u=[];if(n.plugins)for(var i=0;i{D.load({key:"501e5bfaf7cfc5d3d53a9a4d9466d8b9",version:"2.0",plugins:["AMap.ToolBar","AMap.Driving"],AMapUI:{version:"1.1",plugins:[]},Loca:{version:"2.0.0"}}).then(o=>{let d=null;e.value=new o.Map("gpsContainer",{resizeEnable:!0,zoom:16,zooms:[2,22]}),o.plugin(["AMap.Geocoder","AMap.GeometryUtil"],function(){if(a.lnglat&&a.lnglat.length>0){e.value.setCenter(a.lnglat,!0),m(),v(a.lnglat,"教学点","addressMark");const l=new o.Circle({center:new o.LngLat(...a.lnglat),radius:a.attendance_range,strokeColor:"#00B2A7",strokeOpacity:1,strokeWeight:2,fillColor:"#A3FFF9",fillOpacity:.14});e.value.add(l),e.value.setFitView()}a.signInLongitudeLatitude&&a.signInLongitudeLatitude.length>0&&(console.log("signInLongitudeLatitude",a.signInLongitudeLatitude),v(a.signInLongitudeLatitude,"签到点","signInMark")),a.signOutLongitudeLatitude&&a.signOutLongitudeLatitude.length>0&&(console.log("signOutLongitudeLatitude",a.signOutLongitudeLatitude),v(a.signOutLongitudeLatitude,"签退点","signOutMark")),console.log(a,"selectMapAddress"),a.signInMark&&a.addressMark&&(n(a.addressMark,a.signInMark,"top"),console.log("连线 设置签到点与教学点的距离")),a.signOutMark&&a.addressMark&&(n(a.addressMark,a.signOutMark,"bottom"),console.log("连线 设置签退点与教学点的距离"))});function v(l,t,u){const i=new o.Icon({size:[27,28],image:E,imageSize:[27,28]});d=new o.Marker({icon:i,anchor:"bottom-center",position:new o.LngLat(...l),title:t}),d.setLabel({content:`${t}`,direction:"top",offset:[0,-2]}),a[u]=d,d.setMap(e),e.value.add(d)}function m(){d&&(d.setMap(null),d=null)}function n(l,t,u){const i=l.getPosition(),p=t.getPosition(),c=i.divideBy(2).add(p.divideBy(2)),r=Math.round(i.distance(p)),g=[i,p],f=r>a.attendance_range?"#FF5A56":"#01C1B5";r>a.attendance_range&&(t.dom.classList.add("myClassM2"),t.setIcon(S));const w=new o.Polyline({strokeColor:f,strokeWeight:2,isOutline:!0,outlineColor:f});w.setMap(e.value),w.setPath(g);const U=new o.Text({text:r+"M",style:{"font-size":"12px",color:"#fff",border:"none",backgroundColor:f}});U.setPosition(c),U.setMap(e.value),u=="top"&&U.setOffset(new o.Pixel(-40,-10))}}).catch(()=>{})};return C(async()=>{try{const{data:o}=await z.get("/api-web/open/school/queryByParamName",{params:{paramName:"attendance_range"}});a.attendance_range=o.attendance_range||1e3}catch(o){}s()}),()=>I("div",{class:T["amap-gps"]},[I(R,{position:"top"},{default:()=>[I(x,null,null)]}),I("div",{id:"gpsContainer",style:{width:"100%",height:"calc(100vh - var(--header-height))",position:"relative"}},null)])}});export{q as default};