1
YM
2024-07-17 d5f572496c5fb12fec2fe346b847bf58331299c9
src/pages/characterMap/characterMap.vue
@@ -1,8 +1,10 @@
<template>
  <view style="width: 100%;height: 100%;display: flex;flex-direction: column;">
    <headNav :idIndex="1 + ''" text="中医人物数据库" />
  <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 style="flex: 1; overflow: hidden">
      <!-- 地图 -->
      <!-- <view id="spaceTime" style="height: 90vh;width: 100%;position: relative;"></view> -->
      <div id="map"></div>
@@ -12,7 +14,7 @@
        <view
          class="font-family"
          style="font-size: 0.26rem; padding-top: 0.16rem; font-weight: bold"
          >{{ activityInfo.participants }}</view
          >{{ basicInfo.name }}</view
        >
        <ul
          style="
@@ -23,15 +25,15 @@
            line-height: 0.28rem;
          "
        >
          <li>出生于{{ basicInfo.nativePlace }}</li>
          <li>出生于{{ basicInfo.nativePlace || "-" }}</li>
          <li>
            {{
              basicInfo.birthYear +
              basicInfo.nativePlace +
              "(今" +
              basicInfo.nowPlace +
              ")"
            }}
            <span v-if="basicInfo.birthYear">{{ basicInfo.birthYear }}</span>
            <span v-if="basicInfo.nativePlace">{{
              basicInfo.nativePlace
            }}</span>
            <span v-if="basicInfo.nowPlace"
              >(今{{ basicInfo.nowPlace }})</span
            >
          </li>
        </ul>
        <ul
@@ -42,18 +44,18 @@
            line-height: 0.28rem;
          "
        >
          <li>活动名称:{{ activityInfo.activityName }}</li>
          <li>活动地点:{{ activityInfo.activityAddr }}</li>
          <li>活动区间:{{ activityInfo.time }}</li>
          <li>活动描述:{{ activityInfo.desc }}</li>
          <li>参与人员:{{ activityInfo.participants }}</li>
          <li>活动名称:{{ activityInfo.activityName || "-" }}</li>
          <li>活动地点:{{ activityInfo.activityAddr || "-" }}</li>
          <li>活动区间:{{ activityInfo.time || "-" }}</li>
          <li>活动描述:{{ activityInfo.desc || "-" }}</li>
          <li>参与人员:{{ activityInfo.participants || "-" }}</li>
        </ul>
        <!-- <img
          style="width: 100%; height: 2rem"
          src="https://img0.baidu.com/it/u=1845740325,2917001370&fm=253&app=120&size=w931&n=0&f=JPEG&fmt=auto?sec=1711731600&t=0b208ab46e1d33aa81ac31dd6bf627be"
          alt=""
        /> -->
        <div class="box" style="width: 80%">
        <!-- <div class="box" style="width: 80%">
          <span class="span" :style="{ marginLeft: spanML + 'rem' }"
            >{{ span }}年</span
          >
@@ -67,7 +69,7 @@
          </div>
          <div class="MX"></div>
          <div class="cursor" :style="{ marginLeft: cursorML + 'rem' }"></div>
        </div>
        </div> -->
      </el-dialog>
    </view>
  </view>
@@ -95,7 +97,13 @@
      spanML: 0,
      cursorML: -0.05,
      activityInfo: {},
      basicInfo: {}
      basicInfo: {
        name: "",
        birthYear: "",
        deathYear: "",
        nativePlace: "",
        nowPlace: "",
      },
    };
  },
@@ -108,7 +116,6 @@
    //   this.aaa();
    // });
    this.$route;
    console.log(this.$route, "this.$route");
    this.getPersonInfoFun();
    this.getBasicInfo();
  },
