在线解析时添加进历史记录

This commit is contained in:
buvta
2020-12-30 20:01:04 +08:00
parent 88db766337
commit 112f92d3e0
3 changed files with 13 additions and 4 deletions

View File

@@ -45,6 +45,7 @@
label="时间进度">
<template slot-scope="scope">
<span v-if="scope.row.time && scope.row.duration">{{fmtMSS(scope.row.time.toFixed(0))}}/{{fmtMSS(scope.row.duration.toFixed(0))}}</span>
<span v-if="scope.row.onlinePlay">在线解析</span>
</template>
</el-table-column>
<el-table-column
@@ -94,6 +95,7 @@
<span v-if="props.data.time && props.data.duration">
{{fmtMSS(props.data.time.toFixed(0))}}/{{fmtMSS(props.data.duration.toFixed(0))}}
</span>
<span v-if="props.data.onlinePlay">在线解析</span>
<span v-if="props.data.detail && props.data.detail.m3u8List !== undefined && props.data.detail.m3u8List.length > 1">
{{ props.data.index + 1 }}({{props.data.detail.m3u8List.length}})
</span>

View File

@@ -124,6 +124,7 @@
<span class="last-tip" v-if="!video.key && right.history.length > 0 && right.history[0]" @click="historyItemEvent(right.history[0])">
<span>上次播放到:{{right.history[0].site}}{{right.history[0].name}} {{right.history[0].index+1}} </span>
<span v-if="right.history[0].time && right.history[0].duration">{{fmtMSS(right.history[0].time.toFixed(0))}}/{{fmtMSS(right.history[0].duration.toFixed(0))}}</span>
<span v-if="right.history[0].onlinePlay">在线解析</span>
</span>
</div>
<div class="more" v-if="video.iptv" :key="Boolean(video.iptv)">
@@ -638,6 +639,7 @@ export default {
} else {
this.onlineUrl = 'https://jx.7kjx.com/?url=' + url
}
this.videoPlaying('online')
return
}
if (url.endsWith('.mp4') && this.playerType !== 'mp4') {
@@ -697,7 +699,7 @@ export default {
}
})
},
async videoPlaying () {
async videoPlaying (isOnline) {
this.changeVideo()
const db = await history.find({ site: this.video.key, ids: this.video.info.id })
let time = this.xg.currentTime || 0
@@ -707,6 +709,9 @@ export default {
duration = duration || db.duration
await history.remove(db.id)
}
if (isOnline) {
time = duration = 0
}
const doc = {
site: this.video.key,
ids: this.video.info.id,
@@ -716,11 +721,12 @@ export default {
index: this.video.info.index,
time: time,
duration: duration,
detail: this.video.detail
detail: this.video.detail,
onlinePlay: isOnline
}
await history.add(doc)
this.updateStar()
this.timerEvent()
if (!isOnline) this.timerEvent()
},
changeVideo () {
win.setProgressBar(-1)

View File

@@ -31,7 +31,8 @@ db.version(6).stores({
})
db.version(7).stores({
sites: '++id, key, name, api, download, jiexiUrl, isActive, group'
sites: '++id, key, name, api, download, jiexiUrl, isActive, group',
history: '++id, [site+ids], name, type, year, index, time, duration, detail, onlinePlay'
}).upgrade(trans => {
trans.sites.toCollection().modify(site => {
site.jiexiUrl = ''