From 7067bb2c06b37bf7493a27aa6ff259a6090153ac Mon Sep 17 00:00:00 2001 From: bai <1643359946@qq.com> Date: Fri, 27 Oct 2023 00:49:17 +0800 Subject: [PATCH] =?UTF-8?q?2023=E5=B9=B410=E6=9C=8827=E6=97=A5=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/kc/jiaoshi/index.vue | 6 +- .../site/common/video/videojs/viewPage.vue | 75 +++++++++++++++---- 2 files changed, 63 insertions(+), 18 deletions(-) diff --git a/src/views/kc/jiaoshi/index.vue b/src/views/kc/jiaoshi/index.vue index 4a2e812..a396d6e 100644 --- a/src/views/kc/jiaoshi/index.vue +++ b/src/views/kc/jiaoshi/index.vue @@ -360,8 +360,8 @@ enum Api { */ const list = (params) => defHttp.get({ url: Api.list, params }); const updateAllLive = (params) => defHttp.get({ url: Api.updateAllLive, params }); -const changeAvyLiveApi = (params) => defHttp.get({ url: Api.changeAvyLiveApi, params,timeout: 90000 }); -const jsjbxxList = (params) => defHttp.get({ url: Api.xxhbjsjbxxList, params,timeout: 90000 }); +const changeAvyLiveApi = (params) => defHttp.get({ url: Api.changeAvyLiveApi, params,timeout: 9000000 }); +const jsjbxxList = (params) => defHttp.get({ url: Api.xxhbjsjbxxList, params,timeout: 9000000 }); const shangXianQuartz = ref({}); @@ -594,7 +594,7 @@ function batchLive(type: boolean){ setTimeout(() => { loadData(); createInfoModal({ width:'50%', title: '结果',content }) - }, 12*1000); + }, 10*1000);//10秒 }else{ loadData(); createInfoModal({ width:'50%', title: '结果',content }) diff --git a/src/views/site/common/video/videojs/viewPage.vue b/src/views/site/common/video/videojs/viewPage.vue index b133eb1..ed55fa1 100644 --- a/src/views/site/common/video/videojs/viewPage.vue +++ b/src/views/site/common/video/videojs/viewPage.vue @@ -101,6 +101,9 @@ import { getUserId } from '/@/views/site/utils/index'; import KcErrorreportIndexModal from '/@/views/kc/kcErrorreport/components/KcErrorreportIndexZbModal.vue' import videojs from "video.js"; import { getSysConfig } from '/@/views/site/utils/index'; +import { useMessage } from '/@/hooks/web/useMessage'; + +const { createMessage, createInfoModal, createErrorModal } = useMessage(); const mainVideo = ref(); const bVideoRefs = ref([]); @@ -127,7 +130,8 @@ enum Api { addSuibi = '/kc/kcKetangSuibi/add', // editSuibi = '/kc/kcKetangSuibi/edit' getKtangInfo = '/ktgl/kcKetangbiao/queryById', - savePlayLog = '/jiaoshi/kcZhihuijiaoshiAccessLog/savePlayLog' + savePlayLog = '/jiaoshi/kcZhihuijiaoshiAccessLog/savePlayLog', + changeAvyLiveByJsbhsApi = '/httpinterface/runAvyApiByJsbhs', } /** @@ -139,6 +143,7 @@ const querySuibi = (params) => defHttp.get({ url: Api.querySuibi, params }); const addSuibi = (params) => defHttp.post({ url: Api.addSuibi, params }); const getKtangInfo = (params) => defHttp.get({ url: Api.getKtangInfo, params }); const savePlayLog = (params) => defHttp.post({ url: Api.savePlayLog, params, }, { isTransformResponse: false }); +const changeAvyLiveByJsbhsApi = (params) => defHttp.get({ url: Api.changeAvyLiveByJsbhsApi, params,timeout: 9000000 }); // const editSuibi = (params) => defHttp.post({ url: Api.editSuibi, params }); onMounted(() => { @@ -149,12 +154,13 @@ onMounted(() => { let list = (res?.records) ?? []; tableData.value = list; tableData.value.forEach(x => x.isShow = true);//默认展开 + let zjData = tableData.value.find(x => x.xm == '教师近景') || {}; nextTick(() => { - if(tableData.value[0]){ - changeLive(tableData.value[0]); + if(zjData){ + changeLive(zjData); } - savePlayLogFn(tableData.value[0]); - calcPlayStatus(tableData.value[0]); + savePlayLogFn(zjData); + calcPlayStatus(zjData); tableData.value.forEach(x => x.isShow = false);//关闭 }) }); @@ -180,7 +186,7 @@ function handleBaocuo(item) { player.on('play',() => { setTimeout(() => { player.pause(); - },1000); + },2000); }) }) } @@ -225,6 +231,37 @@ function mainVideoLoadEnd(player){ } +function openLive(item: any){ + changeAvyLiveByJsbhsApi({ jsbhs:item.jsbh, type: 1 }).then(res => { + let content = ''; + res.forEach(x => { + // content += x.jsmc + "-" + x.xm + content += x.jsmc + let text = ''; + if(x.resText){ + if(x.resText.includes('ok')){ + text = '播放失败,开启直播间成功,请稍后再试' + }else{ + text = '播放失败,开启直播间失败,请联系管理员。' + } + } + content += " " + text + "
" + }); + // if(content.includes('开启直播间成功')){ + // //延迟12秒 + // setTimeout(() => { + // createInfoModal({ width:'50%', title: '结果',content }) + // }, 12*1000); + // }else{ + createInfoModal({ width:'50%', title: '结果',content }) + // } + + }).catch(e => { + console.error(e); + //loading.value = false; + //createInfoModal({title: '错误结果',content:e}) + }) +} function getSuibi(){ @@ -259,15 +296,23 @@ function savePlayLogFn(item){ //计算播放状态 function calcPlayStatus(item){ - videojs.xhr.get(item.pullUrl,(err, resp, body) => { - if(err){ - playStatus.value = false; - isError.value = true; - }else{ - playStatus.value = true; - isError.value = false; - } - }) + if(item.pullUrl){ + videojs.xhr.get(item.pullUrl,(err, resp, body) => { + if(err){ + playStatus.value = false; + isError.value = true; + openLive(item); + }else{ + playStatus.value = true; + isError.value = false; + } + }) + }else { + console.log(1111111); + + playStatus.value = true; + isError.value = true; + } } function saveSuibi(){