169 lines
4.7 KiB
Plaintext
169 lines
4.7 KiB
Plaintext
<template>
|
|
<div style="width:100%;height: 100%;">
|
|
<a-row>
|
|
<a-col :span="3">
|
|
<a-menu
|
|
v-model:openKeys="openKeys"
|
|
v-model:selectedKeys="selectedKeys"
|
|
style="overflow: hidden;overflow-y:scroll"
|
|
:style="{ height: `calc(100vh - ${topWidth})`, borderRight: 0 }"
|
|
mode="inline"
|
|
>
|
|
<a-menu-item v-for="(item, index) of leftList" :key="index" @click="(e) => titleClick(e,item)" :title="`${item.jsmc}`">
|
|
{{ item.jsmc }}
|
|
</a-menu-item>
|
|
</a-menu>
|
|
</a-col>
|
|
<a-col :span="21">
|
|
<div>
|
|
<a-card :title="mainVideoCardBoxTitle" class="videoCardMain" style="width:100%">
|
|
<bVideo ref="mainVideo" videoId="mainVideo" :videoOption="{ autoplay: true }"/>
|
|
</a-card>
|
|
</div>
|
|
<div style="display: flex;flex-direction: row;flex-wrap: nowrap;overflow-x: scroll;">
|
|
<div v-for="(item,index) of calcOtherVideo()" class="videoMax" :key="index">
|
|
<a-card class="videoCardMain">
|
|
<template #title>
|
|
<span>{{ item?.xm }}</span>
|
|
<span style="padding-left: 1rem;" @click="execAvyApi(getAvyCtrlLiveOpenOrCloseUrl(item.ip,item.user,item.mima,true))">打开直播</span>
|
|
<span style="padding-left: 1rem;" @click="execAvyApi(getAvyCtrlLiveOpenOrCloseUrl(item.ip,item.user,item.mima,false))">关闭直播</span>
|
|
</template>
|
|
<bVideo :ref="el=> bVideoRefs[index]=el" :videoId="'other-'+item.id" :src="item.pullUrl" :videoOption="{ autoplay: true, userActions: { click: bVideoClick } }" @load-end="loadEnd"/>
|
|
</a-card>
|
|
</div>
|
|
</div>
|
|
</a-col>
|
|
</a-row>
|
|
</div>
|
|
</template>
|
|
<script lang="ts" setup name="zhihuijiaoshiIndexPage">
|
|
import { defHttp } from '/@/utils/http/axios';
|
|
import { ref, onMounted } from 'vue';
|
|
import bVideo from '/@/views/site/common/video/videojs/video.vue';
|
|
import { nextTick } from 'vue';
|
|
import { execAvyApi, getAvyCtrlLiveOpenOrCloseUrl } from "/@/views/site/utils/index";
|
|
|
|
const bVideoRefs:any = ref([]);
|
|
const mainVideo:any = ref();
|
|
const _document:any = window.document;
|
|
// const bVideoLeftRef = ref();
|
|
|
|
const leftList:any = ref([]);
|
|
const currentItem:any = ref({});
|
|
const topWidth:any = ref('0');
|
|
const isfirst:any = ref(false);
|
|
const mainVideoCardBoxTitle:any = ref('');
|
|
|
|
|
|
onMounted(() => {
|
|
list({ pageSize: -1, sfyx: '0' }).then(res => {
|
|
let list = (res?.records) ?? [];
|
|
//聚合
|
|
let map = {};
|
|
list.forEach(x => {
|
|
let item = map[x.jsmc];
|
|
if(item){
|
|
item.child[x.xm] = x;
|
|
}else{
|
|
let child = {};
|
|
child[x.xm] = x;
|
|
map[x.jsmc] = {
|
|
...x,
|
|
child
|
|
};
|
|
}
|
|
});
|
|
|
|
leftList.value = Object.values(map);
|
|
//计算左侧菜单高度
|
|
let mainDiv:any = _document?.querySelector('.ant-layout .jeecg-default-layout-main > div');
|
|
topWidth.value =mainDiv?.style?.height?? '0';
|
|
});
|
|
});
|
|
|
|
enum Api {
|
|
list = '/jiaoshi/kcZhihuijiaoshi/list',
|
|
}
|
|
/**
|
|
* 列表接口
|
|
* @param params
|
|
*/
|
|
const list = (params) => defHttp.get({ url: Api.list, params });
|
|
|
|
|
|
const selectedKeys = ref<string[]>(['1']);
|
|
const openKeys = ref<string[]>(['sub1']);
|
|
|
|
/**
|
|
* 点击左侧菜单回调
|
|
* @param e
|
|
* @param item
|
|
*/
|
|
const titleClick = (e: Event, item: any) => {
|
|
//初始化数据
|
|
isfirst.value = false;
|
|
currentItem.value = {};
|
|
//等一会,清空上一次的对象,
|
|
nextTick(() => {
|
|
currentItem.value = item;
|
|
});
|
|
};
|
|
|
|
/**
|
|
* 子页加载完成后回调
|
|
* @param player
|
|
*/
|
|
function loadEnd(player){
|
|
nextTick(() => {
|
|
if(!isfirst.value){
|
|
isfirst.value = true;
|
|
//播放第一个
|
|
let one:any = Object.values(calcOtherVideo())[0];
|
|
bVideoClick({ target: { playerId: 'other-'+ one.id} })
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
/**
|
|
* 拆分对象(过滤器)
|
|
*/
|
|
function calcOtherVideo() :any{
|
|
if(!currentItem.value.child) return {};
|
|
let map = {};
|
|
Object.keys(currentItem.value.child).forEach(key => {
|
|
// if(key != '录播主机' && key.indexOf('音频处理器') ==-1){
|
|
map[key] = currentItem.value.child[key];
|
|
// }
|
|
});
|
|
return map;
|
|
}
|
|
|
|
/**
|
|
* 点击时切换至大屏
|
|
* @param e
|
|
*/
|
|
function bVideoClick(e:any){
|
|
console.log(`bVideoClick: 点击切换至主界面`);
|
|
|
|
let mainVideo:any = document.querySelector('#mainVideo');
|
|
let currentVideo:any = document.querySelector('#'+e.target.playerId);
|
|
let src = currentVideo.player?.src();
|
|
|
|
mainVideo?.player?.src([{type:'application/x-mpegURL',src }])
|
|
}
|
|
|
|
</script>
|
|
<style lang="less" scoped>
|
|
.videoMax{
|
|
width: 25%;
|
|
}
|
|
.videoCardMain {
|
|
:deep(.ant-card-body) {
|
|
padding: 0;
|
|
}
|
|
}
|
|
/* 隐藏video 进度条 */
|
|
video::-webkit-media-controls-timeline {
|
|
display: none;
|
|
} |