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

直播bug修复

上级 dcb2c16f
......@@ -143,8 +143,7 @@ export default class CourseAction extends BaseACTION {
case 2: str = '正在直播'; break
case 3: str = '直播结束'; break
case 4: str = '即将开始'; break
case 5: str = '直播未开始'; break
case 11: str = '直播结束'; break
case 5: str = '直播结束'; break
default: str = '直播未开始'
}
// 5分钟内显示“即将开始”,5~1小时内“N分钟后开始”,1~24小时内“N小时后开始”,1天以上“N天后开始”天就显示年月日
......
......@@ -62,7 +62,13 @@ export default {
}
// zoom直播
if (data.type === 8) {
window.open(data.live.record_url || data.live.join_url)
const live = data.live
const hasRecordUrl = live.enable_record && live.record_url
if ([3, 5].includes(live.live_status) && !hasRecordUrl) {
this.$message.error('直播结束')
return
}
window.open(live.record_url || data.join_url)
return
}
// 课程大作业
......
......@@ -48,7 +48,7 @@ export default {
},
// 是否直播结束
isLiveEnd() {
return this.live.live_status === 3
return [3, 5].includes(this.live.live_status)
},
// 是否有回放
hasRecord() {
......
......@@ -190,8 +190,9 @@ export default {
},
/* 直接进直播 */
goLive () {
if (this.newLiveMsg.live.type === 8) {
window.open(this.newLiveMsg.live.record_url || this.newLiveMsg.live.join_url)
const live = this.newLiveMsg.live
if (live.type === 8) {
window.open(live.record_url || live.join_url)
} else {
this.$router.push({ name: 'viewerCourseChapter', params: { sid: this.newLiveMsg.semester_id, cid: this.newLiveMsg.course_id, id: this.newLiveMsg.chapter_id } })
}
......
......@@ -512,8 +512,8 @@ export default {
// cc直播
if (type === 5) {
const live = data.live
const status = live.live_status
if (status === 3 && !live.enable_record) {
const hasRecordUrl = live.enable_record && live.record_url
if ([3, 5].includes(live.live_status) && !hasRecordUrl) {
this.$message.error(live.statusStr)
return
}
......@@ -533,6 +533,12 @@ export default {
}
// zoom直播
if (type === 8) {
const live = data.live
const hasRecordUrl = live.enable_record && live.record_url
if ([3, 5].includes(live.live_status) && !hasRecordUrl) {
this.$message.error(live.statusStr)
return
}
window.open(data.live.record_url || data.live.join_url)
return
}
......
......@@ -121,41 +121,31 @@ export default {
},
onClick(data) {
data.live_status = parseInt(data.live_status)
const { live_status: liveStatus, type: liveType = 5, start_time: liveTime } = data
let message = this.calcTimeText(liveTime, liveStatus)
if (liveStatus === 3 && !data.enable_record) {
message = this.$t('live.noPlayback')
const { live_status: liveStatus, type: liveType } = data
const hasRecordUrl = data.enable_record && data.record_url
if ([3, 5].includes(liveStatus) && !hasRecordUrl) {
this.message && this.message.close()
this.message = this.$message({ type: 'warning', offset: 0, message })
return
}
if (liveType === 'cloud') {
// 打开云课堂
this.openCloudClass(data, message)
this.message = this.$message({ type: 'warning', offset: 0, message: this.$t('live.liveEnd') })
return
}
if (liveType === 5) {
// 打开云直播
this.openCloudLive(data, message)
this.openCloudLive(data)
return
}
if (liveType === 'meeting') {
// 打开腾讯会议
this.openMeeting(data, message)
if (liveType === 'cloud') {
// 打开云课堂
this.openCloudClass(data)
return
}
this.openNewWindow(data.record_url || data.join_url)
},
// 打开云课堂
openCloudClass(data, message) {
openCloudClass(data) {
// https://doc.bokecc.com/class/developer/api/login.html
const liveStatus = data.live_status
data.user_name = data.user_name || window.G.UserInfo.student_info.personal_name
if (liveStatus === 1) {
// 进行中
const url = `http://view.csslcloud.net/api/view/index?roomid=${data.room_id}&userid=${data.account_id}&autoLogin=true&viewername=${data.username}&viewertoken=${data.password}`
this.openNewWindow(url)
} else if (liveStatus === 2) {
if (liveStatus === 3) {
// 查看回放
const replayUrl = data.record_url.replayUrl
const url = replayUrl
......@@ -163,17 +153,17 @@ export default {
: ''
this.openNewWindow(url)
} else {
this.message && this.message.close()
this.message = this.$message({ type: 'warning', offset: 0, message })
// 进行中
const url = `http://view.csslcloud.net/api/view/index?roomid=${data.room_id}&userid=${data.account_id}&autoLogin=true&viewername=${data.username}&viewertoken=${data.password}`
this.openNewWindow(url)
}
},
// 打开云直播
openCloudLive(data, message) {
openCloudLive(data) {
// https://doc.bokecc.com/live/Appendix_1.html
const liveStatus = data.live_status
data.user_name = data.user_name || this.nickName
if (liveStatus === 3 && data.enable_record === 1) {
// enable_record 0:不启用回放 1:开启回放
if (liveStatus === 3) {
// 查看回放
// const url = `https://view.csslcloud.net/api/view/callback?recordid=${data.record_id}&roomid=${data.room_id}&userid=${data.account_id}&autoLogin=true&viewername=${data.user_name}&viewertoken=${data.play_pass}`
this.openNewWindow(data.record_url)
......@@ -183,15 +173,6 @@ export default {
this.openNewWindow(url)
}
},
// 打开腾讯会议
openMeeting(data, message) {
if (data.join_url) {
this.openNewWindow(data.join_url)
} else {
this.message && this.message.close()
this.message = this.$message({ type: 'warning', offset: 0, message })
}
},
// 新窗口打开
openNewWindow(url) {
url && window.open(url, '_blank')
......@@ -203,8 +184,7 @@ export default {
2: this.$t('live.liveStreaming'),
3: this.$t('live.liveEnd'),
4: this.$t('live.start'),
5: this.$t('live.notStarted'),
11: this.$t('live.liveEnd')
5: this.$t('live.liveEnd')
}
let result = map[liveStatus] || liveTime
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论