This commit is contained in:
commit
625c9d66ec
|
@ -13,7 +13,7 @@
|
|||
<script setup>
|
||||
import Header from "../components/header.vue";
|
||||
|
||||
import { ref, onMounted, onBeforeMount ,watch} from "vue";
|
||||
import { ref, onMounted, onBeforeMount ,watch, nextTick} from "vue";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
const router = useRouter();
|
||||
const routers = useRoute();
|
||||
|
@ -21,9 +21,9 @@ console.log(routers.path);
|
|||
watch(
|
||||
() => routers.path,
|
||||
(newVal, oldVal) => {
|
||||
if (routers.path == '/home/index/map') {
|
||||
reset_font()
|
||||
}
|
||||
nextTick(()=>{
|
||||
reset_font()
|
||||
})
|
||||
}
|
||||
);
|
||||
const reset_font = () => {
|
||||
|
|
|
@ -389,6 +389,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)));
|
||||
|
@ -401,32 +402,37 @@ const addPolygonCounty = () => {
|
|||
fillColor: fillColor,
|
||||
fillOpacity: 0.7,
|
||||
name: item.name,
|
||||
zIndex: 92,
|
||||
});
|
||||
|
||||
map.addOverlay(polygon);
|
||||
polygon.addEventListener("click", () => {
|
||||
console.log(item.name);
|
||||
let jdCenter = [];
|
||||
if (item.name == "溪口镇") {
|
||||
if (!title_choose.value.includes("溪口镇")) {
|
||||
title_choose.value = title_choose.value + `>${polygon.name}`;
|
||||
}
|
||||
loadCs();
|
||||
addPolygonCountyCs();
|
||||
mapTownCount.map((item) => {
|
||||
if (item.name == "溪口镇") {
|
||||
jdCenter = item.center;
|
||||
}
|
||||
});
|
||||
addCs();
|
||||
goMapCenter(jdCenter, 13);
|
||||
if (title_choose.value.includes("溪口镇")) {
|
||||
} else {
|
||||
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]);
|
||||
});
|
||||
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]);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -487,8 +493,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]);
|
||||
// });
|
||||
// }
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@ -586,7 +619,7 @@ const createCustomOverlayJd2 = (polygon, indexx) => {
|
|||
title.appendChild(document.createTextNode(this.properties.title));
|
||||
content.appendChild(div);
|
||||
var number = document.createElement("div");
|
||||
number.style.fontSize = "16px";
|
||||
number.style.fontSize = "9px";
|
||||
number.style.fontWeight = "600";
|
||||
number.style.color = "rgba(0, 255, 189, 1)";
|
||||
div.appendChild(number);
|
||||
|
@ -900,7 +933,7 @@ const changeRs = (id) => {
|
|||
jdm_number_arr.value.forEach((item, index) => {
|
||||
map.removeOverlay(jdm_number_arr.value[index]);
|
||||
});
|
||||
if (cs_number_name_arr.value) {
|
||||
if (cs_number_name_arr.value?.length) {
|
||||
cs_number_name_arr.value.forEach((item, index) => {
|
||||
map.removeOverlay(cs_number_name_arr.value[index]);
|
||||
});
|
||||
|
@ -920,6 +953,7 @@ const changeRs = (id) => {
|
|||
// addJd();
|
||||
// }
|
||||
} else {
|
||||
console.log(8888);
|
||||
// if(chooseArr.value.includes("jd_number")){
|
||||
// chooseArr.value = chooseArr.value.filter((item) => item !== "jd_number");
|
||||
// chooseArr.value.push("jd_noNumber");
|
||||
|
@ -930,13 +964,19 @@ const changeRs = (id) => {
|
|||
jdm_arr.value.forEach((item, index) => {
|
||||
map.removeOverlay(jdm_arr.value[index]);
|
||||
});
|
||||
if (cs_name_arr.value) {
|
||||
if (cs_name_arr.value?.length) {
|
||||
cs_name_arr.value.forEach((item, index) => {
|
||||
map.removeOverlay(cs_name_arr.value[index]);
|
||||
});
|
||||
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();
|
||||
|
|
Loading…
Reference in New Issue