文件下载的路径问题

This commit is contained in:
WenG 2021-04-11 22:07:19 +08:00
parent 3743c9107f
commit 116b4dc7a2
8 changed files with 13 additions and 13 deletions

View File

@ -66,7 +66,7 @@
<script id="appFileDownload" type="text/html"> <script id="appFileDownload" type="text/html">
{{# if(d.appFile != '') { }} {{# if(d.appFile != '') { }}
<span class="layui-btn-group"> <span class="layui-btn-group">
<a class="layui-btn layui-btn-normal" href="route/file/downloadfile/false/{{d.appFile}}" target="_blank">点击下载此文件</a> <a class="layui-btn layui-btn-normal" href="route/file/download/false/{{d.appFile}}" target="_blank">点击下载此文件</a>
<a class="layui-btn layui-btn-danger text-danger" href="javascript:void(0);" lay-form-button lay-filter="removeAppFile">删除</a> <a class="layui-btn layui-btn-danger text-danger" href="javascript:void(0);" lay-form-button lay-filter="removeAppFile">删除</a>
</span> </span>
{{# } }} {{# } }}

View File

@ -35,7 +35,7 @@
<div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login"> <div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login">
<div id="layadminUserLoginMain" class="layadmin-user-login-main" style=""> <div id="layadminUserLoginMain" class="layadmin-user-login-main" style="">
<div class="layadmin-user-login-box layadmin-user-login-header"> <div class="layadmin-user-login-box layadmin-user-login-header">
<img class="system-logo" th:src="'route/file/downloadfile/true/'+ ${systemLogo}" th:if="${systemLogo ne ''}"> <img class="system-logo" th:src="'route/file/download/true/'+ ${systemLogo}" th:if="${systemLogo ne ''}">
<div th:class="${(systemLogo ne '') ? 'system-logo-title': ''}"> <div th:class="${(systemLogo ne '') ? 'system-logo-title': ''}">
<h2 th:text="${systemTitle}" th:style="'font-size:'+ ${systemTitleSize} +'px'"></h2> <h2 th:text="${systemTitle}" th:style="'font-size:'+ ${systemTitleSize} +'px'"></h2>
<p th:text="${systemSubTitle}" th:style="'font-size:'+ ${systemSubTitleSize} +'px'"></p> <p th:text="${systemSubTitle}" th:style="'font-size:'+ ${systemSubTitleSize} +'px'"></p>
@ -145,7 +145,7 @@
var loginBackgroundImageArray = loginBackgroundImages.split(','); var loginBackgroundImageArray = loginBackgroundImages.split(',');
for(var i = 0, item = loginBackgroundImageArray[i]; item = loginBackgroundImageArray[i++];) { for(var i = 0, item = loginBackgroundImageArray[i]; item = loginBackgroundImageArray[i++];) {
photos.push({ photos.push({
image: 'route/file/downloadfile/true/'+ item image: 'route/file/download/true/'+ item
}) })
} }
} else { } else {

View File

@ -450,7 +450,7 @@ public class FileServiceImpl extends DefaultBaseService implements IFileService
FileDTO fileDTO = uploadSingleForFileDTO(null, image, UploadTypeEnum.IMAGE, params); FileDTO fileDTO = uploadSingleForFileDTO(null, image, UploadTypeEnum.IMAGE, params);
result.put("errno", 0); result.put("errno", 0);
JSONArray fileArray = new JSONArray(); JSONArray fileArray = new JSONArray();
fileArray.add(String.format("route/file/downloadfile/true/%s", fileDTO.getFileId())); fileArray.add(String.format("route/file/download/true/%s", fileDTO.getFileId()));
result.put("data", fileArray); result.put("data", fileArray);
} catch (Exception e) { } catch (Exception e) {
LOG.error(e.getMessage(), e); LOG.error(e.getMessage(), e);
@ -528,7 +528,7 @@ public class FileServiceImpl extends DefaultBaseService implements IFileService
List<Map<String, String>> fileList = new ArrayList<>(); List<Map<String, String>> fileList = new ArrayList<>();
for (FileDTO fileDTO : listFileDTOs) { for (FileDTO fileDTO : listFileDTOs) {
Map<String, String> fileMap = new HashMap<>(0); Map<String, String> fileMap = new HashMap<>(0);
fileMap.put("url", String.format("%s/route/file/downloadfile/%s/%s.%s", request.getContextPath(), downloadFile, fileDTO.getFileId(), fileDTO.getFileType())); fileMap.put("url", String.format("%s/route/file/download/%s/%s.%s", request.getContextPath(), downloadFile, fileDTO.getFileId(), fileDTO.getFileType()));
fileList.add(fileMap); fileList.add(fileMap);
} }
JSONObject uEditorListResult = new JSONObject(); JSONObject uEditorListResult = new JSONObject();
@ -565,7 +565,7 @@ public class FileServiceImpl extends DefaultBaseService implements IFileService
if (fileDTO == null) { if (fileDTO == null) {
throw new SystemException("文件上传失败"); throw new SystemException("文件上传失败");
} }
String fileUrl = String.format("route/file/downloadfile/%s/%s.%s", downloadFile, fileDTO.getFileId(), fileDTO.getFileType()); String fileUrl = String.format("route/file/download/%s/%s.%s", downloadFile, fileDTO.getFileId(), fileDTO.getFileType());
JSONObject fileUploadResult = new JSONObject(); JSONObject fileUploadResult = new JSONObject();
fileUploadResult.put("state", "SUCCESS"); fileUploadResult.put("state", "SUCCESS");
fileUploadResult.put("url", fileUrl); fileUploadResult.put("url", fileUrl);

View File

@ -129,7 +129,7 @@
var icon = '<i class="fa fa-download"></i>'; var icon = '<i class="fa fa-download"></i>';
var result = ''; var result = '';
if(isImageType(row.fileType)) { if(isImageType(row.fileType)) {
result += '<img src="route/file/downloadfile/true/'+ row.fileId +'" style="display: none;"/>'; result += '<img src="route/file/download/true/'+ row.fileId +'" style="display: none;"/>';
imageIdArray.push(row.fileId); imageIdArray.push(row.fileId);
icon = '<i class="fa fa-image"></i>'; icon = '<i class="fa fa-image"></i>';
} else if(row.fileType === 'mp4') { } else if(row.fileType === 'mp4') {

View File

@ -11,9 +11,9 @@
<body> <body>
<div id="content" class="edit-content" style="padding: 5px;"> <div id="content" class="edit-content" style="padding: 5px;">
<div class="tile color"> <div class="tile color">
<img th:if="${type == 'image'}" th:src="@{'route/file/downloadfile/false/'+ ${fileId}}" alt="加载失败" style="width: 100%;"/> <img th:if="${type == 'image'}" th:src="@{'route/file/download/false/'+ ${fileId}}" alt="加载失败" style="width: 100%;"/>
<video th:if="${type == 'video'}" controls style="width:100%;"> <video th:if="${type == 'video'}" controls style="width:100%;">
<source th:src="@{'route/file/downloadfile/false/'+ ${fileId}}" type="video/mp4"> <source th:src="@{'route/file/download/false/'+ ${fileId}}" type="video/mp4">
您的浏览器不支持 video 标签。 您的浏览器不支持 video 标签。
</video> </video>
</div> </div>

View File

@ -140,7 +140,7 @@
if(null == item.userAvatar || '' == item.userAvatar) { if(null == item.userAvatar || '' == item.userAvatar) {
avatarDom = '<img class="user-avatar" src="assets/images/profile-photo.jpg"/> ' avatarDom = '<img class="user-avatar" src="assets/images/profile-photo.jpg"/> '
} else { } else {
avatarDom = '<img class="user-avatar" src="route/file/downloadfile/false/'+ item.userAvatar +'"/> '; avatarDom = '<img class="user-avatar" src="route/file/download/false/'+ item.userAvatar +'"/> ';
} }
userDom += '<a id="user_'+ item.userId +'" href="javascript:void(0);" class="users list-group-item '+ (isUserSelected(item.userId) ? 'user-selected' : '') +'" lay-click-user data-userid="'+ item.userId +'" data-username="'+ item.userName +'">'+ avatarDom + item.userName +' ['+ item.userUsername +']</a>'; userDom += '<a id="user_'+ item.userId +'" href="javascript:void(0);" class="users list-group-item '+ (isUserSelected(item.userId) ? 'user-selected' : '') +'" lay-click-user data-userid="'+ item.userId +'" data-username="'+ item.userName +'">'+ avatarDom + item.userName +' ['+ item.userUsername +']</a>';
} }
@ -167,7 +167,7 @@
if(null == item.userAvatar || '' == item.userAvatar) { if(null == item.userAvatar || '' == item.userAvatar) {
avatarDom = '<img class="user-avatar" src="assets/images/profile-photo.jpg"/> ' avatarDom = '<img class="user-avatar" src="assets/images/profile-photo.jpg"/> '
} else { } else {
avatarDom = '<img class="user-avatar" src="route/file/downloadfile/false/'+ item.userAvatar +'"/> '; avatarDom = '<img class="user-avatar" src="route/file/download/false/'+ item.userAvatar +'"/> ';
} }
userDom += '<a id="user_'+ item.userId +'" href="javascript:void(0);" class="users search-users list-group-item '+ (isUserSelected(item.userId) ? 'user-selected' : '') +'" lay-click-user data-userid="'+ item.userId +'" data-username="'+ item.userName +'">'+ avatarDom + item.userName +' ['+ item.userUsername +']</a>'; userDom += '<a id="user_'+ item.userId +'" href="javascript:void(0);" class="users search-users list-group-item '+ (isUserSelected(item.userId) ? 'user-selected' : '') +'" lay-click-user data-userid="'+ item.userId +'" data-username="'+ item.userName +'">'+ avatarDom + item.userName +' ['+ item.userUsername +']</a>';
} }

View File

@ -138,7 +138,7 @@
{{# for(var i = 0, item = files[i]; item = files[i++];) { }} {{# for(var i = 0, item = files[i]; item = files[i++];) { }}
<div class="upload-image-box"> <div class="upload-image-box">
<span class="upload-image-span"> <span class="upload-image-span">
<img src="route/file/downloadfile/false/{{item.fileId}}" align="加载失败"> <img src="route/file/download/false/{{item.fileId}}" align="加载失败">
</span> </span>
<a class="layui-btn layui-btn-xs layui-btn-danger text-danger remove-image" href="javascript:void(0);" lay-form-button data-id="{{item.fileId}}" data-name="{{fileName}}" lay-filter="systemIconRemoveFile"> <a class="layui-btn layui-btn-xs layui-btn-danger text-danger remove-image" href="javascript:void(0);" lay-form-button data-id="{{item.fileId}}" data-name="{{fileName}}" lay-filter="systemIconRemoveFile">
<i class="fa fa-trash-o"></i> <i class="fa fa-trash-o"></i>

View File

@ -138,7 +138,7 @@
{{# for(var i = 0, item = files[i]; item = files[i++];) { }} {{# for(var i = 0, item = files[i]; item = files[i++];) { }}
<div class="upload-image-box"> <div class="upload-image-box">
<span class="upload-image-span"> <span class="upload-image-span">
<img src="route/file/downloadfile/false/{{item.fileId}}" align="加载失败"> <img src="route/file/download/false/{{item.fileId}}" align="加载失败">
</span> </span>
<a class="layui-btn layui-btn-xs layui-btn-danger text-danger remove-image" href="javascript:void(0);" lay-form-button data-id="{{item.fileId}}" data-name="{{fileName}}" lay-filter="systemIconRemoveFile"> <a class="layui-btn layui-btn-xs layui-btn-danger text-danger remove-image" href="javascript:void(0);" lay-form-button data-id="{{item.fileId}}" data-name="{{fileName}}" lay-filter="systemIconRemoveFile">
<i class="fa fa-trash-o"></i> <i class="fa fa-trash-o"></i>