From 12c72e520e0ff9d738b9dac5ce84a4821a75e6e3 Mon Sep 17 00:00:00 2001
From: web <candymxq888@outlook.com>
Date: 星期一, 21 四月 2025 17:29:55 +0800
Subject: [PATCH] feat:添加视频弹窗

---
 src/views/screen/flow/graphic/components/FullScreenVideo.vue |  103 ++++++++++++++++++++++++++++++++++
 src/assets/images/flow/screenIconWhite.png                   |    0 
 src/views/screen/flow/graphic/index.vue                      |   69 ++++++++++++----------
 src/views/screen/temperature/statics/index.vue               |    2 
 src/views/screen/temperature/graphic/index.vue               |    2 
 5 files changed, 143 insertions(+), 33 deletions(-)

diff --git a/src/assets/images/flow/screenIconWhite.png b/src/assets/images/flow/screenIconWhite.png
new file mode 100644
index 0000000..3691a45
--- /dev/null
+++ b/src/assets/images/flow/screenIconWhite.png
Binary files differ
diff --git a/src/views/screen/flow/graphic/components/FullScreenVideo.vue b/src/views/screen/flow/graphic/components/FullScreenVideo.vue
new file mode 100644
index 0000000..c188ecf
--- /dev/null
+++ b/src/views/screen/flow/graphic/components/FullScreenVideo.vue
@@ -0,0 +1,103 @@
+<script setup>
+import EZUIKit from 'ezuikit-js';
+
+const props = defineProps({
+    data: {
+        type: Object,
+        default: {},
+    }
+})
+
+const emit = defineEmits(['close'])
+
+let ezKitEl = ''
+let ezKitId = 'ezid'
+
+const closeScreen = () => {
+    ezKitEl.stop(); //停止播放视频
+    emit('close')
+}
+
+onMounted(() => {
+    ezKitEl = new EZUIKit.EZUIKitPlayer({
+        id: ezKitId,
+        url: props.data.url,
+        accessToken: props.data.accessToken,
+    })
+})
+
+</script>
+
+<template>
+    <div class="modal">
+        <div class="vb" :id="ezKitId"></div>
+        <div class="close" @click="closeScreen"><el-icon><CircleClose /></el-icon></div>
+        <div class="mask">
+            <div class="list">
+                <div class="item">
+                    <div class="name">水位:</div>
+                    <div class="val"><span>{{props.data.waterLevel}}</span>m</div>
+                </div>
+                <div class="item">
+                    <div class="name">流速:</div>
+                    <div class="val"><span>{{props.data.flowVelocity}}</span>m/s</div>
+                </div>
+                <div class="item">
+                    <div class="name">瞬时流量:</div>
+                    <div class="val"><span>{{props.data.newFlow}}</span>m³/h</div>
+                </div>
+                <div class="item">
+                    <div class="name">累计流量:</div>
+                    <div class="val"><span>{{props.data.totalFlow}}</span>m³</div>
+                </div>
+            </div>
+        </div>
+    </div>
+</template>
+
+<style scoped lang="scss">
+.modal{
+    position: absolute;
+    left: 2%;
+    top: 2%;
+    width: 96%;
+    height: 96%;
+    background-color: rgba(0, 0, 0, 0.5);
+    z-index: 100;
+    .vb{
+        position: absolute;
+        width: 100%;
+        height: 100%;
+        top: 0;
+        left: 0;
+    }
+    .close{
+        position: absolute;
+        right: 1%;
+        top: 1%;
+        font-size: 2rem;
+        color: #fff;
+    }
+    .mask{
+        position: absolute;
+        left: 5%;
+        bottom: 5%;
+        width: 15%;
+        background-color: rgba(0, 0, 0, 0.5);
+        color: #fff;
+        padding: 1rem;
+        border-radius: 1rem;
+        .item{
+            display: flex;
+            align-items: center;
+            padding: 0.5rem 0;
+            .name{
+                width: 50%;
+            }
+            span{
+                margin-right: 0.8rem;
+            }
+        }
+    }
+}
+</style>
\ No newline at end of file
diff --git a/src/views/screen/flow/graphic/index.vue b/src/views/screen/flow/graphic/index.vue
index 47b28aa..2c48386 100644
--- a/src/views/screen/flow/graphic/index.vue
+++ b/src/views/screen/flow/graphic/index.vue
@@ -5,6 +5,7 @@
 import {getFlowVideoData} from '@/api/screen/graphic/index.js'
 import EZUIKit from 'ezuikit-js';
 import {useRoute} from "vue-router";
+import FullScreenVideo from "./components/FullScreenVideo.vue";
 
 const route = useRoute();
 
@@ -13,24 +14,21 @@
 const searchVal = ref('')
 const playerData = ref([])
 const hasFullScreen = ref(false)
+const fullIndex = ref()
 let ezKitList = []; //视频组件实例数组
 let ezKitId = []; //视频盒子id数组
 let timer = null;
 
-// 全屏操作
-const handleFullScreen = () => {
-    const dom = document.getElementById(ezKitId[0])
-    dom.requestFullscreen()
+// 全屏弹窗
+const handleFullScreen = (index) => {
+    fullIndex.value = index;
+    hasFullScreen.value = true;
 }
 
-// 监听全屏状态,是否要开起蒙层
-document.addEventListener('fullscreenchange', (val) => {
-    if (!document.fullscreenElement) {  //退出全屏
-        hasFullScreen.value = false;
-    } else { //开起全屏
-        hasFullScreen.value = true;
-    }
-});
+// 关闭全屏弹窗
+const closeFullScreen = () => {
+    hasFullScreen.value = false;
+}
 
 // 抓拍
 const handleSnap = (index) => {
@@ -99,6 +97,10 @@
     if (timer) {
         clearInterval(timer)
     }
+    // 停止播放
+    ezKitList?.forEach(item => {
+        item.stop();
+    })
 })
 </script>
 
@@ -141,10 +143,6 @@
                         新增
                     </el-button>
                 </div>
-                <div class="tool-r" @click="handleFullScreen">
-                    <img src="@/assets/images/flow/fullscreen.png"/>
-                    全屏
-                </div>
             </div>
             <div class="monitor-box">
                 <div class="monitor-list">
@@ -171,6 +169,10 @@
                                 </div>
                             </div>
                             <div class="info-btn">
+                                <div class="fullScreen" @click="handleFullScreen(index)">
+                                    <img src="@/assets/images/flow/screenIconWhite.png" alt="" />
+                                    全屏
+                                </div>
                                 <el-button style="width: 6rem" @click="handleSnap(index)">抓拍</el-button>
                             </div>
                         </div>
@@ -178,9 +180,11 @@
                 </div>
             </div>
         </div>
-        <div class="mask" v-show="hasFullScreen">
-            <div class="mask-item"></div>
-        </div>
+        <FullScreenVideo
+            v-if="hasFullScreen"
+            :data="playerData[fullIndex]"
+            @close="closeFullScreen"
+        />
     </div>
 </template>
 
@@ -252,16 +256,6 @@
                     font-size: 1.1rem;
                 }
             }
-
-            .tool-r {
-                display: flex;
-                align-items: center;
-
-                img {
-                    width: 25px;
-                    margin-right: 10px;
-                }
-            }
         }
 
         .monitor-box {
@@ -328,17 +322,30 @@
                         }
 
                         .info-btn {
-                            width: 20%;
+                            width: 15%;
                             padding: 1rem 0;
                             display: flex;
                             align-items: flex-end;
-
+                            flex-direction: column;
+                            justify-content: space-between;
                             :deep(.el-button) {
                                 color: #fff;
                                 background: rgba(94, 229, 92, 0.6);
                                 border-radius: 4px 4px 4px 4px;
                                 border: 1px solid rgba(94, 229, 92, 0.6);
                             }
+                            .fullScreen{
+                                width: 100%;
+                                height: 50px;
+                                display: flex;
+                                align-items: center;
+                                justify-content: center;
+                                color: #fff;
+                                img{
+                                    width: 25px;
+                                    margin-right: 10px;
+                                }
+                            }
                         }
                     }
                 }
diff --git a/src/views/screen/temperature/graphic/index.vue b/src/views/screen/temperature/graphic/index.vue
index 235ce02..edeeaef 100644
--- a/src/views/screen/temperature/graphic/index.vue
+++ b/src/views/screen/temperature/graphic/index.vue
@@ -270,7 +270,7 @@
         <div class="graphic-info">
             <div class="graphic-tool">
                 <div class="tool-l">
-                    <div class="name">类型</div>
+                    <div class="name">时间类型</div>
                     <el-button-group class="ml-4">
                         <el-button :type="timeType === 1 ? 'primary' : ''" @click="changeType(1)">日
                         </el-button>
diff --git a/src/views/screen/temperature/statics/index.vue b/src/views/screen/temperature/statics/index.vue
index e2a2350..6628720 100644
--- a/src/views/screen/temperature/statics/index.vue
+++ b/src/views/screen/temperature/statics/index.vue
@@ -308,7 +308,7 @@
                     placeholder="请选择时间"
                     @change="(value) => getTime(value, warn.type, 'warn')"
                 />
-                <div>电站平均水位汇总</div>
+                <div>电站报警次数汇总</div>
             </div>
         </div>
     </div>

--
Gitblit v1.9.3