@@ -117,7 +124,7 @@
    initMap(info) {
      var map = L.map("map", {
        attributionControl: false,
        preferCanvas: true
        preferCanvas: true,
      }).setView([35.91667, 110.41667], 5);
      // L.tileLayer(
@@ -128,26 +135,33 @@
        .chinaProvider("TianDiTu.Normal.Map", {
          key: "76bc34ead7e30e663a4eded8aeaf5860",
          maxZoom: 18,
          minZoom: 5
          minZoom: 5,
        })
        .addTo(map);
      L.tileLayer
        .chinaProvider("TianDiTu.Normal.Annotion", {
          key: "76bc34ead7e30e663a4eded8aeaf5860",
          maxZoom: 18,
          minZoom: 3,
        })
        .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"
        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: icon
            icon: icon,
          }).addTo(map);
          marker1.on("click", (e) => {
            this.menuNav = true;
@@ -179,9 +193,8 @@
    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);
      });
    },
@@ -189,9 +202,8 @@
    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(
          (f) => f.fieldName == "WEAK_NAME"
        ).content1;
@@ -207,16 +219,14 @@
        this.basicInfo.nowPlace = res.object.personFieldList.find(
          (f) => f.fieldName == "NATIVE_PLACE"
        ).content2;
        // this.initMap(res.object.personSpaceTimeList);
        console.log(this.basicInfo);
      });
    },
    creatMX(len) {
      console.log(len);
      let width = len * 50 + 10;
      // this.MX.style.width = `${width}px`
      // this.scales.style.width = `${width}px`
      // console.log(this.box.style.width);
    },
    creatScale() {
      // for (let i = 0; i < this.yearArr.length; i++) {
@@ -226,7 +236,6 @@
      //    scale.addEventListener("click", this.scaleClick)
      //    scales.appendChild(scale)
      // }
      // console.log(arr[0]);
    },
    handleSliderChange(value) {
@@ -234,16 +243,13 @@
    },
    scaleClick(i) {
      // let i = Number(this.getAttribute("data-index"))
      console.log(i, this.cursorML);
      if (i > this.yearIndex) {
        this.cursorML += (i - this.yearIndex + +("0.0" + this.yearIndex)) / 1.9;
        // this.spanML += 50 * (i - this.yearIndex)
        console.log(i - this.yearIndex + 0.2, "aaaa");
      } else {
        this.cursorML -= (this.yearIndex - i) / 2 + 0.04;
        // this.spanML -= 50 * (this.yearIndex - i)
        console.log(this.yearIndex, i, "bbbb");
      }
      this.yearIndex = i;
    },
@@ -257,40 +263,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],
@@ -320,7 +326,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 = [];
@@ -329,7 +335,7 @@
          if (geoCoord) {
            res.push({
              name: data[i].name,
              value: geoCoord.concat(data[i].value)
              value: geoCoord.concat(data[i].value),
            });
          }
        }
@@ -337,7 +343,7 @@
      };
      option = {
        tooltip: {
          trigger: "item"
          trigger: "item",
        },
        bmap: {
          center: [104.114129, 37.550339], // 调整地图中心点位置
@@ -349,60 +355,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: [
          {
@@ -419,11 +425,11 @@
              return val[2] / 10;
            },
            encode: {
              value: 2
              value: 2,
            },
            showEffectOn: "render",
            rippleEffect: {
              brushType: "stroke"
              brushType: "stroke",
            },
            label: {
              formatter: "{b}",
@@ -441,30 +447,28 @@
              },
              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;
      // 设置点击事件监听
      myChart.on("click", (params) => {
        // menuNav2 = !menuNav1
        // console.log(menuNav);
        if (params.componentType === "series") {
          var dataName = params.data.name; // 获取点击的数据名称
          var dataValue = params.data.value; // 获取点击的数据值
          // 在这里可以根据需要处理点击事件,比如弹出对应数据的详细信息等操作
          // console.log('点击了', dataName, '数据,数值为', dataValue);
          // 这里可以编写触发时间获取对应数据信息的逻辑
          this.spaceTimeArr(params);
        }
@@ -477,9 +481,8 @@
      // 修改 Vue 组件的数据,例如显示菜单导航
      this.menuNav = !this.menuNav;
      // 时空地图的数据
      console.log(Arr);
    }
  }
    },
  },
};
</script>
@@ -567,9 +570,9 @@
  margin: 0 !important;
  position: absolute;
  right: 0;
  top: 0;
  top: 86px;
  bottom: 0;
  width: 4rem;
  height: 100%;
}
.particulars ::v-deep .el-dialog__header {