<template>
  <div style="height:100vh;padding-top: 13vw;">
    <TopNav navTitle="当前位置" :showRight="false" :showLeft="true" />
    <GdMap />
  </div>
</template>

<script setup>
import Axios from "axios";
import { getyjzlCount } from "../../api/checkponit.js";
import { qcckGet } from "@/api/qcckApi.js";
import {
  dateFormat,
  setUserHome,
  hintToast,
  timeValidate,
} from "../../utils/tools.js";
import TopNav from "../../components/topNav.vue";
import GdMap from "../../components/GdMap/index.vue";
import { setUserDefaultModleData, getUserLzLocation } from "../../api/user.js";
import emitter from "../../utils/eventBus.js";
import {
  ref,
  onMounted,
} from "vue";
import { useRouter, useRoute } from "vue-router";
import { Dialog } from "vant";
const route = useRoute();
const Loadtion = ref({
  address: "暂无地址信息",
  lng: "暂无",
  lat: "暂无",
  ly: "暂无",
});
let timer;
onMounted(() => {
  localStorage.removeItem('NFC')
  localStorage.removeItem('OCR')
  _getUserLocation(true); //获取当前位置
  setInterval(() => {
    _getUserLocation(false); //获取当前位置
  }, 5000);
});



//获取当前位置信息
function _getUserLocation(sfdw) {
  let { lng, lat, zbly } = getLocation();
  if (lng && lat) {
    Loadtion.value.lng = lng;
    Loadtion.value.lat = lat;
    Loadtion.value.ly = zbly == 1 ? "GPS" : "融合";
    emitter.emit("deletePointArea", "dw");
    //地图撒点然后移动
    emitter.emit("addPointArea", {
      coords: [{ jd: lng, wd: lat }],
      icon: require("../../assets/lz/dw.png"),
      flag: "dw",
      sfdw: sfdw,
      sizeX: 30,
      sizeY: 35
    });
  } else {
    hintToast("暂无坐标信息");
  }
}
</script>

<style lang="scss" scoped>
@import "../../assets/styles/mixin.scss";

::v-deep .van-radio-group {
  padding: 5vw;
}

::v-deep .van-radio {
  padding: 2vw 0;
}

.homeTotal_box {
  position: absolute;
  bottom: 13.5vw;
  z-index: 20;
  background: #fff;
  width: 100%;
  border-top-left-radius: 2vw;
  border-top-right-radius: 2vw;
}

.home_box {
  padding: 1vw 3vw 3vw 3vw;
}

.point-pop-alert {
  position: absolute;
  display: flex;
  flex-direction: column;
  top: 80px;
  right: 10px;

  >img {
    width: 45px;
    height: 45px;
    margin: 2vw 0;
  }
}

.count-box {
  display: flex;
  flex-wrap: wrap;
  line-height: 3.5vh;
  justify-content: space-around;
  @include font_size($font_medium_s);

  .count-item {
    margin-top: 1vh;
    width: 47%;
    display: flex;
    margin-top: 3%;
    align-items: center;
    background-color: rgba(140, 175, 206, 0.1);
    border-radius: 1.5vw;

    .bottom-box {
      flex: 1;
      box-sizing: border-box;
      padding: 10px;
      border-right: 1px dashed rgb(172, 171, 171);
      width: 100%;
      height: 100%;
      display: flex;
      justify-content: center;
      align-items: center;
      line-height: 2.5vh;

      .inner-box {
        width: 70%;
        text-align: center;
      }
    }

    .text-box {
      color: rgb(179, 179, 179);
    }

    .left {
      flex: 1;
      text-align: center;
      // margin-right: 4vw;
    }

    .right {
      flex: 1;
      text-align: center;
      // margin-left: 4vw;
    }

    .num1 {
      color: rgb(16, 16, 16);
      font-weight: bold;
    }

    .num2 {
      color: rgb(5, 167, 24);
      font-weight: bold;
    }

    .num3 {
      color: rgb(241, 8, 8);
      font-weight: bold;
    }

    .top {
      display: flex;
    }
  }

  // 检查站
  .count-item-jcz {
    width: calc(50% - 1px);
    text-align: center;
    color: #999;
    border-top: 1px solid #e9e9e9;

    .count-time-jcz {
      font-size: 1rem;
      color: #222;
      line-height: 12vw;
    }

    .count-item-jcz-num {
      display: flex;
      @include font_size($font_medium_s);

      .count-item-jcz-num-left {
        position: relative;
        width: 50%;
        text-align: right;
        padding: 0 3vw;
        box-sizing: border-box;
      }

      .count-item-jcz-num-right {
        width: 50%;
        text-align: left;
        padding: 0 3vw;
        box-sizing: border-box;
      }

      .count-item-jcz-num-left::after {
        content: "";
        position: absolute;
        right: 0;
        top: 10px;
        bottom: 10px;
        width: 1px;
        background: #e9e9e9;
        border-radius: 1px;
      }

      .num-red {
        color: #f00;
        font-size: 14px;
      }

      .num {
        color: #000;
        font-size: 14px;
      }
    }
  }

  .count-item-jcz:nth-child(2n + 1) {
    border-right: 1px solid #e9e9e9;
  }
}

.count-box-jcz {
  padding-top: 1vh;
  box-sizing: border-box;
}

.hsf {
  position: absolute;
  top: 20px;
  right: 18px;
}
</style>
