You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
2.1 KiB
101 lines
2.1 KiB
1 week ago
|
<script setup>
|
||
|
import { reactive } from 'vue'
|
||
|
import { vehicleList, vehicleAdd, vehicleUpdate, vehicleDelete, vehicleGetById, iproductionplanList } from './api'
|
||
|
import { baseModelOptions, baseFilterOptions } from './options'
|
||
|
import { useRouter } from 'vue-router';
|
||
|
|
||
|
const cameraList = reactive([
|
||
|
{ name: '5305#摄像头', source: 'rtsp://admin:admin@IP_ADDRESS' },
|
||
|
{ name: '5601#摄像头', source: 'rtsp://admin:admin@IP_ADDRESS' }
|
||
|
])
|
||
|
const state = reactive({
|
||
|
currentCameraIndex: 0
|
||
|
})
|
||
|
</script>
|
||
|
|
||
|
<template>
|
||
|
<div class="app-container">
|
||
|
<!-- 监控摄像头名称列表 -->
|
||
|
<div class="camera-name-list">
|
||
|
<template v-for="(camera, index) in cameraList" :key="index">
|
||
|
<span
|
||
|
class="camera-name"
|
||
|
@click="switchCamera(index)"
|
||
|
:class="{ active: state.currentCameraIndex === index }"
|
||
|
>
|
||
|
{{ camera.name }}
|
||
|
</span>
|
||
|
</template>
|
||
|
</div>
|
||
|
<!-- 摄像头展示区域 -->
|
||
|
<div class="camera-display">
|
||
|
<video
|
||
|
v-if="state.currentCameraIndex !== -1"
|
||
|
:src="cameraList[state.currentCameraIndex].source"
|
||
|
controls
|
||
|
autoplay
|
||
|
muted
|
||
|
></video>
|
||
|
<p v-else>请选择摄像头</p>
|
||
|
</div>
|
||
|
</div>
|
||
|
</template>
|
||
|
|
||
|
<style scoped>
|
||
|
.app-container {
|
||
|
display: flex;
|
||
|
flex-direction: column;
|
||
|
align-items: center;
|
||
|
padding: 20px;
|
||
|
min-height: 100vh;
|
||
|
}
|
||
|
|
||
|
.camera-name-list {
|
||
|
display: flex;
|
||
|
gap: 15px;
|
||
|
margin-bottom: 20px;
|
||
|
flex-wrap: wrap;
|
||
|
justify-content: center;
|
||
|
}
|
||
|
|
||
|
.camera-name {
|
||
|
padding: 8px 16px;
|
||
|
border: 1px solid #ccc;
|
||
|
border-radius: 20px;
|
||
|
cursor: pointer;
|
||
|
transition: all 0.3s ease;
|
||
|
background-color: white;
|
||
|
}
|
||
|
|
||
|
.camera-name:hover {
|
||
|
background-color: #e0e0e0;
|
||
|
transform: translateY(-2px);
|
||
|
}
|
||
|
|
||
|
.camera-name.active {
|
||
|
background-color: #2196F3;
|
||
|
color: white;
|
||
|
border-color: #2196F3;
|
||
|
}
|
||
|
|
||
|
.camera-display {
|
||
|
width: 80%;
|
||
|
max-width: 800px;
|
||
|
background-color: #fff;
|
||
|
padding: 20px;
|
||
|
border-radius: 8px;
|
||
|
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||
|
}
|
||
|
|
||
|
video {
|
||
|
width: 100%;
|
||
|
height: auto;
|
||
|
}
|
||
|
|
||
|
p {
|
||
|
text-align: center;
|
||
|
color: #666;
|
||
|
font-size: 18px;
|
||
|
}
|
||
|
</style>
|