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-e362c2e8.js";import{M as R}from"./index-cf657a5b.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(e){var l=[];return e.AMapUI&&l.push(L(e.AMapUI)),e.Loca&&l.push(h(e.Loca)),Promise.all(l)}function L(e){return new Promise(function(l,t){var u=[];if(e.plugins)for(var i=0;i{D.load({key:"ac943ac1522de0d63eb8a99b71fe2601",version:"2.0",plugins:["AMap.ToolBar","AMap.Driving"],AMapUI:{version:"1.1",plugins:[]},Loca:{version:"2.0.0"}}).then(o=>{let d=null;n.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){n.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});n.value.add(l),n.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&&(e(a.addressMark,a.signInMark,"top"),console.log("连线 设置签到点与教学点的距离")),a.signOutMark&&a.addressMark&&(e(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(n),n.value.add(d)}function m(){d&&(d.setMap(null),d=null)}function e(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(n.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(n.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};