提交 575e6363 authored 作者: pengxiaohui's avatar pengxiaohui

feat: 看回放增加缺课、迟到补签功能

上级 4265544c
module.exports = { module.exports = {
domain: 'dev.ezijing.com', domain: 'dev.ezijing.com',
url: 'https://learn-api.ezijing.com/api', url: 'https://learn-api.ezijing.com/api',
apiBaseURL: 'https://learn-api.ezijing.com', apiBaseURL: 'https://learn-api2.ezijing.com',
others: { others: {
url: '/app/learn/course', url: '/app/learn/course',
loginUrl: 'https://login.ezijing.com/wmp/login/index' loginUrl: 'https://login2.ezijing.com/wmp/login/index'
}, },
webpack: { webpack: {
externals: { externals: {
......
...@@ -97,6 +97,7 @@ ...@@ -97,6 +97,7 @@
<el-tag v-if="item1.live.sign_status === 2" type="danger" size="small">迟到</el-tag> <el-tag v-if="item1.live.sign_status === 2" type="danger" size="small">迟到</el-tag>
<template v-if="[3, 5].includes(item1.live.live_status)"> <template v-if="[3, 5].includes(item1.live.live_status)">
<el-tag v-if="item1.live.sign_status === 3" type="danger" size="small">缺课</el-tag> <el-tag v-if="item1.live.sign_status === 3" type="danger" size="small">缺课</el-tag>
<el-tag v-if="item1.live.sign_status === 4" type="success" size="small">已完成</el-tag>
</template> </template>
</template> </template>
</template> </template>
...@@ -745,6 +746,15 @@ export default { ...@@ -745,6 +746,15 @@ export default {
const { sid, cid, vid, type } = data const { sid, cid, vid, type } = data
/* 进入详情页,不管是哪个,都存localstorage */ /* 进入详情页,不管是哪个,都存localstorage */
window.localStorage.setItem('headerInfo', JSON.stringify(this.headerInfo)) window.localStorage.setItem('headerInfo', JSON.stringify(this.headerInfo))
const live = data.live
const hasRecordUrl = live.enable_record && live.record_url
if ([3, 5].includes(live.live_status) && hasRecordUrl) {
// 回看时,(缺课,迟到)先默认签到,隐藏签到成功弹窗
if ([2, 3].includes(live.sign_status)) {
this.fetchSignIn(data, true)
return
}
}
if (type === 1) { if (type === 1) {
return return
} }
...@@ -984,19 +994,23 @@ export default { ...@@ -984,19 +994,23 @@ export default {
if (r != null) return unescape(r[2]) if (r != null) return unescape(r[2])
return null return null
}, },
fetchSignIn(item) { fetchSignIn(item, hidePopup) {
cAction.Player.signIn(item.live.id) cAction.Player.signIn(item.live.id)
.then(res => { .then(res => {
const { code, status } = res const { code, status } = res
if (code === 0) { if (code === 0) {
this.popup.signStatus = status if (hidePopup) {
this.popup.visible = true window.open(item.live.record_url)
this.popup.data = item } else {
this.updatePages() this.popup.signStatus = status
this.popup.visible = true
this.popup.data = item
this.updatePages()
}
} }
}) })
.catch(e => { .catch(e => {
this.$message.error(e.message || '签到失败') if (!hidePopup) this.$message.error(e.message || '签到失败')
}) })
} }
} }
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
<el-tag v-if="subitem.sign_status === 1" type="success" size="small" style="float:right;">已签到</el-tag> <el-tag v-if="subitem.sign_status === 1" type="success" size="small" style="float:right;">已签到</el-tag>
<template v-if="[3, 5].includes(subitem.live_status)"> <template v-if="[3, 5].includes(subitem.live_status)">
<el-tag v-if="subitem.sign_status === 3" type="danger" size="small" style="float:right;">缺课</el-tag> <el-tag v-if="subitem.sign_status === 3" type="danger" size="small" style="float:right;">缺课</el-tag>
<el-tag v-if="subitem.sign_status === 4" type="success" size="small" style="float:right;">已完成</el-tag>
</template> </template>
</template> </template>
</div> </div>
...@@ -181,10 +182,22 @@ export default { ...@@ -181,10 +182,22 @@ export default {
data.live_status = parseInt(data.live_status) data.live_status = parseInt(data.live_status)
const { live_status: liveStatus, type: liveType } = data const { live_status: liveStatus, type: liveType } = data
const hasRecordUrl = data.enable_record && data.record_url const hasRecordUrl = data.enable_record && data.record_url
if ([3, 5].includes(liveStatus) && !hasRecordUrl) { if ([3, 5].includes(liveStatus)) {
this.message && this.message.close() if (!hasRecordUrl) {
this.message = this.$message({ type: 'warning', offset: 0, message: this.$t('live.liveEnd') }) this.message && this.message.close()
return this.message = this.$message({ type: 'warning', offset: 0, message: this.$t('live.liveEnd') })
return
} else {
// 回看时,先默认签到,隐藏签到成功弹窗
if ([2, 3].includes(data.sign_status)) {
this.fetchSignIn(data, courseId, true)
return
}
}
// if ([2, 3].includes(data.sign_status)) {
// this.fetchSignIn(data, courseId, true)
// return
// }
} }
if (liveType === 5) { if (liveType === 5) {
// 打开云直播 // 打开云直播
...@@ -196,7 +209,7 @@ export default { ...@@ -196,7 +209,7 @@ export default {
this.openCloudClass(data) this.openCloudClass(data)
return return
} }
this.openNewWindow(data.record_url || data.join_url) this.openNewWindow(data.join_url)
}, },
// 打开云课堂 // 打开云课堂
openCloudClass(data) { openCloudClass(data) {
...@@ -276,21 +289,25 @@ export default { ...@@ -276,21 +289,25 @@ export default {
} }
return result return result
}, },
fetchSignIn(item, courseId) { fetchSignIn(item, courseId, hidePopup) {
cAction.Player.signIn(item.id) cAction.Player.signIn(item.id)
.then(res => { .then(res => {
const { code, status } = res const { code, status } = res
if (code === 0) { if (code === 0) {
this.popup.signStatus = status if (hidePopup) {
this.popup.visible = true this.openNewWindow(item.record_url)
this.popup.data = item } else {
this.popup.courseId = courseId this.popup.signStatus = status
this.getNewLiveMsg() this.popup.visible = true
this.getLiveList() this.popup.data = item
this.popup.courseId = courseId
this.getNewLiveMsg()
this.getLiveList()
}
} }
}) })
.catch(e => { .catch(e => {
this.$message.error(e.message || '签到失败') if (!hidePopup) this.$message.error(e.message || '签到失败')
}) })
} }
}, },
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论