【新增】生成笔试试卷按钮,细节修改

This commit is contained in:
YOHO\20373
2025-05-26 20:07:33 +08:00
committed by 陆光LG
parent 9efe51987e
commit 068f5c0401
23 changed files with 207 additions and 23 deletions

View File

@@ -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('下载试卷失败');
}
}