From 1d35bfb5122f8e5916c301fc6fa57391e6e6af11 Mon Sep 17 00:00:00 2001 From: yaoyuhao Date: Wed, 24 Jul 2024 16:18:27 +0800 Subject: [PATCH 1/3] gx --- src/view/sy_map.vue | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/view/sy_map.vue b/src/view/sy_map.vue index 1eff34d..bd0fb72 100644 --- a/src/view/sy_map.vue +++ b/src/view/sy_map.vue @@ -137,6 +137,7 @@ const cs_qk_arr = ref([]); const cs_name_arr = ref([]); const cs_number_name_arr = ref([]); // +const jrcs=ref(false) const title_choose = ref("龙游县"); //村社颜色列表 const colorList = [ @@ -168,6 +169,8 @@ const colorList = [ bg: "RGBA(27, 91, 55, 1)", }, ]; +//选中社区 + //中心点坐标 const center_now = ref([]); const center_center = ref([119.178783, 29.034583]); @@ -404,8 +407,16 @@ const addPolygonCounty = () => { map.addOverlay(polygon); polygon.addEventListener("click", () => { console.log(item.name); - if (title_choose.value.includes("溪口镇")) { + if(item.name !== "溪口镇"){ + jrcs.value=false; + console.log( jrcs.value,'000'); + } + if (jrcs.value && item.name !== "溪口镇") { + console.log(1); } else { + console.log(2); + + jrcs.value=true; let jdCenter = []; if (item.name == "溪口镇") { if (!title_choose.value.includes("溪口镇")) { @@ -418,6 +429,7 @@ const addPolygonCounty = () => { jdCenter = item.center; } }); + console.log( jrcs.value); addCs(); goMapCenter(jdCenter, 13); } else { @@ -493,7 +505,13 @@ const addPolygonCountyCs = () => { }); map.addOverlay(cs_qk_arr.value[index]); cs_qk_arr.value[index].addEventListener("click", () => { - console.log(111); + console.log(item.name); + // console.log(111,xkzDk); + // xkzDk.forEach((itemm,indexx)=>{ + // if(itemm.name==item.name){ + + // } + // }) // let jdCenter = []; // if (item.name == "溪口镇") { // if (!title_choose.value.includes("溪口镇")) { @@ -521,6 +539,7 @@ const addPolygonCountyCs = () => { } }); }; + // 添加地图上的街道名 const createCustomOverlayJd = (polygon, indexx) => { From de9a394ec19b7da225a8dea84cae3b4b6ae7b9ab Mon Sep 17 00:00:00 2001 From: wanghui Date: Wed, 24 Jul 2024 17:18:27 +0800 Subject: [PATCH 2/3] 11 --- src/view/home.vue | 3 - src/view/sy_map.vue | 184 +++++++++++++++++++++++++++++--------------- vite.config.js | 4 +- 3 files changed, 123 insertions(+), 68 deletions(-) diff --git a/src/view/home.vue b/src/view/home.vue index b7e8f53..2867d35 100644 --- a/src/view/home.vue +++ b/src/view/home.vue @@ -31,7 +31,6 @@ const reset_font = () => { let height = document.documentElement.clientHeight || document.body.clientHeight; - console.log(width, height) document.querySelector("#m").style.transformOrigin = "top left"; document.querySelector("#m").style.transform = @@ -54,11 +53,9 @@ const reset_font = () => { }; onMounted(() => { reset_font(); - reset_font(); }); window.addEventListener("resize", function () { reset_font(); - reset_font(); }); diff --git a/src/view/sy_map.vue b/src/view/sy_map.vue index 1eff34d..86012b6 100644 --- a/src/view/sy_map.vue +++ b/src/view/sy_map.vue @@ -9,15 +9,10 @@
-
-
{{ item.name }}
-
{{ item.value }}
+
+
{{ item.ages }}
+
{{ item.rksl }}
@@ -27,13 +22,8 @@
-
+
{{ item.name }}
{{ item.value }}
@@ -47,19 +37,11 @@
-
+
{{ item.name }}
-
+
{{ itemm.name }}
@@ -72,13 +54,8 @@
-
+
{{ item.name }}
@@ -129,6 +106,8 @@ import b4 from "@/assets/images/map/b4.png"; import b5 from "@/assets/images/map/b5.png"; import b6 from "@/assets/images/map/b6.png"; import xcbg from "@/assets/images/map/xcbg.png"; +import http from "@/utils/request.js"; + //删除 const jdm_arr = ref([]); const jdm_number_arr = ref([]); @@ -177,6 +156,7 @@ const mapTownCount = reactive([ name: "龙洲街道", center: [119.1573083, 28.9799445], number: "1000", + }, { name: "东华街道", @@ -438,6 +418,7 @@ const addPolygonCounty = () => { const addJd = () => { mapTownCount.map((item, index) => { + goMapCenter([119.178783, 29.034581], 11); createCustomOverlayJd(item, index); }); }; @@ -1022,71 +1003,101 @@ const personTotal = ref([ id: 0, name: "总人口", value: "1724114", + ages: '总人口', + age: '1000' + }, { id: 1, - name: "1岁", + name: "0岁", value: "26737", + ages: '0岁', + age: '1000' }, { id: 2, - name: "2岁", + name: "1岁", value: "26737", + ages: '1岁', + age: '1000' }, { id: 3, - name: "3岁", + name: "2岁", value: "26737", + ages: '2岁', + age: '1000' }, { id: 4, - name: "4岁", + name: "3岁", value: "26737", + ages: '3岁', + age: '1000' }, + { id: 5, - name: "5岁", + name: "4岁", value: "26737", + ages: '4岁', + age: '1000' }, { id: 6, - name: "6岁", + name: "5岁", value: "26737", + ages: '5岁', + age: '1000' }, { id: 7, - name: "7岁", + name: "6岁", value: "26737", + ages: '6岁', + age: '1000' }, { id: 8, - name: "8岁", + name: "7岁", value: "26737", + ages: '7岁', + age: '1000' }, { id: 9, - name: "9岁", + name: "8岁", value: "26737", + ages: '8岁', + age: '1000' }, { id: 10, - name: "10岁", + name: "9岁", value: "26737", + ages: '9岁', + age: '1000' }, { id: 11, - name: "11岁", + name: "10岁", value: "26737", + ages: '10岁', + age: '1000' }, { id: 12, - name: "12岁", + name: "11岁", value: "26737", + ages: '11岁', + age: '1000' }, { id: 13, - name: "13岁", + name: "12岁", value: "26737", + ages: '12岁', + age: '1000' }, ]); @@ -1693,8 +1704,63 @@ const yaosuTotal = ref([ wz: true, }, ]); +const getData = async (i, e) => { + await http.get(`/api/ggfwyth/ysyzt/getXzjdrksl?age=${e || ''}`).then((res) => { + if (res.code == 200) { + personTotal.value = [{ + id: '0', + ages: "总人口", + age: '', + value: "res.data.total", + },] + personTotal.value[0].rksl = res.data.total + personTotal.value[0].ages = '总人口' + res.data.age.forEach((item, index) => { + console.log(index); + personTotal.value.push({ + id: index + 1, + rksl: item.rksl, + age: item.age + '', + ages: item.age + '岁' + }) + }) + res.data.town.map((item) => { + mapTownCount.map((items) => { + if (item.town == items.name) { + items.number = item.rksl + } + }) + }) + } + }); + console.log(mapTownCount, 10001); + if (i) { + changeRs(i) + } +}; +const reset_font = () => { + let width = document.documentElement.clientWidth || document.body.clientWidth; + let height = + document.documentElement.clientHeight || document.body.clientHeight; + document.querySelector(".header_content").style.transformOrigin = "top left"; + document.querySelector(".header_content").style.transform = + "scale(" + width / 1920 + "," + height / 1080 + ")"; + if ( + document.querySelector(".left")) { + document.querySelector(".left").style.transformOrigin = "bottom left"; + document.querySelector(".left").style.transform = + "scale(" + width / 1920 + "," + height / 1080 + ")"; + document.querySelector(".right").style.transformOrigin = "bottom right"; + document.querySelector(".right").style.transform = + "scale(" + width / 1920 + "," + height / 1080 + ")"; + + } + +}; onMounted(() => { + reset_font() initMap(); + getData() });