limeng 3 tháng trước cách đây
mục cha
commit
ade2c4722e

+ 2 - 1
src/main/java/com/sooka/component/druid/DataSourceConfiguration.java

@@ -44,7 +44,8 @@ public class DataSourceConfiguration {
         //分页插件
         PageInterceptor pageHelper = new PageInterceptor();
         Properties properties = new Properties();
-        properties.setProperty("reasonable", "true");
+//        properties.setProperty("reasonable", "true");分页合理化,开启后,当pageNum大于总页数时,会自动设置为最后一页
+        properties.setProperty("reasonable", "false"); //关闭,适配手机端
         properties.setProperty("supportMethodsArguments", "true");
         properties.setProperty("returnPageInfo", "check");
         properties.setProperty("params", "count=countSql");

+ 4 - 30
src/main/java/com/sooka/module/web/cms/IndexController.java

@@ -150,13 +150,13 @@ public class IndexController {
         modelAndView.addObject("site",site);
         return modelAndView;
     }
-     //ccmj搜索
+     //搜索
      @RequestMapping("/searchFor")
      public ModelAndView SearchTitleFor(String type, String lmid, String keyword, String siteId, @RequestParam(value = "number",defaultValue = "1") Integer pageNumber){
-         ModelAndView modelAndView=new ModelAndView("www/ccmj/listss");
-         Map<String,Object>map=new HashMap<String, Object>(3);
+         ModelAndView modelAndView=new ModelAndView("www/tuiyijunren/listForSearch");
+         Map<String,Object>map=new HashMap<>(3);
          map.put("type",type);
-         if(!lmid.equals("0")){
+         if(lmid != null && !lmid.equals("0")){
             map.put("categoryId",lmid);
          }
          map.put("keyword",keyword);
@@ -172,32 +172,6 @@ public class IndexController {
          return modelAndView;
      }
 
-
-
-    //spdxx搜索
-    @RequestMapping("/searchFors")
-    public ModelAndView SearchTitleFors(String keyword, String siteId, @RequestParam(value = "number", defaultValue = "1") Integer pageNumber) {
-        ModelAndView modelAndView = new ModelAndView("www/spdx/listss");
-        Map<String, Object> map = new HashMap<String, Object>(4);
-        map.put("keyword", keyword);
-        map.put("type", "title");
-        map.put("status", 1); // 添加status为1的条件
-
-        PageInfo<TCmsContent> tCmsContentPageInfo = contentService.SearchTitleFor(pageNumber, map);
-        TCmsSite site = new TCmsSite();
-        site.setSiteId(Integer.parseInt(siteId));
-        modelAndView.addObject("model", tCmsContentPageInfo);
-        modelAndView.addObject("frontPath", httpProtocol + "://" + host + ":" + port + "/" + siteName + "/" + sitePrefix);
-        modelAndView.addObject("resPath", httpProtocol + "://" + host + ":" + port + "/" + siteName + "/static/www");
-        modelAndView.addObject("keyword", keyword);
-        modelAndView.addObject("siteId", siteId);
-        modelAndView.addObject("site", site);
-        return modelAndView;
-    }
-//     @RequestMapping("/ceshi")
-//     public ModelAndView ceTitleshi(String ceshi1, String ceshi2 ,String ceshi3, @RequestParam(value="number",defaultValue="1") Integer pageNumber){
-//      Map<String,Object>map=new HashMap<String, Object>
-//     }
     /**
      * 站点首页
      * @param siteId

+ 6 - 3
src/main/resources/templates/www/tuiyijunren/include/header-index.html

@@ -26,9 +26,12 @@
         </span>
     </div>
     <div class="wid1200"><img src="${resPath}/tuiyijunren/images/twjr_logo.png"/>
-        <form class="ss">
-            <input type="text" class="ss_inp" placeholder="请输入搜索关键词"/>
-            <input type="button" class="ss_btn"/>
+        <form class="ss" action="${ctxPath}/searchFor"  accept-charset="UTF-8" method="post">
+            <input type="hidden" value="${site.siteId!}" name="siteId">
+            <input type="hidden" value="title" name="type">
+            <input type="text" class="ss_inp" placeholder="请输入搜索关键词" name="keyword"
+                   onblur="if (this.value == ''){this.value = '';}" onfocus="if (this.value == '请输入搜索关键词') {this.value = '';}"/>
+            <button type="submit" class="ss_btn"></button>
         </form>
     </div>
 </div>

+ 24 - 0
src/main/resources/templates/www/tuiyijunren/listForSearch.html

@@ -0,0 +1,24 @@
+<!--头部开始-->
+@includeFileTemplate("/www/tuiyijunren/include/header.html"){}
+<!--头部结束-->
+<div class="er_content">
+	<div class="news_list">
+
+		@for(item in model.list){
+			<a class="hzqy_list_div clearfix" href="${frontPath}/${siteId}/${item.categoryId}/${item.contentId}.html" style="color: #1b1b1b">
+				<div class="hzqy_list_text">
+					<h2>${item.title!}</h2>
+					<span>简介:${item.description!}</span>
+					<span>发布时间:${item.inputdate,dateFormat="YYYY-MM-dd"}</span>
+				</div>
+			</a>
+		@}
+	</div>
+
+</div>
+<!--中间内容结束-->
+<!--底部开始-->
+@includeFileTemplate("/www/tuiyijunren/include/footer.html"){}
+<!--底部结束-->
+</body>
+</html>