From e7d6963b8cfadd7e04218d85901fca115edcdddc Mon Sep 17 00:00:00 2001
From: bai <1643359946@qq.com>
Date: Tue, 16 May 2023 17:02:33 +0800
Subject: [PATCH] =?UTF-8?q?2023=E5=B9=B45=E6=9C=8816=E6=97=A5=20=E6=99=BA?=
=?UTF-8?q?=E6=85=A7=E6=95=99=E5=AE=A4=E6=94=B9=E4=B8=BA=E5=90=8E=E5=8F=B0?=
=?UTF-8?q?=E8=B0=83=E7=94=A8=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/kc/jiaoshi/index.vue | 49 ++++++++++++-------
src/views/kc/jiaoshi/showAllLive.vue | 4 ++
.../site/common/video/videojs/viewPage.vue | 1 +
3 files changed, 35 insertions(+), 19 deletions(-)
diff --git a/src/views/kc/jiaoshi/index.vue b/src/views/kc/jiaoshi/index.vue
index a4a454b..3aea0b9 100644
--- a/src/views/kc/jiaoshi/index.vue
+++ b/src/views/kc/jiaoshi/index.vue
@@ -90,7 +90,8 @@ onMounted(() => {
enum Api {
list = '/jiaoshi/kcZhihuijiaoshi/list',
- updateAllLive = '/jiaoshi/kcZhihuijiaoshi/updateAllLive'
+ updateAllLive = '/jiaoshi/kcZhihuijiaoshi/updateAllLive',
+ changeAvyLiveApi = '/httpinterface/runAvyApiByIds',
}
/**
* 列表接口
@@ -98,6 +99,7 @@ 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 });
function loadData(){
loading.value = true;
@@ -180,34 +182,43 @@ function ylLive(record){
function changeLive(record, isEnable){
loading.value = true;
- //record
+ let ids:any = [];
let changeLiveEnd:any = [];
Object.values(record.child).forEach(x => {
let item:any = x;
- changeLiveEnd.push(new Promise((resolve,reject) => {
- videojs.xhr.get(getAvyCtrlLiveOpenOrCloseUrl(item.ip,item.user,item.mima,isEnable),(err, resp, body) => {
- if(!err){
- resolve(true);
- }else{
- reject(false);
- }
- })
- }));
+ //收集ID
+ ids.push(item.id);
+ // changeLiveEnd.push(new Promise((resolve,reject) => {
+ // videojs.xhr.get(getAvyCtrlLiveOpenOrCloseUrl(item.ip,item.user,item.mima,isEnable),(err, resp, body) => {
+ // if(!err){
+ // resolve(true);
+ // }else{
+ // reject(false);
+ // }
+ // })
+ // }));
});
- console.log('changeLiveEnd ->',changeLiveEnd);
+ // console.log('changeLiveEnd ->',changeLiveEnd);
- Promise.all(changeLiveEnd).then(resList => {
- console.log(`🚀 ----------------------------------------------------------🚀`);
- console.log(`🚀 ~ file: index.vue:181 ~ Promise.all ~ resList:`, resList);
- console.log(`🚀 ----------------------------------------------------------🚀`);
- createMessage.info("操作成功!");
+ // Promise.all(changeLiveEnd).then(resList => {
+ // console.log(`🚀 ----------------------------------------------------------🚀`);
+ // console.log(`🚀 ~ file: index.vue:181 ~ Promise.all ~ resList:`, resList);
+ // console.log(`🚀 ----------------------------------------------------------🚀`);
+ // createMessage.info("操作成功!");
+ // loadData();
+ // }).catch(e => {
+ // console.error(e);
+ // createMessage.error("操作失败!");
+ // loading.value = false;
+ // });
+ changeAvyLiveApi({ ids:ids.join(','), type: isEnable?1:0 }).then(res => {
loadData();
}).catch(e => {
console.error(e);
- createMessage.error("操作失败!");
loading.value = false;
- });
+ })
+
// if(!err){
// createMessage.info("操作成功!");
diff --git a/src/views/kc/jiaoshi/showAllLive.vue b/src/views/kc/jiaoshi/showAllLive.vue
index 03df466..4e0f4fe 100644
--- a/src/views/kc/jiaoshi/showAllLive.vue
+++ b/src/views/kc/jiaoshi/showAllLive.vue
@@ -29,6 +29,7 @@
关闭直播 -->
+
@@ -202,6 +203,9 @@ function bVideoClick(e:any){
console.log('重新初始化');
mainVideo.value.init();
}
+ let buttonEl = mainVideo?.player.el().querySelector('.changeDefinitionBtn');
+ //赋值原URL
+ buttonEl.dataset.url = src;
}
defineExpose({
diff --git a/src/views/site/common/video/videojs/viewPage.vue b/src/views/site/common/video/videojs/viewPage.vue
index 64cbc12..526a9fb 100644
--- a/src/views/site/common/video/videojs/viewPage.vue
+++ b/src/views/site/common/video/videojs/viewPage.vue
@@ -162,6 +162,7 @@ function changeLive(item:any){
console.log(`🚀 ~ file: viewPage.vue:164 ~ changeLive ~ mainVideo?.player:`, mainVideo?.player);
console.log(`🚀 --------------------------------------------------------------------------------🚀`);
let buttonEl = mainVideo?.player.el().querySelector('.changeDefinitionBtn');
+ //赋值原URL
buttonEl.dataset.url = url;
curentPlayerVideo.value = item;