保存videoFlag

This commit is contained in:
buvta
2020-12-31 15:08:11 +08:00
parent b72c88dfb9
commit 025d1606f7
2 changed files with 12 additions and 2 deletions

View File

@@ -151,9 +151,16 @@ export default {
close () {
this.detail.show = false
},
updateVideoList (e) {
async updateVideoList (e) {
this.videoFlag = e.flag
this.videoList = e.list
const db = await history.find({ site: this.detail.key, ids: this.detail.info.id })
if (db) {
const doc = { ...db }
doc.videoFlag = e.flag
delete doc.id
history.update(db.id, doc)
}
},
async playEvent (n) {
if (!this.playOnline) {

View File

@@ -547,6 +547,7 @@ export default {
time = db.time
}
if (!VIDEO_DETAIL_CACHE[key]) VIDEO_DETAIL_CACHE[key] = {}
if (!this.video.info.videoFlag) this.video.info.videoFlag = db.videoFlag
if (db.startPosition) { // 数据库保存的时长通过快捷键设置时可能为小数, this.startPosition为object对应输入框分秒转化到数据库后肯定为整数
VIDEO_DETAIL_CACHE[key].startPosition = db.startPosition
this.startPosition = { min: '' + parseInt(db.startPosition / 60), sec: '' + parseInt(db.startPosition % 60) }
@@ -690,6 +691,7 @@ export default {
},
async videoPlaying (isOnline) {
const db = await history.find({ site: this.video.key, ids: this.video.info.id })
const videoFlag = this.video.info.videoFlag || ''
let time = this.xg.currentTime || 0
let duration = this.xg.duration || 0
let startPosition = 0
@@ -716,7 +718,8 @@ export default {
startPosition: startPosition,
endPosition: endPosition,
detail: this.video.detail,
onlinePlay: isOnline
onlinePlay: isOnline,
videoFlag: videoFlag
}
await history.add(doc)
this.updateStar()