From 025d1606f7d8cdf2ecba140cbd0aefbf24f77a46 Mon Sep 17 00:00:00 2001 From: buvta <12312540+buvta@users.noreply.github.com> Date: Thu, 31 Dec 2020 15:08:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E5=AD=98videoFlag?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Detail.vue | 9 ++++++++- src/components/Play.vue | 5 ++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/components/Detail.vue b/src/components/Detail.vue index c16e53e..008518d 100644 --- a/src/components/Detail.vue +++ b/src/components/Detail.vue @@ -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) { diff --git a/src/components/Play.vue b/src/components/Play.vue index 98da1d0..4c86466 100644 --- a/src/components/Play.vue +++ b/src/components/Play.vue @@ -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()