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

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)