From bd7fba5184c13ef98c969ca6e428e264b3c47350 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 11 Jul 2026 15:36:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=94=BB=E5=BB=8A=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E6=8C=89=E9=92=AE=E5=92=8C=E4=B8=8B=E8=BD=BD=E9=93=BE?= =?UTF-8?q?=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/DashBoard.vue | 11 +++++++++-- src/store/index.js | 15 ++++++++++++--- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/components/DashBoard.vue b/src/components/DashBoard.vue index 8c94ffa..97b5ac7 100644 --- a/src/components/DashBoard.vue +++ b/src/components/DashBoard.vue @@ -84,7 +84,7 @@ @@ -271,6 +271,13 @@ function deleteGallery(){ store.dispatch("deleteGallery", chosenGallery.value.gid) } +function downloadChosenGallery(){ + if(chosenGallery.value.download) + window.open(chosenGallery.value.download) + else + ElMessage({message: "下载地址不存在,请刷新任务后重试", type: "error"}) +} + function validate(){ if(AuthCode.value.trim() === ""){ ElMessage("请输入授权码后再验证") @@ -357,4 +364,4 @@ function saveConfig(){ \ No newline at end of file + diff --git a/src/store/index.js b/src/store/index.js index 62a35b7..597b3bc 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -64,8 +64,12 @@ const actions = { AuthCode: context.state.AuthCode } }).then((res) => { - if(res.data.result === 'success') - context.commit("_setChosenGallery", {gallery: JSON.parse(res.data.data)}) + if(res.data.result === 'success'){ + let gallery = JSON.parse(res.data.data) + if(gallery.status === "下载完成") + gallery.download = buildGalleryDownloadUrl(gallery.gid, context.state.AuthCode) + context.commit("_setChosenGallery", {gallery}) + } else ElMessage("查询失败") }) @@ -237,7 +241,7 @@ const mutations = { break; case "下载完成": task.progress = task.status - task.download = GalleryManageUrl + "/file/" + encodeURI(task.name) + ".zip?AuthCode=" + state.AuthCode + "&gid=" + task.gid + task.download = buildGalleryDownloadUrl(task.gid, state.AuthCode) break; } @@ -483,6 +487,11 @@ function getShortname(name){ return name.replace(/\s*\[[^\]]*\]\s*/g, '').replace(/\s*\([^\)]*\)\s*/g, '').trim() } +function buildGalleryDownloadUrl(gid, AuthCode){ + let params = new URLSearchParams({AuthCode, gid: gid.toString()}) + return GalleryManageUrl + "/file/" + gid + ".zip?" + params.toString() +} + function confirmCurrentTask(state){ switch (state.category){ case 'myDownload':