From 8e50879796a9d13bd5a751a20b1093fe9c4bcd31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Sat, 6 Jul 2019 16:56:22 +0800 Subject: [PATCH] b --- .../modules/courses/shixunHomework/Httpdownloads.js | 6 +----- .../src/modules/courses/shixunHomework/Listofworks.js | 10 +++++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/public/react/src/modules/courses/shixunHomework/Httpdownloads.js b/public/react/src/modules/courses/shixunHomework/Httpdownloads.js index 11bd91f6b..84b1d090b 100644 --- a/public/react/src/modules/courses/shixunHomework/Httpdownloads.js +++ b/public/react/src/modules/courses/shixunHomework/Httpdownloads.js @@ -3,8 +3,7 @@ import axios from 'axios'; // 导出实习报告批量zip 、xlsx 类型 -export function Internshipreportsy (url,struy,types,stingtype){ - axios.get((url),{responseType: 'blob'}).then((response) => { +export function Internshipreportsy (url,struy,types,stingtype,response){ const blob = new Blob([response.data], { type: stingtype }); const downloadElement = document.createElement('a'); const href = window.URL.createObjectURL(blob); @@ -15,7 +14,4 @@ export function Internshipreportsy (url,struy,types,stingtype){ downloadElement.click(); document.body.removeChild(downloadElement) ;// 下载完成移除元素 window.URL.revokeObjectURL(href) // 释放掉blob对象 - }).catch((error) => { - console.log(error) - }); } \ No newline at end of file diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js index 58c868677..832d5eaa4 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworks.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js @@ -1355,11 +1355,11 @@ class Listofworks extends Component { }else if(response.data.status&&response.data.status===-2){ }else { - if(type === 1){ - Internshipreportsy(url,struy,".zip",'application/zip'); - }else{ - Internshipreportsy(url,struy,".xlsx",'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); - } + // if(type === 1){ + // Internshipreportsy(url,struy,".zip",'application/zip'); + // }else{ + Internshipreportsy(url,struy,".xlsx",'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',response); + // } } } }).catch((error) => {