修复飞行模式切换后,gis得状态

This commit is contained in:
WORK\64751 2025-09-05 16:46:15 +08:00
parent 0708d800e2
commit a605ae2f3e
4 changed files with 75 additions and 57 deletions

View File

@ -96,7 +96,7 @@ export async function getAirWayPointsToJson2(url) {
} }
arr.shift() arr.shift()
arr.pop() arr.pop()
console.log(arr) // console.log(arr)
arr = arr.map((text) => { arr = arr.map((text) => {
return text.split(/\s+/) return text.split(/\s+/)

View File

@ -24,8 +24,8 @@ const airPortSocketStore = useAirPortSocketStore()
let size1Img = ref(new URL(`@/assets/icons/size1active.png`, import.meta.url).href) 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 size2Img = ref(new URL(`@/assets/icons/size2.png`, import.meta.url).href)
let viewMode = ref(1) //1-1/4 2- let viewMode = ref(1) //1-1/4 2-
let littleViewMode = ref(2) //1- 2- 3- let littleViewMode = ref(1) //1- 2- 3-
let littleViewModeName = ref('舱画面') let littleViewModeName = ref('舱画面')
import img_default from '@/assets/icons/state1.png' import img_default from '@/assets/icons/state1.png'
import img_touch from '@/assets/icons/state2.png' import img_touch from '@/assets/icons/state2.png'
@ -43,7 +43,7 @@ let planeStateList = reactive({
value: '0', value: '0',
touch: false, touch: false,
content: '爬升<br>速度', content: '爬升<br>速度',
unit: '/s', unit: 'm/s',
}, },
hspeed: { hspeed: {
id: 2, id: 2,
@ -52,7 +52,7 @@ let planeStateList = reactive({
value: '0', value: '0',
touch: false, touch: false,
content: '平飞<br>速度', content: '平飞<br>速度',
unit: '/s', unit: 'm/s',
}, },
distToHome: { distToHome: {
id: 3, id: 3,

View File

@ -95,6 +95,23 @@ const switchViewFn = (viewPrecent) => {
} }
sendGisMessage(params) 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) => { const bottom_switchScreenVideo = (smallVideoType) => {
big_area_showType.value = smallVideoType big_area_showType.value = smallVideoType
@ -113,7 +130,7 @@ const queryAirLine_AirPort = async () => {
currentAirPortInfo.value = res[0].value.data[0] currentAirPortInfo.value = res[0].value.data[0]
if (!currentAirPortInfo.value.online) { if (!currentAirPortInfo.value.online) {
//退 //退
window.close() // window.close()
} }
airPortSocketStore.ceurrentAirPortData = currentAirPortInfo.value airPortSocketStore.ceurrentAirPortData = currentAirPortInfo.value
@ -122,14 +139,17 @@ const queryAirLine_AirPort = async () => {
// //
if (currentAirPortStatus.value != Number(currentAirPortInfo.value.status)) { if (currentAirPortStatus.value != Number(currentAirPortInfo.value.status)) {
currentAirPortStatus.value = Number(currentAirPortInfo.value.status) currentAirPortStatus.value = Number(currentAirPortInfo.value.status)
console.log( // console.log(
'现在的状态是:', // ':',
currentAirPortStatus.value, // currentAirPortStatus.value,
statusList[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) queryAirLine(currentAirPortInfo.value.fileUrl)
} else { } else {
@ -190,38 +210,41 @@ const queryAirPort = async () => {
let params = { let params = {
airportId: window.iframe_AirPortID, airportId: window.iframe_AirPortID,
} }
console.log(params) // console.log(params)
let res = await queryAirportApi(params) let res = await queryAirportApi(params)
if (res.code == 0) { if (res.code == 0) {
currentAirPortInfo.value = res.data[0] currentAirPortInfo.value = res.data[0]
if (!currentAirPortInfo.value.online) { if (!currentAirPortInfo.value.online) {
//退 //退
window.close() // window.close()
} }
airPortSocketStore.ceurrentAirPortData = currentAirPortInfo.value airPortSocketStore.ceurrentAirPortData = currentAirPortInfo.value
// console.log(currentAirPortInfo.value) // console.log(currentAirPortInfo.value)
//currentAirPortInfo.value.status = 2 // currentAirPortInfo.value.status = 1
if (currentAirPortStatus.value != Number(currentAirPortInfo.value.status)) { if (currentAirPortStatus.value != Number(currentAirPortInfo.value.status)) {
currentAirPortStatus.value = Number(currentAirPortInfo.value.status) currentAirPortStatus.value = Number(currentAirPortInfo.value.status)
console.log( // console.log(
'现在的状态是:', // ':',
currentAirPortStatus.value, // currentAirPortStatus.value,
statusList[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) queryAirLine(currentAirPortInfo.value.fileUrl)
} }
resetScreen() resetScreen()
} }
console.log('现在的状态是:', currentAirPortStatus.value, statusList[currentAirPortStatus.value]) // console.log(':', currentAirPortStatus.value, statusList[currentAirPortStatus.value])
} }
// //
setTimeout(() => { setTimeout(() => {
@ -232,7 +255,7 @@ const queryAirPort = async () => {
const queryAirLine = async (fileUrl) => { const queryAirLine = async (fileUrl) => {
//线 //线
let resultWayPoint = await getAirWayPointsToJson2(fileUrl) let resultWayPoint = await getAirWayPointsToJson2(fileUrl)
console.log(resultWayPoint) // console.log(resultWayPoint)
// //
iframeData = { iframeData = {
airportName: currentAirPortInfo.value.name, airportName: currentAirPortInfo.value.name,
@ -243,30 +266,6 @@ const queryAirLine = async (fileUrl) => {
flyPath: resultWayPoint, flyPath: resultWayPoint,
coverage: currentAirPortInfo.value.coverage, 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 () => { // const getweatherFn = async () => {
@ -310,8 +309,8 @@ const socketFn = (workParams) => {
const iframeLoaded = (iframeContent) => { const iframeLoaded = (iframeContent) => {
setTimeout(() => { setTimeout(() => {
map_iframeContent = iframeContent map_iframeContent = iframeContent
console.log('iframeData:') // console.log('iframeData:')
console.log(iframeData) // console.log(iframeData)
// //
let tempTime = null let tempTime = null
@ -319,9 +318,15 @@ const iframeLoaded = (iframeContent) => {
if (iframeData) { if (iframeData) {
clearInterval(tempTime) clearInterval(tempTime)
let data = JSON.stringify(iframeData) let data = JSON.stringify(iframeData)
console.log('向gis发送数据....................................') // console.log('gis....................................')
console.log(data) // console.log(data)
iframeContent.postMessage(data, '*') iframeContent.postMessage(data, '*')
//
if (currentAirPortInfo.value.status == 2) {
//gis
changeGisToolHeight()
}
} }
}, 50) }, 50)
}, 0) }, 0)
@ -354,9 +359,21 @@ const sendPosToPlane = (socketData) => {
//gis //gis
const sendGisMessage = (params) => { const sendGisMessage = (params) => {
let contentWindow = document.getElementById('virturalDrive_iframe_full').contentWindow let contentWindow = document.getElementById('virturalDrive_iframe_full').contentWindow
let data = JSON.stringify(params) let data = JSON.stringify(params)
// console.log(data) console.log('...............发送给gis数据是:', data)
contentWindow.postMessage(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 //screen
@ -588,6 +605,7 @@ onMounted(() => {
<!-- 底部面板 --> <!-- 底部面板 -->
<div <div
v-if="currentAirPortStatus == 2" v-if="currentAirPortStatus == 2"
id="bottomPlane"
class="bottomPlane w-full lg:h-[150px] xk:h-[150px] x1k:h-[212px] x2k:h-[282px] bg-[#001626] bg-opacity-70 absolute bottom-0 left-0 z-[3]" class="bottomPlane w-full lg:h-[150px] xk:h-[150px] x1k:h-[212px] x2k:h-[282px] bg-[#001626] bg-opacity-70 absolute bottom-0 left-0 z-[3]"
> >
<bottomPlaneFlying <bottomPlaneFlying

View File

@ -23,9 +23,9 @@ let items = reactive({
}) })
// //
let precent = ref('-') let precent = ref('20')
// //
let lastTime = ref('-') let lastTime = ref('30')
const setCurrentData = (data) => { const setCurrentData = (data) => {
// console.log(data) // console.log(data)
@ -35,7 +35,7 @@ const setCurrentData = (data) => {
items.temperature.value = data ? data.weather.cellTemp + '℃' : '0℃' items.temperature.value = data ? data.weather.cellTemp + '℃' : '0℃'
precent.value = data ? Number(data.battery) * 100 : '-' precent.value = data ? Number(data.battery) * 100 : '-'
lastTime.value = data ? data.allflytime : '-' lastTime.value = data ? parseInt(data.allflytime, 10) : '-'
} }
const droneCommand = async (type) => { const droneCommand = async (type) => {
@ -91,7 +91,7 @@ onMounted(() => {})
</div> </div>
</template> </template>
<div <div
class="relative middlePlane w-[210px] h-[46px] mx-3 flex flex-row items-center justify-around" class="relative middlePlane w-[210px] h-[46px] mx-3 px-1 flex flex-row items-center justify-around"
> >
<img src="@/assets/icons/middleplane.png" alt="" class="absolute w-full h-full z-[-1]" /> <img src="@/assets/icons/middleplane.png" alt="" class="absolute w-full h-full z-[-1]" />
<div <div
@ -101,7 +101,7 @@ onMounted(() => {})
</div> </div>
<span class="text-sm text-[#ffffff]">电池电量</span> <span class="text-sm text-[#ffffff]">电池电量</span>
<div class="lastTime text-sm font-bold">{{ precent }}%/{{ lastTime }}min</div> <div class="lastTime text-sm font-bold">{{ precent }}%/{{ lastTime }}min</div>
<span class="iconfont icon-xiashuangjiantou text-[#ffffff50]"></span> <span class="iconfont icon-xiashuangjiantou text-[#ffffff50] text-[12px]"></span>
</div> </div>
</a-tooltip> </a-tooltip>
<!-- <div class="middlePlane w-[210px] h-[46px] mx-3 flex flex-row items-center justify-around"> <!-- <div class="middlePlane w-[210px] h-[46px] mx-3 flex flex-row items-center justify-around">