Commit a5497246 authored by 黄奎's avatar 黄奎

文件下载调整

parent ddabee40
......@@ -1138,7 +1138,6 @@ export default {
};
try {
let url = oss.signatureUrl(objectKey);
console.log("url", url);
let getBlob = new Promise(resolve => {
const xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
......@@ -1156,9 +1155,17 @@ export default {
xhr.send();
});
getBlob.then(blob => {
if (window.navigator.msSaveOrOpenBlob) {
if (window.navigator.msSaveOrOpenBlob) {
navigator.msSaveBlob(blob, filename);
} else {
resultJson.resultCode = 1;
if (callBack) {
callBack(resultJson)
}
} else {
resultJson.resultCode = 1;
if (callBack) {
callBack(resultJson)
}
const link = document.createElement('a');
const body = document.querySelector('body');
link.href = window.URL.createObjectURL(blob);
......@@ -1168,10 +1175,6 @@ export default {
link.click();
body.removeChild(link);
window.URL.revokeObjectURL(link.href);
resultJson.resultCode = 1;
if (callBack) {
callBack(resultJson)
}
}
});
} catch (err) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment