From 850c8d5423136d449fe96a4e1b8436348477b95f Mon Sep 17 00:00:00 2001 From: Hunlongyu Date: Thu, 22 Oct 2020 10:59:29 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20=E8=A7=86=E9=A2=91=E6=BA=90?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E7=8A=B6=E6=80=81=E5=A4=84=E7=90=86,=20?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E9=87=8D=E7=BD=AE=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/EditSites.vue | 7 ++++--- src/components/Film.vue | 12 +++++++++--- src/components/Setting.vue | 21 +++++++++++++++++++-- src/lib/site/analytics.js | 12 ++++++------ yarn.lock | 5 +++++ 5 files changed, 43 insertions(+), 14 deletions(-) diff --git a/src/components/EditSites.vue b/src/components/EditSites.vue index f96bb52..eea06d8 100644 --- a/src/components/EditSites.vue +++ b/src/components/EditSites.vue @@ -122,10 +122,10 @@ export default { getSites () { sites.all().then(res => { this.sites = res + this.editSites = { + sites: res + } }) - this.editSites = { - sites: this.sites - } }, addSite () { this.dialogType = 'new' @@ -234,6 +234,7 @@ export default { this.resetId(this.sites) sites.clear().then(sites.bulkAdd(this.sites)) this.$message.success('导入成功') + this.getSites() }) } }) diff --git a/src/components/Film.vue b/src/components/Film.vue index 59abe54..b81fc9c 100644 --- a/src/components/Film.vue +++ b/src/components/Film.vue @@ -470,9 +470,15 @@ export default { }, getAllsites () { sites.all().then(res => { - this.sites = res.filter(x => x.isActive) - this.site = this.sites[0] - this.siteClick(this.site) + if (res.length <= 0) { + this.site = {} + this.type = {} + this.list = [] + } else { + this.sites = res.filter(x => x.isActive) + this.site = this.sites[0] + this.siteClick(this.site) + } }) } }, diff --git a/src/components/Setting.vue b/src/components/Setting.vue index a3934c8..f2e448e 100644 --- a/src/components/Setting.vue +++ b/src/components/Setting.vue @@ -142,6 +142,7 @@ import { mapMutations } from 'vuex' import pkg from '../../package.json' import { setting, sites, shortcut, star } from '../lib/dexie' +import { sites as defaultSites } from '../lib/dexie/initData' import { shell, clipboard, remote } from 'electron' import db from '../lib/dexie/dexie' export default { @@ -193,10 +194,18 @@ export default { set (val) { this.SET_SETTING(val) } + }, + editSites: { + get () { + return this.$store.getters.getEditSites + }, + set (val) { + this.SET_EDITSITES(val) + } } }, methods: { - ...mapMutations(['SET_SETTING', 'SET_VIEW']), + ...mapMutations(['SET_SETTING', 'SET_VIEW', 'SET_EDITSITES']), linkOpen (e) { shell.openExternal(e) }, @@ -218,7 +227,15 @@ export default { }, getSites () { sites.all().then(res => { - this.sitesList = res + if (res.length <= 0) { + this.$message.warning('检测到视频源未能正常加载, 即将重置源.') + sites.clear().then(sites.bulkAdd(defaultSites).then(this.getSites())) + } else { + this.sitesList = res + this.editSites = { + sites: res + } + } }) }, getShortcut () { diff --git a/src/lib/site/analytics.js b/src/lib/site/analytics.js index b464a8b..822f246 100644 --- a/src/lib/site/analytics.js +++ b/src/lib/site/analytics.js @@ -1,6 +1,6 @@ -const hmt = window._hmt -hmt.push(['_trackEvent', 'video', 'play', '海上钢琴师']) -hmt.push(['_trackEvent', 'video', 'play', '三国演义']) -hmt.push(['_trackEvent', 'page', 'open', 'Film']) -hmt.push(['_trackEvent', 'page', 'open', 'IPTV']) -console.log(hmt) +const _hmt = window._hmt +_hmt.push(['_trackEvent', 'video', 'play', '红楼梦']) +// _hmt.push(['_trackEvent', 'video', 'play', '三国演义']) +// _hmt.push(['_trackEvent', 'page', 'open', 'Film']) +// _hmt.push(['_trackEvent', 'page', 'open', 'IPTV']) +console.log(_hmt) diff --git a/yarn.lock b/yarn.lock index ae97ead..1c5c338 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9580,6 +9580,11 @@ uuid@^3.3.2, uuid@^3.4.0: resolved "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== +v-fit-columns@^0.2.0: + version "0.2.0" + resolved "https://registry.npm.taobao.org/v-fit-columns/download/v-fit-columns-0.2.0.tgz#4d75b0eb66fcd701025044f356cc00e8d6fec7a2" + integrity sha1-TXWw62b81wECUETzVswA6Nb+x6I= + v8-compile-cache@^2.0.3: version "2.1.1" resolved "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz#54bc3cdd43317bca91e35dcaf305b1a7237de745"