From 57e6ea50ad837a338e88a4b5a5addadb8d1e578f Mon Sep 17 00:00:00 2001 From: hunlongyu Date: Wed, 13 May 2020 11:46:04 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=98=8B=20=E7=B2=BE=E7=AE=80=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/components/Setting.vue | 31 +++++++++++++++ src/locales/en.json | 4 +- src/locales/zh-cn.json | 4 +- src/mini/Mini.vue | 81 ++++++++++++++++++++------------------ 5 files changed, 80 insertions(+), 42 deletions(-) diff --git a/package.json b/package.json index 8b73f41..0c2065b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "zy", - "version": "0.9.33", + "version": "0.9.35", "private": true, "author": { "name": "Hunlongyu", diff --git a/src/components/Setting.vue b/src/components/Setting.vue index 99c98ce..f18bf8d 100644 --- a/src/components/Setting.vue +++ b/src/components/Setting.vue @@ -60,6 +60,10 @@ +
+ {{$t('clearDB')}} + {{$t('clearTips')}} +
@@ -67,6 +71,7 @@ import { mapMutations } from 'vuex' import setting from '../lib/dexie/setting' import { sites } from '../lib/site/sites' +import db from '../lib/dexie/index' import '../lib/cloud/index.js' import { shell } from 'electron' import pkg from '../../package.json' @@ -148,6 +153,11 @@ export default { setting.update(this.s).then(res => { this.$m.success(this.$t('set_success')) }) + }, + clearDBEvent () { + db.delete().then(res => { + this.$m.success(this.$t('set_success')) + }) } }, created () { @@ -248,5 +258,26 @@ export default { } } } + .clearDB{ + margin-top: 20px; + margin-bottom: 20px; + .clearBtn{ + margin-left: 20px; + color: red; + cursor: pointer; + border: 1px solid #ff000088; + display: inline-block; + width: 160px; + height: 32px; + font-size: 14px; + text-align: center; + line-height: 32px; + } + .clearTips{ + font-size: 12px; + color: #ff000088; + margin-left: 10px; + } + } } diff --git a/src/locales/en.json b/src/locales/en.json index dfe1245..2a1f894 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -44,5 +44,7 @@ "copy_success": "has been copied, Download it now", "async_failed": "Synchronization successful, no updates found.", "async_success": "Synchronization succeeded, update found.", - "no_history": "No history data." + "no_history": "No history data.", + "clearDB": "Reset software", + "clearTips": "Click to clear the database and close the software" } diff --git a/src/locales/zh-cn.json b/src/locales/zh-cn.json index 5e68ad0..59a49ca 100644 --- a/src/locales/zh-cn.json +++ b/src/locales/zh-cn.json @@ -44,5 +44,7 @@ "copy_success": "已复制,快去下载吧。", "async_failed": "同步成功, 未查询到更新。", "async_success": "同步成功, 查询到更新。", - "no_history": "无历史记录" + "no_history": "无历史记录", + "clearDB": "重置软件", + "clearTips": "软件没有问题,请勿重置软件,否则数据丢失概不负责.点击即清空数据库,并关闭软件." } diff --git a/src/mini/Mini.vue b/src/mini/Mini.vue index cf632c5..6a52099 100644 --- a/src/mini/Mini.vue +++ b/src/mini/Mini.vue @@ -2,14 +2,14 @@
- {{index + 1}} / {{length}} - + {{index + 1}} / {{length}} + 上一集 - + 下一集 @@ -57,11 +57,6 @@ export default { opacity: 100, video: {}, d: {}, - show: { - prev: false, - next: false, - number: false - }, index: 0, length: 0 } @@ -76,16 +71,9 @@ export default { getUrls () { mini.find().then(res => { const v = res - if (v.index > 0) { - this.show.next = true - this.show.number = true - } this.video = res tools.detail_get(v.site, v.detail).then(res => { this.d = res - if (v.index >= this.d.m3u8_urls.length) { - this.show.next = false - } this.index = v.index this.length = this.d.m3u8_urls.length const link = res.m3u8_urls[v.index] @@ -101,6 +89,16 @@ export default { this.xg.play() } this.onPlayVideo() + this.xg.on('ended', () => { + if (this.d.m3u8_urls.length > 1 && (this.d.m3u8_urls.length - 1 > this.index)) { + this.video.currentTime = 0 + this.index++ + let src = this.d.m3u8_urls[this.index] + src = src.split('$')[1] + this.xg.src = src + this.xg.play() + } + }) }) }) }, @@ -122,37 +120,42 @@ export default { this.timer = setInterval(() => { history.find({ detail: d }).then(res => { if (res) { - const h = { ...this.video } - h.currentTime = this.xg.currentTime - h.id = res.id - history.update(res.id, h) + const v = res + v.currentTime = this.xg.currentTime + const id = v.id + delete v.id + history.update(id, v) } }) }, 10000) }, prevEvent () { - if (this.index > 0) { - this.index-- - let src = this.d.m3u8_urls[this.index] - src = src.split('$')[1] - this.xg.src = src - this.show.next = true - } - if (this.index === 0) { - this.show.prev = false - } + history.find({ detail: this.video.detail }).then(res => { + const v = res + v.index-- + const id = v.id + delete v.id + history.update(id, v).then(e => { + let src = this.d.m3u8_urls[v.index] + src = src.split('$')[1] + this.xg.src = src + this.index-- + }) + }) }, nextEvent () { - if (this.index < this.d.m3u8_urls.length - 1) { - this.index++ - let src = this.d.m3u8_urls[this.index] - src = src.split('$')[1] - this.xg.src = src - this.show.prev = true - } - if (this.index === this.d.m3u8_urls.length - 1) { - this.show.next = false - } + history.find({ detail: this.video.detail }).then(res => { + const v = res + v.index++ + const id = v.id + delete v.id + history.update(id, v).then(e => { + let src = this.d.m3u8_urls[v.index] + src = src.split('$')[1] + this.xg.src = src + this.index++ + }) + }) } }, created () {