From 2c2bc8614c8ea0ce386369eb4924da1e6aa052d1 Mon Sep 17 00:00:00 2001
From: husq <931347610@qq.com>
Date: Wed, 27 Sep 2023 09:35:57 +0800
Subject: [PATCH] 添加环境配置区分

---
 src/components/g-map/DroneControlPanel.vue |   52 +++++++++++++++++++++++++++++++++-------------------
 1 files changed, 33 insertions(+), 19 deletions(-)

diff --git a/src/components/g-map/DroneControlPanel.vue b/src/components/g-map/DroneControlPanel.vue
index 4e75eac..bd5764f 100644
--- a/src/components/g-map/DroneControlPanel.vue
+++ b/src/components/g-map/DroneControlPanel.vue
@@ -1,6 +1,11 @@
 <template>
-  <div class="drone-control-wrapper">
-    <div class="drone-control-header">无人机飞行控制</div>
+  <div class="drone-control-wrapper" v-if="modelValue">
+    <div class="drone-control-header width-100 flex-display flex-align-center flex-justify-between">
+      <span>无人机飞行控制</span>
+      <span @click="closeDrone">
+    <CloseOutlined />
+    </span>
+    </div>
     <div class="drone-control-box">
       <div class="box">
         <div class="row">
@@ -115,7 +120,7 @@
               </div>
             </template>
             <Button size="small" ghost @click="onShowTakeoffToPointPopover" >
-              <span>起飞</span>
+              <span>一键起飞</span>
             </Button>
           </DroneControlPopover>
           <Button :loading="cmdItem.loading" size="small" ghost @click="sendControlCmd(cmdItem, 0)">
@@ -238,13 +243,13 @@
 </template>
 
 <script setup lang="ts">
-import { defineProps, reactive, ref, watch, computed, onMounted, watchEffect } from 'vue'
+import { defineProps, reactive, ref, watch, computed, onMounted, watchEffect, defineEmits } from 'vue'
 import { Select, message, Button } from 'ant-design-vue'
 import { PayloadInfo, DeviceInfoType, ControlSource, DeviceOsdCamera, DrcStateEnum } from '/@/types/device'
 import { useMyStore } from '/@/store'
 import { postDrcEnter, postDrcExit } from '/@/api/drc'
 import { useMqtt, DeviceTopicInfo } from './use-mqtt'
-import { DownOutlined, UpOutlined, LeftOutlined, RightOutlined, PauseCircleOutlined, UndoOutlined, RedoOutlined, ArrowUpOutlined, ArrowDownOutlined } from '@ant-design/icons-vue'
+import { DownOutlined, UpOutlined, LeftOutlined, RightOutlined, PauseCircleOutlined, UndoOutlined, RedoOutlined, ArrowUpOutlined, ArrowDownOutlined, CloseOutlined } from '@ant-design/icons-vue'
 import { useManualControl, KeyCode } from './use-manual-control'
 import { usePayloadControl } from './use-payload-control'
 import { CameraMode, CameraType, CameraTypeOptions, ZoomCameraTypeOptions, CameraListItem } from '/@/types/live-stream'
@@ -261,7 +266,8 @@
 const props = defineProps<{
   sn: string,
   deviceInfo: DeviceInfoType,
-  payloads: null | PayloadInfo[]
+  payloads: null | PayloadInfo[],
+  modelValue: Boolean,
 }>()
 
 const store = useMyStore()
@@ -287,11 +293,15 @@
     message.success('返航成功')
     exitFlightCOntrol()
   } else {
-    message.error('返航失败')
+    message.warn('请先进入控制!')
   }
   cmdItem.loading = false
 }
-
+const emits = defineEmits(['update:modelValue'])
+// 关闭弹窗
+const closeDrone = () => {
+  emits('update:modelValue', false)
+}
 const { flyToPoint, stopFlyToPoint, takeoffToPoint } = useDroneControl()
 const MAX_SPEED = 14
 
@@ -342,12 +352,12 @@
 const takeoffToPointPopoverData = reactive({
   visible: false,
   loading: false,
-  latitude: null as null | number,
-  longitude: null as null | number,
-  height: null as null | number,
-  securityTakeoffHeight: null as null | number,
+  latitude: 28.62426114 as null | number,
+  longitude: 115.85657177 as null | number,
+  height: 120 as null | number,
+  securityTakeoffHeight: 100 as null | number,
   maxSpeed: MAX_SPEED,
-  rthAltitude: null as null | number,
+  rthAltitude: 100 as null | number,
   rcLostAction: LostControlActionInCommandFLight.RETURN_HOME,
   exitWaylineWhenRcLost: WaylineLostControlActionInCommandFlight.EXEC_LOST_ACTION
 })
@@ -355,10 +365,10 @@
 function onShowTakeoffToPointPopover () {
   takeoffToPointPopoverData.visible = !takeoffToPointPopoverData.visible
   takeoffToPointPopoverData.loading = false
-  takeoffToPointPopoverData.latitude = null
-  takeoffToPointPopoverData.longitude = null
-  takeoffToPointPopoverData.securityTakeoffHeight = null
-  takeoffToPointPopoverData.rthAltitude = null
+  takeoffToPointPopoverData.latitude = 28.62426114
+  takeoffToPointPopoverData.longitude = 115.85657177
+  takeoffToPointPopoverData.securityTakeoffHeight = 100
+  takeoffToPointPopoverData.rthAltitude = 100
   takeoffToPointPopoverData.rcLostAction = LostControlActionInCommandFLight.RETURN_HOME
   takeoffToPointPopoverData.exitWaylineWhenRcLost = WaylineLostControlActionInCommandFlight.EXEC_LOST_ACTION
 }
@@ -411,7 +421,6 @@
   }
   enterFlightControl()
 }
-
 // 进入飞行控制
 async function enterFlightControl () {
   try {
@@ -706,7 +715,12 @@
 
 <style lang='scss' scoped>
 .drone-control-wrapper{
-  // border-bottom: 1px solid #515151;
+  position: absolute;
+    background: #000;
+    color: #fff;
+    left: calc( 100% + 10px);
+    width: 480px;
+    top: 0;
 
   .drone-control-header{
     font-size: 14px;

--
Gitblit v1.9.3