diff --git a/src/components/EditSites.vue b/src/components/EditSites.vue
index 51f0d14..de0c5cf 100644
--- a/src/components/EditSites.vue
+++ b/src/components/EditSites.vue
@@ -6,21 +6,22 @@
新增
导出
导入
- 检测
- 清空
+ 检测{{ this.checkAllSitesLoading ? this.checkProgress + '/' + this.sites.length : '' }}
重置
+ @click.native.stop='isActiveChangeEvent(scope.row)'>
@@ -47,7 +49,7 @@
prop="group"
label="分组"
:filters="getFilters"
- :filter-method="filterHandle"
+ :filter-method="(value, row) => value === row.group"
filter-placement="bottom-end">
置顶
编辑
- 检测
+ 检测
删除
@@ -131,7 +133,7 @@ export default {
api: '',
download: '',
group: '',
- isActive: 1
+ isActive: true
},
siteGroup: [],
rules: {
@@ -144,9 +146,14 @@ export default {
},
enableBatchEdit: false,
batchGroupName: '',
- batchIsActive: 1,
+ batchIsActive: true,
+ shiftDown: false,
+ selectionBegin: '',
+ selectionEnd: '',
multipleSelection: [],
- checkAllSiteLoading: false,
+ checkAllSitesLoading: false,
+ checkProgress: 0,
+ stopFlag: false,
editOldkey: ''
}
},
@@ -159,14 +166,6 @@ export default {
this.SET_SETTING(val)
}
},
- editSites: {
- get () {
- return this.$store.getters.getEditSites
- },
- set (val) {
- this.SET_EDITSITES(val)
- }
- },
getFilters () {
const groups = [...new Set(this.sites.map(site => site.group))]
var filters = []
@@ -180,21 +179,48 @@ export default {
return filters
}
},
+ watch: {
+ enableBatchEdit () {
+ if (this.checkAllSitesLoading) {
+ this.$message.info('正在检测, 请勿操作.')
+ this.enableBatchEdit = false
+ }
+ }
+ },
methods: {
- ...mapMutations(['SET_SETTING', 'SET_EDITSITES']),
+ ...mapMutations(['SET_SETTING']),
excludeR18FilmsChangeEvent () {
setting.find().then(res => {
res.excludeR18Films = this.setting.excludeR18Films
setting.update(res)
})
},
- filterHandle (value, row) {
- return row.group === value
+ selectionCellClick (selection, row) {
+ if (this.shiftDown && this.selectionBegin !== '' && selection.includes(row)) {
+ this.selectionEnd = row.id
+ const start = Math.min(this.selectionBegin, this.selectionEnd) - 1
+ const end = Math.max(this.selectionBegin, this.selectionEnd)
+ const selections = this.sites.slice(start, end)
+ this.$nextTick(() => {
+ selections.forEach(e => this.$refs.editSitesTable.toggleRowSelection(e, true))
+ })
+ this.selectionBegin = this.selectionEnd = ''
+ return
+ }
+ if (selection.includes(row)) {
+ this.selectionBegin = row.id
+ } else {
+ this.selectionBegin = ''
+ }
},
handleSelectionChange (rows) {
this.multipleSelection = rows
},
handleSortChange (column, prop, order) {
+ if (this.checkAllSitesLoading) {
+ this.$message.info('正在检测, 请勿操作.')
+ return false
+ }
this.updateDatabase(this.sites)
},
saveBatchEdit () {
@@ -208,10 +234,12 @@ export default {
},
getSites () {
sites.all().then(res => {
+ res.forEach(ele => {
+ if (ele.isActive === undefined) {
+ ele.isActive = true
+ }
+ })
this.sites = res
- this.editSites = {
- sites: res
- }
})
},
getSitesGroup () {
@@ -224,6 +252,10 @@ export default {
this.siteGroup = arr
},
addSite () {
+ if (this.checkAllSitesLoading) {
+ this.$message.info('正在检测, 请勿操作.')
+ return false
+ }
this.getSitesGroup()
this.dialogType = 'new'
this.dialogVisible = true
@@ -233,15 +265,15 @@ export default {
api: '',
download: '',
group: '',
- isActive: 1
+ isActive: true
}
},
editSite (siteInfo) {
- this.getSitesGroup()
- if (this.checkAllSiteLoading) {
+ if (this.checkAllSitesLoading) {
this.$message.info('正在检测, 请勿操作.')
return false
}
+ this.getSitesGroup()
this.dialogType = 'edit'
this.dialogVisible = true
this.siteInfo = siteInfo
@@ -252,7 +284,7 @@ export default {
this.getSites()
},
removeEvent (e) {
- if (this.checkAllSiteLoading) {
+ if (this.checkAllSitesLoading) {
this.$message.info('正在检测, 请勿操作.')
return false
}
@@ -329,6 +361,10 @@ export default {
})
},
importSites () {
+ if (this.checkAllSitesLoading) {
+ this.$message.info('正在检测, 请勿操作.')
+ return false
+ }
const options = {
filters: [
{ name: 'JSON file', extensions: ['json'] },
@@ -346,7 +382,7 @@ export default {
if (ele.api && this.sites.filter(x => x.key === ele.key).length === 0 && this.sites.filter(x => x.name === ele.name && x.api === ele.api).length === 0) {
// 不含该key 同时也不含名字和url一样的
if (ele.isActive === undefined) {
- ele.isActive = 1
+ ele.isActive = true
}
if (ele.group === undefined) {
ele.group = '导入'
@@ -363,11 +399,16 @@ export default {
})
},
resetSitesEvent () {
+ this.stopFlag = true
+ if (this.checkAllSitesLoading) {
+ this.$message.info('部分检测还未完全终止, 请稍等...')
+ return
+ }
sites.clear().then(sites.bulkAdd(defaultSites).then(this.getSites()))
this.$message.success('重置源成功')
},
moveToTopEvent (i) {
- if (this.checkAllSiteLoading) {
+ if (this.checkAllSitesLoading) {
this.$message.info('正在检测, 请勿操作.')
return false
}
@@ -375,7 +416,7 @@ export default {
this.updateDatabase()
},
syncTableData () {
- if (this.$refs.editSitesTable.tableData && this.$refs.editSitesTable.tableData.length === this.sites.length) {
+ if (this.$refs.editSitesTable.tableData) {
this.sites = this.$refs.editSitesTable.tableData
}
},
@@ -402,10 +443,18 @@ export default {
sites.bulkAdd(this.sites).then(this.getSites())
})
},
- removeAllSites () {
- sites.clear().then(this.getSites())
+ removeSelectedSites () {
+ this.multipleSelection.forEach(e => sites.remove(e.id))
+ this.$refs.editSitesTable.clearFilter()
+ this.getSites()
+ this.updateDatabase()
+ this.enableBatchEdit = false
},
rowDrop () {
+ if (this.checkAllSitesLoading) {
+ this.$message.info('正在检测, 请勿操作.')
+ return false
+ }
const tbody = document.getElementById('sites-table').querySelector('.el-table__body-wrapper tbody')
var _this = this
Sortable.create(tbody, {
@@ -417,20 +466,30 @@ export default {
})
},
async checkAllSite () {
- this.checkAllSiteLoading = true
- Promise.all(this.sites.map(site => this.checkSingleSite(site))).then(res => {
- this.checkAllSiteLoading = false
+ this.checkAllSitesLoading = true
+ this.stopFlag = false
+ this.checkProgress = 0
+ const uncheckedList = this.sites.filter(e => e.status === undefined || e.status === ' ') // 未检测过的优先
+ const other = this.sites.filter(e => !uncheckedList.includes(e))
+ await Promise.all(uncheckedList.map(site => this.checkSingleSite(site)))
+ await Promise.all(other.map(site => this.checkSingleSite(site))).then(res => {
+ this.checkAllSitesLoading = false
this.getSites()
})
},
async checkSingleSite (row) {
row.status = ' '
+ if (this.stopFlag) {
+ this.checkProgress += 1
+ return row.status
+ }
const flag = await zy.check(row.key)
+ this.checkProgress += 1
if (flag) {
row.status = '可用'
} else {
row.status = '失效'
- row.isActive = 0
+ row.isActive = false
}
sites.remove(row.id)
sites.add(row)
@@ -439,6 +498,8 @@ export default {
},
mounted () {
this.rowDrop()
+ addEventListener('keydown', code => { if (code.keyCode === 16) this.shiftDown = true })
+ addEventListener('keyup', code => { if (code.keyCode === 16) this.shiftDown = false })
},
created () {
this.getSites()
diff --git a/src/components/IPTV.vue b/src/components/IPTV.vue
index 4b1a7df..796da18 100644
--- a/src/components/IPTV.vue
+++ b/src/components/IPTV.vue
@@ -45,7 +45,7 @@
prop="isActive"
width="120"
align="center"
- :filters = "[{text:'启用', value: 1}, {text:'停用', value: 0}]"
+ :filters = "[{text:'启用', value: true}, {text:'停用', value: false}]"
:filter-method="(value, row) => value === row.isActive"
label="启用">
diff --git a/src/components/Play.vue b/src/components/Play.vue
index 3231e14..c5a631f 100644
--- a/src/components/Play.vue
+++ b/src/components/Play.vue
@@ -1051,7 +1051,7 @@ export default {
},
getIptvList () {
iptv.all().then(res => {
- this.iptvList = res
+ this.iptvList = res.filter(e => e.isActive)
})
},
bindEvent () {
diff --git a/src/components/Setting.vue b/src/components/Setting.vue
index 4c7b75b..6882fd8 100644
--- a/src/components/Setting.vue
+++ b/src/components/Setting.vue
@@ -174,7 +174,6 @@ export default {
data () {
return {
pkg: pkg,
- sitesList: [],
shortcutList: [],
show: {
site: false,
@@ -206,18 +205,10 @@ 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', 'SET_EDITSITES']),
+ ...mapMutations(['SET_SETTING', 'SET_VIEW']),
linkOpen (e) {
shell.openExternal(e)
},
@@ -232,11 +223,6 @@ export default {
if (res.length <= 0) {
this.$message.warning('检测到视频源未能正常加载, 即将重置源.')
sites.clear().then(sites.bulkAdd(defaultSites).then(this.getSites()))
- } else {
- this.sitesList = res
- this.editSites = {
- sites: res
- }
}
})
},
diff --git a/src/lib/dexie/iniData/Iptv.json b/src/lib/dexie/iniData/Iptv.json
index fe07c2f..4e2d9f1 100644
--- a/src/lib/dexie/iniData/Iptv.json
+++ b/src/lib/dexie/iniData/Iptv.json
@@ -1667,4 +1667,4 @@
"url": "https://www.fanmingming.cn/hls/fhzw.m3u8",
"group": "港澳台"
}
-]
\ No newline at end of file
+]
diff --git a/src/lib/dexie/iniData/Sites.json b/src/lib/dexie/iniData/Sites.json
index 5401b3a..98e307b 100644
--- a/src/lib/dexie/iniData/Sites.json
+++ b/src/lib/dexie/iniData/Sites.json
@@ -5,7 +5,6 @@
"name": "麻花资源",
"api": "https://www.mhapi123.com/inc/api.php",
"download": "",
- "isActive": 1,
"group": "默认"
},
{
@@ -14,7 +13,6 @@
"name": "速播资源站",
"api": "https://www.subo988.com/inc/api.php",
"download": "",
- "isActive": 1,
"group": "默认"
},
{
@@ -32,7 +30,6 @@
"name": "1886 资源",
"api": "http://cj.1886zy.co/inc/api.php",
"download": "",
- "isActive": 1,
"group": "默认"
},
{
@@ -41,7 +38,6 @@
"name": "88 影视资源站",
"api": "http://www.88zyw.net/inc/api.php",
"download": "",
- "isActive": 1,
"group": "默认"
},
{
@@ -59,7 +55,6 @@
"name": "秒播资源",
"api": "http://caiji.mb77.vip/inc/api.php",
"download": "",
- "isActive": 1,
"group": "默认"
},
{
@@ -68,7 +63,6 @@
"name": "最大资源网",
"api": "http://www.zdziyuan.com/inc/api.php",
"download": "http://www.zdziyuan.com/inc/apidown.php",
- "isActive": 1,
"group": "默认"
},
{
@@ -77,7 +71,6 @@
"name": "123 资源",
"api": "http://cj.123ku2.com:12315/inc/api.php",
"download": "",
- "isActive": 1,
"group": "默认"
},
{
@@ -86,7 +79,6 @@
"name": "OK 资源网",
"api": "http://cj.okzy.tv/inc/api.php",
"download": "http://cj.okzy.tv/inc/apidown.php",
- "isActive": 1,
"group": "默认"
},
{
@@ -95,7 +87,6 @@
"name": "酷云资源",
"api": "http://caiji.kuyun98.com/inc/ldg_api.php",
"download": "http://caiji.kuyun98.com/inc/apidown.php",
- "isActive": 1,
"group": "默认"
},
{
@@ -104,7 +95,6 @@
"name": "最新资源",
"api": "http://api.zuixinapi.com/inc/api.php",
"download": "",
- "isActive": 1,
"group": "默认"
},
{
@@ -113,7 +103,6 @@
"name": "酷播资源",
"api": "http://api.kbzyapi.com/inc/api.php",
"download": "",
- "isActive": 1,
"group": "默认"
},
{
@@ -122,7 +111,6 @@
"name": "永久资源",
"api": "http://cj.yongjiuzyw.com/inc/api.php",
"download": "",
- "isActive": 1,
"group": "默认"
},
{
@@ -131,7 +119,6 @@
"name": "人人资源",
"api": "https://www.rrzyw.cc/api.php/provide/vod/from/rrm3u8/at/xml/",
"download": "",
- "isActive": 1,
"group": "默认"
},
{
@@ -140,7 +127,6 @@
"name": "步步高顶尖资源网",
"api": "http://api.bbkdj.com/api",
"download": "",
- "isActive": 1,
"group": "默认"
},
{
@@ -149,7 +135,6 @@
"name": "搜乐资源网",
"api": "https://www.caijizy.vip/api.php/provide/vod/at/xml/",
"download": "",
- "isActive": 1,
"group": "默认"
},
{
@@ -158,7 +143,6 @@
"name": "605资源",
"api": "http://www.605zy.net/inc/seacmsapi.php",
"download": "",
- "isActive": 1,
"group": "默认"
},
{
@@ -167,7 +151,6 @@
"name": "豆瓣电影资源",
"api": "http://v.1988cj.com/inc/api.php",
"download": "http://v.1988cj.com/inc/apidown.php",
- "isActive": 1,
"group": "默认"
},
{
@@ -176,7 +159,6 @@
"name": "135 资源网",
"api": "http://cj.zycjw1.com/inc/api.php",
"download": "http://cj.zycjw1.com/inc/apidown.php",
- "isActive": 1,
"group": "默认"
},
{
@@ -185,7 +167,6 @@
"name": "芒果 TV 资源网",
"api": "https://api.shijiapi.com/api.php/provide/vod/at/xml/",
"download": "",
- "isActive": 1,
"group": "默认"
},
{
@@ -194,7 +175,6 @@
"name": "209 资源",
"api": "http://cj.1156zy.com/inc/api.php",
"download": "",
- "isActive": 1,
"group": "默认"
},
{
@@ -203,7 +183,6 @@
"name": "快快资源",
"api": "https://api.kkzy.tv/inc/api.php",
"download": "",
- "isActive": 1,
"group": "默认"
},
{
@@ -212,7 +191,6 @@
"name": "卧龙资源",
"api": "http://cj.wlzy.tv/inc/api_mac.php",
"download": "",
- "isActive": 1,
"group": "默认"
},
{
@@ -221,7 +199,6 @@
"name": "魔卡资源网",
"api": "https://cj.heiyap.com/api.php/provide/vod/at/xml/",
"download": "",
- "isActive": 1,
"group": "默认"
},
{
@@ -230,7 +207,6 @@
"name": "壹伍捌资源网",
"api": "http://cj.158zyz.net:158/inc/api.php",
"download": "",
- "isActive": 1,
"group": "默认"
},
{
@@ -239,7 +215,6 @@
"name": "快影资源站",
"api": "https://www.kyzy.tv/api.php/kyyun/vod/at/xml/",
"download": "",
- "isActive": 1,
"group": "默认"
}
-]
\ No newline at end of file
+]