为未完成任务添加重试按钮

This commit is contained in:
root
2026-07-11 15:02:04 +08:00
parent c47cd3fb0d
commit 826b080da0
2 changed files with 32 additions and 4 deletions
+18 -2
View File
@@ -34,12 +34,17 @@
</template>
</el-table-column>
<el-table-column label="操作" width="280">
<el-table-column label="操作" width="360">
<template #default="scoped">
<span>
<el-button @click="downloadTask(scoped.row.download)" :disabled="scoped.row.status !== '下载完成'">下载</el-button>
<el-button @click="changeGalleryCollect(scoped.row.gid, scoped.row.isCollect)">{{scoped.row.isCollect ? '取消收藏' : '收藏'}}</el-button>
<el-button @click="readOnlineGallery(scoped.row)">在线看</el-button>
<el-button v-if="scoped.row.status !== '下载完成'"
@click="retryGallery(scoped.row.gid)"
:loading="retryingGids.has(scoped.row.gid)">
重试
</el-button>
</span>
</template>
</el-table-column>
@@ -123,6 +128,7 @@ let username = computed(() => {
//防抖计时器
let debounceTimer = 0
let retryingGids = ref(new Set())
//是否加载完成
let loadComplete = computed(() => {
return store.state.loadComplete
@@ -220,6 +226,16 @@ function downloadTask(link){
function deleteGallery(gid){
store.dispatch("deleteGallery", gid)
}
async function retryGallery(gid){
if(retryingGids.value.has(gid))
return
retryingGids.value.add(gid)
try {
await store.dispatch("retryGallery", gid)
} finally {
retryingGids.value.delete(gid)
}
}
function readOnlineGallery(gallery){
store.dispatch("readOnlineGallery", gallery)
}
@@ -271,4 +287,4 @@ function showThumbnail(gallery){
.detail-info > span {
display: block;
}
</style>
</style>