dbsd_kczx/src/views/site/common/video/videojs/viewPage.vue

274 lines
8.1 KiB
Vue
Raw Normal View History

2023-04-24 22:40:50 +08:00
<template>
2023-05-05 23:52:51 +08:00
<div id="siteMain">
<div id="maxSite">
<a-layout>
<!-- 页头 -->
<headerPage/>
<!-- 主体部分 -->
<a-layout-content>
<div style="width:100%;height: 100%;margin-top: 1rem;" v-if="!isError">
<a-row :gutter="[16,16]">
<a-col :span="19">
<div>
<a-card class="videoCardMain" style="width:100%">
<template #title>
2023-05-06 00:00:19 +08:00
<span class="" style="background: #23c6c8;color:#fff; padding: 0.3rem;border-radius: 5px;">
2023-05-05 23:52:51 +08:00
{{ kcCardBoxTitle || ' ' }}
</span>
2023-05-06 00:00:19 +08:00
<span style="margin-left: 10px;background: #1c84c6;color: #fff;padding: 0.3rem;border-radius: 5px;" @click="() => tingKeZuJiAddModal.view({ ketangbiaoid: route.query.ktId })">填写评价表</span>
2023-05-05 23:52:51 +08:00
</template>
<div style="padding: 1rem;">
<div >{{ mainVideoCardBoxTitle || '' }}</div>
<bVideo ref="mainVideo" videoId="mainVideo" :videoOption="{ autoplay: true }"/>
<div style="width: 100%;">
2023-05-06 00:00:19 +08:00
<a-textarea style="width: calc(100% - 7rem);height:120px;" v-model:value="model.notes" placeholder="您可以填写听课笔记"></a-textarea>
2023-05-05 23:52:51 +08:00
<a-button type="primary" style="width: 7rem;height: 100%;" @click="saveSuibi">保存听课笔记</a-button>
</div>
</div>
</a-card>
</div>
</a-col>
<a-col :span="5">
<a-row>
2023-05-07 11:37:41 +08:00
<a-col :span="24" v-for="(item,index) of tableData" style="text-align: center;" :key="'col-'+index">
2023-05-05 23:52:51 +08:00
<a-card>
<div>
<div style="margin-bottom: .5rem;">
<span class="smallTxt miniButton" :class="item.id == curentPlayerVideo.id?'activte':''" @click="changeLive(item)">
<i class="fa-solid fa-right-left"></i>{{ item?.xm }}
</span>
<span class="smallTxt miniButton miniButtonRight" v-show="!item.isShow" @click="(item.isShow = true,initVideo('other-'+item.id))"><i class="fa-solid fa-film"></i>显示缩略窗口</span>
2023-05-06 00:00:19 +08:00
<span class="smallTxt miniButton miniButtonRight" v-show="item.isShow" @click="item.isShow = false"><i class="fa-solid fa-film"></i>隐藏缩略窗口</span>
2023-05-05 23:52:51 +08:00
</div>
<div style="height: 2rem;">&nbsp;</div>
<div v-show="item.isShow" :key="'other-div-'+index">
<bVideo :key="'other-'+index" :ref="el=> bVideoRefs['other-'+item.id] = el" :videoId="'other-'+item.id" :src="item.pullUrl" :videoOption="{ autoplay: true, controls: false }" @load-end="loadEnd"/>
</div>
</div>
</a-card>
</a-col>
</a-row>
</a-col>
</a-row>
2023-04-24 22:40:50 +08:00
</div>
2023-05-05 23:52:51 +08:00
<div v-else style="height: 100%;display: flex;justify-content: center;align-items: center;">
<a-empty>
<template #description>
<span>
没有找到直播间
</span>
</template>
<!-- <a-button type="primary" @="">关闭</a-button> -->
</a-empty>
</div>
</a-layout-content>
</a-layout>
</div>
2023-04-24 22:40:50 +08:00
</div>
2023-05-04 23:50:32 +08:00
<addModalPage ref="tingKeZuJiAddModal"/>
2023-04-24 22:40:50 +08:00
</template>
<script lang="ts" setup name="zhihuijiaoshiIndexPage">
2023-05-04 23:50:32 +08:00
2023-04-24 22:40:50 +08:00
import { defHttp } from '/@/utils/http/axios';
2023-05-04 23:50:32 +08:00
import { ref, reactive, onMounted } from 'vue';
2023-05-05 23:52:51 +08:00
import headerPage from '/@/views/site/common/header.vue';
2023-04-24 22:40:50 +08:00
import bVideo from '/@/views/site/common/video/videojs/video.vue';
2023-05-04 23:50:32 +08:00
import addModalPage from '/@/views/site/tingKeZuJi/components/addModal.vue';
2023-04-24 22:40:50 +08:00
import { nextTick } from 'vue';
import { useRoute } from 'vue-router'
2023-05-04 23:50:32 +08:00
import { getUserId } from '/@/views/site/utils/index';
2023-04-24 22:40:50 +08:00
2023-05-07 11:37:41 +08:00
const mainVideo = ref<any>();
const bVideoRefs = ref<any>([]);
2023-04-24 22:40:50 +08:00
2023-05-07 11:37:41 +08:00
const tingKeZuJiAddModal = ref<any>({});
const curentPlayerVideo = ref<any>({});
const kcCardBoxTitle = ref<any>('');
const mainVideoCardBoxTitle = ref<any>('');
2023-04-24 22:40:50 +08:00
const tableData = ref<Recordable>([])
const isError = ref(false);
2023-05-04 23:50:32 +08:00
const model = reactive<Record<string, any>>({ notes:'' });
2023-04-24 22:40:50 +08:00
const route = useRoute();
2023-05-04 23:50:32 +08:00
enum Api {
list = '/jiaoshi/kcZhihuijiaoshi/list',
querySuibi = '/kc/kcKetangSuibi/list',
2023-05-05 23:52:51 +08:00
addSuibi = '/kc/kcKetangSuibi/add',
2023-05-04 23:50:32 +08:00
// editSuibi = '/kc/kcKetangSuibi/edit'
2023-05-05 23:52:51 +08:00
getKtangInfo = '/ktgl/kcKetangbiao/queryById'
2023-05-04 23:50:32 +08:00
}
/**
* 列表接口
* @param params
*/
const list = (params) => defHttp.get({ url: Api.list, params });
const querySuibi = (params) => defHttp.get({ url: Api.querySuibi, params });
const addSuibi = (params) => defHttp.post({ url: Api.addSuibi, params });
2023-05-05 23:52:51 +08:00
const getKtangInfo = (params) => defHttp.get({ url: Api.getKtangInfo, params });
2023-05-04 23:50:32 +08:00
// const editSuibi = (params) => defHttp.post({ url: Api.editSuibi, params });
2023-04-24 22:40:50 +08:00
onMounted(() => {
if(route.query.id){
2023-05-04 23:50:32 +08:00
model.notes = '';
2023-05-07 11:37:41 +08:00
//按教师编号加载数据,屏蔽掉无效的,不分页
2023-04-24 22:40:50 +08:00
list({ pageSize: -1, sfyx: '0', jsbh: route.query.id }).then(res => {
let list = (res?.records) ?? [];
tableData.value = list;
2023-05-05 23:52:51 +08:00
tableData.value.forEach(x => x.isShow = true);//默认展开
2023-04-24 22:40:50 +08:00
nextTick(() => {
2023-05-04 23:50:32 +08:00
changeLive(tableData.value[0]);
2023-05-05 23:52:51 +08:00
tableData.value.forEach(x => x.isShow = false);//关闭
2023-04-24 22:40:50 +08:00
})
});
2023-05-04 23:50:32 +08:00
getSuibi();
2023-05-05 23:52:51 +08:00
getKcxx();
2023-04-24 22:40:50 +08:00
}else{
isError.value = true;
}
});
2023-05-05 23:52:51 +08:00
/**
* 子页加载完成后回调
* @param player
*/
function loadEnd(player){
nextTick(() => {
player.on('play',() => {
setTimeout(() => {
player.pause();
},1000);
})
})
}
function initVideo(key){
nextTick(() => {
let ref = bVideoRefs.value[key];
ref.init();
})
}
2023-05-04 23:50:32 +08:00
function changeLive(item:any){
2023-05-07 11:37:41 +08:00
let mainVideo = document.querySelector<any>('#mainVideo');
2023-05-04 23:50:32 +08:00
mainVideo?.player?.src([{ type:'application/x-mpegURL',src: item.pullUrl }])
2023-05-05 23:52:51 +08:00
mainVideoCardBoxTitle.value = item.jsmc+item.xm;
curentPlayerVideo.value = item;
2023-04-24 22:40:50 +08:00
}
2023-05-04 23:50:32 +08:00
function getSuibi(){
2023-05-05 23:52:51 +08:00
//查询随笔
2023-05-04 23:50:32 +08:00
let param = {
userId: getUserId(),
ketangbiaoId: route.query.ktId,
column: 'createTime',
order: 'desc',
};
querySuibi(param).then(res => {
Object.assign(model, (res.records??[{}])[0]);
// model = (res.records??[{}])[0];
2023-04-24 22:40:50 +08:00
});
}
2023-05-05 23:52:51 +08:00
function getKcxx(){
//查询课程信息
//route.query.ktId
let param = {
id: route.query.ktId
}
getKtangInfo(param).then(res => {
// console.log(res);
kcCardBoxTitle.value = res.kcmc;
});
}
2023-05-04 23:50:32 +08:00
function saveSuibi(){
//addSuibi editSuibi
// if(model.value.id){
// editSuibi({...model.value, })
// }else{
addSuibi({ notes: model.notes, userId: getUserId(), ketangbiaoId: route.query.ktId })
// }
2023-04-24 22:40:50 +08:00
}
</script>
<style lang="less" scoped>
2023-05-05 23:52:51 +08:00
#siteMain {
// font-size: ;
height: 100%;
background: #f3f3f4;
#maxSite {
//最大宽度
max-width: 1170px;
//居中
margin: 0 auto;
.rowGutter{
margin-top: 1rem;
margin-bottom: 1rem;
}
.ant-layout-header {
color: #fff;
background: #1ab394;
}
.ant-layout-footer {
line-height: 1.5;
background: #FFF;
}
.ant-layout-sider {
color: #fff;
line-height: 120px;
background: #3ba0e9;
}
.ant-layout-content {
min-height: 120px;
color: #000;
/*line-height: 120px;*/
background: #f3f3f4;
}
}
}
/**暗黑模式特殊配色*/
[data-theme='dark'] #siteMain #maxSite {
.ant-layout-header, .ant-layout-footer {
background: #6aa0c7;
}
.ant-layout-content {
background: #107bcb;
}
.ant-layout-sider {
background: #3499ec;
}
}
2023-04-24 22:40:50 +08:00
.videoMax{
width: 25%;
}
.videoCardMain {
:deep(.ant-card-body) {
padding: 0;
}
}
/* 隐藏video 进度条 */
video::-webkit-media-controls-timeline {
display: none;
}
2023-05-05 23:52:51 +08:00
.smallTxt {
font-size: .8rem;
}
.activte {
background: #1ab394;
color: #FFF;
}
.miniButton {
float: left;
padding: 0.3rem;
border-radius: 5px;
}
.miniButtonRight {
float: right
2023-05-04 23:50:32 +08:00
}
2023-04-24 22:40:50 +08:00
</style>