From 310156b7244cd7b0c1b958f4267b5cf4e12bd90a Mon Sep 17 00:00:00 2001
From: ZhangXianQiang <1135831638@qq.com>
Date: 星期五, 08 三月 2024 17:15:45 +0800
Subject: [PATCH] fix:修改获取实例
---
src/views/daoAnOffice/right/publicize/index.vue | 132 ++++++++++++++++++++++++++++++++++++-------
1 files changed, 109 insertions(+), 23 deletions(-)
diff --git a/src/views/daoAnOffice/right/publicize/index.vue b/src/views/daoAnOffice/right/publicize/index.vue
index b2c56b4..4bce0c5 100644
--- a/src/views/daoAnOffice/right/publicize/index.vue
+++ b/src/views/daoAnOffice/right/publicize/index.vue
@@ -5,14 +5,15 @@
<RightTitle title="浜ら�氬浼�">
<template #top>
<div class="select-container flex">
- <div class="item whitespace-no-wrap cursor-pointer" v-for="item in selectItems" :key="item.itemIndex">
+ <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">
+ <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">
@@ -30,18 +31,37 @@
</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 lang="ts">
-import testImage from '@/assets/img/test_img/閬撳畨鍔�.png';
+<script setup>
+import { require } from '@/utils/require.js';
+
+import Test1 from '@/assets/img/test_img/t4.jpg';
+import Test2 from '@/assets/img/test_img/t5.jpg';
+import Test3 from '@/assets/img/test_img/t6.jpg';
+import Test4 from '@/assets/img/test_img/t7.jpg';
+
+import video1 from '@/assets/video/video1.mp4';
+import video2 from '@/assets/video/video2.mp4';
+
import RightTitle from "@/components/right-title";
import { ref } from 'vue';
-
+// 娴嬭瘯瑙嗛
+const testVideo = ref('');
+const isShowVideo = ref(false);
+const videoDom = ref(null);
const selectItems = ref([
- { itemIndex: 1, name: '浜ら�氬浼�', isActive: false },
- { itemIndex: 2, name: '浜ら�氫簨鏁�', isActive: true },
+ { itemIndex: 1, name: '浜ら�氬浼�', isActive: true },
+ { itemIndex: 2, name: '浜ら�氫簨鏁�', isActive: false },
]);
const contentList = ref([
@@ -49,39 +69,62 @@
itemIndex: 1,
time: '2023 12-12',
type: '閬撹矾闅愭偅',
- unit: '閮芥睙鍫板競鍏畨灞�',
+ unit: '鍏ㄥ浗浜ら�氬畨鍏ㄦ棩',
rectTime: '2023-13-23',
state: '鎶慨涓�',
- image: testImage
+ image: Test1,
+ video: video1
},
{
itemIndex: 2,
time: '2023 12-12',
type: '閬撹矾闅愭偅',
- unit: '閮芥睙鍫板競鍏畨灞�',
+ unit: '鍐浜ゅ畨瀹d紶蹇� 钀ラ�犳枃鏄庡嚭琛屽ソ姘涘洿',
rectTime: '2023-13-23',
state: '鎶慨涓�',
- image: testImage
+ image: Test2,
+ video: video2
},
{
itemIndex: 3,
time: '2023 12-12',
type: '閬撹矾闅愭偅',
- unit: '閮芥睙鍫板競鍏畨灞�',
+ unit: '楂橀�熶氦璀﹀己鍖栧浼犳彁绀� 纭繚鏄ヨ繍浜ら�氬畨鍏�',
rectTime: '2023-13-23',
state: '鎶慨涓�',
- image: testImage
+ image: Test3,
+ video: video1
},
{
itemIndex: 4,
time: '2023 12-12',
type: '閬撹矾闅愭偅',
- unit: '閮芥睙鍫板競鍏畨灞�',
+ unit: '浜戝摠璀︾ず椋庨櫓鑷籂',
rectTime: '2023-13-23',
state: '鎶慨涓�',
- image: testImage
+ image: Test4,
+ video: video2
},
]);
+
+const changeSelect = (selectItem) => {
+ selectItems.value.map(item => item.isActive = false);
+ selectItem.isActive = true;
+}
+
+const openVideo = (item) => {
+ isShowVideo.value = true;
+ testVideo.value = item.video;
+ setTimeout(() => {
+ videoDom.value.play();
+ },500);
+}
+
+const closeVideo = () => {
+ isShowVideo.value = false;
+ videoDom.value.pause();
+}
+
</script>
@@ -93,10 +136,16 @@
.item {
margin: 0 8px;
padding: 10px 14px;
- font-size: 12px;
+ font-size: 14px;
background: rgba(67, 102, 155, 0.4);
border: 1px solid rgba(47, 91, 157, 0.8);
flex-shrink: 0;
+ color: #5B83BD;
+ font-family: 'PingFang SC';
+}
+
+.select-active {
+ color: #fff;
}
.item:last-child {
@@ -105,27 +154,25 @@
.content-container {
width: 100%;
- height: 560px;
+ 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;
+ font-family: 'PingFang SC';
// margin-bottom: 24px;
}
-// .content-item:last-child {
-// margin-bottom: 0px;
-// }
.content-video-info {
width: 100%;
- height: 209px;
+ height: 180px;
position: relative;
}
@@ -139,15 +186,54 @@
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;
+ font-size: 14px;
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>
\ No newline at end of file
--
Gitblit v1.8.0