|
|
|
@ -1358,23 +1358,22 @@ class Listofworks extends Component {
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
// window.location.href("/api"+url);
|
|
|
|
|
console.log("开始下载zip文件")
|
|
|
|
|
// console.log("开始下载zip文件")
|
|
|
|
|
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中传文件名
|
|
|
|
|
console.log(Base64.decode(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
|
|
|
|
|
var now="";
|
|
|
|
|
try {
|
|
|
|
|
now = moment().year()+""+moment().month()+1+""+moment().date()+""+moment().hour()+""+moment().minute()+""
|
|
|
|
|
console.log("1422");
|
|
|
|
|
now = moment().year()+""+(moment().month()+1)+""+moment().date()+""+moment().hour()+""+moment().minute()+""
|
|
|
|
|
console.log(now);
|
|
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.log("1432");
|
|
|
|
|
console.log("1376");
|
|
|
|
|
}
|
|
|
|
|
downloadElement.download = string+now+".zip"
|
|
|
|
|
document.body.appendChild(downloadElement)
|
|
|
|
@ -1389,20 +1388,6 @@ class Listofworks extends Component {
|
|
|
|
|
// 课堂学生成绩的导出下载
|
|
|
|
|
Classstudentachievement=(url)=>{
|
|
|
|
|
console.log("Classstudentachievement");
|
|
|
|
|
// const course_id = this.props.match.params.coursesId;
|
|
|
|
|
// let url = "/courses/"+course_id+"/export_member_scores_excel.xlsx";
|
|
|
|
|
// ,{
|
|
|
|
|
// params: {
|
|
|
|
|
// group_id: this.state.checkedValuesineinfo,
|
|
|
|
|
// 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);
|
|
|
|
@ -1417,16 +1402,12 @@ 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])
|
|
|
|
|
// 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(Base64.decode(response.headers['content-disposition'].split('=')[1]));
|
|
|
|
|
// console.log("1409");
|
|
|
|
|
// console.log(Base64.decode(response.headers['content-disposition'].split('=')[1]));
|
|
|
|
|
const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
|
|
|
|
|
var now="";
|
|
|
|
|
try {
|
|
|
|
|
now = moment().year()+""+moment().month()+1+""+moment().date()+""+moment().hour()+""+moment().minute()+""
|
|
|
|
|
now = moment().year()+""+(moment().month()+1)+""+moment().date()+""+moment().hour()+""+moment().minute()+""
|
|
|
|
|
console.log("1422");
|
|
|
|
|
console.log(now);
|
|
|
|
|
|
|
|
|
@ -1439,7 +1420,6 @@ class Listofworks extends Component {
|
|
|
|
|
downloadElement.click()
|
|
|
|
|
document.body.removeChild(downloadElement) // 下载完成移除元素
|
|
|
|
|
window.URL.revokeObjectURL(href) // 释放掉blob对象
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
console.log(error)
|
|
|
|
|