This commit is contained in:
姚宇浩 2024-07-24 15:50:55 +08:00
parent fd53ee78bf
commit 97c8e04edc
1 changed files with 60 additions and 22 deletions

View File

@ -341,7 +341,7 @@ const BMAP = () => {
// console.log(e.point.latLng.lng,e.point.latLng.lat, 666);
// var pt = e.point; //
map.addOverlay(marker);
var marker = new BMapGL.Marker(new BMapGL.Point(e.point.lng,e.point.lat)); //
var marker = new BMapGL.Marker(new BMapGL.Point(e.point.lng, e.point.lat)); //
// var marker = new BMapGL.Marker(pt); //
map.addOverlay(marker); //
});
@ -385,6 +385,7 @@ const addPolygonCounty = () => {
map.clearOverlays();
let fillColor = "#ffffff";
mapTownDataDK.map((item) => {
item.leg = 0;
//
let points = [];
item.point.map((p) => points.push(new BMapGL.Point(...p)));
@ -397,11 +398,14 @@ const addPolygonCounty = () => {
fillColor: fillColor,
fillOpacity: 0.7,
name: item.name,
zIndex: 92,
});
map.addOverlay(polygon);
polygon.addEventListener("click", () => {
console.log(item.name);
if (title_choose.value.includes("溪口镇")) {
} else {
let jdCenter = [];
if (item.name == "溪口镇") {
if (!title_choose.value.includes("溪口镇")) {
@ -417,7 +421,7 @@ const addPolygonCounty = () => {
addCs();
goMapCenter(jdCenter, 13);
} else {
title_choose.value='龙游县'
title_choose.value = "龙游县";
cs_qk_arr.value.forEach((item, index) => {
map.removeOverlay(cs_qk_arr.value[index]);
});
@ -425,6 +429,7 @@ const addPolygonCounty = () => {
map.removeOverlay(cs_name_arr.value[index]);
});
}
}
});
}
});
@ -484,8 +489,35 @@ const addPolygonCountyCs = () => {
fillColor: fillColor,
fillOpacity: 0.7,
name: item.name,
zIndex: 99,
});
map.addOverlay(cs_qk_arr.value[index]);
cs_qk_arr.value[index].addEventListener("click", () => {
console.log(111);
// let jdCenter = [];
// if (item.name == "") {
// if (!title_choose.value.includes("")) {
// title_choose.value = title_choose.value + `>${item.name}`;
// }
// loadCs();
// addPolygonCountyCs();
// mapTownCount.map((item) => {
// if (item.name == "") {
// jdCenter = item.center;
// }
// });
// addCs();
// goMapCenter(jdCenter, 13);
// } else {
// title_choose.value = "";
// cs_qk_arr.value.forEach((item, index) => {
// map.removeOverlay(cs_qk_arr.value[index]);
// });
// cs_name_arr.value.forEach((item, index) => {
// map.removeOverlay(cs_name_arr.value[index]);
// });
// }
});
}
});
};
@ -935,6 +967,12 @@ const changeRs = (id) => {
cs_name_arr.value.length = 0;
addCs2();
}
if (jdm_number_arr.value?.length) {
jdm_number_arr.value.forEach((item, index) => {
map.removeOverlay(jdm_number_arr.value[index]);
});
jdm_number_arr.value.length = 0;
}
addJd2();
// removeAllPolygon("person");
// xuanran();