🎨 视频源异常状态处理, 自动重置源

This commit is contained in:
Hunlongyu
2020-10-22 10:59:29 +08:00
parent 63cf367f52
commit 850c8d5423
5 changed files with 43 additions and 14 deletions

View File

@@ -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()
})
}
})

View File

@@ -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)
}
})
}
},

View File

@@ -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 () {

View File

@@ -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)

View File

@@ -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"