From b6ad5cb4dd652388136ac8bff78a9406d96e69b0 Mon Sep 17 00:00:00 2001 From: scwang18 Date: Wed, 2 May 2018 23:08:32 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E9=99=84=E4=BB=B6=E9=A2=84=E8=A7=88?= =?UTF-8?q?=EF=BC=8C=E5=A6=82=E6=9E=9C=E4=BF=AE=E6=94=B9=E8=BF=87=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E5=99=A8=E5=9C=B0=E5=9D=80=E5=92=8C=E7=AB=AF=E5=8F=A3?= =?UTF-8?q?=EF=BC=8C=E9=A2=84=E8=A7=88=E4=B8=8D=E5=8F=AF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/templates/common/tag/attachment.tag.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/admin-core/src/main/resources/templates/common/tag/attachment.tag.html b/admin-core/src/main/resources/templates/common/tag/attachment.tag.html index 8d5975eb..e111a6c9 100644 --- a/admin-core/src/main/resources/templates/common/tag/attachment.tag.html +++ b/admin-core/src/main/resources/templates/common/tag/attachment.tag.html @@ -135,8 +135,7 @@ function() { tr.find('.demo-preview').on('click', 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 安装 Common.openDlg("${env('file.previewURL')}?url="+file,fileName+"预览") //window.open("http://localhost:8012/onlinePreview?url="+file); -- Gitee From de7623d4d2dd8d1744d4402fd2f846a5747996a7 Mon Sep 17 00:00:00 2001 From: scwang18 Date: Thu, 3 May 2018 01:10:13 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=99=84=E4=BB=B6?= =?UTF-8?q?=E4=B8=AD=E6=96=87=E5=90=8D=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加一个直接到top层弹出窗口的函数。 --- .../ibeetl/admin/core/web/FileSystemContorller.java | 3 ++- admin-core/src/main/resources/static/js/common.js | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/admin-core/src/main/java/com/ibeetl/admin/core/web/FileSystemContorller.java b/admin-core/src/main/java/com/ibeetl/admin/core/web/FileSystemContorller.java index 028e01d6..712c7273 100644 --- a/admin-core/src/main/java/com/ibeetl/admin/core/web/FileSystemContorller.java +++ b/admin-core/src/main/java/com/ibeetl/admin/core/web/FileSystemContorller.java @@ -3,6 +3,7 @@ package com.ibeetl.admin.core.web; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.net.URLEncoder; import javax.servlet.http.HttpServletResponse; @@ -59,7 +60,7 @@ public class FileSystemContorller { @GetMapping(MODEL + "/download/{fileId}/{batchFileUUID}/{name}") public ModelAndView download(HttpServletResponse response,@PathVariable Long fileId,@PathVariable String batchFileUUID ) throws IOException { 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()); return null; } diff --git a/admin-core/src/main/resources/static/js/common.js b/admin-core/src/main/resources/static/js/common.js index 078c2c84..e3af2b86 100644 --- a/admin-core/src/main/resources/static/js/common.js +++ b/admin-core/src/main/resources/static/js/common.js @@ -78,6 +78,16 @@ var Common = { }); 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){ var index = layer.confirm(content, { btn: ['确认','取消'] //按钮 -- Gitee From 4b1c623b48a9ca55389630c325b3cc43278d106f Mon Sep 17 00:00:00 2001 From: scwang18 Date: Thu, 3 May 2018 09:40:11 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E9=99=84=E4=BB=B6=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E7=AA=97=E5=8F=A3=E5=9C=A8top=E5=B1=82=E5=BC=B9=E5=87=BA?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/templates/common/tag/attachment.tag.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/admin-core/src/main/resources/templates/common/tag/attachment.tag.html b/admin-core/src/main/resources/templates/common/tag/attachment.tag.html index e111a6c9..b0b197ac 100644 --- a/admin-core/src/main/resources/templates/common/tag/attachment.tag.html +++ b/admin-core/src/main/resources/templates/common/tag/attachment.tag.html @@ -137,8 +137,8 @@ function() { //文件下载地址 var file = encodeURIComponent("http://" + window.location.host+"/core/file/download/"+fileId+"/${batchFileUUID}/"+fileName); //8012为预览服务器地址,参考 https://gitee.com/kekingcn/file-online-preview 安装 - Common.openDlg("${env('file.previewURL')}?url="+file,fileName+"预览") - //window.open("http://localhost:8012/onlinePreview?url="+file); + Common.topOpenDlg("${env('file.previewURL')}?url="+file,fileName+"预览"); + //window.open("${env('file.previewURL')}?url="+file,fileName+"预览"); return false; }); -- Gitee