测试问题优化

main
刘妍 2 months ago
parent aea2fa0d32
commit b545ba822d

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

@ -6,7 +6,7 @@
<div class="anticon" :class="getAppLogoClass" @click="goHome">
<img :src="VITE_GLOB_APP_LOGO" />
<div class="ml-2 truncate md:opacity-100" :class="getTitleClass" v-show="showTitle">
{{ subjectLogoTitle ? subjectLogoTitle : title }}
{{ subjectLogoTitle ? subjectLogoTitle : shortName }}
</div>
</div>
</template>
@ -42,7 +42,7 @@
const { prefixCls } = useDesign('app-logo');
const { getCollapsedShowTitle } = useMenuSetting();
const userStore = useUserStore();
const { title } = useGlobSetting();
const { shortName } = useGlobSetting();
const subjectLogoTitle = getAuthCache(SUBJECT_LOGO_TITLE);
const go = useGo();

@ -3,14 +3,20 @@ import type { GlobConfig } from '#/config';
import { getAppEnvConfig } from '@/utils/env';
export const useGlobSetting = (): Readonly<GlobConfig> => {
const { VITE_GLOB_APP_TITLE, VITE_GLOB_API_URL, VITE_GLOB_API_URL_PREFIX, VITE_GLOB_UPLOAD_URL } =
getAppEnvConfig();
const {
VITE_GLOB_APP_TITLE,
VITE_GLOB_API_URL,
VITE_GLOB_API_URL_PREFIX,
VITE_GLOB_UPLOAD_URL,
VITE_GLOB_APP_HEADER_TITLE,
} = getAppEnvConfig();
// Take global configuration
const glob: Readonly<GlobConfig> = {
title: VITE_GLOB_APP_TITLE,
apiUrl: VITE_GLOB_API_URL,
shortName: VITE_GLOB_APP_TITLE.replace(/\s/g, '_').replace(/-/g, '_'),
// shortName: VITE_GLOB_APP_TITLE.replace(/\s/g, '_').replace(/-/g, '_'),
shortName: VITE_GLOB_APP_HEADER_TITLE,
urlPrefix: VITE_GLOB_API_URL_PREFIX,
uploadUrl: VITE_GLOB_UPLOAD_URL,
};

@ -41,6 +41,7 @@ export function getAppEnvConfig() {
VITE_GLOB_APP_TECHINICAL_SUPPORT,
VITE_GLOB_APP_VERSIONS,
VITE_GLOB_FILE_PREVIEW,
VITE_GLOB_APP_HEADER_TITLE,
} = ENV;
let { VITE_GLOB_API_URL } = ENV;
if (localStorage.getItem(API_ADDRESS)) {
@ -59,6 +60,7 @@ export function getAppEnvConfig() {
VITE_GLOB_APP_TECHINICAL_SUPPORT,
VITE_GLOB_APP_VERSIONS,
VITE_GLOB_FILE_PREVIEW,
VITE_GLOB_APP_HEADER_TITLE,
};
}

@ -15,6 +15,7 @@
@changeLive="changeAirportLive"
@changeRemote="changeRemote"
:msgData="msgData"
v-if="changeSelectValue"
/>
<UAVInformation
:msgData="msgData"
@ -22,6 +23,7 @@
@changeLoadControl="changeLoadControl"
@changeFlightControl="changeFlightControl"
@loadLiveStreaming="loadLiveStreaming"
v-if="changeSelectValue"
/>
<!-- 远程调试 -->
<!-- <div v-if="remoteVisible">
@ -32,6 +34,7 @@
v-if="loadControlVisible"
@changeLoadControl="changeLoadControl"
:msgData="msgData"
:uavStatus="uavStatus"
:cameraType="cameraType"
/>
<!-- 飞行控制 -->
@ -39,6 +42,7 @@
@changeFlightControl="changeFlightControl"
@clickTakeOff="clickTakeOff"
@clickFlyTo="clickFlyTo"
:uavStatus="uavStatus"
v-if="flightControlVisible"
/>
<!-- 一键起飞表单 -->
@ -116,10 +120,10 @@
longitude: null,
});
const uavTrack = ref({});
const connected = ref(false)
const connected = ref(false);
const connectCallback = () => {
connected.value = true
}
connected.value = true;
};
onMounted(() => {
destroyConnection();
createConnection(connectCallback);
@ -127,12 +131,15 @@
// changeSelect();
// }, 1000);
});
watch(() => connected.value, (value) => {
watch(
() => connected.value,
(value) => {
if (value) {
console.log('start')
changeSelect()
console.log('start');
changeSelect();
}
})
},
);
onBeforeUnmount(() => {
destroyConnection();
});
@ -195,6 +202,7 @@
};
const msgData = ref({});
const changeSelect = async (value?: any) => {
createConnection(connectCallback);
//
//
airportLiveVisible.value = false;
@ -220,6 +228,7 @@
//
clientSubscribe(topicUAVUrl, { qos: 0 });
if (!value) {
//
getClient().on('message', (topic, message) => {
const rs = JSON.parse(message);
@ -238,9 +247,13 @@
airPort.value.latitude = rs.data.latitude;
airPort.value.longitude = rs.data.longitude;
}
if (rs.data.sub_device) {
uavStatus.value = rs.data.sub_device.device_online_status;
}
}
}
});
}
};
</script>
<style lang="less" scoped>

