修复:使用nginx代理访问时,下载多个文件失败的问题

This commit is contained in:
jmal 2020-05-14 17:10:20 +08:00
parent 2723a73b47
commit e24350cb85
3 changed files with 27 additions and 14 deletions

View File

@ -8,7 +8,7 @@
<!--在 head 标签中添加 meta 标签,并设置 viewport-fit=cover 值--> <!--在 head 标签中添加 meta 标签,并设置 viewport-fit=cover 值-->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover">
<link rel="icon" href="<%= BASE_URL %>netdisk.png"> <link rel="icon" href="<%= BASE_URL %>facion.ico">
<title><%= webpackConfig.name %></title> <title><%= webpackConfig.name %></title>
</head> </head>

View File

@ -2243,7 +2243,20 @@
}else{ }else{
fileIds.push(this.rowContextData.id) fileIds.push(this.rowContextData.id)
} }
window.open(process.env.VUE_APP_BASE_FILE_API + 'download?jmal-token=' + this.$store.state.user.token + '&fileIds=' + fileIds, '_self') let host = window.location.host
if(window.location.port.length > 0){
host = window.location.host.substring(0,window.location.host.length - window.location.port.length - 1)
}
console.log(host)
if(process.env.NODE_ENV !== 'development'){
let host = window.location.host
if(window.location.port.length > 0){
host = window.location.host.substring(0,window.location.host.length - window.location.port.length - 1)
}
window.open(`http://${host}:8088/download?jmal-token=${this.$store.state.user.token}&fileIds=${fileIds}`,'_self')
}else{
window.open(process.env.VUE_APP_BASE_FILE_API + '/download?jmal-token=' + this.$store.state.user.token + '&fileIds=' + fileIds, '_self')
}
} else { } else {
this.$message({ this.$message({
message: '所选文件为空', message: '所选文件为空',

View File

@ -164,18 +164,18 @@ export const constantRoutes = [
] ]
}, },
{ // {
path: '/demo', // path: '/demo',
component: Layout, // component: Layout,
children: [ // children: [
{ // {
path: 'index', // path: 'index',
name: 'demo', // name: 'demo',
component: () => import('@/views/demo/index'), // component: () => import('@/views/demo/index'),
meta: { title: 'demo', icon: 'example' } // meta: { title: 'demo', icon: 'example' }
} // }
] // ]
}, // },
{ {
path: '/markdown', path: '/markdown',