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

154 lines
4.8 KiB
Vue
Raw Normal View History

2023-04-24 22:40:50 +08:00
<template>
2023-05-04 23:50:32 +08:00
<div class="maxSite" style="width:100%;height: 100%;margin-top: 1rem;" v-if="!isError">
<a-row :gutter="[16,16]">
<a-col :span="22">
2023-04-24 22:40:50 +08:00
<div>
<a-card :title="mainVideoCardBoxTitle" class="videoCardMain" style="width:100%">
<bVideo ref="mainVideo" videoId="mainVideo" :videoOption="{ autoplay: true }"/>
</a-card>
</div>
2023-05-04 23:50:32 +08:00
<!-- <div style="display: flex;flex-direction: row;flex-wrap: nowrap;overflow-x: scroll;"> -->
<!-- <div v-for="(item,index) of tableData" class="videoMax"> -->
<!-- <a-card :title="item?.xm" class="videoCardMain"> -->
<!-- <bVideo :ref="el=> bVideoRefs[index]=el" :videoId="'other-'+item.id" :src="item.pullUrl" :videoOption="{ autoplay: true, userActions: { click: bVideoClick } }" @load-end="loadEnd"/> -->
2023-04-24 22:40:50 +08:00
<!-- <bVideo :ref="el=> bVideoRefs[index]=el" :videoId="'other-'+index" :src="'http://127.0.0.1/live_hls/soures.m3u8'" :videoOption="{ autoplay: true, userActions: { click: bVideoClick } }" @load-end="loadEnd"/> -->
2023-05-04 23:50:32 +08:00
<!-- </a-card>
2023-04-24 22:40:50 +08:00
</div>
2023-05-04 23:50:32 +08:00
</div> -->
</a-col>
<a-col :span="2">
<a-row>
<a-col :span="24">
<a-button type="primary" style="width: 100%;margin-bottom: 0.5rem;" @click="() => tingKeZuJiAddModal.view({ ketangbiaoid: route.query.ktId })">评价</a-button>
</a-col>
<a-col :span="24" v-for="(item,index) of tableData" style="text-align: center;">
<a-button type="primary" style="width: 100%;margin-bottom: 0.5rem;" @click="changeLive(item)">{{ item?.xm }}</a-button>
</a-col>
</a-row>
</a-col>
</a-row>
<a-row :gutter="[16,16]">
<a-col :span="22">
<a-textarea v-model:value="model.notes"></a-textarea>
</a-col>
<a-col :span="2">
<a-button type="primary" @click="saveSuibi">保存</a-button>
2023-04-24 22:40:50 +08:00
</a-col>
</a-row>
</div>
<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>
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-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
const mainVideo = <any>ref();
2023-05-04 23:50:32 +08:00
const tingKeZuJiAddModal = <any>ref({});
2023-04-24 22:40:50 +08:00
const mainVideoCardBoxTitle = <any>ref('');
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',
addSuibi = '/kc/kcKetangSuibi/add'
// editSuibi = '/kc/kcKetangSuibi/edit'
}
/**
* 列表接口
* @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 });
// 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-04-24 22:40:50 +08:00
//按ID加载数据
list({ pageSize: -1, sfyx: '0', jsbh: route.query.id }).then(res => {
let list = (res?.records) ?? [];
tableData.value = list;
nextTick(() => {
2023-05-04 23:50:32 +08:00
changeLive(tableData.value[0]);
2023-04-24 22:40:50 +08:00
})
});
2023-05-04 23:50:32 +08:00
getSuibi();
2023-04-24 22:40:50 +08:00
}else{
isError.value = true;
}
});
2023-05-04 23:50:32 +08:00
function changeLive(item:any){
let mainVideo = <any> document.querySelector('#mainVideo');
mainVideo?.player?.src([{ type:'application/x-mpegURL',src: item.pullUrl }])
2023-04-24 22:40:50 +08:00
}
2023-05-04 23:50:32 +08:00
function getSuibi(){
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-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>
.videoMax{
width: 25%;
}
.videoCardMain {
:deep(.ant-card-body) {
padding: 0;
}
}
/* 隐藏video 进度条 */
video::-webkit-media-controls-timeline {
display: none;
}
2023-05-04 23:50:32 +08:00
.maxSite {
//最大宽度
max-width: 1170px;
//居中
margin: 0 auto;
}
2023-04-24 22:40:50 +08:00
</style>