mirror of
https://github.com/cuiocean/ZY-Player.git
synced 2026-06-30 16:46:08 +08:00
可以打开或关闭源是否为自选源
This commit is contained in:
@@ -18,6 +18,19 @@
|
||||
label="资源名"
|
||||
min-width="200">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="isActive"
|
||||
label="自选源"
|
||||
width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-switch
|
||||
v-model="scope.row.isActive"
|
||||
:active-value="1"
|
||||
:inactive-value="0"
|
||||
@change='isActiveChangeEvent'>
|
||||
</el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
header-align="center"
|
||||
@@ -215,6 +228,9 @@ export default {
|
||||
json.forEach(ele => {
|
||||
if (this.sites.filter(x => x.key === ele.key).length === 0 && this.sites.filter(x => x.name === ele.name && x.url === ele.url).length === 0) {
|
||||
// 不含该key 同时也不含名字和url一样的
|
||||
if (ele.isActive === undefined) {
|
||||
ele.isActive = 1
|
||||
}
|
||||
this.sites.push(ele)
|
||||
}
|
||||
})
|
||||
@@ -233,6 +249,9 @@ export default {
|
||||
this.sites.sort(function (x, y) { return x.key === i.key ? -1 : y.key === i.key ? 1 : 0 })
|
||||
this.updateDatabase(this.sites)
|
||||
},
|
||||
isActiveChangeEvent () {
|
||||
this.updateDatabase(this.sites)
|
||||
},
|
||||
resetId (inArray) {
|
||||
var id = 1
|
||||
inArray.forEach(ele => {
|
||||
|
||||
@@ -470,7 +470,7 @@ export default {
|
||||
},
|
||||
getAllsites () {
|
||||
sites.all().then(res => {
|
||||
this.sites = res
|
||||
this.sites = res.filter(x => x.isActive)
|
||||
this.site = this.sites[0]
|
||||
this.siteClick(this.site)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user