fix(aiot): 删除实时视频模块

删除 views/aiot/video 和 api/aiot/video 目录,
撤回 auth.ts 中的菜单过滤逻辑。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-09 11:40:56 +08:00
parent 649d9e2a76
commit 4b54a50d8c
3 changed files with 1 additions and 167 deletions

View File

@@ -1,43 +0,0 @@
import { wvpRequestClient } from '#/api/aiot/request';
export namespace AiotVideoApi {
/** 流信息 */
export interface StreamInfo {
app?: string;
stream?: string;
ip?: string;
flv?: string;
ws_flv?: string;
rtmp?: string;
hls?: string;
rtsp?: string;
mediaServerId?: string;
tracks?: StreamTrack[];
}
export interface StreamTrack {
codec_id?: number;
codec_id_name?: string;
ready?: boolean;
type?: number;
width?: number;
height?: number;
fps?: number;
}
}
// ==================== 视频播放 API ====================
/** 开始播放 */
export function playStart(deviceId: string, channelId: string) {
return wvpRequestClient.get<AiotVideoApi.StreamInfo>(
`/aiot/video/play/start/${deviceId}/${channelId}`,
);
}
/** 停止播放 */
export function playStop(deviceId: string, channelId: string) {
return wvpRequestClient.get(
`/aiot/video/play/stop/${deviceId}/${channelId}`,
);
}

View File

@@ -138,18 +138,7 @@ export const useAuthStore = defineStore('auth', () => {
userStore.setUserInfo(authPermissionInfo.user);
userStore.setUserRoles(authPermissionInfo.roles);
// accessStore
// 过滤掉 visible=false 的菜单项(含子菜单递归过滤)
const filterVisibleMenus = (menus: any[]): any[] => {
return menus
.filter((menu) => menu.visible !== false)
.map((menu) => ({
...menu,
children: menu.children
? filterVisibleMenus(menu.children)
: undefined,
}));
};
accessStore.setAccessMenus(filterVisibleMenus(authPermissionInfo.menus));
accessStore.setAccessMenus(authPermissionInfo.menus);
accessStore.setAccessCodes(authPermissionInfo.permissions);
return authPermissionInfo;
}

View File

@@ -1,112 +0,0 @@
<script setup lang="ts">
import type { AiotVideoApi } from '#/api/aiot/video';
import { ref } from 'vue';
import { Page } from '@vben/common-ui';
import { Button, Card, Input, message, Select, Space } from 'ant-design-vue';
import { playStart, playStop } from '#/api/aiot/video';
defineOptions({ name: 'AiotVideoLive' });
const deviceId = ref('');
const channelId = ref('');
const streamInfo = ref<AiotVideoApi.StreamInfo | null>(null);
const loading = ref(false);
const playing = ref(false);
/** 开始播放 */
async function handlePlay() {
if (!deviceId.value || !channelId.value) {
message.warning('请输入设备ID和通道ID');
return;
}
loading.value = true;
try {
const info = await playStart(deviceId.value, channelId.value);
streamInfo.value = info;
playing.value = true;
message.success('播放请求已发送');
} catch (error) {
console.error('播放失败:', error);
message.error('播放失败');
} finally {
loading.value = false;
}
}
/** 停止播放 */
async function handleStop() {
if (!deviceId.value || !channelId.value) return;
try {
await playStop(deviceId.value, channelId.value);
playing.value = false;
streamInfo.value = null;
message.success('已停止播放');
} catch (error) {
console.error('停止播放失败:', error);
}
}
</script>
<template>
<Page auto-content-height>
<Card title="实时视频播放">
<div class="mb-4">
<Space>
<Input
v-model:value="deviceId"
placeholder="设备ID"
style="width: 200px"
/>
<Input
v-model:value="channelId"
placeholder="通道ID"
style="width: 200px"
/>
<Button
type="primary"
:loading="loading"
:disabled="playing"
@click="handlePlay"
>
开始播放
</Button>
<Button :disabled="!playing" danger @click="handleStop">
停止播放
</Button>
</Space>
</div>
<!-- 播放器区域 -->
<div v-if="streamInfo" class="mt-4">
<div class="mb-2 text-gray-500">
流地址{{ streamInfo.flv || streamInfo.ws_flv || '-' }}
</div>
<div
v-if="streamInfo.ws_flv || streamInfo.flv"
class="bg-black rounded"
style="width: 100%; max-width: 800px; aspect-ratio: 16/9"
>
<video
:src="streamInfo.flv"
autoplay
controls
style="width: 100%; height: 100%"
/>
</div>
</div>
<div
v-else
class="flex items-center justify-center bg-gray-100 rounded"
style="width: 100%; max-width: 800px; aspect-ratio: 16/9"
>
<span class="text-gray-400">请选择通道开始播放</span>
</div>
</Card>
</Page>
</template>