更新飞行界面,更换python接口

main
石超 2026-02-11 13:49:38 +08:00
parent 0c70023e30
commit 1078b2b0aa
13 changed files with 161 additions and 67 deletions

View File

@ -31,10 +31,11 @@ VITE_GLOB_MEDIALIBRARY_IMAGE_URL = http://175.27.168.120:6013/test/
VITE_GLOB_APP_HEADER_TITLE = 低空数智平台
VITE_GLOB_PY_URL = http://192.168.10.131:9309
VITE_GLOB_PY_WS_URL = ws://192.168.10.131:9309
VITE_GLOB_MQTT_URL = wrj.wisestcity.com
VITE_GLOB_MQTT_PORT = 6010
VITE_GLOB_APP_RTMP_URL = rtmp://wrj.wisestcity.com:8081
VITE_GLOB_APP_FLV_URL = http://wrj.wisestcity.com:8081
VITE_GLOB_APP_RTMP_URL = rtmp://wrj.wisestcity.com:1986
VITE_GLOB_APP_FLV_URL = http://wrj.wisestcity.com:1986
VITE_GLOB_SRS_API_URL = http://wrj.wisestcity.com:1985

View File

@ -1,7 +1,7 @@
<template>
<div :class="`${prefixCls}-toolbar`" class="flex items-center px-2 py-1">
<template v-for="item in toolbarItemList" :key="item.type">
<Tooltip placement="bottom" v-bind="item.disabled ? { visible: false } : {}">
<Tooltip placement="bottom" v-bind="item.disabled ? { open: false } : {}">
<template #title>{{ item.tooltip }}</template>
<span :class="`${prefixCls}-toolbar__icon`" v-if="item.icon" @click="onControl(item)">
<Icon

View File

@ -93,7 +93,7 @@
</a-tooltip>
<a-popover placement="bottom" v-if="props.splitPlugin" v-model:visible="splitPanelVisible">
<a-popover placement="bottom" v-if="props.splitPlugin" v-model:open="splitPanelVisible">
<template #content>
<div class="split-panel">
<p class="split-panel-item" @click="handlerDrawLineString()">线</p>

View File

@ -1,7 +1,7 @@
<template>
<div :class="prefixCls">
<Popover
v-model:visible="visible"
v-model:open="visible"
title=""
trigger="click"
:overlayClassName="`${prefixCls}__overlay`"

View File

@ -47,7 +47,6 @@ class LiveStreamPlugin {
src: live_url + '.flv', // 播放地址
},
],
licenseUrl: live_url + '.flv', // license 地址,必传。参考准备工作部分,在视立方控制台申请 license 后可获得 licenseUrl
autoplay: true, // 是否自动播放
});
}, 1000);

View File

