Commit 5c1e20ac authored by 盖献康's avatar 盖献康

公用文件下载方法

parent 614c3480
......@@ -26,7 +26,7 @@ export default {
})
},
resource(resource) {
var url = baseURL + '/common/download/resource?resource=' + encodeURIComponent(resource)
var url = baseURL + 'business/common/downloadMinio?url=' + encodeURIComponent(resource)
axios({
method: 'get',
url: url,
......@@ -36,7 +36,16 @@ export default {
const isBlob = blobValidate(res.data)
if (isBlob) {
const blob = new Blob([res.data])
this.saveAs(blob, decodeURIComponent(res.headers['download-filename']))
const url = res.config['url']
const keyword = '-'
const index = url.indexOf(keyword, url.indexOf(keyword, url.indexOf(keyword) + 1) + 1)
let result = ''
if (index !== -1) {
result = url.substring(index + keyword.length)
} else {
return 'aa.pdf'
}
this.saveAs(blob, result)
} else {
this.printErrMsg(res.data)
}
......
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