|
|
@ -1350,15 +1350,22 @@ class Listofworks extends Component {
|
|
|
|
},{responseType: 'blob'}).then((response) => {
|
|
|
|
},{responseType: 'blob'}).then((response) => {
|
|
|
|
console.log("1342");
|
|
|
|
console.log("1342");
|
|
|
|
console.log(response);
|
|
|
|
console.log(response);
|
|
|
|
var blob = new Blob([response.data])
|
|
|
|
if (response.status == 200) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var blob = new Blob([response.data])
|
|
|
|
var downloadElement = document.createElement('a');
|
|
|
|
var downloadElement = document.createElement('a');
|
|
|
|
var href = window.URL.createObjectURL(blob); //创建下载的链接
|
|
|
|
var href = window.URL.createObjectURL(blob); //创建下载的链接
|
|
|
|
downloadElement.href = href;
|
|
|
|
let filename = response.headers.get('Content-Disposition');
|
|
|
|
downloadElement.download = '实习报告.pdf'; //下载后文件名
|
|
|
|
if (filename) {
|
|
|
|
document.body.appendChild(downloadElement);
|
|
|
|
filename = filename.match(/\"(.*)\"/)[1]; //提取文件名
|
|
|
|
downloadElement.click(); //点击下载
|
|
|
|
downloadElement.href = href;
|
|
|
|
document.body.removeChild(downloadElement); //下载完成移除元素
|
|
|
|
downloadElement.download = filename; //下载后文件名
|
|
|
|
|
|
|
|
document.body.appendChild(downloadElement);
|
|
|
|
|
|
|
|
downloadElement.click(); //点击下载
|
|
|
|
|
|
|
|
document.body.removeChild(downloadElement); //下载完成移除元素
|
|
|
|
|
|
|
|
}
|
|
|
|
window.URL.revokeObjectURL(href); //释放掉blob对象
|
|
|
|
window.URL.revokeObjectURL(href); //释放掉blob对象
|
|
|
|
|
|
|
|
}
|
|
|
|
}).catch((error) => {
|
|
|
|
}).catch((error) => {
|
|
|
|
console.log(error)
|
|
|
|
console.log(error)
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -1377,15 +1384,21 @@ class Listofworks extends Component {
|
|
|
|
},{responseType: 'blob'}).then((response) => {
|
|
|
|
},{responseType: 'blob'}).then((response) => {
|
|
|
|
console.log("1306");
|
|
|
|
console.log("1306");
|
|
|
|
console.log(response);
|
|
|
|
console.log(response);
|
|
|
|
|
|
|
|
if (response.status == 200) {
|
|
|
|
var blob = new Blob([response.data])
|
|
|
|
var blob = new Blob([response.data])
|
|
|
|
var downloadElement = document.createElement('a');
|
|
|
|
var downloadElement = document.createElement('a');
|
|
|
|
var href = window.URL.createObjectURL(blob); //创建下载的链接
|
|
|
|
var href = window.URL.createObjectURL(blob); //创建下载的链接
|
|
|
|
downloadElement.href = href;
|
|
|
|
let filename = response.headers.get('Content-Disposition');
|
|
|
|
downloadElement.download = '课堂学生成绩.xlsx'; //下载后文件名
|
|
|
|
if (filename) {
|
|
|
|
document.body.appendChild(downloadElement);
|
|
|
|
filename = filename.match(/\"(.*)\"/)[1]; //提取文件名
|
|
|
|
downloadElement.click(); //点击下载
|
|
|
|
downloadElement.href = href;
|
|
|
|
document.body.removeChild(downloadElement); //下载完成移除元素
|
|
|
|
downloadElement.download = filename; //下载后文件名
|
|
|
|
|
|
|
|
document.body.appendChild(downloadElement);
|
|
|
|
|
|
|
|
downloadElement.click(); //点击下载
|
|
|
|
|
|
|
|
document.body.removeChild(downloadElement); //下载完成移除元素
|
|
|
|
|
|
|
|
}
|
|
|
|
window.URL.revokeObjectURL(href); //释放掉blob对象
|
|
|
|
window.URL.revokeObjectURL(href); //释放掉blob对象
|
|
|
|
|
|
|
|
}
|
|
|
|
}).catch((error) => {
|
|
|
|
}).catch((error) => {
|
|
|
|
console.log(error)
|
|
|
|
console.log(error)
|
|
|
|
});
|
|
|
|
});
|
|
|
|