@ -44,6 +44,7 @@ export function getAppEnvConfig() {
VITE_GLOB_FILE_PREVIEW,
VITE_GLOB_APP_HEADER_TITLE,
VITE_GLOB_PY_URL,
VITE_GLOB_PY_WS_URL,
VITE_GLOB_MQTT_URL,
VITE_GLOB_MQTT_PORT,
VITE_GLOB_APP_RTMP_URL,
@ -70,6 +71,7 @@ export function getAppEnvConfig() {
VITE_GLOB_FILE_PREVIEW,
VITE_GLOB_APP_HEADER_TITLE,
VITE_GLOB_PY_URL,
VITE_GLOB_PY_WS_URL,
VITE_GLOB_MQTT_URL,
VITE_GLOB_MQTT_PORT,
VITE_GLOB_APP_RTMP_URL,

View File

@ -651,7 +651,6 @@
import { ref, watch, onMounted, onBeforeUnmount, computed, nextTick } from 'vue';
import { cloneDeep } from 'lodash-es';
import { getAppEnvConfig } from '@/utils/env';
const { VITE_GLOB_MEDIALIBRARY_IMAGE_URL } = getAppEnvConfig();
const props = defineProps(['recordList', 'nowRecord', 'groupIndex', 'isEdit', 'graffitiColor']);
const emits = defineEmits(['chooseNowImageGroup']);

View File

@ -68,8 +68,7 @@
</div>
</div>
<!-- 飞行器控制盒 -->
<!-- <div class="uav-box" ref="uavBox" v-if="uavBoxVisible"> -->
<div class="uav-box" ref="uavBox" v-if="1">
<div class="uav-box" ref="uavBox" v-if="uavBoxVisible">
<UavBox @closeUavBox="uavBoxVisible = false" @flyLog="logVisible = true" @flyTo="flyTobtn" @patrol="patrolbtn"
@taskSubmitted="handleTaskSubmitted" />
</div>
@ -203,7 +202,8 @@ import axios from 'axios';
import TCPlayer from 'tcplayer.js';
import 'tcplayer.js/dist/tcplayer.min.css'; //
import { io, Socket } from 'socket.io-client';
import { getAppEnvConfig } from '@/utils/env';
const { VITE_GLOB_PY_WS_URL } = getAppEnvConfig();
//
const { createConfirm, createMessage } = useMessage();
//
@ -260,7 +260,7 @@ const flyToVisible = ref(false);
// Socket
const socket = ref<Socket | null>(null);
const socketConnected = ref(false);
const socketUrl = ref('http://localhost:5000'); // Socket
const socketUrl = ref(`${VITE_GLOB_PY_WS_URL}`); // Socket
// Socket
const connectSocket = () => {
@ -424,7 +424,7 @@ watch(
() => {
nextTick(() => {
if (myDiv.value) {
myDiv.value.scrollTop = myDiv.value.scrollHeight;
(myDiv.value as HTMLElement).scrollTop = (myDiv.value as HTMLElement).scrollHeight;
}
});
},
@ -648,8 +648,7 @@ const getRtmpList = () => {
//
if (res.data.streams[index].publish.active) {
//
player.src(live_info.url + liveCode.value + '.flv');
player.play();
reloadLive()
//
airPortStoreVal.setflyLog({
type: 'success',
@ -690,8 +689,21 @@ const startLiveFun = () => {
};
//
const reloadLive = () => {
player.src(live_info.url + liveCode.value + '.flv');
player.play();
let liveUrl = `${live_info.url}/${liveCode.value}.flv`
if(player){
player.src(liveUrl);
player.play();
}else{
//
player = TCPlayer('player-container-id', {
sources: [
{
src: liveUrl, //
},
],
autoplay: true, //
});
}
};
// ID
const stopTid = buildGUID();
@ -827,17 +839,18 @@ onMounted(() => {
//
document.addEventListener('keydown', handleKeyDown);
document.addEventListener('keyup', handleKeyUp);
if (liveVisible.value && live_info) {
//
player = TCPlayer('player-container-id', {
sources: [
{
src: live_info.url + liveCode.value + '.flv', //
},
],
autoplay: true, //
});
}
//
player = TCPlayer('player-container-id', {
sources: [
{
src: live_info.url + liveCode.value + '.flv', //
},
],
licenseUrl: live_info.url + liveCode.value + '.flv', // license
autoplay: true, //
});
//
EventBus.on('obtainTheLocation', (val: any) => {

View File

@ -463,7 +463,7 @@
</div>
<!-- 快捷键提示弹窗 -->
<a-modal
v-model:visible="shortcutVisible"
v-model:open="shortcutVisible"
title="快捷键"
width="1000px"
height="500px"
@ -1644,15 +1644,23 @@
setTimeout(() => {
liveCode.value = uavInfo.sn;
const initVideoUrl = isAiVideo.value && aiLiveUrl.value ? aiLiveUrl.value : live_info.url + liveCode.value + '.flv';
try{
player = TCPlayer('player-container-id-live', {
sources: [
{
src: initVideoUrl, //
},
],
licenseUrl: initVideoUrl, // license license licenseUrl
autoplay: true, //
});
{
src: initVideoUrl, //
},
],
autoplay: true, //
});
} catch (error) {
console.error('视频播放失败:', error);
airPortStoreVal.setflyLog({
type: 'error',
title: '视频播放',
content: '失败: ' + (error.message || '未知错误'),
});
}
getRtmpList();
let receivedMessages = {};
getClient().on('message', (topic, message) => {

View File

@ -137,7 +137,6 @@
src: live_info.url + liveCode.value + '.flv', //
},
],
licenseUrl: live_info.url + liveCode.value + '.flv', // license license licenseUrl
autoplay: true, //
});
getClient().on('message', (topic, message) => {
@ -145,12 +144,28 @@
if (rs.method == 'live_start_push' && rs.tid == startTid) {
if (rs.data.result == 0) {
createMessage.success('开始直播成功');
player.src(live_info.url + liveCode.value + '.flv');
player.play();
if (player) {
try {
player.src(live_info.url + liveCode.value + '.flv');
player.play().catch((error) => {
console.error('视频播放失败:', error);
});
} catch (error) {
console.error('设置视频源失败:', error);
}
}
} else if (rs.data.result == 513003) {
createMessage.success('直播已开启');
player.src(live_info.url + liveCode.value + '.flv');
player.play();
if (player) {
try {
player.src(live_info.url + liveCode.value + '.flv');
player.play().catch((error) => {
console.error('视频播放失败:', error);
});
} catch (error) {
console.error('设置视频源失败:', error);
}
}
} else {
createMessage.error('开始直播失败,' + errorName(rs.data.result));
}

View File

@ -216,13 +216,24 @@
maxTime: 0,
});
const playVideo = () => {
//
if (player) {
try {
player.dispose();
player = null;
} catch (error) {
console.error('销毁播放器失败:', error);
}
}
//
player = TCPlayer('player-container-id-live', {
sources: [
{
src: live_info.url + liveCode.value + '.flv', //
},
],
licenseUrl: live_info.url + liveCode.value + '.flv', // license license licenseUrl
autoplay: true, //
});
};
const stopTid = buildGUID();
@ -240,8 +251,21 @@
emits('loadLiveStreaming');
};
const reloadLive = () => {
player.src(live_info.url + liveCode.value + '.flv');
player.play();
if (player) {
try {
player.src(live_info.url + liveCode.value + '.flv');
player.play().catch((error) => {
console.error('视频播放失败:', error);
});
} catch (error) {
console.error('重新加载视频失败:', error);
//
playVideo();
}
} else {
//
playVideo();
}
};
onMounted(() => {
console.log(props.uavStatus);
@ -267,12 +291,28 @@
if (rs.method == 'live_start_push' && rs.tid == startTid) {
if (rs.data.result == 0) {
createMessage.success('无人机开始直播成功');
player.src(live_info.url + liveCode.value + '.flv');
player.play();
if (player) {
try {
player.src(live_info.url + liveCode.value + '.flv');
player.play().catch((error) => {
console.error('视频播放失败:', error);
});
} catch (error) {
console.error('设置视频源失败:', error);
}
}
} else if (rs.data.result == 513003) {
createMessage.success('无人机直播已开启');
player.src(live_info.url + liveCode.value + '.flv');
player.play();
if (player) {
try {
player.src(live_info.url + liveCode.value + '.flv');
player.play().catch((error) => {
console.error('视频播放失败:', error);
});
} catch (error) {
console.error('设置视频源失败:', error);
}
}
} else {
createMessage.error('开始直播失败,' + errorName(rs.data.result));
}
@ -288,16 +328,32 @@
} else if (rs.method == 'live_set_quality' && rs.tid == qualityTid) {
if (rs.data.result == 0) {
createMessage.success('无人机设置清晰度成功');
player.src(live_info.url + '4.flv');
player.play();
if (player) {
try {
player.src(live_info.url + '4.flv');
player.play().catch((error) => {
console.error('视频播放失败:', error);
});
} catch (error) {
console.error('设置视频源失败:', error);
}
}
} else {
createMessage.error('无人机设置清晰度失败,' + errorName(rs.data.result));
}
} else if (rs.method == 'live_lens_change' && rs.tid == lensTid) {
if (rs.data.result == 0) {
createMessage.success('无人机设置直播镜头成功');
player.src(live_info.url + liveCode.value + '.flv');
player.play();
if (player) {
try {
player.src(live_info.url + liveCode.value + '.flv');
player.play().catch((error) => {
console.error('视频播放失败:', error);
});
} catch (error) {
console.error('设置视频源失败:', error);
}
}
} else {
createMessage.error('无人机设置直播镜头失败,' + errorName(rs.data.result));
}

View File

@ -140,7 +140,7 @@
</div>
<div class="table-title-item" style="width: 57px;border-right: 0px;">编辑</div>
</div>
<div class="setting-table-item" v-for="item in project.userIds">
<div class="setting-table-item" v-for="item in project.userIds" v-if="item">
<div class="table-item-col" style="width: 119px;padding-left: 12px; justify-content: start;">
{{ item.name }}
<div class="user-icon" v-if="userId == item.id"></div>
@ -172,7 +172,7 @@
</div>
<div class="table-title-item" style="width: 57px;border-right: 0px;">编辑</div>
</div>
<div class="setting-table-item" v-for="item in project.deviceIds">
<div class="setting-table-item" v-for="item in project.deviceIds" v-if="item">
<div class="table-item-col" style="width: 119px;padding-left: 12px; justify-content: start;">
{{item.name}}
<div class="time-icon"></div>
@ -252,21 +252,19 @@ watch(() => props.addModal, (newValue) => {
project.value.userIds.push(user)
}
}else if(newValue && props.modalType == 'update'){
let userId = props.updateProject.users.map(item => item.id)
let userlist = userList.value.filter(item => userId.includes(item.id))
// let deviceId = props.updateProject.lasaDronePort.map(item => item.id)
// let deviceArray = deviceList.value.filter(item => deviceId.includes(item.id))
project.value = {
...props.updateProject.workspace,
requestCodeCutOffTime: props.updateProject.workspace.requestCodeCutOffTime? dayjs(props.updateProject.workspace.requestCodeCutOffTime): '',
userIds: userlist,
lockfly: props.updateProject.lasaSpaceLockFlies,
deviceIds: props.updateProject.lasaDronePort
let userIds = props.updateProject?.users?.map(item => item.id) || []
let userlist = userList.value.filter(item => userIds.includes(item.id))
project.value = {
...props.updateProject?.workspace || {},
requestCodeCutOffTime: props.updateProject?.workspace?.requestCodeCutOffTime? dayjs(props.updateProject.workspace.requestCodeCutOffTime): '',
userIds: userlist,
lockfly: props.updateProject?.lasaSpaceLockFlies || [],
deviceIds: props.updateProject?.lasaDronePort || []
}
}
}
})
const userId = localStorage.getItem('userid')
const userId = parseInt(localStorage.getItem('userid') || '-1')
const childSetting = ref({
open: false,
type: ''
@ -330,16 +328,18 @@ const deviceList = ref([])
onMounted(() => {
getAccountList({page:1,limit:999}).then(res => {
userList.value = res.items
userList.value = res.items || []
if(userId == -1){
project.value.userIds.push({id:-1,name:'超级管理员',role:'超级管理员'})
return
}
let user = userList.value.find(item => item.id == userId)
project.value.userIds.push(user)
if(user){
project.value.userIds.push(user)
}
})
GetUavList().then(res => {
deviceList.value = res
deviceList.value = res || []
})
})
const closeAddModal = () => {

1
types/config.d.ts vendored
View File

@ -171,6 +171,7 @@ export interface GlobEnvConfig {
VITE_GLOB_FILE_PREVIEW?: string;
VITE_GLOB_APP_HEADER_TITLE?: string;
VITE_GLOB_PY_URL?: string;
VITE_GLOB_PY_WS_URL?: string;
VITE_GLOB_MQTT_URL?: string;
VITE_GLOB_MQTT_PORT?: number;
VITE_GLOB_APP_RTMP_URL?: string;