<!-- 交通宣传 -->
|
|
|
<template>
|
<RightTitle title="交通宣传">
|
<template #top>
|
<div class="select-container flex">
|
<div class="item whitespace-no-wrap cursor-pointer" :class="{ 'select-active': item.isActive }"
|
v-for="item in selectItems" :key="item.itemIndex" @click="changeSelect(item)">
|
{{ item.name }}
|
</div>
|
</div>
|
</template>
|
<template #content>
|
<div class="content-container flex flex-wrap justify-between content-between">
|
<div class="content-item" v-for="item in contentList" :key="item.itemIndex" @click="openVideo(item)">
|
<div class="content-wrapper">
|
<div class="content-video-info">
|
<img :src="item.image" class="video-cover">
|
<div class="video-icon">
|
<el-icon>
|
<VideoPlay />
|
</el-icon>
|
</div>
|
</div>
|
<div class="content-video-name">
|
{{ item.unit }}
|
</div>
|
</div>
|
</div>
|
</div>
|
</template>
|
</RightTitle>
|
|
<div class="video-container" v-show="isShowVideo">
|
<div class="video-wrapper">
|
<video :src="testVideo" ref="videoDom" class="video-player" controls></video>
|
<div class="close-btn flex justify-center items-center" @click="closeVideo">X</div>
|
</div>
|
</div>
|
</template>
|
|
<script setup>
|
import testImage from '@/assets/img/test_img/道安办.png';
|
|
import RightTitle from "@/components/right-title";
|
import { ref } from 'vue';
|
|
// 测试视频
|
const testVideo = 'https://www.w3schools.com/html/movie.mp4';
|
const isShowVideo = ref(false);
|
const videoDom = ref(null);
|
const selectItems = ref([
|
{ itemIndex: 1, name: '交通宣传', isActive: true },
|
{ itemIndex: 2, name: '交通事故', isActive: false },
|
]);
|
|
const contentList = ref([
|
{
|
itemIndex: 1,
|
time: '2023 12-12',
|
type: '道路隐患',
|
unit: '都江堰市公安局',
|
rectTime: '2023-13-23',
|
state: '抢修中',
|
image: testImage
|
},
|
{
|
itemIndex: 2,
|
time: '2023 12-12',
|
type: '道路隐患',
|
unit: '都江堰市公安局',
|
rectTime: '2023-13-23',
|
state: '抢修中',
|
image: testImage
|
},
|
{
|
itemIndex: 3,
|
time: '2023 12-12',
|
type: '道路隐患',
|
unit: '都江堰市公安局',
|
rectTime: '2023-13-23',
|
state: '抢修中',
|
image: testImage
|
},
|
{
|
itemIndex: 4,
|
time: '2023 12-12',
|
type: '道路隐患',
|
unit: '都江堰市公安局',
|
rectTime: '2023-13-23',
|
state: '抢修中',
|
image: testImage
|
},
|
]);
|
|
const changeSelect = (selectItem) => {
|
selectItems.value.map(item => item.isActive = false);
|
selectItem.isActive = true;
|
}
|
|
const openVideo = () => {
|
isShowVideo.value = true;
|
videoDom.value.play();
|
}
|
|
const closeVideo = () => {
|
isShowVideo.value = false;
|
videoDom.value.pause();
|
}
|
|
|
</script>
|
|
<style scoped lang="scss">
|
.select-container {
|
flex-shrink: 0;
|
}
|
|
.item {
|
margin: 0 8px;
|
padding: 10px 14px;
|
font-size: 12px;
|
background: rgba(67, 102, 155, 0.4);
|
border: 1px solid rgba(47, 91, 157, 0.8);
|
flex-shrink: 0;
|
color: #5B83BD;
|
}
|
|
.select-active {
|
color: #fff;
|
}
|
|
.item:last-child {
|
margin-right: 0;
|
}
|
|
.content-container {
|
width: 100%;
|
height: 510px;
|
overflow-y: hidden;
|
background-color: rgba(17, 34, 58, 0.6);
|
border: 1px solid rgba(47, 91, 157, 0.8);
|
padding: 22px 20px;
|
|
}
|
|
.content-item {
|
width: 279px;
|
flex-shrink: 0;
|
cursor: pointer;
|
// margin-bottom: 24px;
|
}
|
|
.content-video-info {
|
width: 100%;
|
height: 180px;
|
position: relative;
|
}
|
|
.video-icon {
|
width: 45px;
|
height: 45px;
|
position: absolute;
|
left: 50%;
|
top: 50%;
|
transform: translate(-50%, -50%);
|
font-size: 45px;
|
opacity: 0.7;
|
}
|
|
.video-cover {
|
width: 100%;
|
height: 100%;
|
object-fit: fill;
|
}
|
|
.content-video-name {
|
text-align: center;
|
margin-top: 16px;
|
font-size: 12px;
|
color: rgba(91, 131, 189, 1);
|
}
|
|
.video-container {
|
position: fixed;
|
z-index: 99999;
|
width: 100%;
|
height: 100%;
|
top: 0;
|
left: 0;
|
|
.video-wrapper {
|
position: absolute;
|
width: 70%;
|
height: 80%;
|
left: 50%;
|
top: 50%;
|
transform: translate(-50%, -50%);
|
background-color: rgba(0, 0, 0, 0.9);
|
|
}
|
|
.video-player {
|
width: 100%;
|
height: 100%;
|
}
|
}
|
|
.close-btn {
|
position: absolute;
|
right: -80px;
|
top: -10px;
|
width: 40px;
|
height: 40px;
|
border: 2px solid #fff;
|
border-radius: 50%;
|
font-size: 18px;
|
cursor: pointer;
|
}
|
</style>
|