2023年5月16日 智慧教室改为后台调用接口
This commit is contained in:
parent
ab1038b709
commit
e7d6963b8c
|
@ -90,7 +90,8 @@ onMounted(() => {
|
||||||
|
|
||||||
enum Api {
|
enum Api {
|
||||||
list = '/jiaoshi/kcZhihuijiaoshi/list',
|
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 list = (params) => defHttp.get({ url: Api.list, params });
|
||||||
const updateAllLive = (params) => defHttp.get({ url: Api.updateAllLive, params });
|
const updateAllLive = (params) => defHttp.get({ url: Api.updateAllLive, params });
|
||||||
|
const changeAvyLiveApi = (params) => defHttp.get({ url: Api.changeAvyLiveApi, params });
|
||||||
|
|
||||||
function loadData(){
|
function loadData(){
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
|
@ -180,34 +182,43 @@ function ylLive(record){
|
||||||
|
|
||||||
function changeLive(record, isEnable){
|
function changeLive(record, isEnable){
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
//record
|
let ids:any = [];
|
||||||
let changeLiveEnd:any = [];
|
let changeLiveEnd:any = [];
|
||||||
Object.values(record.child).forEach(x => {
|
Object.values(record.child).forEach(x => {
|
||||||
let item:any = x;
|
let item:any = x;
|
||||||
changeLiveEnd.push(new Promise((resolve,reject) => {
|
//收集ID
|
||||||
videojs.xhr.get(getAvyCtrlLiveOpenOrCloseUrl(item.ip,item.user,item.mima,isEnable),(err, resp, body) => {
|
ids.push(item.id);
|
||||||
if(!err){
|
// changeLiveEnd.push(new Promise((resolve,reject) => {
|
||||||
resolve(true);
|
// videojs.xhr.get(getAvyCtrlLiveOpenOrCloseUrl(item.ip,item.user,item.mima,isEnable),(err, resp, body) => {
|
||||||
}else{
|
// if(!err){
|
||||||
reject(false);
|
// resolve(true);
|
||||||
}
|
// }else{
|
||||||
})
|
// reject(false);
|
||||||
}));
|
// }
|
||||||
|
// })
|
||||||
|
// }));
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log('changeLiveEnd ->',changeLiveEnd);
|
// console.log('changeLiveEnd ->',changeLiveEnd);
|
||||||
|
|
||||||
Promise.all(changeLiveEnd).then(resList => {
|
// Promise.all(changeLiveEnd).then(resList => {
|
||||||
console.log(`🚀 ----------------------------------------------------------🚀`);
|
// console.log(`🚀 ----------------------------------------------------------🚀`);
|
||||||
console.log(`🚀 ~ file: index.vue:181 ~ Promise.all ~ resList:`, resList);
|
// console.log(`🚀 ~ file: index.vue:181 ~ Promise.all ~ resList:`, resList);
|
||||||
console.log(`🚀 ----------------------------------------------------------🚀`);
|
// console.log(`🚀 ----------------------------------------------------------🚀`);
|
||||||
createMessage.info("操作成功!");
|
// createMessage.info("操作成功!");
|
||||||
|
// loadData();
|
||||||
|
// }).catch(e => {
|
||||||
|
// console.error(e);
|
||||||
|
// createMessage.error("操作失败!");
|
||||||
|
// loading.value = false;
|
||||||
|
// });
|
||||||
|
changeAvyLiveApi({ ids:ids.join(','), type: isEnable?1:0 }).then(res => {
|
||||||
loadData();
|
loadData();
|
||||||
}).catch(e => {
|
}).catch(e => {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
createMessage.error("操作失败!");
|
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
});
|
})
|
||||||
|
|
||||||
|
|
||||||
// if(!err){
|
// if(!err){
|
||||||
// createMessage.info("操作成功!");
|
// createMessage.info("操作成功!");
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
<span style="padding-left: 1rem;" @click="execAvyApi(getAvyCtrlLiveOpenOrCloseUrl(item.ip,item.user,item.mima,false))">关闭直播</span> -->
|
<span style="padding-left: 1rem;" @click="execAvyApi(getAvyCtrlLiveOpenOrCloseUrl(item.ip,item.user,item.mima,false))">关闭直播</span> -->
|
||||||
</template>
|
</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="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>
|
</a-card>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -202,6 +203,9 @@ function bVideoClick(e:any){
|
||||||
console.log('重新初始化');
|
console.log('重新初始化');
|
||||||
mainVideo.value.init();
|
mainVideo.value.init();
|
||||||
}
|
}
|
||||||
|
let buttonEl = mainVideo?.player.el().querySelector('.changeDefinitionBtn');
|
||||||
|
//赋值原URL
|
||||||
|
buttonEl.dataset.url = src;
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
|
|
|
@ -162,6 +162,7 @@ function changeLive(item:any){
|
||||||
console.log(`🚀 ~ file: viewPage.vue:164 ~ changeLive ~ mainVideo?.player:`, mainVideo?.player);
|
console.log(`🚀 ~ file: viewPage.vue:164 ~ changeLive ~ mainVideo?.player:`, mainVideo?.player);
|
||||||
console.log(`🚀 --------------------------------------------------------------------------------🚀`);
|
console.log(`🚀 --------------------------------------------------------------------------------🚀`);
|
||||||
let buttonEl = mainVideo?.player.el().querySelector('.changeDefinitionBtn');
|
let buttonEl = mainVideo?.player.el().querySelector('.changeDefinitionBtn');
|
||||||
|
//赋值原URL
|
||||||
buttonEl.dataset.url = url;
|
buttonEl.dataset.url = url;
|
||||||
|
|
||||||
curentPlayerVideo.value = item;
|
curentPlayerVideo.value = item;
|
||||||
|
|
Loading…
Reference in New Issue