From 3e6d9bb0a12a304314bbb89b696bc2694e35b86e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 5 Jul 2019 23:10:50 +0800 Subject: [PATCH] b --- .../courses/shixunHomework/Listofworks.js | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js index f06acf8ec..ca1bcc1a0 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworks.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js @@ -1351,10 +1351,10 @@ class Listofworks extends Component { axios.get((url),{responseType: 'blob'}).then((response) => { console.log("1350"); console.log(response); - if(response.data.status&&response.data.status===-1){ + if(response.status&&response.status===-1){ - }else if(response.data.status&&response.data.status===-2){ + }else if(response.status&&response.status===-2){ }else{ // window.location.href("/api"+url); @@ -1367,7 +1367,16 @@ class Listofworks extends Component { console.log(Base64.decode(response.headers['content-disposition'].split('=')[1])); const string = Base64.decode(response.headers['content-disposition'].split('=')[1]); downloadElement.href = href - downloadElement.download = string+".zip" + var now=""; + try { + now = moment().year()+""+moment().month()+""+moment().date(); + console.log("1422"); + console.log(now); + + } catch (e) { + console.log("1432"); + } + downloadElement.download = string+now+".zip" document.body.appendChild(downloadElement) downloadElement.click() document.body.removeChild(downloadElement) // 下载完成移除元素 @@ -1397,10 +1406,10 @@ class Listofworks extends Component { axios.get((url),{responseType: 'blob'}).then((response) => { console.log("1374"); console.log(response); - if(response.data.status&&response.data.status===-1){ + if(response.status&&response.status===-1){ - }else if(response.data.status&&response.data.status===-2){ + }else if(response.status&&response.status===-2){ }else{ const type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' //excel文件 @@ -1417,7 +1426,7 @@ class Listofworks extends Component { const string = Base64.decode(response.headers['content-disposition'].split('=')[1]); var now=""; try { - now = moment().year()+moment().month()+moment().date(); + now = moment().year()+""+moment().month()+""+moment().date(); console.log("1422"); console.log(now);