@ -1,6 +1,13 @@
<template>
<VueDragResize :w="width" :h="height" :x="left" :y="top" :isActive="true" :parentLimitation="true"
:isResizable="false">
<VueDragResize
:w="width"
:h="height"
:x="left"
:y="top"
:isActive="true"
:parentLimitation="true"
:isResizable="false"
>
<div class="flight-control" v-if="airportVal" v-drag>
<div class="title">
<div>
@ -20,7 +27,7 @@
<div class="content">
<div class="content-button">
<a-button @click="takeOff"></a-button>
<a-button @click="emits('clickFlyTo')"></a-button>
<a-button @click="flyTo"></a-button>
<!-- <a-button>智能环绕</a-button> -->
<a-button @click="returnVoyage"></a-button>
<a-button @click="obtain" style="background-color: #1b71e8; border: none">
@ -35,53 +42,118 @@
</template>
进入飞行控制
</a-button>
<a-button @click="exitDRC" style="background-color: #e3150e; border: none">退出飞行控制</a-button>
<a-button @click="exitDRC" style="background-color: #e3150e; border: none"
>退出飞行控制</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" title="上升" @mousedown="changeDRC('throttle', 'up', '上升')"
@mouseup="changeDRC('throttle', 'up', '')">
<img src="@/assets/images/flightoperation/top-active.png" alt="" v-if="selectName == ''" />
<div
class="info-item-top"
title="上升"
@mousedown="changeDRC('throttle', 'up', '上升')"
@mouseup="changeDRC('throttle', 'up', '')"
>
<img
src="@/assets/images/flightoperation/top-active.png"
alt=""
v-if="selectName == '上升'"
/>
<img src="@/assets/images/flightoperation/top.png" alt="" v-else />
</div>
<div class="info-item-right" title="右旋转" @mousedown="changeDRC('yaw', 'up', '右旋转')"
@mouseup="changeDRC('yaw', 'up', '')">
<img src="@/assets/images/flightoperation/right-active.png" alt="" v-if="selectName == ''" />
<div
class="info-item-right"
title="右旋转"
@mousedown="changeDRC('yaw', 'up', '右旋转')"
@mouseup="changeDRC('yaw', 'up', '')"
>
<img
src="@/assets/images/flightoperation/right-active.png"
alt=""
v-if="selectName == '右旋转'"
/>
<img src="@/assets/images/flightoperation/right.png" alt="" v-else />
</div>
<div class="info-item-bottom" title="下降" @mousedown="changeDRC('throttle', 'down', '下降')"
@mouseup="changeDRC('throttle', 'down', '')">
<img src="@/assets/images/flightoperation/bottom-active.png" alt="" v-if="selectName == ''" />
<div
class="info-item-bottom"
title="下降"
@mousedown="changeDRC('throttle', 'down', '下降')"
@mouseup="changeDRC('throttle', 'down', '')"
>
<img
src="@/assets/images/flightoperation/bottom-active.png"
alt=""
v-if="selectName == '下降'"
/>
<img src="@/assets/images/flightoperation/bottom.png" alt="" v-else />
</div>
<div class="info-item-left" title="左旋转" @mousedown="changeDRC('yaw', 'down', '左旋转')"
@mouseup="changeDRC('yaw', 'down', '')">
<img src="@/assets/images/flightoperation/left-active.png" alt="" v-if="selectName == ''" />
<div
class="info-item-left"
title="左旋转"
@mousedown="changeDRC('yaw', 'down', '左旋转')"
@mouseup="changeDRC('yaw', 'down', '')"
>
<img
src="@/assets/images/flightoperation/left-active.png"
alt=""
v-if="selectName == '左旋转'"
/>
<img src="@/assets/images/flightoperation/left.png" alt="" v-else />
</div>
</div>
<div class="info-item">
<!-- <img src="@/assets/images/flightoperation/flight_control.png" alt="" /> -->
<div class="info-item-top" title="前进"
@mousedown="changeDRC('pitch', 'up', '前进')" @mouseup="changeDRC('pitch', 'up', '')">
<img src="@/assets/images/flightoperation/top-active.png" alt=""
v-if="selectName == '前进'" />
<div
class="info-item-top"
title="前进"
@mousedown="changeDRC('pitch', 'up', '前进')"
@mouseup="changeDRC('pitch', 'up', '')"
>
<img
src="@/assets/images/flightoperation/top-active.png"
alt=""
v-if="selectName == '前进'"
/>
<img src="@/assets/images/flightoperation/top.png" alt="" v-else />
</div>
<div class="info-item-right" title="右移"
@mousedown="changeDRC('roll', 'up', '右移')" @mouseup="changeDRC('roll', 'up', '')">
<img src="@/assets/images/flightoperation/right-active.png" alt="" v-if="selectName == ''" />
<div
class="info-item-right"
title="右移"
@mousedown="changeDRC('roll', 'up', '右移')"
@mouseup="changeDRC('roll', 'up', '')"
>
<img
src="@/assets/images/flightoperation/right-active.png"
alt=""
v-if="selectName == '右移'"
/>
<img src="@/assets/images/flightoperation/right.png" alt="" v-else />
</div>
<div class="info-item-bottom" title="后退"
@mousedown="changeDRC('pitch', 'down', '后退')" @mouseup="changeDRC('pitch', 'down', '')">
<img src="@/assets/images/flightoperation/bottom-active.png" alt="" v-if="selectName == '退'" />
<div
class="info-item-bottom"
title="后退"
@mousedown="changeDRC('pitch', 'down', '后退')"
@mouseup="changeDRC('pitch', 'down', '')"
>
<img
src="@/assets/images/flightoperation/bottom-active.png"
alt=""
v-if="selectName == '后退'"
/>
<img src="@/assets/images/flightoperation/bottom.png" alt="" v-else />
</div>
<div class="info-item-left" title="左移"
@mousedown="changeDRC('roll', 'down', '左移')" @mouseup="changeDRC('roll', 'down', '')">
<img src="@/assets/images/flightoperation/left-active.png" alt="" v-if="selectName == ''" />
<div
class="info-item-left"
title="左移"
@mousedown="changeDRC('roll', 'down', '左移')"
@mouseup="changeDRC('roll', 'down', '')"
>
<img
src="@/assets/images/flightoperation/left-active.png"
alt=""
v-if="selectName == '左移'"
/>
<img src="@/assets/images/flightoperation/left.png" alt="" v-else />
</div>
</div>
@ -120,10 +192,15 @@ import { useUserStore } from '@/store/modules/user';
import { timestampToFormattedDate } from '@/utils/index';
import VueDragResize from 'vue-drag-resize/src';
import { airPortStore } from '@/store/modules/airport';
import { EventBus } from '@/utils/eventBus';
const props = defineProps({
uavStatus: Number,
});
console.log(props.uavStatus);
const airPortStoreVal = airPortStore();
const uav = airPortStoreVal.getUAV;
const isTakeOff = ref(false);
const width = ref(380);
const height = ref(390);
const left = ref(700);
@ -169,10 +246,24 @@ const takeOff = () => {
createMessage.warning('当前有用户正在操作,请稍后再试');
return;
}
if (isTakeOff.value) {
createMessage.warning('请勿重复操作');
return;
}
emits('clickTakeOff');
changeRedisUser(true);
};
//
const flyTo = () => {
console.log('飞行器状态', props.uavStatus);
console.log('是否一键起飞', !isTakeOff.value);
console.log(props.uavStatus == 0 && !isTakeOff.value);
if (!props.uavStatus && !isTakeOff.value) {
createMessage.warning('飞行器未开机');
return;
}
emits('clickFlyTo');
};
//
const obtain = () => {
// if (!getClient()) {
@ -182,6 +273,10 @@ const obtain = () => {
createMessage.warning('当前有用户正在操作,请稍后再试');
return;
}
if (props.uavStatus == 0 && !isTakeOff.value) {
createMessage.warning('飞行器未开机');
return;
}
if (flightGrab.value) {
createMessage.warning('已经获取了飞行器控制权');
return;
@ -211,6 +306,10 @@ const obtain = () => {
//
const returnBtn = ref(false);
const returnVoyage = () => {
if (props.uavStatus == 0 && !isTakeOff.value) {
createMessage.warning('飞行器未开机');
return;
}
if (returnBtn.value) {
createMessage.warning('正在返航或已返航,请勿重复操作');
return;
@ -249,7 +348,7 @@ const changeDRC = (type, value, name) => {
let querys = getDRCFlightQuery(type, value, seq);
drcDownTopicReize(querys);
createMessage.info(name + '指令已发送');
}, 1000)
}, 1000);
}, longPressDuration.value);
if (isLongPress) {
isLongPress = false;
@ -259,7 +358,6 @@ const changeDRC = (type, value, name) => {
let querys = getDRCFlightQuery(type, value, seq);
drcDownTopicReize(querys);
createMessage.info(name + '指令已发送');
} else {
if (longPressTimer.value) {
clearTimeout(longPressTimer.value);
@ -299,7 +397,13 @@ const getDRCFlightQuery = (type, value, seq) => {
return querys;
};
const drcSeq = ref(1);
let drc_mode_enter_timer;
const drc_mode_enter_val = ref(1);
const enterDRC = () => {
if (props.uavStatus == 0 && !isTakeOff.value) {
createMessage.warning('飞行器未开机');
return;
}
if (!flightGrab.value) {
createMessage.warning('请先获取飞行控制权');
return;
@ -317,6 +421,7 @@ const enterDRC = () => {
address: connectUrl,
// client_id: 'mqtt_client_1581F8HGX254V00A0BUY',
client_id: 'mqtt_client_1581F8HGX254V00A0BUYSeize',
// client_id: 'mqttx_' + Math.random().toString(16).substring(2, 8),
enable_tls: false,
expire_time: 3600,
password: '',
@ -331,6 +436,16 @@ const enterDRC = () => {
servicesTopic(querys);
drc_eart_beat();
drcUpTopic();
drc_mode_enter_timer = window.setInterval(() => {
if (drc_mode_enter_val.value > 30) {
window.clearInterval(drc_mode_enter_timer);
drc_mode_enter_timer = null;
drc_mode_enter_val.value = 0;
createMessage.error('进入指令飞行控制模式失败,无响应');
return;
}
drc_mode_enter_val.value++;
}, 1000);
};
let timer;
const drc_eart_beat = () => {
@ -354,6 +469,10 @@ const drc_eart_beat = () => {
eventsTopicSubscribe();
};
const exitDRC = () => {
if (props.uavStatus == 0 && !isTakeOff.value) {
createMessage.warning('飞行器未开机');
return;
}
createMessage.info('正在退出飞行控制,请稍后');
const querys = {
bid: bid,
@ -401,8 +520,10 @@ onMounted(() => {
modeEnter.value = false;
createMessage.success('退出指令飞行控制模式成功');
changeRedisUser(false);
window.clearInterval(drc_mode_enter_timer);
} else {
createMessage.error('退出指令飞行控制模式失败,' + errorName(rs.data.result));
window.clearInterval(drc_mode_enter_timer);
}
}
//
@ -419,6 +540,8 @@ onMounted(() => {
if (rs.method === 'takeoff_to_point') {
if (rs.data.result == 0) {
createMessage.success('一键起飞成功');
isTakeOff.value = true;
EventBus.emit('closeTranslation', null);
} else {
createMessage.error('一键起飞失败,' + errorName(rs.data.result));
}
@ -437,6 +560,7 @@ onMounted(() => {
if (rs.method == 'fly_to_point') {
if (rs.data.result == 0) {
createMessage.success('指点飞行成功');
EventBus.emit('closeTranslation', null);
} else {
createMessage.error('指点飞行失败,' + errorName(rs.data.result));
}
@ -445,6 +569,7 @@ onMounted(() => {
});
onUnmounted(() => {
window.clearInterval(timer);
window.clearInterval(drc_mode_enter_timer);
destroySeizeConnection();
changeRedisUser(false);
monitorDRC.value = false;

@ -44,7 +44,7 @@
>关闭</a-button
>
<a-button type="primary" style="background: #3a57e8; width: 40%" @click="takeOff"
>起飞</a-button
>执行</a-button
>
</div>
</div>
@ -97,6 +97,9 @@
createMessage.warning('请先选择目标点');
return;
}
data.points[0].latitude = Number(data.points[0].latitude);
data.points[0].longitude = Number(data.points[0].longitude);
data.points[0].height = Number(data.points[0].height);
const querys = {
bid: buildGUID(),
data: data,
@ -118,9 +121,9 @@
onMounted(() => {
//
EventBus.on('obtainTheLocation', (val: any) => {
data.points[0].latitude = val.lat;
data.points[0].longitude = val.lng;
data.points[0].height = val.alt;
data.points[0].latitude = val.lat.toFixed(6);
data.points[0].longitude = val.lng.toFixed(6);
data.points[0].height = val.alt.toFixed(2);
});
});
</script>

@ -256,7 +256,7 @@
setTopic(querys);
}
setTimeout(() => {
startLiveFun();
// startLiveFun();
playVideo();
getClient().on('message', (topic, message) => {
const rs = JSON.parse(message);

@ -24,27 +24,63 @@
<a-button @click="singleShot"></a-button>
</div>
<div class="direction-controller">
<img src="@/assets/images/flightoperation/direction_controller.png" alt="" />
<img
class="controller-bg"
src="@/assets/images/flightoperation/direction_controller.png"
alt=""
/>
<div
class="direction-controller-top"
title="俯视"
@click="changeDrc('pitch_speed', 'up')"
></div>
@mousedown="changeDrc('pitch_speed', 'up', '俯视')"
@mouseup="changeDrc('pitch_speed', 'up', '')"
>
<img
src="@/assets/images/flightoperation/p-top-active.png"
alt=""
v-if="selectName == '俯视'"
/>
<img src="@/assets/images/flightoperation/p-top.png" alt="" v-else />
</div>
<div
class="direction-controller-right"
title="右移"
@click="changeDrc('yaw_speed', 'up')"
></div>
@mousedown="changeDrc('yaw_speed', 'up', '右移')"
@mouseup="changeDrc('yaw_speed', 'up', '')"
>
<img
src="@/assets/images/flightoperation/p-right-active.png"
alt=""
v-if="selectName == '右移'"
/>
<img src="@/assets/images/flightoperation/p-right.png" alt="" v-else />
</div>
<div
class="direction-controller-bottom"
title="仰视"
@click="changeDrc('pitch_speed', 'down')"
></div>
@mousedown="changeDrc('pitch_speed', 'down', '仰视')"
@mouseup="changeDrc('pitch_speed', 'down', '')"
>
<img
src="@/assets/images/flightoperation/p-bottom-active.png"
alt=""
v-if="selectName == '仰视'"
/>
<img src="@/assets/images/flightoperation/p-bottom.png" alt="" v-else />
</div>
<div
class="direction-controller-left"
title="左移"
@click="changeDrc('yaw_speed', 'down')"
></div>
@mousedown="changeDrc('yaw_speed', 'down', '左移')"
@mouseup="changeDrc('yaw_speed', 'down', '')"
>
<img
src="@/assets/images/flightoperation/p-left-active.png"
alt=""
v-if="selectName == '左移'"
/>
<img src="@/assets/images/flightoperation/p-left.png" alt="" v-else />
</div>
</div>
<div class="zoom">
<a-slider
@ -96,6 +132,7 @@
const airPort = airPortStoreVal.getAirport;
const uav = airPortStoreVal.getUAV;
const selectName = ref('');
const userStore = useUserStore();
const userInfo = userStore.getUserInfo;
const redisUser = ref({});
@ -104,6 +141,7 @@
const props = defineProps({
msgData: Object,
cameraType: String,
uavStatus: Number,
});
const monitorDRC = ref(false);
//
@ -135,13 +173,13 @@
style: {
color: '#f50',
},
label: createVNode('strong', {}, '100'),
label: createVNode('strong', {}, '10'),
},
20: {
style: {
color: '#f50',
},
label: createVNode('strong', {}, '200'),
label: createVNode('strong', {}, '20'),
},
});
watch(
@ -207,6 +245,10 @@
createMessage.warning('当前有用户正在操作,请稍后再试');
return;
}
if (!props.uavStatus) {
createMessage.warning('飞行器未开机');
return;
}
if (grabBtn.value) {
createMessage.warning('已经获取了飞行器控制权');
return;
@ -252,12 +294,50 @@
services_replyTopicReize();
};
let timer;
const longPressTimer = ref();
const longPressInterval = ref();
const longPressDuration = ref(1000); //
//
const changeDrc = (type, val) => {
const changeDrc = (type, val, name) => {
selectName.value = name;
if (name !== '') {
if (!flightGrab.value) {
createMessage.warning('请先获取相机控制权');
return;
}
let isLongPress = false;
longPressTimer.value = setTimeout(() => {
console.log('长按事件触发!');
isLongPress = true;
longPressInterval.value = setInterval(() => {
let querys = getDRCFlightQuery(type, val);
servicesTopicReize(querys);
createMessage.info(name + '指令已发送');
}, 1000);
}, longPressDuration.value);
if (isLongPress) {
isLongPress = false;
return;
}
//
let querys = getDRCFlightQuery(type, val);
servicesTopicReize(querys);
createMessage.info(name + '指令已发送');
} else {
if (longPressTimer.value) {
clearTimeout(longPressTimer.value);
longPressTimer.value = null;
console.log('清除延时器');
}
if (longPressInterval.value) {
clearTimeout(longPressInterval.value);
longPressInterval.value = null;
console.log('清除定时器');
}
console.log('鼠标松开');
}
};
const getDRCFlightQuery = (type, val) => {
let data = {
payload_index: uav.camera_index,
locked: true,
@ -269,15 +349,15 @@
} else {
data[type] = -8;
}
console.log('data', data);
//
servicesTopicReize({
const querys = {
bid: buildGUID(),
method: 'camera_screen_drag',
tid: buildGUID(),
timestamp: new Date().getTime(),
data: data,
});
};
console.log(querys);
return querys;
};
onMounted(() => {
// mqtt
@ -382,41 +462,45 @@
.direction-controller {
position: relative;
margin-top: 20px;
img {
.controller-bg {
margin-left: 60px;
width: 200px;
}
.direction-controller-top {
width: 50px;
height: 50px;
position: absolute;
top: 20px;
left: 130px;
top: 43px;
left: 120px;
cursor: pointer;
img {
width: 80px;
}
}
.direction-controller-right {
width: 50px;
height: 50px;
position: absolute;
top: 70px;
right: 100px;
top: 60px;
right: 127px;
cursor: pointer;
img {
width: 38px;
}
}
.direction-controller-bottom {
width: 50px;
height: 50px;
position: absolute;
bottom: 20px;
right: 160px;
bottom: 44px;
left: 120px;
cursor: pointer;
img {
width: 80px;
}
}
.direction-controller-left {
width: 50px;
height: 50px;
position: absolute;
top: 80px;
left: 80px;
top: 60px;
left: 103px;
cursor: pointer;
img {
width: 38px;
}
}
}
.zoom {

@ -217,6 +217,9 @@
createMessage.warning('请先选择目标点');
return;
}
data.target_height = Number(data.target_height);
data.target_latitude = Number(data.target_latitude);
data.target_longitude = Number(data.target_longitude);
const querys = {
bid: buildGUID(),
data: data,
@ -238,9 +241,9 @@
onMounted(() => {
//
EventBus.on('obtainTheLocation', (val: any) => {
data.target_latitude = val.lat;
data.target_longitude = val.lng;
data.target_height = val.alt;
data.target_latitude = val.lat.toFixed(6);
data.target_longitude = val.lng.toFixed(6);
data.target_height = val.alt.toFixed(2);
});
});
</script>

@ -121,10 +121,7 @@
>
</div>
<div class="content-button">
<a-button
type="primary"
style="background: #3a57e8; width: 100%"
@click="emits('loadLiveStreaming', uavInformation.sub_device.device_online_status)"
<a-button type="primary" style="background: #3a57e8; width: 100%" @click="liveStreaming"
>负载直播</a-button
>
</div>
@ -132,15 +129,21 @@
</div>
</template>
<script setup lang="ts">
import { reactive, ref, watch } from 'vue';
import { reactive, ref, watch, onMounted } from 'vue';
import { CopyOutlined, EditOutlined } from '@ant-design/icons-vue';
import { timestampToFormattedDate } from '@/utils/index';
import { airPortStore } from '@/store/modules/airport';
import { buildGUID } from '@/utils/uuid';
import { servicesTopic, services_replyTopic, errorName } from '@/utils/debugging/remote';
import { getClient } from '@/utils/mqtt';
import { useMessage } from '@/hooks/web/useMessage';
const { createMessage } = useMessage();
const airPortStoreVal = airPortStore();
const airPort = airPortStoreVal.getAirport;
const uav = airPortStoreVal.getUAV;
const live_info = airPortStoreVal.getLiveInfo;
const liveCode = ref('6');
const emits = defineEmits(['changeLoadControl', 'changeFlightControl', 'loadLiveStreaming']);
const props = defineProps({
msgData: Object,
@ -203,11 +206,49 @@
watch(
() => props.uavTrack,
(val) => {
uavLocation.value.longitude = val.longitude;
uavLocation.value.latitude = val.latitude;
uavLocation.value.height = val.height;
uavLocation.value.longitude = val.longitude.toFixed(6);
uavLocation.value.latitude = val.latitude.toFixed(6);
uavLocation.value.height = val.height.toFixed(2);
},
);
const startTid = buildGUID();
const liveStreaming = () => {
createMessage.info('正在开启负载直播,请稍后');
const querys = {
bid: buildGUID(),
method: 'live_start_push',
tid: startTid,
timestamp: new Date().getTime(),
data: {
url_type: 1, // 0 = RTMP 1GB28181 3WebRTC 4
url: live_info.rtmp + liveCode.value,
video_id: uav.video_id,
video_quality: 3, // 0=1=2=3=4=
},
};
console.log(querys);
servicesTopic(querys);
services_replyTopic();
};
onMounted(() => {
setTimeout(() => {
getClient().on('message', (topic, message) => {
const rs = JSON.parse(message);
if (rs.method == 'live_start_push' && rs.tid == startTid) {
console.log(rs);
if (rs.data.result == 0) {
createMessage.success('无人机开始直播成功');
emits('loadLiveStreaming', uavInformation.value.sub_device.device_online_status);
} else if (rs.data.result == 513003) {
createMessage.success('无人机直播已开启');
emits('loadLiveStreaming', uavInformation.value.sub_device.device_online_status);
} else {
createMessage.error('开始直播失败,' + errorName(rs.data.result));
}
}
});
}, 1000);
});
</script>
<style lang="less" scoped>
.airport-information {

@ -36,6 +36,7 @@
import { buildUUID } from '@/utils/uuid';
import airPoint from './airPoint.vue';
import * as mars3d from 'mars3d';
import { EventBus } from '@/utils/eventBus';
import 'mars3d-space';
@ -257,6 +258,12 @@ const generatePreviewPoint = (placemark)=>{
onMounted(() => {
initMap();
EventBus.on('closeTranslation', (val: any) => {
if (moveTool) {
moveTool.destroy();
moveTool = null;
}
});
});
const initMap = () => {
@ -1561,6 +1568,9 @@ const loadChangGuangLayer = ()=>{
if(!graphicLayer){
return
}
if(props.airPort.longitude == null){
return;
}
let point = graphicLayer.getGraphicById('set-airport');
// //
let position = [props.airPort.longitude, props.airPort.latitude, 70];

Loading…
Cancel
Save