longyvfengyun
2024-03-25 4b6b56fc1cbd9f6be12a5bc439e496f29c4b51a1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<script setup>
import FlexBox from "@/components/FlexBox.vue";
import ChartBox from "@/components/chartBox.vue";
import {onMounted, ref} from "vue";
import AbsPosLayout from "@/components/absPosLayout.vue";
import VideoItemIcon from "@/components/videoItemIcon.vue";
import videoContent from "@/assets/images/video-content.jpeg";
const num = ref([]);
const imgSrc = ref("http://192.168.1.109:8080/?action=stream");
 
const changeVideoState = (data)=>{
    num.value.forEach(item=>{
        item.active = false;
    });
    data.active = true;
}
onMounted(()=>{
    for(let i=0; i<10; i++) {
        num.value.push({
            active: false,
            state: 0,
            label: "摄像头"+i,
            key: 'key'+i
        })
    }
 
    num.value[0].active = true;
    num.value[1].state = 1;
    num.value[2].state = 2;
});
</script>
 
<template>
    <div class="video-show-wrapper">
        <div class="video-show-layout">
            <div class="video-show-header">
                <flex-box>
                    <div class="flex-box-content">
                        <chart-box title="实时监控列表">
                            <abs-pos-layout>
                                <div class="video-list-container">
                                    <div
                                        class="video-item"
                                        v-for="item in num" :key="item.key"
                                        :class="{'active': item.active}" @click="changeVideoState(item)">
                                        <video-item-icon :state="item.state"></video-item-icon>
                                        <div class="video-item-content">{{item.label}}</div>
                                    </div>
                                </div>
                            </abs-pos-layout>
                            <template #footer>
                                    <div class="video-desc">
                                        <div class="video-desc-item">
                                            <span class="video-desc-txt">正常:</span><video-item-icon :state="0"></video-item-icon>
                                        </div>
                                        <div class="video-desc-item">
                                            <span class="video-desc-txt">告警:</span><video-item-icon :state="1"></video-item-icon>
                                        </div>
                                        <div class="video-desc-item">
                                            <span class="video-desc-txt">异常:</span><video-item-icon :state="2"></video-item-icon>
                                        </div>
                                    </div>
                            </template>
                        </chart-box>
                    </div>
                </flex-box>
            </div>
            <div class="video-show-body">
                <flex-box>
                    <abs-pos-layout>
                        <div class="img-container">
                            <img :src="imgSrc" alt="" />
                        </div>
                    </abs-pos-layout>
                </flex-box>
            </div>
        </div>
    </div>
</template>
 
<style scoped lang="less">
.video-show-wrapper {
    height: 100%;
    background: url("@/assets/images/dw_bg.jpg") no-repeat;
    background-size: 100% 100%;
}
.video-show-layout {
    display: flex;
    height: 100%;
    .video-show-header {
        width: 20rem;
        padding: 8px 4px 8px 8px;
    }
    .video-show-body {
        flex: 1;
        padding: 8px 8px 8px 4px;
    }
}
.flex-box-content {
    height: 100%;
    padding: 8px 0 8px 8px;
}
.video-list-container {
    user-select: none;
    .video-item {
        color: #FFFFFF;
        padding: 4px;
        margin-top: 8px;
        margin-right: 8px;
        background: linear-gradient(to bottom, #0363f1, #0464f6, #0363f1);
        .video-item-content {
            display: inline-block;
            font-size: 14px;
            vertical-align: middle;
        }
        &.active {
            background: linear-gradient(to bottom, #0363f1, #154a9b, #0363f1);
            &:hover {
                background: linear-gradient(to bottom, #0363f1, #154a9b, #0363f1);
            }
        }
        &:hover {
            background: #0d62ce;
            cursor: pointer;
        }
    }
}
.video-desc {
    text-align: center;
    color: #FFFFFF;
    .video-desc-item {
        display: inline-block;
        padding: 0 8px;
        .video-desc-txt {
            font-size: 14px;
        }
    }
}
.img-container {
    height: 100%;
    img {
        width: 100%;
        height: 100%;
    }
}
</style>