导出作业

This commit is contained in:
zhangsir
2024-07-26 15:27:17 +08:00
parent c8a72140af
commit 0ce5fcfd27

View File

@@ -510,14 +510,15 @@ export default {
courseName:this.manageStudyData.name, courseName:this.manageStudyData.name,
contentId:this.contentId contentId:this.contentId
} }
window.open(`/systemapi/xboe/m/course/portal/export?contentId=${params.contentId}&courseName=${params.courseName}`)
apicourseStudy.homeworkExport(params).then(res=>{ apicourseStudy.homeworkExport(params).then(res=>{
console.log(res,'res') console.log(res,'res')
const link = document.createElement('a');// 创建a标签 const link = document.createElement('a');// 创建a标签
let blob = new Blob([res], { type: 'application/vnd.ms-excel;charset=UTF-8' }); // 设置文件类型 let blob = new Blob([res], { type: 'application/zip' }); // 设置文件类型
link.style.display = "none"; link.style.display = "none";
link.href = URL.createObjectURL(blob); // 创建URL link.href = URL.createObjectURL(blob); // 创建URL
console.log(link.href); console.log(link.href);
link.setAttribute("download", "作业.xlsx"); link.setAttribute("download", "作业.zip");
document.body.appendChild(link); document.body.appendChild(link);
link.click(); link.click();
URL.revokeObjectURL(link.href) URL.revokeObjectURL(link.href)