1
y505174330
2024-05-18 077feba634b75aee3c1fc8e561b2d2aeb95e3305
src/pages/territory/territory.vue
@@ -4,6 +4,7 @@
    <headNav
      :idIndex="idIndex"
      text="中医地域医谱"
      style="z-index:999"
    />
    <view
      class="flex flex-center"
@@ -165,8 +166,6 @@
        type="text"
      >查看更多>></el-button>
    </el-card>
    <!-- echarts地图 -->
    <!-- <view id="main" style="width: 100vw; position: relative"></view> -->
    <div id="map"></div>
    <!-- 朝代 -->
    <view
@@ -404,18 +403,10 @@
    showCard(info) {
      console.log(info);
      console.log(this.markerList);
      const item = this.markerList.find((f) => f.id == info.id);
      console.log(item, "12312");
      this.currentMark = {
        name: item?.WEAK_NAME[0]?.content1,
        nikeName: item?.ALIAS[0]?.content2,
        nativePlace: item?.content1,
        barnch: item?.MEDICAL_BRANCH[0]?.content1,
        medical: item?.MEDICAL_EXPERTISE[0]?.content1,
      };
      console.log(this.currentMark);
      console.log(this.map);
      this.isEchTrue = true;
      const item = this.markerList.find((f) => f.id == info.id);
      var latlng = L.latLng(item.yCoord, item.xCoord);
      this.map.setView(latlng, 10);
    },
    getDataList() {
      getRetrieval({ keyword: this.keyword, dynasty: "" }).then((res) => {
@@ -443,14 +434,13 @@
          id: item.id,
        }));
        this.markerList = markerList;
        console.log(markerList, "markerList");
      });
    },
    //初始化地图
    initMap(markerList) {
      var map = L.map("map", {
        attributionControl: false,
        preferCanvas: true,
        attributionControl: false,
      }).setView([39.91667, 116.41667], 3);
      L.tileLayer
@@ -466,7 +456,7 @@
        iconAnchor: [24, 41], //  图标将对应标记点的位置 这个是重点, 【值1,值2】,值1:为图标坐标第一个值(即32)的一半,值2:为图标坐标第二个值(即52)
        popupAnchor: [1, -24], // 该点是相对于iconAnchor弹出信息的位置  这个是我手动调出来的,文档默认原始值是[-1,-76],我是去一半值,取一半值调出来的
      });
      this.map = map;
      if (markerList.length) {
        for (let i = 0; i < markerList.length; i++) {
          const item = markerList[i];
@@ -648,6 +638,6 @@
  width: 100%;
  margin: 0 auto;
  font-size: 14px !important;
  z-index: -1 !important;
  /* z-index: -1 !important; */
}
</style>