From 6f53b41baf2850b5661331d78554afb5aee3d80a Mon Sep 17 00:00:00 2001 From: gaoxiongzaq Date: Tue, 22 Aug 2023 10:16:02 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E6=96=B0=E5=A2=9E=20?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=20=E5=AE=9A=E4=BD=8D=E9=A1=B5=E7=A0=81=20?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E6=98=BE=E7=A4=BA=E5=A4=9A=E5=B0=91=E5=86=85?= =?UTF-8?q?=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/main/config/application.properties | 10 +- .../cn/keking/config/ConfigConstants.java | 82 ++++++++++++++--- .../keking/config/ConfigRefreshComponent.java | 12 +++ .../keking/web/filter/AttributeSetFilter.java | 4 + server/src/main/resources/web/main/index.ftl | 92 ++++++++++--------- 5 files changed, 140 insertions(+), 60 deletions(-) diff --git a/server/src/main/config/application.properties b/server/src/main/config/application.properties index 8bde8314..415e72c3 100644 --- a/server/src/main/config/application.properties +++ b/server/src/main/config/application.properties @@ -158,8 +158,14 @@ delete.captcha= ${KK_DELETE_CAPTCHA:false} delete.password = ${KK_DELETE_PASSWORD:123456} #删除 转换后OFFICE、CAD、TIFF、压缩包源文件 默认开启 节约磁盘空间 delete.source.file = ${KK_DELETE_SOURCE_FILE:true} - - +#首页初始化加载第一页 +home.pagenumber = ${DEFAULT_HOME_PAGENUMBER:1} +#首页是否分页 +home.pagination = ${DEFAULT_HOME_PAGINATION:true} +#首页初始化单页记录数 +home.pagesize = ${DEFAULT_HOME_PAGSIZE:15} +#首页显示查询框 +home.search = ${DEFAULT_HOME_SEARCH:true} #Tif类型设置 #Tif类型图片浏览模式:tif(利用前端js插件浏览);jpg(转换为jpg后前端显示);pdf(转换为pdf后显示,便于打印) diff --git a/server/src/main/java/cn/keking/config/ConfigConstants.java b/server/src/main/java/cn/keking/config/ConfigConstants.java index 559ba616..e92121cc 100644 --- a/server/src/main/java/cn/keking/config/ConfigConstants.java +++ b/server/src/main/java/cn/keking/config/ConfigConstants.java @@ -61,6 +61,10 @@ public class ConfigConstants { private static Boolean officeDocumentOpenPasswords; private static String cadTimeout; private static int cadThread; + private static String homePpageNumber; + private static String homePagination; + private static String homePageSize; + private static String homeSearch; public static final String DEFAULT_CACHE_ENABLED = "true"; public static final String DEFAULT_TXT_TYPE = "txt,html,htm,asp,jsp,xml,json,properties,md,gitignore,log,java,py,c,cpp,sql,sh,bat,m,bas,prg,cmd,xbrl"; @@ -91,11 +95,8 @@ public class ConfigConstants { public static final String DEFAULT_OFFICE_TYPE_WEB = "web"; public static final String DEFAULT_DELETE_SOURCE_FILE = "true"; public static final String DEFAULT_DELETE_CAPTCHA = "false"; - - public static final String DEFAULT_CAD_TIMEOUT = "90"; public static final String DEFAULT_CAD_THREAD = "5"; - public static final String DEFAULT_OFFICE_PAQERANQE = "false"; public static final String DEFAULT_OFFICE_WATERMARK = "false"; public static final String DEFAULT_OFFICE_QUALITY = "80"; @@ -103,7 +104,10 @@ public class ConfigConstants { public static final String DEFAULT_OFFICE_EXPORTBOOKMARKS = "true"; public static final String DEFAULT_OFFICE_EXPORTNOTES = "true"; public static final String DEFAULT_OFFICE_EOCUMENTOPENPASSWORDS = "true"; - + public static final String DEFAULT_HOME_PAGENUMBER = "1"; + public static final String DEFAULT_HOME_PAGINATION = "true"; + public static final String DEFAULT_HOME_PAGSIZE = "15"; + public static final String DEFAULT_HOME_SEARCH = "true"; public static Boolean isCacheEnabled() { return cacheEnabled; } @@ -407,16 +411,6 @@ public class ConfigConstants { ConfigConstants.tifPreviewType = tifPreviewType; } - public static String getBeian() { - return beian; - } - @Value("${beian:default}") - public void setBeian(String beian) { - setBeianValue(beian); - } - public static void setBeianValue(String beian) { - ConfigConstants.beian = beian; - } public static String[] getProhibit() { return prohibit; } @@ -627,4 +621,64 @@ public class ConfigConstants { ConfigConstants.officeDocumentOpenPasswords = officeDocumentOpenPasswords; } + /** + * 以下为首页显示 + */ + + public static String getBeian() { + return beian; + } + @Value("${beian:default}") + public void setBeian(String beian) { + setBeianValue(beian); + } + public static void setBeianValue(String beian) { + ConfigConstants.beian = beian; + } + + + public static String gethomePpageNumber() { + return homePpageNumber; + } + @Value("${home.pagenumber:1}") + public void sethomePpageNumber(String homePpageNumber) { + sethomePpageNumberValue(homePpageNumber); + } + public static void sethomePpageNumberValue(String homePpageNumber) { + ConfigConstants.homePpageNumber = homePpageNumber; + } + + public static String gethomePagination() { + return homePagination; + } + @Value("${home.pagination:true}") + public void sethomePagination(String homePagination) { + sethomePaginationValue(homePagination); + } + public static void sethomePaginationValue(String homePagination) { + ConfigConstants.homePagination = homePagination; + } + + public static String gethomePageSize() { + return homePageSize; + } + @Value("${home.pagesize:15}") + public void sethomePagesize(String homePageSize) { + sethomePageSizeValue(homePageSize); + } + public static void sethomePageSizeValue(String homePageSize) { + ConfigConstants.homePageSize = homePageSize; + } + + public static String gethomeSearch() { + return homeSearch; + } + @Value("${home.search:1}") + public void sethomeSearch(String homeSearch) { + sethomeSearchValue(homeSearch); + } + public static void sethomeSearchValue(String homeSearch) { + ConfigConstants.homeSearch = homeSearch; + } + } diff --git a/server/src/main/java/cn/keking/config/ConfigRefreshComponent.java b/server/src/main/java/cn/keking/config/ConfigRefreshComponent.java index 7abb7c90..92c7eb49 100644 --- a/server/src/main/java/cn/keking/config/ConfigRefreshComponent.java +++ b/server/src/main/java/cn/keking/config/ConfigRefreshComponent.java @@ -73,6 +73,10 @@ public class ConfigRefreshComponent { boolean officeDocumentOpenPasswords; String cadTimeout; int cadThread; + String homePpageNumber; + String homePagination; + String homePageSize; + String homeSearch; while (true) { FileReader fileReader = new FileReader(configFilePath); BufferedReader bufferedReader = new BufferedReader(fileReader); @@ -115,6 +119,10 @@ public class ConfigRefreshComponent { officeExportNotes = Boolean.parseBoolean(properties.getProperty("office.exportnotes", ConfigConstants.DEFAULT_OFFICE_EXPORTNOTES)); officeDocumentOpenPasswords = Boolean.parseBoolean(properties.getProperty("office.documentopenpasswords", ConfigConstants.DEFAULT_OFFICE_EOCUMENTOPENPASSWORDS)); cadTimeout = properties.getProperty("cad.timeout", ConfigConstants.DEFAULT_CAD_TIMEOUT); + homePpageNumber = properties.getProperty("home.pagenumber", ConfigConstants.DEFAULT_HOME_PAGENUMBER); + homePagination = properties.getProperty("home.pagination", ConfigConstants.DEFAULT_HOME_PAGINATION); + homePageSize = properties.getProperty("home.pagesize", ConfigConstants.DEFAULT_HOME_PAGSIZE); + homeSearch = properties.getProperty("home.search", ConfigConstants.DEFAULT_HOME_SEARCH); cadThread = Integer.parseInt(properties.getProperty("cad.thread", ConfigConstants.DEFAULT_CAD_THREAD)); prohibitArray = prohibit.split(","); @@ -154,6 +162,10 @@ public class ConfigRefreshComponent { ConfigConstants.setDeleteCaptchaValue(deleteCaptcha); ConfigConstants.setCadTimeoutValue(cadTimeout); ConfigConstants.setCadThreadValue(cadThread); + ConfigConstants.sethomePpageNumberValue(homePpageNumber); + ConfigConstants.sethomePaginationValue(homePagination); + ConfigConstants.sethomePageSizeValue(homePageSize); + ConfigConstants.sethomeSearchValue(homeSearch); setWatermarkConfig(properties); bufferedReader.close(); fileReader.close(); diff --git a/server/src/main/java/cn/keking/web/filter/AttributeSetFilter.java b/server/src/main/java/cn/keking/web/filter/AttributeSetFilter.java index d5ffb146..e9fd1c1b 100644 --- a/server/src/main/java/cn/keking/web/filter/AttributeSetFilter.java +++ b/server/src/main/java/cn/keking/web/filter/AttributeSetFilter.java @@ -44,6 +44,10 @@ public class AttributeSetFilter implements Filter { request.setAttribute("beian", ConfigConstants.getBeian()); request.setAttribute("size", ConfigConstants.maxSize()); request.setAttribute("deleteCaptcha", ConfigConstants.getDeleteCaptcha()); + request.setAttribute("homePpageNumber", ConfigConstants.gethomePpageNumber()); + request.setAttribute("homePagination", ConfigConstants.gethomePagination()); + request.setAttribute("homePageSize", ConfigConstants.gethomePageSize()); + request.setAttribute("homeSearch", ConfigConstants.gethomeSearch()); } /** diff --git a/server/src/main/resources/web/main/index.ftl b/server/src/main/resources/web/main/index.ftl index 24951ba1..0d2c1e60 100644 --- a/server/src/main/resources/web/main/index.ftl +++ b/server/src/main/resources/web/main/index.ftl @@ -21,40 +21,44 @@ .alert { width: 50%; } - - <#-- 删除吗CSS样式 --> -<#if deleteCaptcha > - - + <#-- 删除吗CSS样式 --> + <#if deleteCaptcha > + + @@ -155,16 +159,11 @@
<#if fileUploadDisable == false> -
-
- - -
-
+
+ +
-
-
-
+
@@ -201,7 +200,7 @@