diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js index 396995b78..2983b80a4 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworks.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js @@ -1359,16 +1359,15 @@ class Listofworks extends Component { }else{ // window.location.href("/api"+url); console.log("开始下载zip文件") - // const type='application/zip'//ZIP文件 - const type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' //excel文件 - + const type='application/zip'//ZIP文件 const blob = new Blob([response.data], { type: type }) const downloadElement = document.createElement('a') const href = window.URL.createObjectURL(blob) //后台再header中传文件名 - const name = decodeURI(response.headers['content-disposition'].split('=')[1]) + 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 = '' + downloadElement.download = string+".zip" document.body.appendChild(downloadElement) downloadElement.click() document.body.removeChild(downloadElement) // 下载完成移除元素 @@ -1410,18 +1409,14 @@ class Listofworks extends Component { const href = window.URL.createObjectURL(blob) //后台再header中传文件名 // const name = decodeURI(response.headers['content-disposition'].split('=')[1]) - console.log(response.headers['content-disposition'].split('=')[1]); + // console.log(response.headers['content-disposition'].split('=')[1]); // console.log(name); // console.log(decodeURIComponent(response.headers['content-disposition'].split('=')[1])); - console.log("1409"); + console.log("1409"); console.log(Base64.decode(response.headers['content-disposition'].split('=')[1])); - const string = response.headers['content-disposition'].split('=')[1]; - var index=string.lastIndexOf("\."); - const name=string.substring(0,index); - console.log(Base64.decode(name)); + const string = Base64.decode(response.headers['content-disposition'].split('=')[1]); downloadElement.href = href - downloadElement.download = Base64.decode(name)+".xlsx"; - + downloadElement.download =string+".xlsx"; document.body.appendChild(downloadElement) downloadElement.click() document.body.removeChild(downloadElement) // 下载完成移除元素 @@ -1581,8 +1576,7 @@ class Listofworks extends Component { {this.props.isAdmin()?