更换下载库

This commit is contained in:
lyswhut
2019-11-16 20:16:09 +08:00
parent 967093328f
commit 6d935d8589
11 changed files with 441 additions and 149 deletions
+25 -19
View File
@@ -80,9 +80,11 @@ export default {
return this.listId == 'download'
},
playListIndex() {
if (this.listId != 'download') return
let path = this.list[this.playIndex].filePath
return this.showList.findIndex(i => i.filePath == path)
if (this.listId != 'download' || !this.list.length) return
let info = this.list[this.playIndex]
if (!info) return -1
let key = info.key
return this.showList.findIndex(i => i.key == key)
},
showList() {
switch (this.tabId) {
@@ -120,16 +122,16 @@ export default {
...mapMutations('player', ['setList']),
...mapMutations('download', ['pauseTask']),
handlePauseTask(index) {
let info = this.showList[index]
let info = this.list[index]
let dl = this.dls[info.key]
dl ? dl.pause() : this.pauseTask(info)
dl ? dl.stop() : this.pauseTask(info)
console.log('pause')
},
handleStartTask(index) {
console.log('start')
let info = this.showList[index]
let info = this.list[index]
let dl = this.dls[info.key]
dl ? dl.resume() : this.startTask(info)
dl ? dl.start() : this.startTask(info)
},
handleDoubleClick(index) {
if (
@@ -145,7 +147,9 @@ export default {
this.clickIndex = -1
},
handleClick(index) {
let info = this.showList[index]
const key = this.showList[index].key
index = this.list.findIndex(i => i.key === key)
let info = this.list[index]
if (info.isComplate) {
this.handlePlay(index)
} else if (info.status === this.downloadStatus.RUN) {
@@ -155,26 +159,28 @@ export default {
}
},
handlePlay(index) {
if (!checkPath(this.showList[index].filePath)) return
let path = this.showList[index].filePath
if (!checkPath(this.list[index].filePath)) return
let path = this.list[index].filePath
this.setList({ list: this.list, listId: 'download', index: this.list.findIndex(i => i.filePath === path) })
},
handleListBtnClick(info) {
const key = this.showList[info.index].key
let index = this.list.findIndex(i => i.key === key)
switch (info.action) {
case 'play':
this.handlePlay(info.index)
this.handlePlay(index)
break
case 'start':
this.handleStartTask(info.index)
this.handleStartTask(index)
break
case 'pause':
this.handlePauseTask(info.index)
this.handlePauseTask(index)
break
case 'remove':
this.removeTask(info.index)
this.removeTask(index)
break
case 'file':
this.handleOpenFolder(info.index)
this.handleOpenFolder(index)
break
}
},
@@ -190,7 +196,7 @@ export default {
case 'start':
this.selectdData.forEach(item => {
if (item.isComplate || item.status == this.downloadStatus.RUN) return
let index = this.showList.indexOf(item)
let index = this.list.indexOf(item)
if (index < 0) return
this.handleStartTask(index)
})
@@ -200,13 +206,13 @@ export default {
this.selectdData.forEach(item => {
if (item.isComplate || item.status == this.downloadStatus.PAUSE) return
if (item.status == this.downloadStatus.RUN) return runs.push(item)
let index = this.showList.indexOf(item)
let index = this.list.indexOf(item)
if (index < 0) return
this.handlePauseTask(index)
})
runs.forEach(item => {
if (item.isComplate || item.status == this.downloadStatus.PAUSE) return
let index = this.showList.indexOf(item)
let index = this.list.indexOf(item)
if (index < 0) return
this.handlePauseTask(index)
})
@@ -219,7 +225,7 @@ export default {
this.resetSelect()
},
handleOpenFolder(index) {
let path = this.showList[index].filePath
let path = this.list[index].filePath
if (!checkPath(path)) return
openDirInExplorer(path)
},
+2 -2
View File
@@ -78,7 +78,7 @@ div.scroll(:class="$style.setting")
material-checkbox(id="setting_download_isDownloadLrc" v-model="current_setting.download.isDownloadLrc" label="是否启用")
dt 网络设置
dd
h3 代理设置(歌曲下载暂不支持代理)
h3 代理设置
div
p
material-checkbox(id="setting_network_proxy_enable" v-model="current_setting.network.proxy.enable" @change="handleProxyChange('enable')" label="是否启用")
@@ -108,7 +108,7 @@ div.scroll(:class="$style.setting")
material-btn(:class="[$style.btn, $style.gapLeft]" min @click="handleExportAllData") 导出
dt 其他
dd
h3 缓存大小(清理缓存后图片等资源将需要重新下载)
h3 缓存大小(清理缓存后图片等资源将需要重新下载,不建议清除,软件会自动将大小维持在200M左右)
div
p
| 软件已使用缓存大小: