web
5 天以前 01b9e7244825cac11146e3961cafa6525dad56f1
src/views/screen/flow/graphic/index.vue
@@ -4,37 +4,36 @@
import {getFlowPointList} from '@/api/screen/index'
import {getFlowVideoData} from '@/api/screen/graphic/index.js'
import EZUIKit from 'ezuikit-js';
import {useRoute} from "vue-router";
import {useRoute, useRouter} from "vue-router";
import FullScreenVideo from "./components/FullScreenVideo.vue";
const route = useRoute();
const router = useRouter();
const menuList = ref([])
const userType = ref(getUserType())
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) => {
    ezKitList[index].capturePicture(`capture-${new Date().getTime()}`, 0.8); // 参数:回调函数,图片格式,质量(0-1)
    ezKitList[index].capturePicture(`capture-${new Date().getTime()}`, 0.8);
}
// 获取监控点菜单
@@ -99,6 +98,10 @@
    if (timer) {
        clearInterval(timer)
    }
    // 停止播放
    ezKitList?.forEach(item => {
        item.stop();
    })
})
</script>
@@ -134,16 +137,12 @@
                        </el-icon>
                        搜索
                    </el-button>
                    <el-button style="margin-left: 0" v-if="userType === '1'">
                    <el-button style="margin-left: 0" v-if="userType === '1'" @click="router.push('/monitorList')">
                        <el-icon>
                            <Plus/>
                        </el-icon>
                        新增
                    </el-button>
                </div>
                <div class="tool-r" @click="handleFullScreen">
                    <img src="@/assets/images/flow/fullscreen.png"/>
                    全屏
                </div>
            </div>
            <div class="monitor-box">
@@ -169,8 +168,20 @@
                                    <div class="name">累计流量:</div>
                                    <div class="val"><span>{{ item.totalFlow }}</span>m³</div>
                                </div>
                                <div class="info-item">
                                    <div class="name">水面宽度:</div>
                                    <div class="val"><span>{{ item.waterWidth }}</span>m</div>
                                </div>
                                <div class="info-item">
                                    <div class="name">过水面积:</div>
                                    <div class="val"><span>{{ item.waterArea }}</span>m³</div>
                                </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 +189,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 +265,6 @@
                    font-size: 1.1rem;
                }
            }
            .tool-r {
                display: flex;
                align-items: center;
                img {
                    width: 25px;
                    margin-right: 10px;
                }
            }
        }
        .monitor-box {
@@ -320,46 +323,49 @@
                                    width: 100px;
                                }
                                .val span {
                                    display: inline-block;
                                    padding: 0 20px;
                                .val{
                                    display: flex;
                                    align-items: center;
                                    span {
                                        display: inline-block;
                                        width: 6rem;
                                        overflow: hidden;
                                        text-overflow: ellipsis;
                                        white-space: nowrap;
                                    }
                                }
                            }
                        }
                        .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;
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    .mask{
        position: absolute;
        left: 0;
        top: 0;
        z-index: 100;
        width: 100vw;
        height: 100vh;
        .mask-item{
            position: absolute;
            left: 5%;
            bottom: 10%;
            height: 400px;
            width: 300px;
            background-color: rgba(0, 0, 0, 0.4);
        }
    }
}