浏览代码

chore: 调整

cfofpp 6 月之前
父节点
当前提交
10ccbdedab
共有 3 个文件被更改,包括 16 次插入6 次删除
  1. 3 0
      src/views/home/components/box1/index.vue
  2. 12 5
      src/views/home/components/map/index.vue
  3. 1 1
      src/views/home/index.vue

+ 3 - 0
src/views/home/components/box1/index.vue

@@ -49,6 +49,9 @@ export default {
 
       // 指定图表的配置项和数据
       var option = {
+        tooltip: {
+          trigger: "item",
+        },
         xAxis: {
           type: "category",
           data: this.chartOptions.xData,

+ 12 - 5
src/views/home/components/map/index.vue

@@ -4,7 +4,9 @@
       <el-date-picker v-model="year" type="year" placeholder="选择年">
       </el-date-picker>
       <el-button type="primary" style="margin-left: 4px">导出</el-button>
-      <el-button @click="back" type="text">返回></el-button>
+      <el-button @click="back" type="text" v-if="currentMap != '衡阳市'"
+        >返回></el-button
+      >
     </div>
     <div style="display: flex; justify-content: space-between; height: 100%">
       <div id="hy-map" style="width: 65%; height: 97%"></div>
@@ -42,13 +44,15 @@ export default {
       year: "2024",
       loading: true,
       itemData: [{}, {}, {}, {}],
+      currentMap: "",
     };
   },
   mounted() {
-    this.initCharts();
+    this.back();
   },
   methods: {
     back() {
+      this.currentMap = "衡阳市";
       this.initCharts();
     },
     initCharts(json = require("./衡阳市.json")) {
@@ -141,7 +145,7 @@ export default {
               emphasis: {
                 show: true,
                 textStyle: {
-                  color: "#000",
+                  color: "#fff", // 悬浮文字颜色
                 },
               },
             },
@@ -165,7 +169,7 @@ export default {
                 color: "#fff",
               },
               itemStyle: {
-                areaColor: "rgba(11,42,96,0.8)",
+                areaColor: "#5a6fc0", // 选中的区域颜色
               },
             },
             data: [],
@@ -173,8 +177,11 @@ export default {
         ],
       };
       myChart.setOption(option);
+      window.addEventListener("resize", () => {
+        myChart.resize();
+      });
       myChart.on("click", (params) => {
-        console.log(params, "params");
+        this.currentMap = params.name;
         this.initCharts(mapEnum[params.name]);
       });
     },

+ 1 - 1
src/views/home/index.vue

@@ -27,7 +27,7 @@
           <Box1
             v-if="chartOptions.data && chartOptions.data.length > 0"
             :chartOptions="chartOptions"
-            height="95%"
+            height="100%"
           ></Box1>
           <el-empty v-else></el-empty>
         </el-card>