From 15a38f1b9cc6da037ea93d76dfc1cebd9d8f466a Mon Sep 17 00:00:00 2001 From: haiyangcui Date: Fri, 6 Nov 2020 18:07:05 +0100 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=8E=86=E5=8F=B2=E8=A7=86?= =?UTF-8?q?=E5=9B=BE=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Detail.vue | 6 ++- src/components/Film.vue | 3 ++ src/components/History.vue | 79 +++++++++++++++++++++++++++++-- src/components/Play.vue | 10 ++-- src/components/Recommendation.vue | 4 +- src/components/Star.vue | 4 +- src/lib/dexie/dexie.js | 2 +- src/lib/dexie/initData.js | 1 + 8 files changed, 94 insertions(+), 15 deletions(-) diff --git a/src/components/Detail.vue b/src/components/Detail.vue index 93e684c..50b65ea 100644 --- a/src/components/Detail.vue +++ b/src/components/Detail.vue @@ -143,18 +143,21 @@ export default { }, async playEvent (n) { if (!this.playOnline) { + console.log(this.detail) const db = await history.find({ site: this.detail.key, ids: this.detail.info.id }) if (db) { this.video = { key: db.site, info: { id: db.ids, name: db.name, index: n, site: this.detail.site } } } else { this.video = { key: this.detail.key, info: { id: this.detail.info.id, name: this.detail.info.name, index: n, site: this.detail.site } } } + this.video.detail = this.info this.view = 'Play' this.detail.show = false } else { const db = await history.find({ site: this.detail.key, ids: this.detail.info.id }) if (db) { db.index = n + db.detail = this.info history.update(db.id, db) } else { const doc = { @@ -164,7 +167,8 @@ export default { type: this.detail.info.type, year: this.detail.info.year, index: n, - time: '' + time: '', + detail: this.info } history.add(doc) } diff --git a/src/components/Film.vue b/src/components/Film.vue index e80d3d3..93ff884 100644 --- a/src/components/Film.vue +++ b/src/components/Film.vue @@ -410,6 +410,9 @@ export default { } else { this.video = { key: site.key, info: { id: e.id, name: e.name, index: 0, site: site } } } + zy.detail(site.key, e.id).then(detailRes => { + this.video.detail = detailRes + }) this.view = 'Play' }, async starEvent (site, e) { diff --git a/src/components/History.vue b/src/components/History.vue index 377bde7..379b4e3 100644 --- a/src/components/History.vue +++ b/src/components/History.vue @@ -1,12 +1,13 @@ + + + 播放 分享 下载 - 删除 + 删除 +
+ + + +
diff --git a/src/components/Play.vue b/src/components/Play.vue index a6e5881..9a902d9 100644 --- a/src/components/Play.vue +++ b/src/components/Play.vue @@ -437,10 +437,10 @@ export default { type: db.type, year: db.year, index: this.video.info.index, - time: db.time + time: db.time, + detail: this.video.detail } - history.remove(db.id) - history.add(doc) + history.update(db.id, doc) } else { const doc = { site: this.video.key, @@ -449,7 +449,8 @@ export default { type: this.video.info.type, year: this.video.info.year, index: this.video.info.index, - time: '' + time: '', + detail: this.video.detail } history.add(doc) } @@ -473,6 +474,7 @@ export default { if (db) { const doc = { ...db } doc.time = this.xg.currentTime + doc.duration = this.xg.duration delete doc.id history.update(db.id, doc) } diff --git a/src/components/Recommendation.vue b/src/components/Recommendation.vue index 136916a..c2ce0a7 100644 --- a/src/components/Recommendation.vue +++ b/src/components/Recommendation.vue @@ -221,9 +221,9 @@ export default { async playEvent (e) { const db = await history.find({ site: e.key, ids: e.ids }) if (db) { - this.video = { key: e.key, info: { id: db.ids, name: db.name, index: db.index } } + this.video = { key: e.key, info: { id: db.ids, name: db.name, index: db.index }, detail: db.detail } } else { - this.video = { key: e.key, info: { id: e.ids, name: e.name, index: 0 } } + this.video = { key: e.key, info: { id: e.ids, name: e.name, index: 0 }, detail: e.detail } } this.view = 'Play' }, diff --git a/src/components/Star.vue b/src/components/Star.vue index f2087a2..0ba256d 100644 --- a/src/components/Star.vue +++ b/src/components/Star.vue @@ -222,9 +222,9 @@ export default { }, async playEvent (e) { if (e.index) { - this.video = { key: e.key, info: { id: e.ids, name: e.name, index: e.index } } + this.video = { key: e.key, info: { id: e.ids, name: e.name, index: e.index }, detail: e.detail } } else { - this.video = { key: e.key, info: { id: e.ids, name: e.name, index: 0 } } + this.video = { key: e.key, info: { id: e.ids, name: e.name, index: 0 }, detail: e.detail } } if (e.hasUpdate) { this.clearHasUpdateFlag(e) diff --git a/src/lib/dexie/dexie.js b/src/lib/dexie/dexie.js index 37aef29..9a54556 100644 --- a/src/lib/dexie/dexie.js +++ b/src/lib/dexie/dexie.js @@ -11,7 +11,7 @@ db.version(4).stores({ star: '++id, [key+ids], site, name, detail, index, rate, hasUpdate', recommendation: '++id, [key+ids], site, name, detail, index, rate, hasUpdate', sites: '++id, key, name, api, download, isActive, group', - history: '++id, [site+ids], name, type, year, index, time', + history: '++id, [site+ids], name, type, year, index, time, detail', mini: 'id, site, ids, name, index, time', iptv: '++id, name, url, group' }) diff --git a/src/lib/dexie/initData.js b/src/lib/dexie/initData.js index 5b33f15..eb8558e 100644 --- a/src/lib/dexie/initData.js +++ b/src/lib/dexie/initData.js @@ -11,6 +11,7 @@ const setting = [ forwardTimeInSec: 5, starViewMode: 'picture', recommendationViewMode: 'picture', + historyViewMode: 'picture', password: '' } ]