提交 a142dcfd authored 作者: 王鹏飞's avatar 王鹏飞

增加F键新窗口打开直播页面

上级 a5b61453
......@@ -282,4 +282,6 @@ export default class PlayerAction extends BaseACTION {
getNewLiveMsg () { return Player.getNewLiveMsg().then(res => res) }
/* 获取手机直播列表 */
getLiveList () { return Player.getLiveList().then(res => res) }
/* 获取云课堂 url */
getCloudUrl () { return Player.getCloudUrl().then(res => res) }
}
......@@ -97,4 +97,8 @@ export default class PlayerAPI extends BaseAPI {
* 手机端 获取列表接口
*/
getLiveList = (obj = {}) => this.get('/v2/education/lives/courses', obj)
/**
* 跨域接口请求 - 直接获取云课堂设置
*/
getCloudUrl = (obj = {}) => this.get('https://node-server.ezijing.com/get/cloud-class', obj)
}
......@@ -339,10 +339,18 @@ export default {
{ required: true, message: '请输入标题', trigger: 'blur' }
]
},
isOpenNewTabFlag: false,
arrFn: [],
cloudClassUrls: {},
timeHeart: null
}
},
mounted () {
/* 获取云课堂所有地址 */
cAction.Player.getCloudUrl().then(json => {
this.cloudClassUrls = json
})
const loading = this.$loading({ lock: true, text: '', spinner: '', background: 'rgba(255, 255, 255, 0.9)' })
if (this.cid === '0' && this.sid === '0') {
this.$message({
......@@ -389,6 +397,7 @@ export default {
// this.timeHeart = setInterval(() => {
// this.updatePages()
// }, 3000)
this.arrFn = this.initBindKeyfn()
},
destroyed () {
window.removeEventListener('resize', this.resizeRoot.bind(this), false)
......@@ -396,6 +405,7 @@ export default {
this.ckeditor && this.ckeditor.destroy(true)
this.ckeditor = null
if (this.timeHeart) { clearInterval(this.timeHeart); this.timeHeart = null }
if (this.arrFn.length) { this.destroyKeyfn(this.arrFn) }
},
updated () {
this.resizeRoot()
......@@ -489,6 +499,42 @@ export default {
}
}
},
/* 直接跳转打开新页面 */
openNewTab (sid, cid, _id) {
cAction.Player.getChapterList(cid, sid, _id).then(json => {
this.live = (json.curJson && json.curJson.live) || {}
if (this.live.id) {
if (this.live.record_id && this.live.live_status === 103) {
this.live.url = 'https://view.csslcloud.net/api/view/callback?recordid=' + this.live.record_id + '&roomid=' + this.live.room_id + '&userid=' + this.live.user_id + '&autoLogin=true&viewername=' + (this.live.viewer_name || '匿名') + '&viewertoken=' + this.live.viewer_token // + '&groupid=xxx'
} else {
this.live.viewer_name = window.G.UserInfo.student_info.personal_name || window.G.UserInfo.nickname
this.live.url = 'https://view.csslcloud.net/api/view/index?roomid=' + this.live.room_id + '&userid=' + this.live.user_id + '&autoLogin=true&viewername=' + (this.live.viewer_name || '匿名') + '&viewertoken=' + this.live.viewer_token // + '&groupid=xxx'
}
// this.CCLiveInit(this.live)
this.isOpenNewTabFlag = false
window.open(this.live.url)
}
}).catch(e => { this.$message.error(e.message) }).finally(() => { })
},
initBindKeyfn () {
const _fn1 = (e) => {
if (e.keyCode === 70) {
this.isOpenNewTabFlag = true
}
}
const _fn2 = (e) => {
if (e.keyCode === 70) {
this.isOpenNewTabFlag = false
}
}
document.addEventListener('keydown', _fn1, false)
document.addEventListener('keyup', _fn2, false)
return [_fn1, _fn2]
},
destroyKeyfn (arr) {
document.removeEventListener('keydown', arr[0])
document.removeEventListener('keyup', arr[1])
},
/**
* 跳转到对应音视频播放页
*/
......@@ -535,7 +581,20 @@ export default {
this.$message.info('该直播没有回放')
return
}
this.$router.push({ path: `/player/${sid}/${cid}/live/${_id}` })
/* 判别如果为 云课堂记录 id 则直接进入 云课堂 */
if (this.cloudClassUrls[_id]) {
const viewerName = window.G.UserInfo.student_info.personal_name || window.G.UserInfo.nickname
const url = this.cloudClassUrls[_id] + '&viewername=' + viewerName + '&autoLogin=true'
window.open(url)
return
}
if (this.isOpenNewTabFlag) {
this.openNewTab(sid, cid, _id)
} else {
this.$router.push({ path: `/player/${sid}/${cid}/live/${_id}` })
}
}
return
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论