dev_forum
杨树林 5 years ago
parent af12d95753
commit 3e6d9bb0a1

@ -1351,10 +1351,10 @@ class Listofworks extends Component {
axios.get((url),{responseType: 'blob'}).then((response) => { axios.get((url),{responseType: 'blob'}).then((response) => {
console.log("1350"); console.log("1350");
console.log(response); console.log(response);
if(response.data.status&&response.data.status===-1){ if(response.status&&response.status===-1){
}else if(response.data.status&&response.data.status===-2){ }else if(response.status&&response.status===-2){
}else{ }else{
// window.location.href("/api"+url); // window.location.href("/api"+url);
@ -1367,7 +1367,16 @@ class Listofworks extends Component {
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]); const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
downloadElement.href = href downloadElement.href = href
downloadElement.download = string+".zip" var now="";
try {
now = moment().year()+""+moment().month()+""+moment().date();
console.log("1422");
console.log(now);
} catch (e) {
console.log("1432");
}
downloadElement.download = string+now+".zip"
document.body.appendChild(downloadElement) document.body.appendChild(downloadElement)
downloadElement.click() downloadElement.click()
document.body.removeChild(downloadElement) // 下载完成移除元素 document.body.removeChild(downloadElement) // 下载完成移除元素
@ -1397,10 +1406,10 @@ class Listofworks extends Component {
axios.get((url),{responseType: 'blob'}).then((response) => { axios.get((url),{responseType: 'blob'}).then((response) => {
console.log("1374"); console.log("1374");
console.log(response); console.log(response);
if(response.data.status&&response.data.status===-1){ if(response.status&&response.status===-1){
}else if(response.data.status&&response.data.status===-2){ }else if(response.status&&response.status===-2){
}else{ }else{
const type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' //excel文件 const type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' //excel文件
@ -1417,7 +1426,7 @@ class Listofworks extends Component {
const string = Base64.decode(response.headers['content-disposition'].split('=')[1]); const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
var now=""; var now="";
try { try {
now = moment().year()+moment().month()+moment().date(); now = moment().year()+""+moment().month()+""+moment().date();
console.log("1422"); console.log("1422");
console.log(now); console.log(now);

Loading…
Cancel
Save