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

修复直播相关的一些问题

上级 80023d9b
......@@ -110,6 +110,7 @@ export default class CourseAction extends BaseACTION {
currentVideoProvider: cur.latest_play_type || '1',
course: cur.chapters.map((_, i) => {
return {
id: _.id,
title: _.name,
isUp: true,
chapters: _.children.map((__, j) => {
......
......@@ -165,7 +165,10 @@ export default {
this.fetchData()
},
// 刷新
refersh() {
refersh(isForce = false) {
if (isForce) {
this.page.currentPage = 1
}
this.fetchData()
}
},
......
......@@ -21,7 +21,7 @@
@click="golearningAdd('/app/affairs-hall/again-add/-1')"
>申请重修</el-button>
<div style="width: 100%; height: 0.2rem;"></div>
<table-list :key="affairId" v-bind="tableOption" v-if="affairId"></table-list>
<table-list :key="affairId" v-bind="tableOption" v-if="affairId" ref="tableList"></table-list>
</div>
<el-dialog title="提示" :visible.sync="dialogVisible" width="30%">
<span>确定删除?</span>
......@@ -249,7 +249,8 @@ export default {
.then(data => {
if (data.success) {
this.$message({ type: 'success', message: '删除成功' })
this.$router.go(0)
// 刷新列表,强刷新,返回第一页
this.$refs.tableList && this.$refs.tableList.refersh(true)
}
})
.catch(e => {
......
......@@ -107,13 +107,13 @@ export default {
clearInterval(this.timeInterval)
this.timeInterval = null
}
// this.timeInterval = setInterval(() => {
// cAction.chapterAction.getNewLiveMsg().then(json => {
// if (json.status === 200) {
// this.newLiveMsg = json.data
// }
// }).catch(e => { this.$message.error(e.message) }).finally(() => { })
// }, 3000)
this.timeInterval = setInterval(() => {
cAction.Player.getNewLiveMsg().then(json => {
if (json.status === 200) {
this.newLiveMsg = json.data
}
}).catch(e => { this.$message.error(e.message) }).finally(() => { })
}, 3000)
const loading = this.$loading({ lock: true, text: '', spinner: '', background: 'rgba(255, 255, 255, 0.9)' })
cAction.Course.getLearnFind().then(data => {
......
......@@ -401,10 +401,10 @@ export default {
}).catch(e => { this.$message.error(e.message); loading.close() }).finally(() => { })
window.addEventListener('resize', this.resizeRoot.bind(this), false)
/* 实时刷新数据 */
// if (this.timeHeart) { clearInterval(this.timeHeart); this.timeHeart = null }
// this.timeHeart = setInterval(() => {
// this.updatePages()
// }, 3000)
if (this.timeHeart) { clearInterval(this.timeHeart); this.timeHeart = null }
this.timeHeart = setInterval(() => {
this.updatePages()
}, 3000)
this.arrFn = this.initBindKeyfn()
},
destroyed () {
......@@ -456,16 +456,14 @@ export default {
updatePages () {
cAction.Course.getCourseDetail(this.cid, this.sid).then(json => {
/* 更新直播状态 */
const course = json.tabs1ChapterList.course
for (let i = 0; i < course.length; i++) {
const chapters = course[i].chapters
for (let j = 0; j < chapters.length; j++) {
if (chapters[j].type === 5) {
this.tabs[1].chapterList.course[i].chapters[j].live = chapters[j].live
}
}
}
}).catch(e => { this.$message.error(e.message) }).finally(() => { })
this.tabs[1].chapterList.course = json.tabs1ChapterList.course.map(item => {
const found = this.tabs[1].chapterList.course.find(rawItem => rawItem.id === item.id)
item.isUp = found ? found.isUp : item.isUp
return item
})
})
// 暂不处理,新增章节不能实时更新,需要手动刷新
// .catch(e => { this.$message.error(e.message) }).finally(() => { })
},
/**
* 课程内容 - 列表展开或者跳转
......
......@@ -93,7 +93,14 @@ export default {
cAction.Player.getLiveList()
.then(response => {
if (response.status === 200) {
this.dataList = response.data
this.dataList = response.data.map(data => {
// 兼容老的数据结构
if (!Array.isArray(data.live)) {
data.live.live_type = 'live'
data.live = [data.live]
}
return data
})
}
})
// 取消报错提醒
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论