2023年5月16日 智慧教室改为后台调用接口
This commit is contained in:
parent
ab1038b709
commit
e7d6963b8c
|
@ -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("操作成功!");
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
<span style="padding-left: 1rem;" @click="execAvyApi(getAvyCtrlLiveOpenOrCloseUrl(item.ip,item.user,item.mima,false))">关闭直播</span> -->
|
||||
</template>
|
||||
<bVideo :ref="el=> bVideoRefs[index]=el" :videoId="'other-'+item.id" :src="item.pullUrl" :videoOption="{ autoplay: true, userActions: { click: bVideoClick } }" @load-end="loadEnd"/>
|
||||
<!-- <bVideo :ref="el=> bVideoRefs[index]=el" :videoId="'other-'+item.id" :src="'https://kczxs1.nenu.edu.cn:9553/live_hls/a_low.m3u8'" :videoOption="{ autoplay: true, userActions: { click: bVideoClick } }" @load-end="loadEnd"/> -->
|
||||
</a-card>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -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({
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue