Commit 7054a18e authored by 上善若水's avatar 上善若水 Committed by 闲.大赋
Browse files

!15 增加附件中文名支持

Merge pull request !15 from 上善若水/master
parents 869294e5 de7623d4
...@@ -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;
} }
......
...@@ -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: ['确认','取消'] //按钮
......
...@@ -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);
......
Supports Markdown
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