YM
2024-05-20 7a7608d68227404c2cee81589a0f53bd0d9a4c78
src/pages/characterMap/characterMap.vue
@@ -1,8 +1,8 @@
<template>
  <view>
    <headNav :idIndex="idIndex" text="中医人物数据库" />
    <el-button class="getBack" @click="getBack">返回</el-button>
    <view class="" style="position: relative">
  <view style="width: 100%;height: 100%;display: flex;flex-direction: column;">
    <headNav :idIndex="1 + ''" text="中医人物数据库" />
    <el-button class="getBack" @click="goBack">返回</el-button>
    <view style="flex: 1;overflow: hidden;">
      <!-- 地图 -->
      <!-- <view id="spaceTime" style="height: 90vh;width: 100%;position: relative;"></view> -->
      <div id="map"></div>
@@ -78,6 +78,7 @@
import "echarts/extension/bmap/bmap";
import { loadBMap } from "@/static/map.js";
import L from "leaflet";
import "leaflet.chinatmsproviders";
import { getPersonInfo } from "@/api/index.js";
export default {
  data() {
@@ -94,7 +95,7 @@
      spanML: 0,
      cursorML: -0.05,
      activityInfo: {},
      basicInfo: {},
      basicInfo: {}
    };
  },
@@ -116,34 +117,37 @@
    initMap(info) {
      var map = L.map("map", {
        attributionControl: false,
        preferCanvas: true,
        preferCanvas: true
      }).setView([35.91667, 110.41667], 5);
      // L.tileLayer(
      //   "http://webrd01.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=7&x={x}&y={y}&z={z}"
      // ).addTo(map);
      L.tileLayer(
        "https://t{s}.tianditu.gov.cn/vec_c/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=vec&tileMatrixSet=c&TileMatrix={z}&TileRow={y}&TileCol={x}&style=default&format=tiles&tk=76bc34ead7e30e663a4eded8aeaf5860",
        {
      L.tileLayer
        .chinaProvider("TianDiTu.Normal.Map", {
          key: "76bc34ead7e30e663a4eded8aeaf5860",
          maxZoom: 18,
          attribution: "Map data &copy; 2012-2019, TianDiTu",
          id: "tdtAnnoLayer",
          accessToken: "your.mapbox.public.access.token",
        }
      ).addTo(map);
          minZoom: 5
        })
        .addTo(map);
      let DefaultIcon1 = L.icon({
        iconUrl: this.icoName,
        iconSize: [24, 41], //  图标的大小    【值1,值2】 为具体你自定义图标的尺寸,比如我图标尺寸是32×52,表示该图标:宽度32像素,高度:52像素,那么值1:就是32,值2:就是52
        iconAnchor: [24, 41], //  图标将对应标记点的位置 这个是重点, 【值1,值2】,值1:为图标坐标第一个值(即32)的一半,值2:为图标坐标第二个值(即52)
        popupAnchor: [1, -24], // 该点是相对于iconAnchor弹出信息的位置  这个是我手动调出来的,文档默认原始值是[-1,-76],我是去一半值,取一半值调出来的
        popupAnchor: [1, -24] // 该点是相对于iconAnchor弹出信息的位置  这个是我手动调出来的,文档默认原始值是[-1,-76],我是去一半值,取一半值调出来的
      });
      let icon = L.divIcon({
        html: "<div class='map-circle-name ripple'></div>",
        iconSize: [80, 80],
        className: "map-circle"
      });
      this.map = map;
      if (info && info.length) {
        for (let i = 0; i < info.length; i++) {
          const item = info[i];
          const marker1 = L.marker([item.ycoord, item.xcoord], {
            icon: DefaultIcon1,
            icon: icon
          }).addTo(map);
          marker1.on("click", (e) => {
            this.menuNav = true;
@@ -154,8 +158,8 @@
    },
    // 返回按钮
    getBack() {
      uni.navigateBack();
    goBack() {
      this.$router.go(-1);
    },
    aaa() {
      // 渲染母线
@@ -175,7 +179,7 @@
    getPersonInfoFun() {
      getPersonInfo({
        id: this.$route.query.id,
        type: "PERSON_SPACE_TIME",
        type: "PERSON_SPACE_TIME"
      }).then((res) => {
        console.log(res, "res");
        this.initMap(res.object.personSpaceTimeList);
@@ -185,7 +189,7 @@
    getBasicInfo() {
      getPersonInfo({
        id: this.$route.query.id,
        type: "PERSON_BASIC",
        type: "PERSON_BASIC"
      }).then((res) => {
        console.log(res, "res");
        this.basicInfo.name = res.object.personFieldList.find(
@@ -253,40 +257,40 @@
      const data = [
        {
          name: "海门",
          value: 9,
          value: 9
        },
        {
          name: "金昌",
          value: 19,
          value: 19
        },
        {
          name: "泉州",
          value: 21,
          value: 21
        },
        {
          name: "衢州",
          value: 177,
          value: 177
        },
        {
          name: "廊坊",
          value: 193,
          value: 193
        },
        {
          name: "菏泽",
          value: 194,
          value: 194
        },
        {
          name: "合肥",
          value: 229,
          value: 229
        },
        {
          name: "武汉",
          value: 273,
          value: 273
        },
        {
          name: "啊三大矿及说到底是封建士大夫大师傅就",
          value: 279,
        },
          value: 279
        }
      ];
      const geoCoordMap = {
        海门: [121.15, 31.89],
@@ -316,7 +320,7 @@
        菏泽: [115.480656, 35.23375],
        合肥: [117.27, 31.86],
        武汉: ["你好", 30.52],
        啊三大矿及说到底是封建士大夫大师傅就: [125.03, 46.58],
        啊三大矿及说到底是封建士大夫大师傅就: [125.03, 46.58]
      };
      const convertData = function (data) {
        var res = [];
@@ -325,7 +329,7 @@
          if (geoCoord) {
            res.push({
              name: data[i].name,
              value: geoCoord.concat(data[i].value),
              value: geoCoord.concat(data[i].value)
            });
          }
        }
@@ -333,7 +337,7 @@
      };
      option = {
        tooltip: {
          trigger: "item",
          trigger: "item"
        },
        bmap: {
          center: [104.114129, 37.550339], // 调整地图中心点位置
@@ -345,60 +349,60 @@
                featureType: "water",
                elementType: "all",
                stylers: {
                  color: "#d1d1d1",
                },
                  color: "#d1d1d1"
                }
              },
              {
                featureType: "land",
                elementType: "all",
                stylers: {
                  color: "#f3f3f3",
                },
                  color: "#f3f3f3"
                }
              },
              {
                featureType: "manmade",
                elementType: "all",
                stylers: {
                  color: "#d1d1d1",
                },
                  color: "#d1d1d1"
                }
              },
              {
                featureType: "local",
                elementType: "all",
                stylers: {
                  color: "#d1d1d1",
                },
                  color: "#d1d1d1"
                }
              },
              {
                featureType: "arterial",
                elementType: "labels",
                stylers: {
                  visibility: "off",
                },
                  visibility: "off"
                }
              },
              {
                featureType: "boundary",
                elementType: "all",
                stylers: {
                  color: "#fefefe",
                },
                  color: "#fefefe"
                }
              },
              {
                featureType: "building",
                elementType: "all",
                stylers: {
                  color: "#d1d1d1",
                },
                  color: "#d1d1d1"
                }
              },
              {
                featureType: "label",
                elementType: "labels.text.fill",
                stylers: {
                  color: "#999999",
                },
              },
            ],
          },
                  color: "#999999"
                }
              }
            ]
          }
        },
        series: [
          {
@@ -415,11 +419,11 @@
              return val[2] / 10;
            },
            encode: {
              value: 2,
              value: 2
            },
            showEffectOn: "render",
            rippleEffect: {
              brushType: "stroke",
              brushType: "stroke"
            },
            label: {
              formatter: "{b}",
@@ -437,18 +441,18 @@
              },
              show: true,
              fontSize: 12,
              borderRadius: 30,
              borderRadius: 30
            },
            itemStyle: {
              shadowBlur: 10,
              shadowColor: "#333",
              shadowColor: "#333"
            },
            emphasis: {
              scale: true,
              scale: true
            },
            zlevel: 1,
          },
        ],
            zlevel: 1
          }
        ]
      };
      let menuNav1 = this.menuNav;
      let menuNav2 = this.menuNav;
@@ -474,8 +478,8 @@
      this.menuNav = !this.menuNav;
      // 时空地图的数据
      console.log(Arr);
    },
  },
    }
  }
};
</script>
@@ -485,7 +489,7 @@
  width: 0.6rem;
  height: 0.24rem;
  top: 1rem;
  left: 0.24rem;
  left: 0.6rem;
  z-index: 99999;
  font-size: 0.12rem;
  display: flex;
@@ -579,9 +583,41 @@
  height: 100%;
}
#map {
  height: 1080px;
  height: 100%;
  width: 100%;
  margin: 0 auto;
  font-size: 14px !important;
}
::v-deep .map-circle-name {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: rgb(222, 142, 102);
}
::v-deep .ripple {
  border-radius: 50%;
  position: relative;
  overflow: hidden;
}
::v-deep .ripple::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 150%; /* Ensure it covers the entire parent */
  height: 150%;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(1);
  animation: ripple-animation 1s infinite linear;
}
@keyframes ripple-animation {
  to {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
  }
}
</style>