!627 update ruoyi-ui/src/plugins/download.js.

Merge pull request !627 from Zeno/N/A
This commit is contained in:
若依 2022-12-01 08:21:29 +00:00 committed by Gitee
commit 963247df43
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -9,7 +9,7 @@ const baseURL = process.env.VUE_APP_BASE_API
export default { export default {
name(name, isDelete = true) { name(name, isDelete = true) {
var url = baseURL + "/common/download?fileName=" + encodeURI(name) + "&delete=" + isDelete var url = baseURL + "/common/download?fileName=" + encodeURIComponent(name) + "&delete=" + isDelete
axios({ axios({
method: 'get', method: 'get',
url: url, url: url,
@ -19,14 +19,14 @@ export default {
const isLogin = await blobValidate(res.data); const isLogin = await blobValidate(res.data);
if (isLogin) { if (isLogin) {
const blob = new Blob([res.data]) const blob = new Blob([res.data])
this.saveAs(blob, decodeURI(res.headers['download-filename'])) this.saveAs(blob, decodeURIComponent(res.headers['download-filename']))
} else { } else {
this.printErrMsg(res.data); this.printErrMsg(res.data);
} }
}) })
}, },
resource(resource) { resource(resource) {
var url = baseURL + "/common/download/resource?resource=" + encodeURI(resource); var url = baseURL + "/common/download/resource?resource=" + encodeURIComponent(resource);
axios({ axios({
method: 'get', method: 'get',
url: url, url: url,
@ -36,7 +36,7 @@ export default {
const isLogin = await blobValidate(res.data); const isLogin = await blobValidate(res.data);
if (isLogin) { if (isLogin) {
const blob = new Blob([res.data]) const blob = new Blob([res.data])
this.saveAs(blob, decodeURI(res.headers['download-filename'])) this.saveAs(blob, decodeURIComponent(res.headers['download-filename']))
} else { } else {
this.printErrMsg(res.data); this.printErrMsg(res.data);
} }