import{g as E,a as T,b as B}from"./activity-c9a7a2d3.js";import{g as D}from"./map-4f55c240.js";import{d as I,u as A,r as O,o as $,w as x,a as G,c as W,_ as z}from"./index-deffec86.js";import{u as F}from"./index-a862924e.js";const S={id:"container",class:"map"},j=I({__name:"MatchMap",props:{regionId:{default:"530000"},geometriesList:{default:()=>[]}},setup(m){const w=A(),n=m,e=O({markerLayer:null,area:null,markerCluster:null,infoWindow:null,paths:[],centerLocation:[25.046432,102.709372],level:1,clusterBubbleList:[],markerGeometries:[],marker:null}),g={1:6.5,2:8,3:10.5};$(async()=>{window.marker=null,f()});const f=async()=>{const t=new window.TMap.LatLng(24.8487,102.766351);window.map=new window.TMap.Map(document.getElementById("container"),{center:t,zoom:6.5}),window.map.removeControl(window.TMap.constants.DEFAULT_CONTROL_ID.ZOOM),window.map.removeControl(window.TMap.constants.DEFAULT_CONTROL_ID.SCALE),window.map.removeControl(window.TMap.constants.DEFAULT_CONTROL_ID.ROTATION),c(),d()},c=()=>{e.markerCluster=new window.TMap.MarkerCluster({map:window.map,enableDefaultStyle:!1,minimumClusterSize:3,geometries:n.geometriesList,zoomOnClick:!0,gridSize:50,averageCenter:!1,maxZoom:6.5}),v()},v=()=>{e.markerCluster.on("cluster_changed",function(t){e.clusterBubbleList.length&&(e.clusterBubbleList.forEach(function(a){a.destroy()}),e.clusterBubbleList=[]),e.markerGeometries=[],e.markerCluster.getClusters().forEach(function(a){if(a.geometries.length>1){let o=new window.ClusterBubble({map:window.map,position:a.center,content:a.geometries.length,properties:a.geometries[0].properties});o.on("click",()=>{window.map.fitBounds(a.bounds)}),e.clusterBubbleList.push(o)}else e.markerGeometries.push({position:a.center,properties:a.geometries[0].properties})}),l()})},l=()=>{window.marker?window.marker.setGeometries(e.markerGeometries):(window.marker=new window.TMap.MultiMarker({map:window.map,styles:{default:new window.TMap.MarkerStyle({width:34,height:42,anchor:{x:17,y:21},src:"https://mapapi.qq.com/web/lbs/javascriptGL/demo/img/marker_blue.png"})},geometries:e.markerGeometries}),y())},d=async()=>{const t=await D({keyword:n.regionId,get_polygon:1,max_offset:3e3});if(!t.result[0].length)return;const s=t.result[0];e.level=s[0].level,e.centerLocation=[s[0].location.lat,s[0].location.lng],s.forEach(a=>{const o=[];a.polygon.forEach(r=>{o.push([r.reverse()])}),e.paths.push({path:o,styleId:"styel1"})}),!e.area&&(e.area=new window.TMap.visualization.Area({styles:{styel1:{fillColor:"rgba(209, 230, 255, 0.5)",strokeColor:"#6ba3fe"}}}).setData(e.paths).addTo(window.map))},y=()=>{e.infoWindow=new window.TMap.InfoWindow({map:window.map,position:new window.TMap.LatLng(39.984104,116.307503),offset:{x:0,y:-40}}),e.infoWindow.close(),window.marker.on("click",async t=>{const{geometry:s}=t,{address:a,name:o,county_str:r,match_status:u}=await h(s.properties.activity_id);let{cover_img:i}=await k(s.properties.activity_id);const{match_number:M,join_num:C}=await L(s.properties.activity_id);e.infoWindow.open(),e.infoWindow.setPosition(t.geometry.position),e.infoWindow.setContent(`
      <div class=${i?"map-info-container":"no_img"}>
				<div class='top-title'>
					<span>${o}</span>
					<span class='${p[u].class}'>${p[u].label}</span>
				</div>
				<img class=${i?"top-img":"hiddenTopImg"}  src=${i||"https://mapapi.qq.com/web/lbs/javascriptGL/demo/img/em.jpg"}>
				<div class='content'>
					<div class='info'>
						<div>
							<img class='icon' src='https://zwapitest.wesais.cn/images/company_logo/20231102/cfe5abd3df02338980e44ec2e0d176ce.png'>
							<span class='info-text'>${a}</span>
						</div>
						<div>
							<img class='icon' src='https://zwapitest.wesais.cn/images/company_logo/20231102/19a9598c1e62827de9cd83fb8b4a57bd.png'>
							<span class='info-text'>${r}</span>
						</div>
					</div>
					<div id='mapInfo' data-id=${s.properties.activity_id} class='check-detail'>\u67E5\u770B\u8BE6\u60C5 <span>></span></span></div>
				</div>
				<div class='footer'>
					<div>
						<span>\u4E3E\u529E\u573A\u6B21</span>
						<span class='num'>${M||0}</span>
					</div>
					<div>
						<span>\u53C2\u4E0E\u4EBA\u6B21</span>
						<span class='num'>${C||0}</span>
					</div>
				</div>
			</div>
				`),_()})},_=()=>{document.getElementById("mapInfo").addEventListener("click",b)},p={1:{label:"\u8BA1\u5212\u4E2D",class:"info"},2:{label:"\u62A5\u540D\u4E2D",class:"warning"},3:{label:"\u8FDB\u884C\u4E2D",class:""},4:{label:"\u5DF2\u7ED3\u675F",class:"danger"}},b=t=>{w.push({name:"matchActivityDetail",query:{activity_id:t.target.dataset.id}})},h=async t=>{const{data:s}=await E({activity_id:t});return s},k=async t=>{const{data:s}=await T({activity_id:t});return s},L=async t=>{const{data:s}=await B({activity_id:t});return s};return x(()=>n.geometriesList,F(async()=>{var t,s;e.paths=[],(t=e.infoWindow)==null||t.close(),(s=e.area)==null||s.destroy(),e.clusterBubbleList.length&&(e.clusterBubbleList.forEach(function(a){a.destroy()}),e.clusterBubbleList=[]),e.markerGeometries=[],c(),l(),await d(),window.map.setCenter(e.centerLocation),window.map.setZoom(g[e.level]),e.area.setData(e.paths).addTo(window.map),e.markerCluster.setGeometries(n.geometriesList)},500)),(t,s)=>(G(),W("div",S))}});const Z=z(j,[["__scopeId","data-v-118d4ef5"]]);export{Z as default};
