feat: 智能监控选择机器人

This commit is contained in:
zhanghao 2026-08-06 09:08:53 +08:00
parent c2ab0aa8f2
commit 2715d02c22

View File

@ -8,7 +8,7 @@
<div><SvgIcon name="bot" color="#fff" /></div>
<div class="bot-name">全部</div>
</div>
<div v-for="item, index in 4" class="robot" :class="{ active: activeBot === index + 1 }" @click="changeBot(index + 1)">
<div v-for="item, index in robotList" class="robot" :class="{ active: activeBot === index + 1 }" @click="changeBot(index + 1)">
<div>
<SvgIcon name="bot" :color="colorList[index]" />
</div>
@ -41,15 +41,37 @@
<script setup>
import SvgIcon from "@/components/SvgIcon";
import IPlayer from "@/components/IPlayer/index.vue";
import { getRobotList } from '@/api/inspection/robot'
const videoUrl = ref('https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8')
const colorList = ['#00D4FF', '#FFB300', '#00FF88', '#fd00ff']
const robotList = ref([])
const activeBot = ref(0)
const changeBot = (index) => {
activeBot.value = index
}
const fetchRobotList = async () => {
try {
const res = await getRobotList({
robotType: 2,
})
if (res.code === 200) {
robotList.value = res.rows
} else {
console.error('获取机器人列表失败:', res.message)
}
} catch (error) {
console.error('获取机器人列表失败:', error)
}
}
onMounted(() => {
fetchRobotList()
})
</script>
<style lang="scss" scoped>
.page-container {