diff --git a/.env.development b/.env.development index eca4747..6484e91 100644 --- a/.env.development +++ b/.env.development @@ -12,15 +12,21 @@ VITE_APP_CLIENT_SECRET = 'NjHifmmB41rH6bJTd4A7RA==' #程璐 #VITE_APP_API_BASE_URL=http://192.168.12.117:9060/airport/ VITE_APP_API_BASE_URL=https://airport-test.t-aaron.com/ +#VITE_APP_API_BASE_URL=https://airport-develop.t-aaron.com:3443 # VUE_APP_API_BASE_URL=https://airport.t-aaron.com/airport/ # VUE_APP_API_BASE_URL=https://airportdev.t-aaron.com/airport/ # VUE_APP_AUTHORITY = 'http://192.168.11.11:8090' #测试环境 VITE_APP_AUTHORITY =https://login-test.t-aaron.com +#VUE_APP_AUTHORITY = 'https://oidc-develop.t-aaron.com:3443' #线上环境 (配合开发环境使用) #VUE_APP_AUTHORITY = 'https://oidc.t-aaron.com' + +#令牌 +#VUE_APP_OUT_AUTHORITY = 'https://oidc-develop.t-aaron.com:3443' + # 机场大屏跳转地址 VITE_APP_ASURL = 'https://airport-screen-test.t-aaron.com' diff --git a/src/apis/common.js b/src/apis/common.js index 4385992..3cc53fa 100644 --- a/src/apis/common.js +++ b/src/apis/common.js @@ -57,6 +57,47 @@ export async function getAirWayPointsToJson(url) { arr.pop() // console.log(arr) + arr = arr.map((text) => { + return text.split(/\s+/) + }) + // 删除前两个起飞点(不使用) + arr.splice(0, 2) + // 删除最后一个降落点(不删除) + arr.pop() + // 航线节点 + for (let i = 0; i < arr.length; i++) { + const stop = arr[i] + + if (stop[3] == 16) { + // 地图点,用于绘制 + mapPointList.push({ + // id + id: mapPointList.length + 1, + // 经纬度 + lngLat: [parseFloat(stop[9]), parseFloat(stop[8])], + alt: parseInt(stop[10]), // 高度 + // type: Number(stop[3]), //航点类型,gis需要 + }) + } + } + // console.log(mapPointList) + return mapPointList + } +} +export async function getAirWayPointsToJson2(url) { + // console.log(url) + let res = await axios.get(url) + if (res.status === 200) { + const text = res.data + let mapPointList = [] + let arr = text.split('\r\n') + if (arr.length <= 1) { + arr = text.split('\n') + } + arr.shift() + arr.pop() + console.log(arr) + arr = arr.map((text) => { return text.split(/\s+/) }) @@ -69,8 +110,7 @@ export async function getAirWayPointsToJson(url) { // 航线节点 for (let i = 0; i < arr.length; i++) { const stop = arr[i] - - if (true) { + if (parseInt(stop[3]) == 16 || parseInt(stop[3]) == 20 || parseInt(stop[3]) == 22) { // 地图点,用于绘制 mapPointList.push({ // id diff --git a/src/views/carbin/components/beforeCheck.vue b/src/views/carbin/components/beforeCheck.vue index 5fc04a8..3301314 100644 --- a/src/views/carbin/components/beforeCheck.vue +++ b/src/views/carbin/components/beforeCheck.vue @@ -188,14 +188,14 @@ const checkFn = async (row) => { } //临时代码啊 -checkFn({ - id: 1, - task: [ - { - taskId: 2, - }, - ], -}) +// checkFn({ +// id: 1, +// task: [ +// { +// taskId: 2, +// }, +// ], +// }) //临时代码啊 watch( diff --git a/src/views/carbin/index.vue b/src/views/carbin/index.vue index 164ac0f..c30656e 100644 --- a/src/views/carbin/index.vue +++ b/src/views/carbin/index.vue @@ -29,6 +29,7 @@ import { queryAirportApi, queryAirLineApi, getAirWayPointsToJson, + getAirWayPointsToJson2, getweatherApi, } from '@/apis/common' import { checkAirportRunStatusApi, droneCommandExecuteApi } from '@/apis/droneCommand.js' @@ -68,7 +69,7 @@ const statusList = reactive({ 3: '飞行准备中', }) -let iframeData = null +let iframeData = {} //修改左侧面板尺寸 const modifPlaneWidthFn = (num) => { @@ -125,7 +126,7 @@ const queryAirLine_AirPort = async () => { //机场当前状态 if (Number(currentAirPortInfo.value.status) == 2) { //飞行中 请求航线文件 - queryAirLine(currentAirPortInfo.value.task[0].fileUrl) + queryAirLine(currentAirPortInfo.value.fileUrl) } else { //地图数据 iframeData = { @@ -154,11 +155,12 @@ const queryAirLine_AirPort = async () => { } } + //临时代码 // if (res[1].value.code == 0) { // //航线文件 // let airLineInfo = res[1].value.data[0] // //请求航线数据 - // let resultWayPoint = await getAirWayPointsToJson(airLineInfo.fileUrl) + // let resultWayPoint = await getAirWayPointsToJson2(airLineInfo.fileUrl) // //地图数据 // iframeData = { @@ -171,6 +173,7 @@ const queryAirLine_AirPort = async () => { // coverage: currentAirPortInfo.value.coverage, // } // } + //临时代码end //6秒查询一次,主要是获取机场的状态,不同的状态展示的界面也不一样 setTimeout(() => { @@ -189,7 +192,7 @@ const queryAirPort = async () => { airPortSocketStore.ceurrentAirPortData = currentAirPortInfo.value // console.log(currentAirPortInfo.value) - currentAirPortInfo.value.status = 2 + // currentAirPortInfo.value.status = 2 if (currentAirPortStatus.value != Number(currentAirPortInfo.value.status)) { currentAirPortStatus.value = Number(currentAirPortInfo.value.status) @@ -202,7 +205,7 @@ const queryAirPort = async () => { //机场当前状态 if (Number(currentAirPortInfo.value.status) == 2) { //飞行中 请求航线文件 - queryAirLine(currentAirPortInfo.value.task[0].fileUrl) + queryAirLine(currentAirPortInfo.value.fileUrl) } resetScreen() @@ -217,8 +220,8 @@ const queryAirPort = async () => { //只请求航线 const queryAirLine = async (fileUrl) => { //请求航线数据 - let resultWayPoint = await getAirWayPointsToJson(fileUrl) - + let resultWayPoint = await getAirWayPointsToJson2(fileUrl) + console.log(resultWayPoint) //地图数据 iframeData = { airportName: currentAirPortInfo.value.name, @@ -305,7 +308,8 @@ const iframeLoaded = (iframeContent) => { if (iframeData) { clearInterval(tempTime) let data = JSON.stringify(iframeData) - console.log(iframeContent) + console.log('向gis发送数据....................................') + console.log(data) iframeContent.postMessage(data, '*') } }, 50) diff --git a/src/views/carbin/toolComp/screen.vue b/src/views/carbin/toolComp/screen.vue index 2479639..ac011eb 100644 --- a/src/views/carbin/toolComp/screen.vue +++ b/src/views/carbin/toolComp/screen.vue @@ -70,7 +70,7 @@ watch(