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);