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;