<template>
  <div class="map-container" id="mapContainer">
    <div class="top-main">
      <div class="map-title">
        <span> 云航低空研训基地飞行控制中心</span>
      </div>
      <div class="weather">
        <div class="sun-icon"></div>
        <div class="weather-lable">多云</div>
        <div class="weather-value"><span>17</span> ℃</div>
      </div>
      <div class="time">
        {{ uavStore.realTime }}
      </div>
    </div>
    <div class="bottom-box"></div>
    <div class="left-bg">
      <slot name="left"></slot>
    </div>
    <div class="right-bg">
      <slot name="right"></slot>
    </div>
    <div class="map-main">
      <slot name="map"></slot>
    </div>
  </div>
</template>

<script setup>
import { onMounted } from "vue";
import autofit from "autofit.js";
import useUavStore from "@/store/modules/uav";
const uavStore = useUavStore();
onMounted(() => {
  //启用适配
  autofit.init({
    el: "#mapContainer",
    dh: 1080,
    dw: 1920,
    resize: true,
  });
});
</script>

<style lang="scss" scoped>
.map-container {
  position: relative;
  z-index: 100;
  height: 100%;
  width: 100%;
  .map-main {
    height: 100%;
    width: 100%;
  }
  .top-main {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    height: 120px;
    background: url("@/assets/images/top-box.png");
    background-size: 100% 100%;
    .weather {
      display: flex;
      align-items: center;
      gap: 6px;
      position: absolute;
      left: 55px;
      top: 45px;
      color: #cdd6e3;
      font-size: 16px;
      .sun-icon {
        height: 21px;
        width: 21px;
        background: url("@/assets/images/sun.png");
        background-size: 100% 100%;
      }
      .weather-value {
        span {
          font-size: 26px;
          font-family: "DINCondensed-Bold";
        }
      }
    }
    .time {
      position: absolute;
      right: 55px;
      top: 45px;

      font-size: 20px;
      color: #cdd6e3;
      font-weight: 400;
    }
  }
  .map-title {
    width: 100%;
    height: 100%;
    background: url("@/assets/images/map-title.png") no-repeat top center;
    background-size: 100% cover;
    text-align: center;
    span {
      display: inline-block;
      letter-spacing: 2px;
      font-size: 40px;
      color: #ffffff;
      font-family: "YouSheBiaoTiHei";
      text-shadow: 2px 6px 4px #0e426c;
    }
  }

  .bottom-box {
    position: absolute;
    bottom: 0;
    z-index: 200;
    width: 100%;
    height: 150px;
    background: url("@/assets/images/bottom-box.png");
    background-size: 100% 100%;
  }
  .left-bg {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 200;
    height: 100%;
    width: 500px;
    background: url("@/assets/images/left-bg.png");
    background-size: 100% 100%;
    box-sizing: border-box;
    padding: 120px 55px 67px 55px;
  }
  .right-bg {
    position: absolute;
    right: 0;
    top: 0;
    z-index: 100;
    height: 100%;
    width: 500px;
    background: url("@/assets/images/right-bg.png");
    background-size: 100% 100%;
    box-sizing: border-box;
    padding: 120px 55px 67px 55px;
  }
}
</style>
