From 6588589e4132979371d276cae2259607ee01c6f4 Mon Sep 17 00:00:00 2001 From: "YOHO\\20373" <2037305722@qq.com> Date: Mon, 26 May 2025 20:07:33 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=96=B0=E5=A2=9E=E3=80=91=E7=94=9F?= =?UTF-8?q?=E6=88=90=E7=AC=94=E8=AF=95=E8=AF=95=E5=8D=B7=E6=8C=89=E9=92=AE?= =?UTF-8?q?=EF=BC=8C=E7=BB=86=E8=8A=82=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/system/paper/index.ts | 26 ++++++++++++- src/views/paper/question/FileForm.vue | 5 +++ .../steps/step2/components/step-look.vue | 2 +- .../steps/step2/components/step-set.vue | 2 +- .../exam/components/steps/step2/index.vue | 27 +++++++++++++- .../steps/step2/components/step-look.vue | 2 +- .../steps/step2/components/step-set.vue | 2 +- .../ai/components/steps/step2/index.vue | 2 +- .../steps/step2/components/step-look.vue | 2 +- .../steps/step2/components/step-set.vue | 2 +- .../components/steps/step2/index.vue | 26 ++++++++++++- .../steps/step2/components/step-look.vue | 2 +- .../steps/step2/components/step-set.vue | 2 +- .../module/components/steps/step2/index.vue | 26 ++++++++++++- .../steps/step2/components/step-look.vue | 2 +- .../steps/step2/components/step-set.vue | 2 +- .../random/components/steps/step2/index.vue | 26 ++++++++++++- .../steps/step2/components/step-look.vue | 2 +- .../steps/step2/components/step-set.vue | 2 +- .../sprint/components/steps/step2/index.vue | 27 +++++++++++++- .../steps/step2/components/step-look.vue | 2 +- .../steps/step2/components/step-set.vue | 2 +- .../trans/components/steps/step2/index.vue | 37 ++++++++++++++++++- 23 files changed, 207 insertions(+), 23 deletions(-) diff --git a/src/api/system/paper/index.ts b/src/api/system/paper/index.ts index 3e635d7..de1c103 100644 --- a/src/api/system/paper/index.ts +++ b/src/api/system/paper/index.ts @@ -69,7 +69,6 @@ export async function exportPapers(params) { } export async function getPaperDetailByTaskId(paperId) { - return await request.get({ url: '/exam/qu/getPaper' , params:{paperId} }) } @@ -91,4 +90,29 @@ export async function updatePaperStatus(paperId: string, status: number) { data: { paperId, status } // 使用data }) } + +export async function openDown(ids) { + try { + // 1. 将数组转换为逗号分隔的字符串(例如 ["id1", "id2"] → "id1,id2") + const paperIdsParam = ids.join(','); + + const res = await request.download({ + url: `/exam/paper/addUpload/${paperIdsParam}`, + }); + // 3. 创建 Blob 并触发下载 + const blob = new Blob([res]); + const url = window.URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.setAttribute('download', '试卷.docx'); + document.body.appendChild(link); + link.click(); + link.remove(); + window.URL.revokeObjectURL(url); // 释放内存 + } catch (e) { + console.error('下载失败:', e); + throw new Error('下载试卷失败'); + } +} + diff --git a/src/views/paper/question/FileForm.vue b/src/views/paper/question/FileForm.vue index 9c8d72f..d8c092c 100644 --- a/src/views/paper/question/FileForm.vue +++ b/src/views/paper/question/FileForm.vue @@ -192,6 +192,11 @@ --> + + +