Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Springboot Plus
Commits
7054a18e
Commit
7054a18e
authored
May 03, 2018
by
上善若水
Committed by
闲.大赋
May 03, 2018
Browse files
!15 增加附件中文名支持
Merge pull request !15 from 上善若水/master
parents
869294e5
de7623d4
Changes
3
Hide whitespace changes
Inline
Side-by-side
admin-core/src/main/java/com/ibeetl/admin/core/web/FileSystemContorller.java
View file @
7054a18e
...
@@ -3,6 +3,7 @@ package com.ibeetl.admin.core.web;
...
@@ -3,6 +3,7 @@ package com.ibeetl.admin.core.web;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.io.OutputStream
;
import
java.net.URLEncoder
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
...
@@ -59,7 +60,7 @@ public class FileSystemContorller {
...
@@ -59,7 +60,7 @@ public class FileSystemContorller {
@GetMapping
(
MODEL
+
"/download/{fileId}/{batchFileUUID}/{name}"
)
@GetMapping
(
MODEL
+
"/download/{fileId}/{batchFileUUID}/{name}"
)
public
ModelAndView
download
(
HttpServletResponse
response
,
@PathVariable
Long
fileId
,
@PathVariable
String
batchFileUUID
)
throws
IOException
{
public
ModelAndView
download
(
HttpServletResponse
response
,
@PathVariable
Long
fileId
,
@PathVariable
String
batchFileUUID
)
throws
IOException
{
FileItem
item
=
fileService
.
getFileItemById
(
fileId
,
batchFileUUID
);
FileItem
item
=
fileService
.
getFileItemById
(
fileId
,
batchFileUUID
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment; filename="
+
item
.
getName
());
response
.
setHeader
(
"Content-Disposition"
,
"attachment; filename="
+
URLEncoder
.
encode
(
item
.
getName
()
,
"UTF-8"
)
);
item
.
copy
(
response
.
getOutputStream
());
item
.
copy
(
response
.
getOutputStream
());
return
null
;
return
null
;
}
}
...
...
admin-core/src/main/resources/static/js/common.js
View file @
7054a18e
...
@@ -78,6 +78,16 @@ var Common = {
...
@@ -78,6 +78,16 @@ var Common = {
});
});
layer
.
full
(
index
);
layer
.
full
(
index
);
},
},
topOpenDlg
:
function
(
url
,
title
){
var
index
=
top
.
layer
.
open
({
type
:
2
,
content
:
Common
.
ctxPath
+
url
,
title
:
title
,
area
:[
'
100%
'
,
'
100%
'
],
maxmin
:
false
});
layer
.
full
(
index
);
},
openConfirm
:
function
(
content
,
callback
,
callBackNo
){
openConfirm
:
function
(
content
,
callback
,
callBackNo
){
var
index
=
layer
.
confirm
(
content
,
{
var
index
=
layer
.
confirm
(
content
,
{
btn
:
[
'
确认
'
,
'
取消
'
]
//按钮
btn
:
[
'
确认
'
,
'
取消
'
]
//按钮
...
...
admin-core/src/main/resources/templates/common/tag/attachment.tag.html
View file @
7054a18e
...
@@ -135,8 +135,7 @@ function() {
...
@@ -135,8 +135,7 @@ function() {
tr
.
find
(
'
.demo-preview
'
).
on
(
'
click
'
,
tr
.
find
(
'
.demo-preview
'
).
on
(
'
click
'
,
function
()
{
function
()
{
//文件下载地址
//文件下载地址
var
file
=
encodeURIComponent
(
"
http://localhost:8080/core/file/download/
"
+
fileId
+
"
/${batchFileUUID}/
"
+
fileName
);
var
file
=
encodeURIComponent
(
"
http://
"
+
window
.
location
.
host
+
"
/core/file/download/
"
+
fileId
+
"
/${batchFileUUID}/
"
+
fileName
);
//8012为预览服务器地址,参考 https://gitee.com/kekingcn/file-online-preview 安装
//8012为预览服务器地址,参考 https://gitee.com/kekingcn/file-online-preview 安装
Common
.
openDlg
(
"
${env('file.previewURL')}?url=
"
+
file
,
fileName
+
"
预览
"
)
Common
.
openDlg
(
"
${env('file.previewURL')}?url=
"
+
file
,
fileName
+
"
预览
"
)
//window.open("http://localhost:8012/onlinePreview?url="+file);
//window.open("http://localhost:8012/onlinePreview?url="+file);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment