guonan
2025-06-18 1188387a47e55590a87c161cb43b2db0729b0146
src/views/Home.vue
@@ -8,10 +8,14 @@
  <!-- <Left v-if="leftShow" />
      <Right v-if="rightShow" /> -->
  <Tools :style="rightRiverShow || showDangerAssess
    ? { right: '400px' }
    : { right: '12px' }
    " class="tools" />
  <Tools
    :style="
      rightRiverShow || showDangerAssess
        ? { right: '400px' }
        : { right: '12px' }
    "
    class="tools"
  />
  <!-- <Message v-if="messageShow" class="messageTool" /> -->
  <Announcement v-show="$route.fullPath != '/'" class="announcementTool" />
  <!-- <Location v-if="locationShow" class="locationTool" /> -->
@@ -22,7 +26,6 @@
  <ImagePreview v-if="showPreview" />
  <!-- <Weather v-if="weatherShow" @close="weatherShow = false" /> -->
  <Bar v-if="barShow" @close="barShow = false" />
  <Detail v-if="showDetail" />
</template>
@@ -52,17 +55,15 @@
import GisView from "./GisView.vue";
// import Device from "@/components/menu/Device.vue";
import Detail from "@/components/tools/Detail.vue";
// 不可以删除,否则全局样式会丢掉,不知道原因
import ResultAssess from "@/components/monifangzhen/ResultAssess.vue";
// import ResultAssess from "@/components/monifangzhen/ResultAssess.vue";
// import DangerAssess from "@/components/monifangzhen/DangerAssess.vue";
import { showDeviceDetail } from "@/store";
import { setupTokenRefresh } from "@/api/hpApi.js"
import { getSimData } from "@/api/trApi.js"
import { convertToWKT } from '@/utils/wktUtils';
import { setupTokenRefresh, getDangerPoint } from "@/api/hpApi.js";
import { convertToWKT } from "@/utils/wktUtils";
import { getDeviceInfo, getSafePoint } from "@/api/hpApi";
const route = useRoute();
const simStore = useSimStore();
const backHome = ref(false);
// 接收来自 ComponentA 的事件,并更新 isFlying
function handleBackToHome() {
@@ -82,33 +83,41 @@
const { init, startYHGL, startZHJC, startMNFZ, startMNPG } = simStore;
// 模拟的经纬度数组
const multiPolygonCoordinates = [
    [
        [120.123456, 30.654321],
        [120.234567, 30.765432],
        [120.345678, 30.876543],
        [120.123456, 30.654321] // 闭合点
    ],
    [
        [121.111111, 31.222222],
        [121.333333, 31.444444],
        [121.555555, 31.666666],
        [121.111111, 31.222222] // 闭合点
    ]
  [
    [120.123456, 30.654321],
    [120.234567, 30.765432],
    [120.345678, 30.876543],
    [120.123456, 30.654321], // 闭合点
  ],
  [
    [121.111111, 31.222222],
    [121.333333, 31.444444],
    [121.555555, 31.666666],
    [121.111111, 31.222222], // 闭合点
  ],
];
// 计算属性
const showDetail = computed(() => showDeviceDetail.value);
onMounted(() => {
  setupTokenRefresh()// 获取宏图token
  getSimData() //测试tr后端
onMounted(async () => {
  setupTokenRefresh(); // 获取宏图token
  // getSimData(); //测试tr后端
  // 获取隐患点列表(因为中科软后端接口获取加载时间较长)
  getDangerPoint("110116110000").then((res) => {
    simStore.DangerPoint = res.data.pageData;
  });
  getDeviceInfo(null, "110116110000").then((res) => {
    simStore.devices = res.data.pageData;
  });
  try {
    const wktResult = convertToWKT(multiPolygonCoordinates);
    console.log(wktResult);
    // console.log(wktResult,'a');
    // 输出: MULTIPOLYGON(((120.123456 30.654321,120.234567 30.765432,120.345678 30.876543,120.123456 30.654321)))
  } catch (error) {
    console.error(error.message);
  }
});
// 初始化