mirror of
https://github.com/cuiocean/ZY-Player.git
synced 2026-05-08 06:43:03 +08:00
😅 解决收藏夹点击播放,没有历史记录的问题
This commit is contained in:
@@ -69,7 +69,7 @@
|
||||
</div>
|
||||
<div class="tFooter">
|
||||
<span class="tFooter-span">今日更新: {{ tb.update }} 条</span>
|
||||
<span class="tFooter-span btn" @click="goWebsite">前往该资源网</span>
|
||||
<span class="tFooter-span btn" @click="goWebsite">加载不出来,点这里</span>
|
||||
<el-pagination small :page-size="tb.size" :total="tb.total" :current-page="tb.page" @current-change="tbPageChange" layout="total, prev, pager, next, jumper"></el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -210,44 +210,48 @@ export default {
|
||||
this.xg.pause()
|
||||
}
|
||||
this.changeVideo()
|
||||
tools.detail_get(this.video.site, this.video.detail).then(res => {
|
||||
this.name = this.video.name
|
||||
this.right.listData = res.m3u8_urls
|
||||
if (res.m3u8_urls.length > 1) {
|
||||
const m3 = res.m3u8_urls
|
||||
history.find({ detail: this.video.detail }).then(item => {
|
||||
let index = 1
|
||||
let time = 0
|
||||
if (item) {
|
||||
index = item.index
|
||||
if (this.video.index === index) {
|
||||
time = item.currentTime
|
||||
}
|
||||
}
|
||||
tools.detail_get(this.video.site, this.video.detail).then(res => {
|
||||
this.name = this.video.name
|
||||
this.right.listData = res.m3u8_urls
|
||||
|
||||
const m = res.m3u8_urls
|
||||
const arr = []
|
||||
for (const i of m3) {
|
||||
for (const i of m) {
|
||||
arr.push(i.split('$')[1])
|
||||
}
|
||||
this.length = arr.length
|
||||
this.xg.src = arr[this.video.index]
|
||||
this.showNext = true
|
||||
} else {
|
||||
const link = res.m3u8_urls[this.video.index]
|
||||
const src = link.split('$')[1]
|
||||
this.length = 1
|
||||
this.xg.src = src
|
||||
this.showNext = false
|
||||
}
|
||||
const currentTime = this.video.currentTime
|
||||
if (currentTime !== '') {
|
||||
this.xg.play()
|
||||
this.xg.once('playing', () => {
|
||||
this.xg.currentTime = currentTime
|
||||
})
|
||||
} else {
|
||||
this.xg.play()
|
||||
}
|
||||
this.xg.once('play', () => {
|
||||
this.mask = false
|
||||
})
|
||||
this.onPlayVideo()
|
||||
this.xg.once('ended', () => {
|
||||
if (res.m3u8_urls.length > 1 && (res.m3u8_urls.length - 1 > this.video.index)) {
|
||||
this.video.currentTime = 0
|
||||
this.video.index++
|
||||
this.xg.src = arr[index]
|
||||
this.showNext = this.length > 1
|
||||
|
||||
const currentTime = time
|
||||
if (currentTime !== 0) {
|
||||
this.xg.play()
|
||||
this.xg.once('playing', () => {
|
||||
this.xg.currentTime = currentTime
|
||||
})
|
||||
} else {
|
||||
this.xg.play()
|
||||
}
|
||||
this.xg.off('ended')
|
||||
this.xg.once('play', () => {
|
||||
this.mask = false
|
||||
})
|
||||
this.onPlayVideo()
|
||||
this.xg.once('ended', () => {
|
||||
if (res.m3u8_urls.length > 1 && (res.m3u8_urls.length - 1 > this.video.index)) {
|
||||
this.video.currentTime = 0
|
||||
this.video.index++
|
||||
}
|
||||
this.xg.off('ended')
|
||||
})
|
||||
})
|
||||
})
|
||||
},
|
||||
@@ -296,6 +300,14 @@ export default {
|
||||
history.update(res.id, h)
|
||||
}
|
||||
})
|
||||
video.find({ detail: d }).then(res => {
|
||||
if (res) {
|
||||
const h = { ...this.video }
|
||||
delete h.id
|
||||
delete h.currentTime
|
||||
video.update(res.id, h)
|
||||
}
|
||||
})
|
||||
}, 10000)
|
||||
},
|
||||
closeEvent () {
|
||||
|
||||
Reference in New Issue
Block a user