Pre Merge pull request !372 from Hacker/N/A
This commit is contained in:
@ -18,8 +18,11 @@ export default {
|
|||||||
}).then(async (res) => {
|
}).then(async (res) => {
|
||||||
const isLogin = await blobValidate(res.data);
|
const isLogin = await blobValidate(res.data);
|
||||||
if (isLogin) {
|
if (isLogin) {
|
||||||
|
const contentDisposition = decodeURI(res.headers['content-disposition'])
|
||||||
|
const result = new RegExp('filename=([^;]+\\.[^\\.;]+);*').exec(contentDisposition)
|
||||||
|
const fileName = result[1].replace(/\"/g, '')
|
||||||
const blob = new Blob([res.data])
|
const blob = new Blob([res.data])
|
||||||
this.saveAs(blob, decodeURI(res.headers['download-filename']))
|
this.saveAs(blob, fileName)
|
||||||
} else {
|
} else {
|
||||||
this.printErrMsg(res.data);
|
this.printErrMsg(res.data);
|
||||||
}
|
}
|
||||||
@ -35,8 +38,11 @@ export default {
|
|||||||
}).then(async (res) => {
|
}).then(async (res) => {
|
||||||
const isLogin = await blobValidate(res.data);
|
const isLogin = await blobValidate(res.data);
|
||||||
if (isLogin) {
|
if (isLogin) {
|
||||||
|
const contentDisposition = decodeURI(res.headers['content-disposition'])
|
||||||
|
const result = new RegExp('filename=([^;]+\\.[^\\.;]+);*').exec(contentDisposition)
|
||||||
|
const fileName = result[1].replace(/\"/g, '')
|
||||||
const blob = new Blob([res.data])
|
const blob = new Blob([res.data])
|
||||||
this.saveAs(blob, decodeURI(res.headers['download-filename']))
|
this.saveAs(blob, fileName)
|
||||||
} else {
|
} else {
|
||||||
this.printErrMsg(res.data);
|
this.printErrMsg(res.data);
|
||||||
}
|
}
|
||||||
@ -68,5 +74,4 @@ export default {
|
|||||||
const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default']
|
const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default']
|
||||||
Message.error(errMsg);
|
Message.error(errMsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue
Block a user