From febb2002439508523c5bd39977a1ee21985884c9 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 14:40:33 +0800 Subject: [PATCH] b --- .../courses/shixunHomework/Httpdownloads.js | 2 +- .../courses/shixunHomework/Listofworks.js | 31 ++++++++++--------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/public/react/src/modules/courses/shixunHomework/Httpdownloads.js b/public/react/src/modules/courses/shixunHomework/Httpdownloads.js index 0ec5032c8..11bd91f6b 100644 --- a/public/react/src/modules/courses/shixunHomework/Httpdownloads.js +++ b/public/react/src/modules/courses/shixunHomework/Httpdownloads.js @@ -2,7 +2,7 @@ import {Base64} from 'js-base64'; import axios from 'axios'; -// 导出实习报告批量zip 类型 +// 导出实习报告批量zip 、xlsx 类型 export function Internshipreportsy (url,struy,types,stingtype){ axios.get((url),{responseType: 'blob'}).then((response) => { const blob = new Blob([response.data], { type: stingtype }); diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js index fd96ea25e..f09256230 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworks.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js @@ -1349,21 +1349,22 @@ class Listofworks extends Component { } axios.get(url).then((response) => { - console.log(response); - if(response.data.status&&response.data.status===-1){ - console.log("1352"); - console.log(response); - - }else if(response.data.status&&response.data.status===-2){ - console.log("1356"); - console.log(response); - }else { - if(type === 1){ - Internshipreportsy(url,struy,".zip",'application/zip'); - }else{ - Internshipreportsy(url,struy,".xlsx",'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); - } - } + if(response !== undefined){ + if(response.data.status&&response.data.status===-1){ + console.log("1352"); + console.log(response); + + }else if(response.data.status&&response.data.status===-2){ + console.log("1356"); + console.log(response); + }else { + if(type === 1){ + Internshipreportsy(url,struy,".zip",'application/zip'); + }else{ + Internshipreportsy(url,struy,".xlsx",'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); + } + } + } }).catch((error) => { console.log(error) });