From 826b080da0d542b896024469729a11eb44c90670 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 11 Jul 2026 15:02:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BA=E6=9C=AA=E5=AE=8C=E6=88=90=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E6=B7=BB=E5=8A=A0=E9=87=8D=E8=AF=95=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Side.vue | 20 ++++++++++++++++++-- src/store/index.js | 16 ++++++++++++++-- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/src/components/Side.vue b/src/components/Side.vue index a3e6bc0..2a19edd 100644 --- a/src/components/Side.vue +++ b/src/components/Side.vue @@ -34,12 +34,17 @@ - + @@ -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; } - \ No newline at end of file + diff --git a/src/store/index.js b/src/store/index.js index dc4ff39..62a35b7 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -29,7 +29,7 @@ const actions = { }) }, updateGalleryTasks(context){ - axios.get(GalleryManageUrl, { + return axios.get(GalleryManageUrl, { params:{ AuthCode: context.state.AuthCode, type: 'all' @@ -147,6 +147,17 @@ const actions = { ElMessage(res.data.data) }) }, + retryGallery(context, gid){ + return axios.post(GalleryManageUrl + "/retry?" + qs.stringify({ + gid, AuthCode: context.state.AuthCode + })).then((res) => { + if(res.data.result === "success"){ + ElMessage({message: "重试结果:" + res.data.data, type: "success"}) + return context.dispatch("updateGalleryTasks") + } + ElMessage({message: res.data.data || "重试失败", type: "error"}) + }) + }, readOnlineGallery(context, gallery){ if(gallery.images !== undefined && gallery.images.length !== 0) context.commit("_setReadingGallery", gallery) @@ -217,6 +228,7 @@ const mutations = { //处理进度相关 switch (task.status) { case "已提交": + case "等待压缩": case "压缩中": task.progress = task.status break; @@ -514,4 +526,4 @@ function deleteTask(tasks, key, value){ } } -let status = ['已提交', '下载中', '等待压缩', '压缩中', '下载完成'] \ No newline at end of file +let status = ['已提交', '下载中', '等待压缩', '压缩中', '下载完成']