<template>
  <div class="flight-control" v-if="airportVal" v-drag>
    <div class="title">
      <div> 飞行控制：<i>暂无 </i> </div>
      <div @click="emits('changeFlightControl')">
        <CloseOutlined />
      </div>
    </div>
    <div class="content">
      <div class="content-button">
        <a-button>抢夺负载控制</a-button>
        <a-button>进入指令飞行</a-button>
        <a-button>退出指令飞行</a-button>
        <a-button>一键起飞</a-button>
        <a-button>飞向目标点</a-button>
        <a-button>一键返航</a-button>
      </div>
      <div class="content-info">
        <div class="info-item">
          <img src="@/assets/images/flightoperation/flight_control.png" alt="" />
          <div class="info-item-top"></div>
          <div class="info-item-right"></div>
          <div class="info-item-bottom"></div>
          <div class="info-item-left"></div>
        </div>
        <div class="info-item">
          <img src="@/assets/images/flightoperation/flight_control.png" alt="" />
          <div class="info-item-top"></div>
          <div class="info-item-right"></div>
          <div class="info-item-bottom"></div>
          <div class="info-item-left"></div>
        </div>
      </div>
    </div>
  </div>
</template>
<script setup lang="ts">
  import { onMounted, ref, watch } from 'vue';
  import { getClient, createConnection } from '@/utils/mqtt';
  import { CloseOutlined } from '@ant-design/icons-vue';
  import { vDrag } from '@/utils/drag';

  const emits = defineEmits(['changeFlightControl']);
  const props = defineProps({
    airportAllVal: Object,
  });
  console.log(props);
  const airportVal: any = ref({
    mode_code: 0,
    wind_speed: 0,
    environment_temperature: 0,
    temperature: 0,
    rainfall: 0,
    network_state: {
      rate: 0,
    },
    drone_in_dock: 0,
    drone_charge_state: {
      capacity_percent: 0,
    },
  });
  watch(
    () => props.airportAllVal,
    (val) => {
      console.log(val);
      airportVal.value = val.data;
    },
  );
  onMounted(() => {});
</script>
<style lang="less" scoped>
  .flight-control {
    position: absolute;
    bottom: 100px;
    left: 700px;
    width: 360px;
    height: 350px;
    padding: 10px 20px;
    margin: 10px 0 0 10px;
    background: #0d0e15;
    box-shadow:
      0px 10px 30px 0px rgba(0, 0, 6, 0.15),
      inset 0px 0px 36px 0px rgba(58, 87, 232, 0.73);
    border-radius: 6px;
    backdrop-filter: blur(3px);
    color: #fff;
    .title {
      width: 100%;
      padding: 10px 0;
      box-shadow: 0px 10px 30px 0px rgba(0, 0, 6, 0.15);
      border-bottom: 1px solid #4e5778;
      display: flex;
      align-items: center;
      justify-content: space-between;
      i {
        color: #f2762d;
        font-style: normal;
      }
      div {
        color: #fff;
        cursor: pointer;
      }
    }
    .content-item {
      display: flex;
      align-items: center;
      border-bottom: 1px solid #4e5778;
      padding: 10px 0;
    }
    .content-button {
      margin-top: 10px;
      button {
        background: none;
        margin: 10px 0 0 10px;
        color: #fff;
      }
    }
    .content-info {
      display: flex;
      align-items: center;
      justify-content: space-between;
      .info-item {
        position: relative;
        width: 48%;
        margin: 40px 0 20px 20px;
        img {
          width: 100px;
        }
        .info-item-top {
          width: 40px;
          height: 40px;
          position: absolute;
          top: 0px;
          left: 30px;
          cursor: pointer;
        }
        .info-item-right {
          width: 40px;
          height: 40px;
          position: absolute;
          top: 30px;
          right: 40px;
          cursor: pointer;
        }
        .info-item-bottom {
          width: 40px;
          height: 40px;
          position: absolute;
          bottom: 0px;
          left: 30px;
          cursor: pointer;
        }
        .info-item-left {
          width: 40px;
          height: 40px;
          position: absolute;
          top: 30px;
          left: 0px;
          cursor: pointer;
        }
      }
    }
  }
</style>
