测试问题优化

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

@ -3,14 +3,20 @@ import type { GlobConfig } from '#/config';
import { getAppEnvConfig } from '@/utils/env'; import { getAppEnvConfig } from '@/utils/env';
export const useGlobSetting = (): Readonly<GlobConfig> => { export const useGlobSetting = (): Readonly<GlobConfig> => {
const { VITE_GLOB_APP_TITLE, VITE_GLOB_API_URL, VITE_GLOB_API_URL_PREFIX, VITE_GLOB_UPLOAD_URL } = const {
getAppEnvConfig(); 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 // Take global configuration
const glob: Readonly<GlobConfig> = { const glob: Readonly<GlobConfig> = {
title: VITE_GLOB_APP_TITLE, title: VITE_GLOB_APP_TITLE,
apiUrl: VITE_GLOB_API_URL, 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, urlPrefix: VITE_GLOB_API_URL_PREFIX,
uploadUrl: VITE_GLOB_UPLOAD_URL, uploadUrl: VITE_GLOB_UPLOAD_URL,
}; };

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

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

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

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

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

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

@ -121,10 +121,7 @@
> >
</div> </div>
<div class="content-button"> <div class="content-button">
<a-button <a-button type="primary" style="background: #3a57e8; width: 100%" @click="liveStreaming"
type="primary"
style="background: #3a57e8; width: 100%"
@click="emits('loadLiveStreaming', uavInformation.sub_device.device_online_status)"
>负载直播</a-button >负载直播</a-button
> >
</div> </div>
@ -132,15 +129,21 @@
</div> </div>
</template> </template>
<script setup lang="ts"> <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 { CopyOutlined, EditOutlined } from '@ant-design/icons-vue';
import { timestampToFormattedDate } from '@/utils/index'; import { timestampToFormattedDate } from '@/utils/index';
import { airPortStore } from '@/store/modules/airport'; 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 airPortStoreVal = airPortStore();
const airPort = airPortStoreVal.getAirport; const airPort = airPortStoreVal.getAirport;
const uav = airPortStoreVal.getUAV; const uav = airPortStoreVal.getUAV;
const live_info = airPortStoreVal.getLiveInfo;
const liveCode = ref('6');
const emits = defineEmits(['changeLoadControl', 'changeFlightControl', 'loadLiveStreaming']); const emits = defineEmits(['changeLoadControl', 'changeFlightControl', 'loadLiveStreaming']);
const props = defineProps({ const props = defineProps({
msgData: Object, msgData: Object,
@ -203,11 +206,49 @@
watch( watch(
() => props.uavTrack, () => props.uavTrack,
(val) => { (val) => {
uavLocation.value.longitude = val.longitude; uavLocation.value.longitude = val.longitude.toFixed(6);
uavLocation.value.latitude = val.latitude; uavLocation.value.latitude = val.latitude.toFixed(6);
uavLocation.value.height = val.height; 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> </script>
<style lang="less" scoped> <style lang="less" scoped>
.airport-information { .airport-information {

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

Loading…
Cancel
Save