dev_forum
杨树林 5 years ago
parent dfc6d44ae8
commit c4df994aa2

@ -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()? <li className="li_line drop_down fr color-blue font-16 mr8 mt20" style={{"padding":"0 20px"}}>
导出<i className="iconfont icon-xiajiantou font-12 ml2"></i>
<ul className="drop_down_menu" style={{"right":"-0px","left":"unset","height":"auto"}}>
{/*<li><a onClick={()=>this.internshipreport(`/zip/shixun_report?homework_common_id=${this.props.match.params.homeworkid}&work_status=${this.state.course_groupyslstwo}&course_group=${this.state.checkedValuesineinfo}&search=${this.state.searchtext}`)}>实训报告</a></li>*/}
<li><a onClick={()=>this.internshipreport(`/homework_commons/${this.props.match.params.homeworkid}/works_list.xlsx?group_id=${this.state.checkedValuesineinfo}&search=${this.state.searchtext}`)} >学生成绩</a></li>
<li><a onClick={()=>this.internshipreport(`/zip/shixun_report?homework_common_id=${this.props.match.params.homeworkid}&work_status=${this.state.course_groupyslstwo}&course_group=${this.state.checkedValuesineinfo}&search=${this.state.searchtext}`)}>实训报告</a></li>
<li><a onClick={()=>this.Classstudentachievement(`/homework_commons/${this.props.match.params.homeworkid}/works_list.xlsx?group_id=${this.state.checkedValuesineinfo}&search=${this.state.searchtext}`)} >学生成绩</a></li>
</ul>

Loading…
Cancel
Save