12345 |
- <<<<<<<< HEAD:dist/assets/amap-gps-ca7e453c.js
- 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-6ef77773.js";import{M as R}from"./index-fbc0b234.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<e.plugins.length;i+=1)s.AMapUI.plugins.indexOf(e.plugins[i])==-1&&u.push(e.plugins[i]);if(o.AMapUI===n.failed)t("前次请求 AMapUI 失败");else if(o.AMapUI===n.notload){o.AMapUI=n.loading,s.AMapUI.version=e.version||s.AMapUI.version,i=s.AMapUI.version;var p=document.body||document.head,c=document.createElement("script");c.type="text/javascript",c.src="https://webapi.amap.com/ui/"+i+"/main.js",c.onerror=function(r){o.AMapUI=n.failed,t("请求 AMapUI 失败")},c.onload=function(){if(o.AMapUI=n.loaded,u.length)window.AMapUI.loadUI(u,function(){for(var r=0,g=u.length;r<g;r++){var f=u[r].split("/").slice(-1)[0];window.AMapUI[f]=arguments[r]}for(l();d.AMapUI.length;)d.AMapUI.splice(0,1)[0]()});else for(l();d.AMapUI.length;)d.AMapUI.splice(0,1)[0]()},p.appendChild(c)}else o.AMapUI===n.loaded?e.version&&e.version!==s.AMapUI.version?t("不允许多个版本 AMapUI 混用"):u.length?window.AMapUI.loadUI(u,function(){for(var r=0,g=u.length;r<g;r++){var f=u[r].split("/").slice(-1)[0];window.AMapUI[f]=arguments[r]}l()}):l():e.version&&e.version!==s.AMapUI.version?t("不允许多个版本 AMapUI 混用"):d.AMapUI.push(function(r){r?t(r):u.length?window.AMapUI.loadUI(u,function(){for(var g=0,f=u.length;g<f;g++){var w=u[g].split("/").slice(-1)[0];window.AMapUI[w]=arguments[g]}l()}):l()})})}function h(e){return new Promise(function(l,t){if(o.Loca===n.failed)t("前次请求 Loca 失败");else if(o.Loca===n.notload){o.Loca=n.loading,s.Loca.version=e.version||s.Loca.version;var u=s.Loca.version,i=s.AMap.version.startsWith("2"),p=u.startsWith("2");if(i&&!p||!i&&p)t("JSAPI 与 Loca 版本不对应!!");else{i=s.key,p=document.body||document.head;var c=document.createElement("script");c.type="text/javascript",c.src="https://webapi.amap.com/loca?v="+u+"&key="+i,c.onerror=function(r){o.Loca=n.failed,t("请求 AMapUI 失败")},c.onload=function(){for(o.Loca=n.loaded,l();d.Loca.length;)d.Loca.splice(0,1)[0]()},p.appendChild(c)}}else o.Loca===n.loaded?e.version&&e.version!==s.Loca.version?t("不允许多个版本 Loca 混用"):l():e.version&&e.version!==s.Loca.version?t("不允许多个版本 Loca 混用"):d.Loca.push(function(r){r?t(r):t()})})}if(!window)throw Error("AMap JSAPI can only be used in Browser.");var n;(function(e){e.notload="notload",e.loading="loading",e.loaded="loaded",e.failed="failed"})(n||(n={}));var s={key:"",AMap:{version:"1.4.15",plugins:[]},AMapUI:{version:"1.1",plugins:[]},Loca:{version:"1.3.2"}},o={AMap:n.notload,AMapUI:n.notload,Loca:n.notload},d={AMap:[],AMapUI:[],Loca:[]},v=[],m=function(e){typeof e=="function"&&(o.AMap===n.loaded?e(window.AMap):v.push(e))};return{load:function(e){return new Promise(function(l,t){if(o.AMap==n.failed)t("");else if(o.AMap==n.notload){var u=e.key,i=e.version,p=e.plugins;u?(window.AMap&&location.host!=="lbs.amap.com"&&t("禁止多种API加载方式混用"),s.key=u,s.AMap.version=i||s.AMap.version,s.AMap.plugins=p||s.AMap.plugins,o.AMap=n.loading,i=document.body||document.head,window.___onAPILoaded=function(r){if(delete window.___onAPILoaded,r)o.AMap=n.failed,t(r);else for(o.AMap=n.loaded,M(e).then(function(){l(window.AMap)}).catch(t);v.length;)v.splice(0,1)[0]()},p=document.createElement("script"),p.type="text/javascript",p.src="https://webapi.amap.com/maps?callback=___onAPILoaded&v="+s.AMap.version+"&key="+u+"&plugin="+s.AMap.plugins.join(","),p.onerror=function(r){o.AMap=n.failed,t(r)},i.appendChild(p)):t("请填写key")}else if(o.AMap==n.loaded)if(e.key&&e.key!==s.key)t("多个不一致的 key");else if(e.version&&e.version!==s.AMap.version)t("不允许多个版本 JSAPI 混用");else{if(u=[],e.plugins)for(i=0;i<e.plugins.length;i+=1)s.AMap.plugins.indexOf(e.plugins[i])==-1&&u.push(e.plugins[i]);u.length?window.AMap.plugin(u,function(){M(e).then(function(){l(window.AMap)}).catch(t)}):M(e).then(function(){l(window.AMap)}).catch(t)}else if(e.key&&e.key!==s.key)t("多个不一致的 key");else if(e.version&&e.version!==s.AMap.version)t("不允许多个版本 JSAPI 混用");else{var c=[];if(e.plugins)for(i=0;i<e.plugins.length;i+=1)s.AMap.plugins.indexOf(e.plugins[i])==-1&&c.push(e.plugins[i]);m(function(){c.length?window.AMap.plugin(c,function(){M(e).then(function(){l(window.AMap)}).catch(t)}):M(e).then(function(){l(window.AMap)}).catch(t)})}})},reset:function(){delete window.AMap,delete window.AMapUI,delete window.Loca,s={key:"",AMap:{version:"1.4.15",plugins:[]},AMapUI:{version:"1.1",plugins:[]},Loca:{version:"1.3.2"}},o={AMap:n.notload,AMapUI:n.notload,Loca:n.notload},d={AMap:[],AMapUI:[],Loca:[]}}}})})(B);const D=b,E="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAAcCAMAAACnDzTfAAABHVBMVEUAAAADtKj///////////8Ktqv2/Pz////5/v3s+vnI7+z////c9fO+6+klvrSm5eFWzMX////////////////////////0/PwevLISuK7O8e7k9/Z11tC86+i46ueP3dlDx7/////////////////////////////////////////////////////////8/v7o+PczwrkwwbjH7uyB2dRYzcVhz8hRysNQysNHx8Ce4t5bzcaQ3tlp0cv///////////////////////////////////////////////////////8Asqf////1/Pvu+vnA7Oma4NspvrXp+Pff9fPa8/LG7eus5eJ21c9r0sxn0cpXzMU3wrkivLIWuK7c5d5VAAAATHRSTlMA/GsT1vr58Pn39/b29vbz8d2mPy8b+vf39/b09PPy8vLj2MWjkH9oUEU6JyAKBfv39fXz8/Py8vLy8fHv7+zRvbKrnJV8c19JNSoNw2x7SgAAAS1JREFUKM9tked2wjAMRh0IYe8NZVM2dO+9lz+ge/f9H6PEPsF2yP0l+x5LskQk7m87yTRx4K7phUm95bYZdwJAMVwOGIDXpah+HL5KhM7QqiUgMRIqXUMhRy1iBhLCNbDhoYI1A/O0N/DnqUwMXqshHdtUpYQrrlLwa+zm++3l/YlFe9C5cyHKLr4wY/LLuvWBJ13GEnPPMHlkcQE95i5wZB7/wJgyF0ZXeTeR3gWQVOp9mGrMm8kirfb5+Tqe/rCoivj8f1tUJYwW4bRR1BS1K+Yy0rEpK88qxJqSWFmXXBQNIrhEyCNNOtiX3LCOfUvlslAXnwrigCstgDOi0oYvwlwFNTex0eQld5DpETvDE5QpjRi4JosMjnGYD+GcONHNANAfiCOdePB0QAT/0uBtieUrtt8AAAAASUVORK5CYII=",S="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAAcCAMAAACnDzTfAAABIFBMVEUAAAD/XFj/////////////+fn/////8/P/////////+Pj/ZGD/////cm//1dX/xcT/t7X/kY//////////////////////X1v/2tr/1NP/bWr/6ur/5+f/4N//+vr/enf/pqT/0tH/lJH/joz//////////////////////////////////////////////////Pz/9/f/ZmP/3t3/29r/rqz/8PD/mZb/iIX/hoP/wcD/hYL/npz/////////////////////////////////////////////////////////////////////////Wlb/////9PT/6ej/1tX/vbz/npz/dHH/8fD/2tn/ycj/pqT/ko//fXr/cGz/aGT/XFg2JTGLAAAAT3RSTlMA/NZqE/3796UE+vr29vPz8fF+QS8bC/v5+Pf29vb19fTy8vLx7+Pc2cWQbUg6JyD29vX08/Py8vLy8fHv7N7RvbKroZyVc2dfUVA9NSoSehyD/QAAATZJREFUKM9tked6gkAQRRcUxF4Q7BoTa2zpvffOVWN6ef+3SBiCLIbza3bPt7t3dphD8L57o2rMg7vTOkxaKf+MeVAAbOSq2TJQ87lU/wBSImr8ImzHACXoKK2BUt6wSYagOK6NtYzhUAlheu0VAmGDJ4maHUjEpuEmhpSl0ggItPP+Mnp9omoLouU6iNPGBACGn5R2Cdali5gj9wyTR6pL6JE7w565/AIxJpdDlz/3PeTOZXFLzvf33pupJAojlKG5c05G0viDql00p/3Ne/VHXKIguNQC6n57qCLWeRUOoMNsVMgVzsXR5oZ0jmKG++lInznoLezYKr8M9+DTETursIpj5sYHKUougQZl5FFQCJvxZbnHZtEPURWMaAgX7D+DfSRWijhhXqgyAFFnnlw3I0cDbv0DsZxwvZH42EwAAAAASUVORK5CYII=",q=P({name:"amap-gps",setup(){const A=N(),a=k({attendance_range:1e3,lnglat:[],address:"",signInLongitudeLatitude:[],signOutLongitudeLatitude:[],signInMark:null,signOutMark:null,addressMark:null}),M=A.query.sLngLat;A.query.sLngLat&&(a.lnglat=M.split(","));const L=A.query.inLngLat;A.query.inLngLat&&(a.signInLongitudeLatitude=L.split(","));const h=A.query.outLngLat;A.query.outLngLat&&(a.signOutLongitudeLatitude=h.split(","));const n=O(null),s=()=>{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};
- ========
- 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-dbd58bee.js";import{M as R}from"./index-8b3add60.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<e.plugins.length;i+=1)s.AMapUI.plugins.indexOf(e.plugins[i])==-1&&u.push(e.plugins[i]);if(o.AMapUI===n.failed)t("前次请求 AMapUI 失败");else if(o.AMapUI===n.notload){o.AMapUI=n.loading,s.AMapUI.version=e.version||s.AMapUI.version,i=s.AMapUI.version;var p=document.body||document.head,c=document.createElement("script");c.type="text/javascript",c.src="https://webapi.amap.com/ui/"+i+"/main.js",c.onerror=function(r){o.AMapUI=n.failed,t("请求 AMapUI 失败")},c.onload=function(){if(o.AMapUI=n.loaded,u.length)window.AMapUI.loadUI(u,function(){for(var r=0,g=u.length;r<g;r++){var f=u[r].split("/").slice(-1)[0];window.AMapUI[f]=arguments[r]}for(l();d.AMapUI.length;)d.AMapUI.splice(0,1)[0]()});else for(l();d.AMapUI.length;)d.AMapUI.splice(0,1)[0]()},p.appendChild(c)}else o.AMapUI===n.loaded?e.version&&e.version!==s.AMapUI.version?t("不允许多个版本 AMapUI 混用"):u.length?window.AMapUI.loadUI(u,function(){for(var r=0,g=u.length;r<g;r++){var f=u[r].split("/").slice(-1)[0];window.AMapUI[f]=arguments[r]}l()}):l():e.version&&e.version!==s.AMapUI.version?t("不允许多个版本 AMapUI 混用"):d.AMapUI.push(function(r){r?t(r):u.length?window.AMapUI.loadUI(u,function(){for(var g=0,f=u.length;g<f;g++){var w=u[g].split("/").slice(-1)[0];window.AMapUI[w]=arguments[g]}l()}):l()})})}function h(e){return new Promise(function(l,t){if(o.Loca===n.failed)t("前次请求 Loca 失败");else if(o.Loca===n.notload){o.Loca=n.loading,s.Loca.version=e.version||s.Loca.version;var u=s.Loca.version,i=s.AMap.version.startsWith("2"),p=u.startsWith("2");if(i&&!p||!i&&p)t("JSAPI 与 Loca 版本不对应!!");else{i=s.key,p=document.body||document.head;var c=document.createElement("script");c.type="text/javascript",c.src="https://webapi.amap.com/loca?v="+u+"&key="+i,c.onerror=function(r){o.Loca=n.failed,t("请求 AMapUI 失败")},c.onload=function(){for(o.Loca=n.loaded,l();d.Loca.length;)d.Loca.splice(0,1)[0]()},p.appendChild(c)}}else o.Loca===n.loaded?e.version&&e.version!==s.Loca.version?t("不允许多个版本 Loca 混用"):l():e.version&&e.version!==s.Loca.version?t("不允许多个版本 Loca 混用"):d.Loca.push(function(r){r?t(r):t()})})}if(!window)throw Error("AMap JSAPI can only be used in Browser.");var n;(function(e){e.notload="notload",e.loading="loading",e.loaded="loaded",e.failed="failed"})(n||(n={}));var s={key:"",AMap:{version:"1.4.15",plugins:[]},AMapUI:{version:"1.1",plugins:[]},Loca:{version:"1.3.2"}},o={AMap:n.notload,AMapUI:n.notload,Loca:n.notload},d={AMap:[],AMapUI:[],Loca:[]},v=[],m=function(e){typeof e=="function"&&(o.AMap===n.loaded?e(window.AMap):v.push(e))};return{load:function(e){return new Promise(function(l,t){if(o.AMap==n.failed)t("");else if(o.AMap==n.notload){var u=e.key,i=e.version,p=e.plugins;u?(window.AMap&&location.host!=="lbs.amap.com"&&t("禁止多种API加载方式混用"),s.key=u,s.AMap.version=i||s.AMap.version,s.AMap.plugins=p||s.AMap.plugins,o.AMap=n.loading,i=document.body||document.head,window.___onAPILoaded=function(r){if(delete window.___onAPILoaded,r)o.AMap=n.failed,t(r);else for(o.AMap=n.loaded,M(e).then(function(){l(window.AMap)}).catch(t);v.length;)v.splice(0,1)[0]()},p=document.createElement("script"),p.type="text/javascript",p.src="https://webapi.amap.com/maps?callback=___onAPILoaded&v="+s.AMap.version+"&key="+u+"&plugin="+s.AMap.plugins.join(","),p.onerror=function(r){o.AMap=n.failed,t(r)},i.appendChild(p)):t("请填写key")}else if(o.AMap==n.loaded)if(e.key&&e.key!==s.key)t("多个不一致的 key");else if(e.version&&e.version!==s.AMap.version)t("不允许多个版本 JSAPI 混用");else{if(u=[],e.plugins)for(i=0;i<e.plugins.length;i+=1)s.AMap.plugins.indexOf(e.plugins[i])==-1&&u.push(e.plugins[i]);u.length?window.AMap.plugin(u,function(){M(e).then(function(){l(window.AMap)}).catch(t)}):M(e).then(function(){l(window.AMap)}).catch(t)}else if(e.key&&e.key!==s.key)t("多个不一致的 key");else if(e.version&&e.version!==s.AMap.version)t("不允许多个版本 JSAPI 混用");else{var c=[];if(e.plugins)for(i=0;i<e.plugins.length;i+=1)s.AMap.plugins.indexOf(e.plugins[i])==-1&&c.push(e.plugins[i]);m(function(){c.length?window.AMap.plugin(c,function(){M(e).then(function(){l(window.AMap)}).catch(t)}):M(e).then(function(){l(window.AMap)}).catch(t)})}})},reset:function(){delete window.AMap,delete window.AMapUI,delete window.Loca,s={key:"",AMap:{version:"1.4.15",plugins:[]},AMapUI:{version:"1.1",plugins:[]},Loca:{version:"1.3.2"}},o={AMap:n.notload,AMapUI:n.notload,Loca:n.notload},d={AMap:[],AMapUI:[],Loca:[]}}}})})(B);const D=b,E="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAAcCAMAAACnDzTfAAABHVBMVEUAAAADtKj///////////8Ktqv2/Pz////5/v3s+vnI7+z////c9fO+6+klvrSm5eFWzMX////////////////////////0/PwevLISuK7O8e7k9/Z11tC86+i46ueP3dlDx7/////////////////////////////////////////////////////////8/v7o+PczwrkwwbjH7uyB2dRYzcVhz8hRysNQysNHx8Ce4t5bzcaQ3tlp0cv///////////////////////////////////////////////////////8Asqf////1/Pvu+vnA7Oma4NspvrXp+Pff9fPa8/LG7eus5eJ21c9r0sxn0cpXzMU3wrkivLIWuK7c5d5VAAAATHRSTlMA/GsT1vr58Pn39/b29vbz8d2mPy8b+vf39/b09PPy8vLj2MWjkH9oUEU6JyAKBfv39fXz8/Py8vLy8fHv7+zRvbKrnJV8c19JNSoNw2x7SgAAAS1JREFUKM9tked2wjAMRh0IYe8NZVM2dO+9lz+ge/f9H6PEPsF2yP0l+x5LskQk7m87yTRx4K7phUm95bYZdwJAMVwOGIDXpah+HL5KhM7QqiUgMRIqXUMhRy1iBhLCNbDhoYI1A/O0N/DnqUwMXqshHdtUpYQrrlLwa+zm++3l/YlFe9C5cyHKLr4wY/LLuvWBJ13GEnPPMHlkcQE95i5wZB7/wJgyF0ZXeTeR3gWQVOp9mGrMm8kirfb5+Tqe/rCoivj8f1tUJYwW4bRR1BS1K+Yy0rEpK88qxJqSWFmXXBQNIrhEyCNNOtiX3LCOfUvlslAXnwrigCstgDOi0oYvwlwFNTex0eQld5DpETvDE5QpjRi4JosMjnGYD+GcONHNANAfiCOdePB0QAT/0uBtieUrtt8AAAAASUVORK5CYII=",S="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAAcCAMAAACnDzTfAAABIFBMVEUAAAD/XFj/////////////+fn/////8/P/////////+Pj/ZGD/////cm//1dX/xcT/t7X/kY//////////////////////X1v/2tr/1NP/bWr/6ur/5+f/4N//+vr/enf/pqT/0tH/lJH/joz//////////////////////////////////////////////////Pz/9/f/ZmP/3t3/29r/rqz/8PD/mZb/iIX/hoP/wcD/hYL/npz/////////////////////////////////////////////////////////////////////////Wlb/////9PT/6ej/1tX/vbz/npz/dHH/8fD/2tn/ycj/pqT/ko//fXr/cGz/aGT/XFg2JTGLAAAAT3RSTlMA/NZqE/3796UE+vr29vPz8fF+QS8bC/v5+Pf29vb19fTy8vLx7+Pc2cWQbUg6JyD29vX08/Py8vLy8fHv7N7RvbKroZyVc2dfUVA9NSoSehyD/QAAATZJREFUKM9tked6gkAQRRcUxF4Q7BoTa2zpvffOVWN6ef+3SBiCLIbza3bPt7t3dphD8L57o2rMg7vTOkxaKf+MeVAAbOSq2TJQ87lU/wBSImr8ImzHACXoKK2BUt6wSYagOK6NtYzhUAlheu0VAmGDJ4maHUjEpuEmhpSl0ggItPP+Mnp9omoLouU6iNPGBACGn5R2Cdali5gj9wyTR6pL6JE7w565/AIxJpdDlz/3PeTOZXFLzvf33pupJAojlKG5c05G0viDql00p/3Ne/VHXKIguNQC6n57qCLWeRUOoMNsVMgVzsXR5oZ0jmKG++lInznoLezYKr8M9+DTETursIpj5sYHKUougQZl5FFQCJvxZbnHZtEPURWMaAgX7D+DfSRWijhhXqgyAFFnnlw3I0cDbv0DsZxwvZH42EwAAAAASUVORK5CYII=",q=P({name:"amap-gps",setup(){const A=N(),a=k({attendance_range:1e3,lnglat:[],address:"",signInLongitudeLatitude:[],signOutLongitudeLatitude:[],signInMark:null,signOutMark:null,addressMark:null}),M=A.query.sLngLat;A.query.sLngLat&&(a.lnglat=M.split(","));const L=A.query.inLngLat;A.query.inLngLat&&(a.signInLongitudeLatitude=L.split(","));const h=A.query.outLngLat;A.query.outLngLat&&(a.signOutLongitudeLatitude=h.split(","));const n=O(null),s=()=>{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};
- >>>>>>>> 87d4d1b1 (更新):dist/assets/amap-gps-66997ac8.js
|