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

修复直播相关的一些问题

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