1.office预览图片模式禁用图片放大效果,达到图片和pdf预览效果一致的体验
parent
c1802b2487
commit
9b0f381c06
|
@ -158,7 +158,7 @@ public class ConfigConstants {
|
|||
}
|
||||
|
||||
public static void setFileDirValue(String fileDir) {
|
||||
if (!DEFAULT_FILE_DIR_VALUE.equals(fileDir.toLowerCase())) {
|
||||
if (!DEFAULT_FILE_DIR_VALUE.equalsIgnoreCase(fileDir)) {
|
||||
if (!fileDir.endsWith(File.separator)) {
|
||||
fileDir = fileDir + File.separator;
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ public class ConfigConstants {
|
|||
|
||||
public static void setTrustHostValue(String trustHost) {
|
||||
CopyOnWriteArraySet<String> trustHostSet;
|
||||
if (DEFAULT_TRUST_HOST.equals(trustHost.toLowerCase())) {
|
||||
if (DEFAULT_TRUST_HOST.equalsIgnoreCase(trustHost)) {
|
||||
trustHostSet = new CopyOnWriteArraySet<>();
|
||||
} else {
|
||||
String[] trustHostArray = trustHost.toLowerCase().split(",");
|
||||
|
@ -207,9 +207,11 @@ public class ConfigConstants {
|
|||
public static String getOfficePreviewSwitchDisabled() {
|
||||
return OFFICE_PREVIEW_SWITCH_DISABLED;
|
||||
}
|
||||
|
||||
@Value("${office.preview.switch.disabled:true}")
|
||||
public static void setOfficePreviewSwitchDisabled(String officePreviewSwitchDisabled) {
|
||||
public void setOfficePreviewSwitchDisabled(String officePreviewSwitchDisabled) {
|
||||
OFFICE_PREVIEW_SWITCH_DISABLED = officePreviewSwitchDisabled;
|
||||
}
|
||||
public static void setOfficePreviewSwitchDisabledValue(String officePreviewSwitchDisabled) {
|
||||
OFFICE_PREVIEW_SWITCH_DISABLED = officePreviewSwitchDisabled;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ public class ConfigRefreshComponent {
|
|||
ConfigConstants.setFtpControlEncodingValue(ftpControlEncoding);
|
||||
ConfigConstants.setBaseUrlValue(baseUrl);
|
||||
ConfigConstants.setTrustHostValue(trustHost);
|
||||
ConfigConstants.setOfficePreviewSwitchDisabled(officePreviewSwitchDisabled);
|
||||
ConfigConstants.setOfficePreviewSwitchDisabledValue(officePreviewSwitchDisabled);
|
||||
ConfigConstants.setPdfDownloadDisableValue(pdfDownloadDisable);
|
||||
setWatermarkConfig(properties);
|
||||
bufferedReader.close();
|
||||
|
|
|
@ -23,17 +23,11 @@ import java.util.List;
|
|||
public class OfficeFilePreviewImpl implements FilePreview {
|
||||
|
||||
private final FileUtils fileUtils;
|
||||
|
||||
private final PdfUtils pdfUtils;
|
||||
|
||||
private final DownloadUtils downloadUtils;
|
||||
|
||||
private final OfficeToPdf officeToPdf;
|
||||
|
||||
public OfficeFilePreviewImpl(FileUtils fileUtils,
|
||||
PdfUtils pdfUtils,
|
||||
DownloadUtils downloadUtils,
|
||||
OfficeToPdf officeToPdf) {
|
||||
public OfficeFilePreviewImpl(FileUtils fileUtils, PdfUtils pdfUtils, DownloadUtils downloadUtils, OfficeToPdf officeToPdf) {
|
||||
this.fileUtils = fileUtils;
|
||||
this.pdfUtils = pdfUtils;
|
||||
this.downloadUtils = downloadUtils;
|
||||
|
@ -47,7 +41,7 @@ public class OfficeFilePreviewImpl implements FilePreview {
|
|||
@Override
|
||||
public String filePreviewHandle(String url, Model model, FileAttribute fileAttribute) {
|
||||
// 预览Type,参数传了就取参数的,没传取系统默认
|
||||
String officePreviewType = model.asMap().get("officePreviewType") == null ? ConfigConstants.getOfficePreviewType() : model.asMap().get("officePreviewType").toString();
|
||||
String officePreviewType = fileAttribute.getOfficePreviewType();
|
||||
String baseUrl = BaseUrlFilter.getBaseUrl();
|
||||
String suffix=fileAttribute.getSuffix();
|
||||
String fileName=fileAttribute.getName();
|
||||
|
|
|
@ -104,7 +104,7 @@ public class FileUtils {
|
|||
/**
|
||||
* 从url中剥离出文件名
|
||||
*
|
||||
* @param url 格式如:http://keking.ufile.ucloud.com.cn/20171113164107_月度绩效表模板(新).xls?UCloudPublicKey=ucloudtangshd@weifenf.com14355492830001993909323&Expires=&Signature=I D1NOFtAJSPT16E6imv6JWuq0k=
|
||||
* @param url 格式如:http://www.com.cn/20171113164107_月度绩效表模板(新).xls?UCloudPublicKey=ucloudtangshd@weifenf.com14355492830001993909323&Expires=&Signature=I D1NOFtAJSPT16E6imv6JWuq0k=
|
||||
* @return 文件名
|
||||
*/
|
||||
public String getFileNameFromURL(String url) {
|
||||
|
@ -340,26 +340,28 @@ public class FileUtils {
|
|||
public FileAttribute getFileAttribute(String url, HttpServletRequest req) {
|
||||
FileAttribute attribute = new FileAttribute();
|
||||
String suffix;
|
||||
String fullFileName = getUrlParameterReg(url, "fullfilename");
|
||||
FileType type;
|
||||
String fileName;
|
||||
String fullFileName = this.getUrlParameterReg(url, "fullfilename");
|
||||
if (StringUtils.hasText(fullFileName)) {
|
||||
attribute.setName(fullFileName);
|
||||
FileType type = typeFromFileName(fullFileName);
|
||||
attribute.setType(type);
|
||||
fileName = fullFileName;
|
||||
type = typeFromFileName(fullFileName);
|
||||
suffix = suffixFromFileName(fullFileName);
|
||||
} else {
|
||||
|
||||
String fileName = getFileNameFromURL(url);
|
||||
FileType type = typeFromUrl(url);
|
||||
attribute.setName(fileName);
|
||||
attribute.setType(type);
|
||||
fileName = getFileNameFromURL(url);
|
||||
type = typeFromUrl(url);
|
||||
suffix = suffixFromUrl(url);
|
||||
}
|
||||
attribute.setType(type);
|
||||
attribute.setName(fileName);
|
||||
attribute.setSuffix(suffix);
|
||||
attribute.setUrl(url);
|
||||
if (req != null) {
|
||||
String officePreviewType = req.getParameter("officePreviewType");
|
||||
|
||||
if(StringUtils.hasText(officePreviewType)){
|
||||
attribute.setOfficePreviewType(officePreviewType);
|
||||
}
|
||||
}
|
||||
return attribute;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
<div class="container">
|
||||
<#list imgurls as img>
|
||||
<div class="img-area">
|
||||
<img class="my-photo" alt="loading" title="查看大图" style="cursor: pointer;" data-src="${img}" src="images/loading.gif" onclick="changePreviewType('allImages')">
|
||||
<img class="my-photo" alt="loading" data-src="${img}" src="images/loading.gif">
|
||||
</div>
|
||||
</#list>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue