dev_forum
parent
5da56cfec9
commit
7774c7a95f
@ -1,21 +0,0 @@
|
||||
import {Base64} from 'js-base64';
|
||||
import axios from 'axios';
|
||||
|
||||
|
||||
// 导出实习报告批量zip 、xlsx 类型
|
||||
export function Internshipreportsy (url,struy,types,stingtype){
|
||||
axios.get((url),{responseType: 'blob'}).then((response) => {
|
||||
const blob = new Blob([response.data], { type: stingtype });
|
||||
const downloadElement = document.createElement('a');
|
||||
const href = window.URL.createObjectURL(blob);
|
||||
const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
|
||||
downloadElement.href = href;
|
||||
downloadElement.download = string+struy+types;
|
||||
document.body.appendChild(downloadElement);
|
||||
downloadElement.click();
|
||||
document.body.removeChild(downloadElement) ;// 下载完成移除元素
|
||||
window.URL.revokeObjectURL(href) // 释放掉blob对象
|
||||
}).catch((error) => {
|
||||
console.log(error)
|
||||
});
|
||||
}
|
Loading…
Reference in new issue