|
|
|
@ -1359,14 +1359,16 @@ class Listofworks extends Component {
|
|
|
|
|
}else{
|
|
|
|
|
// window.location.href("/api"+url);
|
|
|
|
|
console.log("开始下载zip文件")
|
|
|
|
|
const type='application/zip'//ZIP文件
|
|
|
|
|
// const type='application/zip'//ZIP文件
|
|
|
|
|
const type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' //excel文件
|
|
|
|
|
|
|
|
|
|
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])
|
|
|
|
|
downloadElement.href = href
|
|
|
|
|
// downloadElement.download = name
|
|
|
|
|
downloadElement.download = ''
|
|
|
|
|
document.body.appendChild(downloadElement)
|
|
|
|
|
downloadElement.click()
|
|
|
|
|
document.body.removeChild(downloadElement) // 下载完成移除元素
|
|
|
|
@ -1387,6 +1389,12 @@ class Listofworks extends Component {
|
|
|
|
|
// search: this.state.searchtext,
|
|
|
|
|
// }
|
|
|
|
|
// },{responseType: 'blob'})
|
|
|
|
|
// 56S+5Yy65a+85biIX+iuoeeul+aAnee7tOWvvOiuujIwMTnmmKXlraPor77l,oIJfUHl0aG9u5a6e546w6YCJ5oup,.xls
|
|
|
|
|
// console.log(decodeURIComponent("b178a6c387c1dd2d4097b0dcaa19a043_1562205834"));
|
|
|
|
|
// console.log(decodeURI("b178a6c387c1dd2d4097b0dcaa19a043_1562205834"));
|
|
|
|
|
// console.log(Base64.decode("b178a6c387c1dd2d4097b0dcaa19a043_1562205834"));
|
|
|
|
|
// console.log(Base64.decode("56S-5Yy65a-85biIX-iuoeeul-aAnee7tOWvvOiuujIwMTnmmKXlraPor77loIJfUHl0aG9u5a6e546w6YCJ5oup"));
|
|
|
|
|
|
|
|
|
|
axios.get((url),{responseType: 'blob'}).then((response) => {
|
|
|
|
|
console.log("1374");
|
|
|
|
|
console.log(response);
|
|
|
|
@ -1401,14 +1409,18 @@ class Listofworks extends Component {
|
|
|
|
|
const downloadElement = document.createElement('a')
|
|
|
|
|
const href = window.URL.createObjectURL(blob)
|
|
|
|
|
//后台再header中传文件名
|
|
|
|
|
const name = decodeURI(response.headers['content-disposition'].split('=')[1])
|
|
|
|
|
// const name = decodeURI(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(name);
|
|
|
|
|
// console.log(decodeURIComponent(response.headers['content-disposition'].split('=')[1]));
|
|
|
|
|
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=obj.substring(0,index);
|
|
|
|
|
console.log(Base64.decode(name));
|
|
|
|
|
downloadElement.href = href
|
|
|
|
|
// downloadElement.download = name
|
|
|
|
|
downloadElement.download = Base64.decode(name)+".xlsx";
|
|
|
|
|
|
|
|
|
|
document.body.appendChild(downloadElement)
|
|
|
|
|
downloadElement.click()
|
|
|
|
@ -1569,8 +1581,10 @@ 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(`/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.Classstudentachievement(`/homework_commons/${this.props.match.params.homeworkid}/works_list.xlsx?group_id=${this.state.checkedValuesineinfo}&search=${this.state.searchtext}`)} >学生成绩</a></li>
|
|
|
|
|
|
|
|
|
|
</ul>
|
|
|
|
|
</li>:""}
|
|
|
|
|
{this.props.isAdmin() ?
|
|
|
|
|