From a605ae2f3e616a649f441ab468d9824fa4590060 Mon Sep 17 00:00:00 2001
From: "WORK\\64751" <64751245@qq.com>
Date: Fri, 5 Sep 2025 16:46:15 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A3=9E=E8=A1=8C=E6=A8=A1?=
=?UTF-8?q?=E5=BC=8F=E5=88=87=E6=8D=A2=E5=90=8E=EF=BC=8Cgis=E5=BE=97?=
=?UTF-8?q?=E7=8A=B6=E6=80=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/apis/common.js | 2 +-
src/views/carbin/components/flying.vue | 8 +-
src/views/carbin/index.vue | 112 ++++++++++++---------
src/views/carbin/toolComp/planeControl.vue | 10 +-
4 files changed, 75 insertions(+), 57 deletions(-)
diff --git a/src/apis/common.js b/src/apis/common.js
index 5f59883..129c612 100644
--- a/src/apis/common.js
+++ b/src/apis/common.js
@@ -96,7 +96,7 @@ export async function getAirWayPointsToJson2(url) {
}
arr.shift()
arr.pop()
- console.log(arr)
+ // console.log(arr)
arr = arr.map((text) => {
return text.split(/\s+/)
diff --git a/src/views/carbin/components/flying.vue b/src/views/carbin/components/flying.vue
index ec41bde..45f5490 100644
--- a/src/views/carbin/components/flying.vue
+++ b/src/views/carbin/components/flying.vue
@@ -24,8 +24,8 @@ const airPortSocketStore = useAirPortSocketStore()
let size1Img = ref(new URL(`@/assets/icons/size1active.png`, import.meta.url).href)
let size2Img = ref(new URL(`@/assets/icons/size2.png`, import.meta.url).href)
let viewMode = ref(1) //1-1/4方式 2-对半方式
-let littleViewMode = ref(2) //1-舱外视频 2-舱内视频 3-无人机视频
-let littleViewModeName = ref('舱内画面')
+let littleViewMode = ref(1) //1-舱外视频 2-舱内视频 3-无人机视频
+let littleViewModeName = ref('舱外画面')
import img_default from '@/assets/icons/state1.png'
import img_touch from '@/assets/icons/state2.png'
@@ -43,7 +43,7 @@ let planeStateList = reactive({
value: '0',
touch: false,
content: '爬升
速度',
- unit: '/s',
+ unit: 'm/s',
},
hspeed: {
id: 2,
@@ -52,7 +52,7 @@ let planeStateList = reactive({
value: '0',
touch: false,
content: '平飞
速度',
- unit: '/s',
+ unit: 'm/s',
},
distToHome: {
id: 3,
diff --git a/src/views/carbin/index.vue b/src/views/carbin/index.vue
index 8a95aa3..ecadbf8 100644
--- a/src/views/carbin/index.vue
+++ b/src/views/carbin/index.vue
@@ -95,6 +95,23 @@ const switchViewFn = (viewPrecent) => {
}
sendGisMessage(params)
}
+//gis底部工具栏得高度
+const changeGisToolHeight = () => {
+ let bottomPlane = document.getElementById('bottomPlane')
+ if (bottomPlane) {
+ //获取高度
+ let height = bottomPlane.clientHeight
+ let t = {
+ toolbarStartY: height,
+ }
+ sendGisMessage(t)
+ } else {
+ let t = {
+ toolbarStartY: 0,
+ }
+ sendGisMessage(t)
+ }
+}
//底部切换小屏和大屏的视频
const bottom_switchScreenVideo = (smallVideoType) => {
big_area_showType.value = smallVideoType
@@ -113,7 +130,7 @@ const queryAirLine_AirPort = async () => {
currentAirPortInfo.value = res[0].value.data[0]
if (!currentAirPortInfo.value.online) {
//强制退出
- window.close()
+ // window.close()
}
airPortSocketStore.ceurrentAirPortData = currentAirPortInfo.value
@@ -122,14 +139,17 @@ const queryAirLine_AirPort = async () => {
//机场当前状态
if (currentAirPortStatus.value != Number(currentAirPortInfo.value.status)) {
currentAirPortStatus.value = Number(currentAirPortInfo.value.status)
- console.log(
- '现在的状态是:',
- currentAirPortStatus.value,
- statusList[currentAirPortStatus.value],
- )
+ // console.log(
+ // '现在的状态是:',
+ // currentAirPortStatus.value,
+ // statusList[currentAirPortStatus.value],
+ // )
//机场当前状态
- if (Number(currentAirPortInfo.value.status) == 2) {
+ if (
+ Number(currentAirPortInfo.value.status) == 2 ||
+ Number(currentAirPortInfo.value.status) == 3
+ ) {
//飞行中 请求航线文件
queryAirLine(currentAirPortInfo.value.fileUrl)
} else {
@@ -190,38 +210,41 @@ const queryAirPort = async () => {
let params = {
airportId: window.iframe_AirPortID,
}
- console.log(params)
+ // console.log(params)
let res = await queryAirportApi(params)
if (res.code == 0) {
currentAirPortInfo.value = res.data[0]
if (!currentAirPortInfo.value.online) {
//强制退出
- window.close()
+ // window.close()
}
airPortSocketStore.ceurrentAirPortData = currentAirPortInfo.value
// console.log(currentAirPortInfo.value)
- //currentAirPortInfo.value.status = 2
+ // currentAirPortInfo.value.status = 1
if (currentAirPortStatus.value != Number(currentAirPortInfo.value.status)) {
currentAirPortStatus.value = Number(currentAirPortInfo.value.status)
- console.log(
- '现在的状态是:',
- currentAirPortStatus.value,
- statusList[currentAirPortStatus.value],
- )
+ // console.log(
+ // '现在的状态是:',
+ // currentAirPortStatus.value,
+ // statusList[currentAirPortStatus.value],
+ // )
//机场当前状态
- if (Number(currentAirPortInfo.value.status) == 2) {
+ if (
+ Number(currentAirPortInfo.value.status) == 2 ||
+ Number(currentAirPortInfo.value.status) == 3
+ ) {
//飞行中 请求航线文件
queryAirLine(currentAirPortInfo.value.fileUrl)
}
resetScreen()
}
- console.log('现在的状态是:', currentAirPortStatus.value, statusList[currentAirPortStatus.value])
+ // console.log('现在的状态是:', currentAirPortStatus.value, statusList[currentAirPortStatus.value])
}
//轮询
setTimeout(() => {
@@ -232,7 +255,7 @@ const queryAirPort = async () => {
const queryAirLine = async (fileUrl) => {
//请求航线数据
let resultWayPoint = await getAirWayPointsToJson2(fileUrl)
- console.log(resultWayPoint)
+ // console.log(resultWayPoint)
//地图数据
iframeData = {
airportName: currentAirPortInfo.value.name,
@@ -243,30 +266,6 @@ const queryAirLine = async (fileUrl) => {
flyPath: resultWayPoint,
coverage: currentAirPortInfo.value.coverage,
}
-
- //下面是以前的
- // let params = {
- // airportId: window.iframe_AirPortID, //67 1011
- // }
- // let res = await queryAirLineApi(params)
-
- // if (res.code == 0) {
- // //航线文件
- // let airLineInfo = res.data
- // //请求航线数据
- // let resultWayPoint = await getAirWayPointsToJson(airLineInfo.fileUrl)
-
- // //地图数据
- // iframeData = {
- // airportName: currentAirPortInfo.value.name,
- // airportLocation: {
- // lon: currentAirPortInfo.value.longitude,
- // lat: currentAirPortInfo.value.latitude,
- // },
- // flyPath: resultWayPoint,
- // coverage: currentAirPortInfo.value.coverage,
- // }
- // }
}
//获取天气
// const getweatherFn = async () => {
@@ -310,8 +309,8 @@ const socketFn = (workParams) => {
const iframeLoaded = (iframeContent) => {
setTimeout(() => {
map_iframeContent = iframeContent
- console.log('iframeData:')
- console.log(iframeData)
+ // console.log('iframeData:')
+ // console.log(iframeData)
//必须等待数值
let tempTime = null
@@ -319,9 +318,15 @@ const iframeLoaded = (iframeContent) => {
if (iframeData) {
clearInterval(tempTime)
let data = JSON.stringify(iframeData)
- console.log('向gis发送数据....................................')
- console.log(data)
+ // console.log('向gis发送数据....................................')
+ // console.log(data)
iframeContent.postMessage(data, '*')
+
+ //如果是飞行中
+ if (currentAirPortInfo.value.status == 2) {
+ //gis底部工具栏得高度
+ changeGisToolHeight()
+ }
}
}, 50)
}, 0)
@@ -354,9 +359,21 @@ const sendPosToPlane = (socketData) => {
//给gis发送消息
const sendGisMessage = (params) => {
let contentWindow = document.getElementById('virturalDrive_iframe_full').contentWindow
+
let data = JSON.stringify(params)
- // console.log(data)
+ console.log('...............发送给gis数据是:', data)
contentWindow.postMessage(data, '*')
+
+ // let t = setInterval(() => {
+ // if (document.getElementById('virturalDrive_iframe_full').hasOwnProperty('contentWindow')) {
+ // contentWindow = document.getElementById('virturalDrive_iframe_full').contentWindow
+ // let data = JSON.stringify(params)
+
+ // console.log('...............发送给gis数据是:', data)
+ // contentWindow.postMessage(data, '*')
+ // clearInterval(t)
+ // }
+ // }, 50)
}
//重置screen
@@ -588,6 +605,7 @@ onMounted(() => {