Commit d6537f050baa6e7581f11a81e1a89bae23ace78d

Authored by liwei2917
1 parent 6925cbf9

增加每页显示条数,评论页面重构

src/main/java/com/cnlive/shenhe/controller/CommentsController.java
@@ -62,7 +62,7 @@ public class CommentsController { @@ -62,7 +62,7 @@ public class CommentsController {
62 */ 62 */
63 @GetMapping("/page") 63 @GetMapping("/page")
64 public String getPage(Model model, String activity_id, String content, Integer is_hot, 64 public String getPage(Model model, String activity_id, String content, Integer is_hot,
65 - String start_date, String end_date, String state, Integer receive, 65 + String start_date, String end_date, Integer state, Integer receive,
66 Integer page, Integer pageSize, String orderByClause, HttpSession session) { 66 Integer page, Integer pageSize, String orderByClause, HttpSession session) {
67 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); 67 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
68 if(CommonUtils.isNull(sessionUser)){ 68 if(CommonUtils.isNull(sessionUser)){
@@ -135,6 +135,7 @@ public class CommentsController { @@ -135,6 +135,7 @@ public class CommentsController {
135 /* 获取参数值给前台 用来判断是否需要把查看显示出来 state recive*/ 135 /* 获取参数值给前台 用来判断是否需要把查看显示出来 state recive*/
136 String state1 = state == null ? "" : state.toString(); 136 String state1 = state == null ? "" : state.toString();
137 model.addAttribute("state1", state1); 137 model.addAttribute("state1", state1);
  138 + model.addAttribute("pageSize", pageSize);
138 model.addAttribute("commentPage", commentPage); 139 model.addAttribute("commentPage", commentPage);
139 return "page/comment.html"; 140 return "page/comment.html";
140 } 141 }
src/main/java/com/cnlive/shenhe/controller/ContentController.java
@@ -129,6 +129,7 @@ public class ContentController { @@ -129,6 +129,7 @@ public class ContentController {
129 } 129 }
130 } 130 }
131 model.addAttribute("contentPage", contentPage); 131 model.addAttribute("contentPage", contentPage);
  132 + model.addAttribute("pageSize", pageSize);
132 return "page/content.html"; 133 return "page/content.html";
133 } 134 }
134 135
src/main/java/com/cnlive/shenhe/controller/LiveController.java
@@ -163,6 +163,7 @@ public class LiveController { @@ -163,6 +163,7 @@ public class LiveController {
163 } 163 }
164 } 164 }
165 model.addAttribute("livePage", livePage); 165 model.addAttribute("livePage", livePage);
  166 + model.addAttribute("pageSize", pageSize);
166 return "page/live.html"; 167 return "page/live.html";
167 } 168 }
168 169
src/main/java/com/cnlive/shenhe/controller/SitesController.java
@@ -69,6 +69,7 @@ public class SitesController { @@ -69,6 +69,7 @@ public class SitesController {
69 } 69 }
70 } 70 }
71 model.addAttribute("sitePage", sitePage); 71 model.addAttribute("sitePage", sitePage);
  72 + model.addAttribute("pageSize", pageSize);
72 model.addAttribute("business", business); 73 model.addAttribute("business", business);
73 return "page/site.html"; 74 return "page/site.html";
74 } 75 }
src/main/java/com/cnlive/shenhe/controller/VideosController.java
@@ -173,6 +173,7 @@ public class VideosController { @@ -173,6 +173,7 @@ public class VideosController {
173 } 173 }
174 model.addAttribute("state1", state1); 174 model.addAttribute("state1", state1);
175 model.addAttribute("receive1", receive1); 175 model.addAttribute("receive1", receive1);
  176 + model.addAttribute("pageSize", pageSize);
176 model.addAttribute("videoPage", videoPage); 177 model.addAttribute("videoPage", videoPage);
177 return "page/video.html"; 178 return "page/video.html";
178 } 179 }
src/main/java/com/cnlive/shenhe/serviceImpl/CommentsServiceImpl.java
@@ -79,7 +79,7 @@ public class CommentsServiceImpl { @@ -79,7 +79,7 @@ public class CommentsServiceImpl {
79 return shyCommentsMapper.updateByPrimaryKeySelective(shyComments); 79 return shyCommentsMapper.updateByPrimaryKeySelective(shyComments);
80 } 80 }
81 81
82 - public PageInfo<ShyComments> getPage(String activity_id, String content, Integer is_hot, Date start_date, Date end_date, String states, Integer receive, String updater, Integer page, Integer pageSize, String orderByClause, Integer spid, String userId) { 82 + public PageInfo<ShyComments> getPage(String activity_id, String content, Integer is_hot, Date start_date, Date end_date, Integer states, Integer receive, String updater, Integer page, Integer pageSize, String orderByClause, Integer spid, String userId) {
83 Example example = new Example(ShyComments.class); 83 Example example = new Example(ShyComments.class);
84 Example.Criteria criteria = example.createCriteria(); 84 Example.Criteria criteria = example.createCriteria();
85 if (CommonUtils.isNotEmpty(orderByClause)) { 85 if (CommonUtils.isNotEmpty(orderByClause)) {
@@ -113,13 +113,22 @@ public class CommentsServiceImpl { @@ -113,13 +113,22 @@ public class CommentsServiceImpl {
113 } 113 }
114 } 114 }
115 115
116 - if (CommonUtils.isNotEmpty(states)) {  
117 - Example.Criteria criteria1 = example.createCriteria();  
118 - String[] stas = states.split(",");  
119 - for (String s : stas) {  
120 - criteria1.orEqualTo("state", Integer.parseInt(s));  
121 - }  
122 - example.and(criteria1); 116 +// if (CommonUtils.isNotEmpty(states)) {
  117 +// Example.Criteria criteria1 = example.createCriteria();
  118 +// String[] stas = states.split(",");
  119 +// for (String s : stas) {
  120 +// criteria1.orEqualTo("state", Integer.parseInt(s));
  121 +// }
  122 +// example.and(criteria1);
  123 +// }
  124 +
  125 + if (CommonUtils.isNotNull(states) && states != 3) {
  126 + criteria.andEqualTo("state", states);
  127 + } else if (CommonUtils.isNotNull(states) && states == 3) {
  128 + Example.Criteria criteria1 = example.createCriteria();
  129 + criteria1.orEqualTo("state", 1);
  130 + criteria1.orEqualTo("state", 2);
  131 + example.and(criteria1);
123 } 132 }
124 133
125 PageHelper.startPage(page, pageSize, true); 134 PageHelper.startPage(page, pageSize, true);
src/main/resources/templates/page/comment.html
@@ -60,21 +60,21 @@ @@ -60,21 +60,21 @@
60 60
61 <div class="btn-group margin-bottom pull-right"> 61 <div class="btn-group margin-bottom pull-right">
62 <div class="btn-group margin-bottom"> 62 <div class="btn-group margin-bottom">
63 - <button type="button" id="all_button" 63 + <button type="button" id="quanbu"
64 class="btn btn-sm margin-r-5 action_bottom" 64 class="btn btn-sm margin-r-5 action_bottom"
65 - onclick="searchStatus('','')">全部 65 + th:onclick="'javascript:quanbu()'">全部
66 </button> 66 </button>
67 - <button type="button" id="before_button" 67 + <button type="button" id="daishen"
68 class="btn btn-sm margin-r-5 action_bottom" 68 class="btn btn-sm margin-r-5 action_bottom"
69 - onclick="searchStatus('0',0)">全部待领 69 + >全部待领
70 </button> 70 </button>
71 - <button type="button" id="my_brfore_button" 71 + <button type="button" id="Mydaishen"
72 class="btn btn-sm margin-r-5 action_bottom" 72 class="btn btn-sm margin-r-5 action_bottom"
73 - onclick="searchStatus('0',1)">我的待审 73 + >我的待审
74 </button> 74 </button>
75 - <button type="button" id="my_after_button" 75 + <button type="button" id="yishen"
76 class="btn btn-sm margin-r-5 action_bottom" 76 class="btn btn-sm margin-r-5 action_bottom"
77 - onclick="searchStatus('1,2',1)">我的已审 77 + >我的已审
78 </button> 78 </button>
79 </div> 79 </div>
80 <button type="button" class="btn btn-primary btn-sm margin-r-5" id="query" 80 <button type="button" class="btn btn-primary btn-sm margin-r-5" id="query"
@@ -93,14 +93,14 @@ @@ -93,14 +93,14 @@
93 <label for="activity_id" class="control-label cb-toolbar">活动id:</label> 93 <label for="activity_id" class="control-label cb-toolbar">活动id:</label>
94 <div class="col-sm-8" style="padding: 0;"> 94 <div class="col-sm-8" style="padding: 0;">
95 <input class="form-control" name="activity_id" type="text" 95 <input class="form-control" name="activity_id" type="text"
96 - id="activity_id" th:value="${param.activity_id}"> 96 + id="activity_id" >
97 </div> 97 </div>
98 </div> 98 </div>
99 <div class="col-md-4" style="padding: 0"> 99 <div class="col-md-4" style="padding: 0">
100 <label for="content" class="control-label cb-toolbar">内容:</label> 100 <label for="content" class="control-label cb-toolbar">内容:</label>
101 <div class="col-sm-8" style="padding: 0;"> 101 <div class="col-sm-8" style="padding: 0;">
102 <input class="form-control" name="content" type="text" id="content" 102 <input class="form-control" name="content" type="text" id="content"
103 - th:value="${param.content}"> 103 + >
104 </div> 104 </div>
105 </div> 105 </div>
106 <div class="col-md-3" style="padding: 0"> 106 <div class="col-md-3" style="padding: 0">
@@ -108,9 +108,9 @@ @@ -108,9 +108,9 @@
108 <div class="col-sm-6" style="padding: 0;"> 108 <div class="col-sm-6" style="padding: 0;">
109 <select class="form-control col-sm-2" id="state" name="state"> 109 <select class="form-control col-sm-2" id="state" name="state">
110 <option value="">全部</option> 110 <option value="">全部</option>
111 - <option value="0" th:selected="${state1 == '0'}">未审核</option>  
112 - <option value="1" th:selected="${state1 == '1'}">已通过</option>  
113 - <option value="2" th:selected="${state1 == '2'}">已拒绝</option> 111 + <option value="0" >未审核</option>
  112 + <option value="1" >已通过</option>
  113 + <option value="2" >已拒绝</option>
114 </select> 114 </select>
115 </div> 115 </div>
116 </div> 116 </div>
@@ -145,11 +145,11 @@ @@ -145,11 +145,11 @@
145 </span> 145 </span>
146 </div> 146 </div>
147 </div> 147 </div>
148 - <div class="col-md-4" style="padding: 0;width: 2%;">  
149 - <button type="button" class="btn btn-info btn-sm" id="comments_query"  
150 - onclick="javascript:$('#commentForm').submit();">查 询  
151 - </button>  
152 - </div> 148 +<!-- <div class="col-md-4" style="padding: 0;width: 2%;"> -->
  149 +<!-- <button type="button" class="btn btn-info btn-sm" id="comments_query" -->
  150 +<!-- onclick="javascript:$('#commentForm').submit();">查 询 -->
  151 +<!-- </button> -->
  152 +<!-- </div> -->
153 </div> 153 </div>
154 </div> 154 </div>
155 </form> 155 </form>
@@ -339,47 +339,50 @@ @@ -339,47 +339,50 @@
339 </div> 339 </div>
340 <div class="fixed-table-pagination" style="display: block;"> 340 <div class="fixed-table-pagination" style="display: block;">
341 <div class="pull-left pagination-detail"> 341 <div class="pull-left pagination-detail">
342 - <span class="pagination-info" th:text="'共 '+${commentPage.total}+' 条记录'">总共 0 条记录</span> 342 + <span class="pagination-info" th:text="'共 '+${commentPage.total}+' 条记录,每页显示'">总共 0 条记录</span>
  343 + <select class="" id="pageSize" name="pageSize">
  344 + <option value="10" th:selected="${pageSize==10}">10</option>
  345 + <option value="20" th:selected="${pageSize==20}">20</option>
  346 + <option value="50" th:selected="${pageSize==50}">50</option>
  347 + <option value="100" th:selected="${pageSize==100}">100</option>
  348 + </select>
  349 + <span class="pagination-info" >条记录</span>
343 </div> 350 </div>
344 <div class="pull-right pagination"> 351 <div class="pull-right pagination">
345 - <ul class="pagination" th:if="${commentPage.pages>1}" id="pageUl">  
346 - <li class="page-pre"><a th:href="@{'/comments/page'}">‹‹</a></li>  
347 - <li class="page-pre" th:if="${!commentPage.isFirstPage}"><a  
348 - th:href="@{'/comments/page?page='+${commentPage.pageNum-1}}">‹</a>  
349 - </li>  
350 -  
351 - <li class="page-number" th:if="${commentPage.pageNum-3>=1}"><a  
352 - th:href="@{'/comments/page?page='+${commentPage.pageNum-3}}"  
353 - th:text="${commentPage.pageNum-3}">2</a></li>  
354 - <li class="page-number" th:if="${commentPage.pageNum-2>=1}"><a  
355 - th:href="@{'/comments/page?page='+${commentPage.pageNum-2}}"  
356 - th:text="${commentPage.pageNum-2}">2</a></li>  
357 - <li class="page-number" th:if="${commentPage.pageNum-1>=1}"><a  
358 - th:href="@{'/comments/page?page='+${commentPage.pageNum-1}}"  
359 - th:text="${commentPage.pageNum-1}">2</a></li>  
360 - <li class="page-number active"><a href="javaScript:void(0);"  
361 - th:text="${commentPage.pageNum}">2</a>  
362 - </li>  
363 - <li class="page-number"  
364 - th:if="${commentPage.pageNum+1<=commentPage.pages}"><a  
365 - th:href="@{'/comments/page?page='+${commentPage.pageNum+1}}"  
366 - th:text="${commentPage.pageNum+1}">2</a></li>  
367 - <li class="page-number"  
368 - th:if="${commentPage.pageNum+2<=commentPage.pages}"><a  
369 - th:href="@{'/comments/page?page='+${commentPage.pageNum+2}}"  
370 - th:text="${commentPage.pageNum+2}">2</a></li>  
371 - <li class="page-number"  
372 - th:if="${commentPage.pageNum+3<=commentPage.pages}"><a  
373 - th:href="@{'/comments/page?page='+${commentPage.pageNum+3}}"  
374 - th:text="${commentPage.pageNum+3}">2</a></li>  
375 -  
376 - <li class="page-next" th:if="${!commentPage.isLastPage}"><a  
377 - th:href="@{'/comments/page?page='+${commentPage.pageNum+1}}">›</a>  
378 - </li>  
379 - <li class="page-next"><a  
380 - th:href="@{'/comments/page?page='+${commentPage.pages}}">››</a>  
381 - </li>  
382 - </ul> 352 + <ul class="pagination" th:if="${commentPage.pages>1}">
  353 + <li class="page-pre"><a th:href="'javascript:fanye(1);'">‹‹</a></li>
  354 + <li class="page-pre" th:if="${!commentPage.isFirstPage}"><a
  355 + th:onclick="'javascript:fanye(\''+${commentPage.pageNum-1}+'\');'">‹</a>
  356 + </li>
  357 +
  358 + <li class="page-number" th:if="${commentPage.pageNum-3>=1}"><a
  359 + th:onclick="'javascript:fanye(\''+${commentPage.pageNum-3}+'\');'"
  360 + th:text="${commentPage.pageNum-3}">2</a></li>
  361 + <li class="page-number" th:if="${commentPage.pageNum-2>=1}"><a
  362 + th:onclick="'javascript:fanye(\''+${commentPage.pageNum-2}+'\');'"
  363 + th:text="${commentPage.pageNum-2}">2</a></li>
  364 + <li class="page-number" th:if="${commentPage.pageNum-1>=1}"><a
  365 + th:onclick="'javascript:fanye(\''+${commentPage.pageNum-1}+'\');'"
  366 + th:text="${commentPage.pageNum-1}">2</a></li>
  367 + <li class="page-number active"><a href="javaScript:void(0);"
  368 + th:text="${commentPage.pageNum}">2</a></li>
  369 + <li class="page-number" th:if="${commentPage.pageNum+1<=commentPage.pages}"><a
  370 + th:onclick="'javascript:fanye(\''+${commentPage.pageNum+1}+'\');'"
  371 + th:text="${commentPage.pageNum+1}">2</a></li>
  372 + <li class="page-number" th:if="${commentPage.pageNum+2<=commentPage.pages}"><a
  373 + th:onclick="'javascript:fanye(\''+${commentPage.pageNum+2}+'\');'"
  374 + th:text="${commentPage.pageNum+2}">2</a></li>
  375 + <li class="page-number" th:if="${commentPage.pageNum+3<=commentPage.pages}"><a
  376 + th:onclick="'javascript:fanye(\''+${commentPage.pageNum+3}+'\');'"
  377 + th:text="${commentPage.pageNum+3}">2</a></li>
  378 +
  379 + <li class="page-next" th:if="${!commentPage.isLastPage}"><a
  380 + th:onclick="'javascript:fanye(\''+${commentPage.pageNum+1}+'\');'">›</a>
  381 + </li>
  382 + <li class="page-next"><a
  383 + th:onclick="'javascript:fanye(\''+${commentPage.pages}+'\');'">››</a>
  384 + </li>
  385 + </ul>
383 </div> 386 </div>
384 </div> 387 </div>
385 </div> 388 </div>
@@ -419,112 +422,87 @@ @@ -419,112 +422,87 @@
419 </div> 422 </div>
420 <!-- /.modal --> 423 <!-- /.modal -->
421 <script th:inline="javascript"> 424 <script th:inline="javascript">
422 - var pages = [[${param.page}]];  
423 - var pageNum = 1;  
424 - var sea = location.search;  
425 $(function () { 425 $(function () {
426 - //判断除页数参数外是否还有其他参数  
427 - if (sea != "") {  
428 - if (pages != null) {  
429 - pageNum = pages[0];  
430 - }  
431 - //有其他参数,页脚链接加上参数  
432 - if (sea != "?page=" + pageNum) {  
433 - sea = sea.replace("page=" + pageNum, "");//去掉page参数  
434 - $("#pageUl li a").each(function (i, e) {  
435 - var h = $(e).attr("href");  
436 - if (h.indexOf("page=") >= 0) {  
437 - sea = sea.replace("?", "");//去掉问号  
438 - if (!sea.startsWith("&")) sea = "&" + sea;  
439 - h = h + sea;  
440 - $(e).attr("href", h);  
441 - } else if (h.endsWith("page")) {  
442 - sea = sea.replace("?&", "?");  
443 - h = h + sea;  
444 - $(e).attr("href", h);  
445 - }  
446 - })  
447 - }  
448 - }  
449 -  
450 -  
451 - //按钮颜色显示 426 + //按钮颜色设置
452 var state = [[${param.state}]] ? [[${param.state}]][0] : null; 427 var state = [[${param.state}]] ? [[${param.state}]][0] : null;
453 var receive = [[${param.receive}]] ? [[${param.receive}]][0] : null; 428 var receive = [[${param.receive}]] ? [[${param.receive}]][0] : null;
454 var stateIsNull = $.trim(state) == ""; 429 var stateIsNull = $.trim(state) == "";
455 var receiveIsNull = $.trim(receive) == ""; 430 var receiveIsNull = $.trim(receive) == "";
456 - if (stateIsNull && receiveIsNull) {  
457 - $("#all_button").addClass("btn-info"); 431 + if ( receiveIsNull) {
  432 + $("#quanbu").addClass("btn-info");
458 } else if (state == '0' && receive == '0') { 433 } else if (state == '0' && receive == '0') {
459 - $("#before_button").addClass("btn-warning");  
460 - } else if (!stateIsNull && state != '0' && receive == '1') {  
461 - $("#my_after_button").addClass("btn-success"); 434 + $("#daishen").addClass("btn-warning");
462 } else if (state == '0' && receive == '1') { 435 } else if (state == '0' && receive == '1') {
463 - $("#my_brfore_button").addClass("btn-danger"); 436 + $("#Mydaishen").addClass("btn-success");
  437 + } else if (!stateIsNull && state != '0' && receive == '1') {
  438 + $("#yishen").addClass("btn-danger");
464 } 439 }
465 440
466 }) 441 })
467 -  
468 - //已审、未审、全部,状态切换  
469 - function searchStatus(commentStatus, receive) {  
470 - var href = location.href;  
471 - if ($.trim($("#state").val()) != '') commentStatus =$("#state").val();  
472 - if (sea == "") {//没有参数  
473 - if (href.endsWith("?")) href = href.substring(0, href.length - 1);  
474 - if ($.trim(commentStatus) != '') href = href + "?state=" + commentStatus;  
475 - } else if (sea.indexOf("state=") < 0) {//没有参数state  
476 - var se = sea.replace("?", "");//去掉问号,防止问号和要去掉的参数相连  
477 - if (sea.indexOf("page=") >= 0) {//有参数page,去掉  
478 - var split = se.split("&");  
479 - var h = "";  
480 - for (var i = 0; i < split.length; i++) {  
481 - var s = split[i];  
482 - if (s.indexOf("page=") < 0) h = h + "&" + split[i];  
483 - }  
484 - se = h.substring(1);  
485 - }  
486 - if ($.trim(commentStatus) != '') href = location.origin + location.pathname + "?" + se + "&state=" + commentStatus;  
487 - } else {//有参数state  
488 - if (href.indexOf("&") >= 0) {//有其他参数,去掉page和旧的state  
489 - var se = sea.replace("?", "");//去掉问号  
490 - var split = se.split("&");  
491 - var h = "";  
492 - for (var i = 0; i < split.length; i++) {  
493 - var s = split[i];  
494 - if (s.indexOf("state=") < 0 && s.indexOf("page=") < 0) h = h + "&" + split[i];  
495 - }  
496 - if ($.trim(commentStatus) != '') {  
497 - href = location.origin + location.pathname + "?state=" + commentStatus + "&" + h.substring(1);  
498 - } else {  
499 - href = location.origin + location.pathname + "?" + h.substring(1);  
500 - }  
501 - } else {//只有state参数,直接拼接链接  
502 - if ($.trim(commentStatus) != '') {  
503 - href = location.origin + location.pathname + "?state=" + commentStatus;  
504 - } else {  
505 - href = location.origin + location.pathname;  
506 - }  
507 - }  
508 - }  
509 - //去掉领取参数  
510 - if (href.indexOf("receive") >= 0) {  
511 - href = href.replace("receive=1", "");  
512 - href = href.replace("receive=0", "");  
513 - }  
514 - href = href.replace("&&", "&");  
515 - href = href.replace("?&", "?");  
516 - if (href.endsWith("&")) href = href.substring(0, href.length - 1);  
517 - if (href.endsWith("?")) href = href.substring(0, href.length - 1);  
518 - if ($.trim(receive) != "") {  
519 - if (href.indexOf("=") > 0) {//有其他参数  
520 - href += "&receive=" + receive;  
521 - } else {  
522 - href += "?receive=" + receive; 442 +
  443 + //翻页函数
  444 + function fanye(page) {
  445 + var param = location.search;
  446 + if (param.indexOf("page=") != -1) {
  447 + var se = param.replace("?", "");//去掉问号,防止问号和要去掉的参数相连
  448 + var split = se.split("&");
  449 + var h = "";
  450 + for (var i = 0; i < split.length; i++) {
  451 + var s = split[i];
  452 + if (s.indexOf("page=") < 0) h = h + "&" + split[i];
523 } 453 }
  454 + window.location.href = "/comments/page?" + h + "&page=" + page;
  455 + } else {
  456 + param = param.substring(1, param.length);
  457 + window.location.href = "/comments/page?" + param + "&page=" + page;
524 } 458 }
525 - location.href = href;  
526 } 459 }
527 - 460 +
  461 + var activity_id ="";//活动id
  462 + var content = "";//内容
  463 + var state ="";//状态
  464 + var start_date ="";//开始时间
  465 + var end_date = "";//结束时间
  466 + var count = "";//每页显示数量
  467 + var receive ="";//领取状态
  468 +
  469 + function query(){
  470 + activity_id = $("#activity_id").val();
  471 + content = $("#content").val();
  472 + start_date = $("#start_date").val();
  473 + end_date = $("#end_date").val();
  474 + count = $("#pageSize").val();
  475 + window.location.href = "/comments/page?activity_id=" + activity_id + "&start_date=" + start_date + "&end_date=" + end_date + "&content=" + content + "&pageSize="+count+"&state="+state+"&receive="+receive;
  476 + }
  477 +
  478 + //全部
  479 + function quanbu() {
  480 + state = $("#state").val();
  481 + query();
  482 + }
  483 +
  484 + //全部待领
  485 + $('#daishen').click(function () {
  486 + state = $("#state").val();
  487 + if($.trim(state) == '') state=0;
  488 + receive = 0;
  489 + query();
  490 + });
  491 + //我的待审核
  492 + $('#Mydaishen').click(function () {
  493 + state = $("#state").val();
  494 + if($.trim(state) == '') state=0;
  495 + receive = 1;
  496 + query();
  497 + });
  498 + //我的已审核
  499 + $('#yishen').click(function () {
  500 + state = $("#state").val();
  501 + if($.trim(state) == '') state=3;//审核状态,3代表通过和拒绝都查询
  502 + receive = 1;
  503 + query();
  504 + });
  505 +
528 /*全选的操作*/ 506 /*全选的操作*/
529 $('#select_all').click(function () { 507 $('#select_all').click(function () {
530 if ($("[name=btSelectItem]:checkbox:not(:checked)").length > 0) { 508 if ($("[name=btSelectItem]:checkbox:not(:checked)").length > 0) {
@@ -600,7 +578,7 @@ @@ -600,7 +578,7 @@
600 578
601 } 579 }
602 580
603 - /*查询*/ 581 + /*查询样式*/
604 function openOrClose(id_name_str) { 582 function openOrClose(id_name_str) {
605 var id_name = '#' + id_name_str; 583 var id_name = '#' + id_name_str;
606 if ($(id_name).css('display') == 'block') { 584 if ($(id_name).css('display') == 'block') {
src/main/resources/templates/page/comment2.html 0 → 100644
  1 +<!DOCTYPE html>
  2 +<html lang="zh" xmlns:th="http://www.thymeleaf.org">
  3 +<head th:replace="../templates/common/head::head"></head>
  4 +
  5 +<body class="skin-blue sidebar-mini">
  6 +
  7 +<div class="wrapper">
  8 +
  9 + <div th:replace="../templates/common/frame::frame"></div>
  10 +
  11 + <div class="content-wrapper" style="min-height: 788px;">
  12 + <section class="content-header">
  13 + <h1>
  14 + 评论审核
  15 + </h1>
  16 + <ol class="breadcrumb">
  17 + <li>首页</li>
  18 + <li class="active">评论审核</li>
  19 + </ol>
  20 + </section>
  21 + <section class="content">
  22 + <div class="row">
  23 + <div class="col-md-12">
  24 + <div class="box box-info">
  25 + <div class="box-body">
  26 + <div class="clearfix">
  27 + <div class="btn-group margin-bottom pull-left">
  28 + <div class="btn-group margin-bottom hide" id="hide_select_area">
  29 + <button type="button" class="btn btn-success btn-sm margin-r-5 action_bottom"
  30 + id="more_pass">批量通过
  31 + </button>
  32 + <button type="button" class="btn btn-danger btn-sm margin-r-5 action_bottom"
  33 + id="more_reject">批量拒绝
  34 + </button>
  35 + </div>
  36 +
  37 + <div class="btn-group margin-bottom" id="receive_select">
  38 + <button type="button" class="btn btn-success btn-sm margin-r-5 action_bottom"
  39 + onclick="receive(0);">认领
  40 + </button>
  41 + <button type="button" class="btn btn-success btn-sm margin-r-5 action_bottom"
  42 + onclick="receive(10);">认领10条
  43 + </button>
  44 + <button type="button" class="btn btn-success btn-sm margin-r-5 action_bottom"
  45 + onclick="receive(100);">认领100条
  46 + </button>
  47 + <button type="button" class="btn btn-warning btn-sm margin-r-5 action_bottom"
  48 + onclick="retReceive();">退领
  49 + </button>
  50 + <button type="button" class="btn btn-danger btn-sm margin-r-5 action claim"
  51 + value="2" data="claim1000" id="claim1000" data-toggle="modal"
  52 + data-target="#modal" onclick="repulse();">拒绝
  53 + </button>
  54 + <button type="button" class="btn btn-success btn-sm margin-r-5 action_bottom"
  55 + id="morePass" onclick="morePass();">批量通过
  56 + </button>
  57 + </div>
  58 +
  59 + </div>
  60 +
  61 + <div class="btn-group margin-bottom pull-right">
  62 + <div class="btn-group margin-bottom">
  63 + <button type="button" id="all_button"
  64 + class="btn btn-sm margin-r-5 action_bottom"
  65 + onclick="searchStatus('','')">全部
  66 + </button>
  67 + <button type="button" id="before_button"
  68 + class="btn btn-sm margin-r-5 action_bottom"
  69 + onclick="searchStatus('0',0)">全部待领
  70 + </button>
  71 + <button type="button" id="my_brfore_button"
  72 + class="btn btn-sm margin-r-5 action_bottom"
  73 + onclick="searchStatus('0',1)">我的待审
  74 + </button>
  75 + <button type="button" id="my_after_button"
  76 + class="btn btn-sm margin-r-5 action_bottom"
  77 + onclick="searchStatus('1,2',1)">我的已审
  78 + </button>
  79 + </div>
  80 + <button type="button" class="btn btn-primary btn-sm margin-r-5" id="query"
  81 + onclick="openOrClose(&#39;forms&#39;)">高级查询
  82 + <span id="a_up">▼</span><span id="a_down" style="display: none;">▲</span>
  83 + </button>
  84 + </div>
  85 + </div>
  86 +
  87 +
  88 + <div class="form-horizontal form-group-sm" id="forms" style="display: none;">
  89 + <form id="commentForm">
  90 +<!-- <input th:value="${param.state}"/> -->
  91 + <div class="btn-group margin-bottom col-md-6" style="padding: 0;">
  92 + <div class="col-md-5" style="padding: 0">
  93 + <label for="activity_id" class="control-label cb-toolbar">活动id:</label>
  94 + <div class="col-sm-8" style="padding: 0;">
  95 + <input class="form-control" name="activity_id" type="text"
  96 + id="activity_id" th:value="${param.activity_id}">
  97 + </div>
  98 + </div>
  99 + <div class="col-md-4" style="padding: 0">
  100 + <label for="content" class="control-label cb-toolbar">内容:</label>
  101 + <div class="col-sm-8" style="padding: 0;">
  102 + <input class="form-control" name="content" type="text" id="content"
  103 + th:value="${param.content}">
  104 + </div>
  105 + </div>
  106 + <div class="col-md-3" style="padding: 0">
  107 + <label for="state" class="control-label cb-toolbar">状态:</label>
  108 + <div class="col-sm-6" style="padding: 0;">
  109 + <select class="form-control col-sm-2" id="state" name="state">
  110 + <option value="">全部</option>
  111 + <option value="0" th:selected="${state1 == '0'}">未审核</option>
  112 + <option value="1" th:selected="${state1 == '1'}">已通过</option>
  113 + <option value="2" th:selected="${state1 == '2'}">已拒绝</option>
  114 + </select>
  115 + </div>
  116 + </div>
  117 + <script th:inline="javascript">
  118 +// var isHot = [[${param.is_hot}]];
  119 +// if (isHot != null && isHot[0] != "") {
  120 +// $("#is_hot").val(isHot[0]);
  121 +// }
  122 + </script>
  123 +
  124 + </div>
  125 +
  126 + <div class="btn-group margin-bottom col-md-6 pull-right" style="padding: 0">
  127 + <div class="col-md-11" style="width: 88%;padding: 0;">
  128 + <div class="col-md-6" style="padding: 0;width: 45%;">
  129 + <label for="start_date" class="control-label cb-toolbar">时间:</label>
  130 + <div class="input-group col-md-9 date">
  131 + <input class="form-control date" name="start_date" type="text"
  132 + id="start_date" th:value="${param.start_date}">
  133 + <span class="input-group-addon">
  134 + <span class="glyphicon glyphicon-calendar"></span>
  135 + </span>
  136 + </div>
  137 + </div>
  138 + <div class="col-md-6" style="padding: 0;width: 45%;">
  139 + <label for="start_date" class="control-label cb-toolbar">至</label>
  140 + <div class="input-group col-md-9 date">
  141 + <input class="form-control date" name="end_date" type="text"
  142 + th:value="${param.end_date}">
  143 + <span class="input-group-addon">
  144 + <span class="glyphicon glyphicon-calendar"></span>
  145 + </span>
  146 + </div>
  147 + </div>
  148 + <div class="col-md-4" style="padding: 0;width: 2%;">
  149 + <button type="button" class="btn btn-info btn-sm" id="comments_query"
  150 + onclick="javascript:$('#commentForm').submit();">查 询
  151 + </button>
  152 + </div>
  153 + </div>
  154 + </div>
  155 + </form>
  156 +
  157 + </div>
  158 +
  159 + <div class="bootstrap-table">
  160 + <div class="fixed-table-toolbar"></div>
  161 + <div class="fixed-table-container" style="padding-bottom: 0px;">
  162 + <div class="fixed-table-header" style="display: none;">
  163 + <table></table>
  164 + </div>
  165 + <div class="fixed-table-body">
  166 + <table id="table" data-toggle="table"
  167 + class="table table-hover coma-base-table fixed_headers table-striped"
  168 + style="word-break:break-all;">
  169 + <thead>
  170 + <tr>
  171 + <th class="bs-checkbox " style="width: 3%; " data-field="state"
  172 + tabindex="0">
  173 + <div class="th-inner "><input name="btSelectAll" type="checkbox"
  174 + id="select_all">
  175 + </div>
  176 + <div class="fht-cell"></div>
  177 + </th>
  178 + <th style="text-align: center; width: 5%; " data-field="sp_id_brief"
  179 + tabindex="0">
  180 + <div class="th-inner ">sp简称</div>
  181 + <div class="fht-cell"></div>
  182 + </th>
  183 + <th style="text-align: center; width: 5%; "
  184 + data-field="comment_user_name" tabindex="0">
  185 + <div class="th-inner ">用户昵称</div>
  186 + <div class="fht-cell"></div>
  187 + </th>
  188 + <th style="text-align: center; width: 6%; "
  189 + data-field="comment_user_avatar" tabindex="0">
  190 + <div class="th-inner ">用户头像
  191 + </div>
  192 + <div class="fht-cell"></div>
  193 + </th>
  194 + <th style="text-align: center; width: 6%; " data-field="comment_user_ip"
  195 + tabindex="0">
  196 + <div class="th-inner ">用户IP</div>
  197 + <div class="fht-cell"></div>
  198 + </th>
  199 + <th style="text-align: center; width: 22%; " data-field="content"
  200 + tabindex="0">
  201 + <div class="th-inner ">评论内容
  202 + </div>
  203 + <div class="fht-cell"></div>
  204 + </th>
  205 + <th style="text-align: center; width: 15%; " data-field="comment_title"
  206 + tabindex="0">
  207 + <div class="th-inner ">原文标题
  208 + </div>
  209 + <div class="fht-cell"></div>
  210 + </th>
  211 + <th style="text-align: center; width: 6%; " data-field="updater"
  212 + tabindex="0">
  213 + <div class="th-inner ">审核员</div>
  214 + <div class="fht-cell"></div>
  215 + </th>
  216 +
  217 + <th style="text-align: center; width: 4%; " data-field="is_hot_name"
  218 + tabindex="0">
  219 + <div class="th-inner ">热点</div>
  220 + <div class="fht-cell"></div>
  221 + </th>
  222 + <th style="text-align: center; width: 5%; "
  223 + data-field="state_name_short" tabindex="0">
  224 + <div class="th-inner ">状态
  225 + </div>
  226 + <div class="fht-cell"></div>
  227 + </th>
  228 + <th style="text-align: center; width: 8%; " data-field="comment_time"
  229 + tabindex="0">
  230 + <div class="th-inner ">评论上传时间</div>
  231 + <div class="fht-cell"></div>
  232 + </th>
  233 + <th style="text-align: center; width: 22%; " data-field="action"
  234 + tabindex="0">
  235 + <div class="th-inner ">操作
  236 + </div>
  237 + <div class="fht-cell"></div>
  238 + </th>
  239 + </tr>
  240 + </thead>
  241 + <tbody>
  242 + <tr th:data-index="${commentStat.index}"
  243 + th:each="comment : ${commentPage.list}">
  244 + <td class="bs-checkbox ">
  245 + <input data-index="0" name="btSelectItem" type="checkbox"
  246 + th:value="${comment.id}"></td>
  247 + <td style="text-align: center; width: 5%;"
  248 + th:text="${comment.spid_desc}">网加加
  249 + </td>
  250 + <td style="text-align: center; width: 5%;"
  251 + th:text="${comment.comment_user_name}">鱼
  252 + </td>
  253 + <td style="text-align: center; width: 6%;">
  254 + <div width="60px" height="60px"><img
  255 + th:src="@{${comment.comment_user_avatar}}" width="60px"
  256 + alt="用户头像"></div>
  257 + </td>
  258 + <td style="text-align: center; width: 6%;"
  259 + th:text="${comment.comment_user_ip}">114.242.177.100
  260 + </td>
  261 + <td style="text-align: center; width: 22%;"><a
  262 + th:title="${comment.comment_content}"
  263 + style="font-weight:bold;font-size:16px;"
  264 + data-toggle="tooltip"
  265 + data-placement="right"
  266 + th:text="${comment.comment_content}"
  267 + th:href="@{'/comments/details/'+${comment.id}}">哈哈哈</a>
  268 + </td>
  269 + <td style="text-align: center; width: 15%;">
  270 + <a th:href="@{${comment.comment_original_url}}" th:text="${comment.comment_title}" target="blank"></a>
  271 + </td>
  272 + <td style="text-align: center; width: 6%;" th:text="${comment.updater}">
  273 + 发布
  274 + openadmin9@cnlive.com
  275 + </td>
  276 + <td style="text-align: center; width: 4%;" th:if="${comment.is_hot==1}">
  277 + 否
  278 + </td>
  279 + <td style="text-align: center; width: 4%;" th:if="${comment.is_hot==2}">
  280 + 是
  281 + </td>
  282 + <td style="text-align: center; width: 4%;"
  283 + th:if="${comment.is_hot!=2&&comment.is_hot!=1}">全部
  284 + </td>
  285 + <td style="text-align: center; width: 5%;">
  286 + <span class="btn btn-sm btn-warning"
  287 + th:if="${comment.state==0}">待审</span>
  288 + <span class="btn btn-sm btn-success"
  289 + th:if="${comment.state==1}">已审</span>
  290 + <span class="btn btn-sm btn-danger"
  291 + th:if="${comment.state==2}">拒绝</span>
  292 + <span class="btn btn-sm btn-danger" th:if="${comment.state==3}">自动审核失败</span>
  293 + </td>
  294 + <td style="text-align: center; width: 8%;"
  295 + th:text="${#dates.format(comment.comment_time, 'yyyy-MM-dd HH:mm:ss')}">
  296 + 2018-11-28 16:08:00
  297 + </td>
  298 + <td style="text-align: center; width: 22%;">
  299 + <a class="detail" th:href="@{'/comments/details/'+${comment.id}}">
  300 + <button class="btn btn-info btn-sm">查看</button>
  301 + </a>
  302 +
  303 + <span th:if="${comment.state==0 and comment.receive==0}"> &nbsp;</span>
  304 + <a th:href="@{'javascript:applyReceive('+${comment.id}+')'}"
  305 + th:if="${comment.state==0 and comment.receive==0}">
  306 + <button class="btn btn-primary btn-sm">认领</button>
  307 + </a>
  308 +
  309 + <span th:if="${comment.state==0 and comment.receive==1 and session.sessionUser.userId==comment.receive_user_id}"> &nbsp;</span>
  310 + <a th:href="@{'javascript:applyRetReceive('+${comment.id}+')'}"
  311 + th:if="${comment.state==0 and comment.receive==1 and session.sessionUser.userId==comment.receive_user_id}">
  312 + <button class="btn btn-warning btn-sm">退领</button>
  313 + </a>
  314 +
  315 +<!-- <span th:if="${comment.receive and session.sessionUser.userId==comment.receive_user_id}"> &nbsp;</span> -->
  316 +<!-- <a class="pass_one" -->
  317 +<!-- th:href="@{'javascript:comment('+${comment.id}+',1)'}" -->
  318 +<!-- th:if="${comment.receive and session.sessionUser.userId==comment.receive_user_id}"> -->
  319 +<!-- <button class="btn btn-success btn-sm">通过</button> -->
  320 +<!-- </a> -->
  321 +
  322 +<!-- <span th:if="${comment.receive and session.sessionUser.userId==comment.receive_user_id}"> &nbsp;</span> -->
  323 +<!-- <a class="failed_one" -->
  324 +<!-- th:href="@{'javascript:comment('+${comment.id}+',2)'}" -->
  325 +<!-- th:if="${comment.receive and session.sessionUser.userId==comment.receive_user_id}"> -->
  326 +<!-- <button class="btn btn-danger btn-sm">拒绝</button> -->
  327 +<!-- </a> -->
  328 + </td>
  329 + </tr>
  330 + </tbody>
  331 + </table>
  332 + </div>
  333 + <div class="fixed-table-footer" style="display: none;">
  334 + <table>
  335 + <tbody>
  336 + <tr></tr>
  337 + </tbody>
  338 + </table>
  339 + </div>
  340 + <div class="fixed-table-pagination" style="display: block;">
  341 + <div class="pull-left pagination-detail">
  342 + <span class="pagination-info" th:text="'共 '+${commentPage.total}+' 条记录,每页显示'">总共 0 条记录</span>
  343 + <select class="" id="pageSize" name="pageSize">
  344 + <option value="10" th:selected="${pageSize==10}">10</option>
  345 + <option value="20" th:selected="${pageSize==20}">20</option>
  346 + <option value="50" th:selected="${pageSize==50}">50</option>
  347 + <option value="100" th:selected="${pageSize==100}">100</option>
  348 + </select>
  349 + <span class="pagination-info" >条记录</span>
  350 + </div>
  351 + <div class="pull-right pagination">
  352 + <ul class="pagination" th:if="${commentPage.pages>1}" id="pageUl">
  353 + <li class="page-pre"><a th:href="@{'/comments/page'}">‹‹</a></li>
  354 + <li class="page-pre" th:if="${!commentPage.isFirstPage}"><a
  355 + th:href="@{'/comments/page?page='+${commentPage.pageNum-1}}">‹</a>
  356 + </li>
  357 +
  358 + <li class="page-number" th:if="${commentPage.pageNum-3>=1}"><a
  359 + th:href="@{'/comments/page?page='+${commentPage.pageNum-3}}"
  360 + th:text="${commentPage.pageNum-3}">2</a></li>
  361 + <li class="page-number" th:if="${commentPage.pageNum-2>=1}"><a
  362 + th:href="@{'/comments/page?page='+${commentPage.pageNum-2}}"
  363 + th:text="${commentPage.pageNum-2}">2</a></li>
  364 + <li class="page-number" th:if="${commentPage.pageNum-1>=1}"><a
  365 + th:href="@{'/comments/page?page='+${commentPage.pageNum-1}}"
  366 + th:text="${commentPage.pageNum-1}">2</a></li>
  367 + <li class="page-number active"><a href="javaScript:void(0);"
  368 + th:text="${commentPage.pageNum}">2</a>
  369 + </li>
  370 + <li class="page-number"
  371 + th:if="${commentPage.pageNum+1<=commentPage.pages}"><a
  372 + th:href="@{'/comments/page?page='+${commentPage.pageNum+1}}"
  373 + th:text="${commentPage.pageNum+1}">2</a></li>
  374 + <li class="page-number"
  375 + th:if="${commentPage.pageNum+2<=commentPage.pages}"><a
  376 + th:href="@{'/comments/page?page='+${commentPage.pageNum+2}}"
  377 + th:text="${commentPage.pageNum+2}">2</a></li>
  378 + <li class="page-number"
  379 + th:if="${commentPage.pageNum+3<=commentPage.pages}"><a
  380 + th:href="@{'/comments/page?page='+${commentPage.pageNum+3}}"
  381 + th:text="${commentPage.pageNum+3}">2</a></li>
  382 +
  383 + <li class="page-next" th:if="${!commentPage.isLastPage}"><a
  384 + th:href="@{'/comments/page?page='+${commentPage.pageNum+1}}">›</a>
  385 + </li>
  386 + <li class="page-next"><a
  387 + th:href="@{'/comments/page?page='+${commentPage.pages}}">››</a>
  388 + </li>
  389 + </ul>
  390 + </div>
  391 + </div>
  392 + </div>
  393 + </div>
  394 + <div class="clearfix"></div>
  395 +
  396 + </div>
  397 + </div>
  398 + </div>
  399 + </div>
  400 +
  401 +
  402 + </section><!-- /.content -->
  403 + </div>
  404 + <!-- /.content-wrapper -->
  405 + <!-- 模态框(Modal) -->
  406 + <div class="modal fade" id="msgModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  407 + <div class="modal-dialog">
  408 + <div class="modal-content" style="margin-top: 30%;">
  409 + <div class="modal-header">
  410 + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
  411 + <h4 class="modal-title" id="myModalLabel">审核意见</h4>
  412 + </div>
  413 + <div class="modal-body">
  414 + <div class="form-group" style="margin-bottom: 0;">
  415 + <textarea id="reviewMsg" style="width: 100%;height: 80px;"></textarea>
  416 + </div>
  417 + <div class="form-group">
  418 + </div>
  419 + </div>
  420 + <div class="modal-footer">
  421 + <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
  422 + <button type="button" class="btn btn-primary" onclick="javascript:repulseSubmit();">提交</button>
  423 + </div>
  424 + </div><!-- /.modal-content -->
  425 + </div><!-- /.modal-dialog -->
  426 + </div>
  427 + <!-- /.modal -->
  428 + <script th:inline="javascript">
  429 + var pages = [[${param.page}]];
  430 + var pageNum = 1;
  431 + var sea = location.search;
  432 + $(function () {
  433 + //判断除页数参数外是否还有其他参数
  434 + if (sea != "") {
  435 + if (pages != null) {
  436 + pageNum = pages[0];
  437 + }
  438 + //有其他参数,页脚链接加上参数
  439 + if (sea != "?page=" + pageNum) {
  440 + sea = sea.replace("page=" + pageNum, "");//去掉page参数
  441 + $("#pageUl li a").each(function (i, e) {
  442 + var h = $(e).attr("href");
  443 + if (h.indexOf("page=") >= 0) {
  444 + sea = sea.replace("?", "");//去掉问号
  445 + if (!sea.startsWith("&")) sea = "&" + sea;
  446 + h = h + sea;
  447 + $(e).attr("href", h);
  448 + } else if (h.endsWith("page")) {
  449 + sea = sea.replace("?&", "?");
  450 + h = h + sea;
  451 + $(e).attr("href", h);
  452 + }
  453 + })
  454 + }
  455 + }
  456 +
  457 +
  458 + //按钮颜色显示
  459 + var state = [[${param.state}]] ? [[${param.state}]][0] : null;
  460 + var receive = [[${param.receive}]] ? [[${param.receive}]][0] : null;
  461 + var stateIsNull = $.trim(state) == "";
  462 + var receiveIsNull = $.trim(receive) == "";
  463 + if (stateIsNull && receiveIsNull) {
  464 + $("#all_button").addClass("btn-info");
  465 + } else if (state == '0' && receive == '0') {
  466 + $("#before_button").addClass("btn-warning");
  467 + } else if (!stateIsNull && state != '0' && receive == '1') {
  468 + $("#my_after_button").addClass("btn-success");
  469 + } else if (state == '0' && receive == '1') {
  470 + $("#my_brfore_button").addClass("btn-danger");
  471 + }
  472 +
  473 + })
  474 +
  475 + //已审、未审、全部,状态切换
  476 + function searchStatus(commentStatus, receive) {
  477 + var href = location.href;
  478 + if ($.trim($("#state").val()) != '') commentStatus =$("#state").val();
  479 + if (sea == "") {//没有参数
  480 + if (href.endsWith("?")) href = href.substring(0, href.length - 1);
  481 + if ($.trim(commentStatus) != '') href = href + "?state=" + commentStatus;
  482 + } else if (sea.indexOf("state=") < 0) {//没有参数state
  483 + var se = sea.replace("?", "");//去掉问号,防止问号和要去掉的参数相连
  484 + if (sea.indexOf("page=") >= 0) {//有参数page,去掉
  485 + var split = se.split("&");
  486 + var h = "";
  487 + for (var i = 0; i < split.length; i++) {
  488 + var s = split[i];
  489 + if (s.indexOf("page=") < 0) h = h + "&" + split[i];
  490 + }
  491 + se = h.substring(1);
  492 + }
  493 + if ($.trim(commentStatus) != '') href = location.origin + location.pathname + "?" + se + "&state=" + commentStatus;
  494 + } else {//有参数state
  495 + if (href.indexOf("&") >= 0) {//有其他参数,去掉page和旧的state
  496 + var se = sea.replace("?", "");//去掉问号
  497 + var split = se.split("&");
  498 + var h = "";
  499 + for (var i = 0; i < split.length; i++) {
  500 + var s = split[i];
  501 + if (s.indexOf("state=") < 0 && s.indexOf("page=") < 0) h = h + "&" + split[i];
  502 + }
  503 + if ($.trim(commentStatus) != '') {
  504 + href = location.origin + location.pathname + "?state=" + commentStatus + "&" + h.substring(1);
  505 + } else {
  506 + href = location.origin + location.pathname + "?" + h.substring(1);
  507 + }
  508 + } else {//只有state参数,直接拼接链接
  509 + if ($.trim(commentStatus) != '') {
  510 + href = location.origin + location.pathname + "?state=" + commentStatus;
  511 + } else {
  512 + href = location.origin + location.pathname;
  513 + }
  514 + }
  515 + }
  516 + //去掉领取参数
  517 + if (href.indexOf("receive") >= 0) {
  518 + href = href.replace("receive=1", "");
  519 + href = href.replace("receive=0", "");
  520 + }
  521 + href = href.replace("&&", "&");
  522 + href = href.replace("?&", "?");
  523 + if (href.endsWith("&")) href = href.substring(0, href.length - 1);
  524 + if (href.endsWith("?")) href = href.substring(0, href.length - 1);
  525 + if ($.trim(receive) != "") {
  526 + if (href.indexOf("=") > 0) {//有其他参数
  527 + href += "&receive=" + receive;
  528 + } else {
  529 + href += "?receive=" + receive;
  530 + }
  531 + }
  532 + location.href = href;
  533 + }
  534 +
  535 + /*全选的操作*/
  536 + $('#select_all').click(function () {
  537 + if ($("[name=btSelectItem]:checkbox:not(:checked)").length > 0) {
  538 + $("#select_all").prop('checked', true);
  539 + $("[name=btSelectItem]:checkbox").each(function () {
  540 + $(this).prop('checked', true);
  541 + });
  542 + } else {
  543 + $("#select_all").prop('checked', false);
  544 + $("[name=btSelectItem]:checkbox").each(function () {
  545 + $(this).prop('checked', false);
  546 + });
  547 + }
  548 + });
  549 +
  550 + //批量通过
  551 + $('#more_pass').click(function () {
  552 + var rows = $("[name=btSelectItem]:checkbox:checked");
  553 + if (rows.length > 0) {
  554 + var r = confirm("您确定通过选中的" + rows.length + "条评论吗?");
  555 + if (r == true) {
  556 + var ids = "";
  557 + rows.each(function (i, e) {
  558 + ids = ids + "," + e.value;
  559 + })
  560 + ids = ids.substring(1);
  561 + comment(ids, 1);
  562 + }
  563 + } else {
  564 + alert("没有选中的数据!");
  565 + }
  566 +
  567 + });
  568 + //批量拒绝
  569 + $('#more_reject').click(function () {
  570 + var rows = $("[name=btSelectItem]:checkbox:checked");
  571 + if (rows.length > 0) {
  572 + var r = confirm("您确定拒绝选中的" + rows.length + "条评论吗?");
  573 + if (r == true) {
  574 + var ids = "";
  575 + rows.each(function (i, e) {
  576 + ids = ids + "," + e.value;
  577 + })
  578 + ids = ids.substring(1);
  579 + comment(ids, 2);
  580 + }
  581 + } else {
  582 + alert("没有选中的数据!");
  583 + }
  584 + });
  585 +
  586 + //审核操作,status=1为通过
  587 + function comment(ids, status) {
  588 + if (status == 1) {
  589 + $.post("/comments/pass?ids=" + ids, function (data) {
  590 + if (data.errorCode == 0) {
  591 + alert(data.errorMessage);
  592 + location.href = location.href;
  593 + } else {
  594 + alert(data.errorMessage);
  595 + }
  596 + })
  597 + } else {
  598 + $.post("/comments/refuse?ids=" + ids, function (data) {
  599 + if (data.errorCode == 0) {
  600 + alert(data.errorMessage);
  601 + location.href = location.href;
  602 + } else {
  603 + alert(data.errorMessage);
  604 + }
  605 + })
  606 + }
  607 +
  608 + }
  609 +
  610 + /*查询*/
  611 + function openOrClose(id_name_str) {
  612 + var id_name = '#' + id_name_str;
  613 + if ($(id_name).css('display') == 'block') {
  614 + $(id_name).slideUp(350);
  615 + $('#a_up').show();
  616 + $('#a_down').hide();
  617 + } else {
  618 + $(id_name).slideDown(350);
  619 + $('#a_up').hide();
  620 + $('#a_down').show();
  621 + }
  622 + }
  623 +
  624 + /**
  625 + * 认领
  626 + */
  627 + function receive(n) {
  628 + if (n > 0) {
  629 + applyReceiveNum(n);
  630 + } else {
  631 + var rows = $("[name=btSelectItem]:checkbox:checked");
  632 + if (rows.length > 0) {
  633 + var ids = "";
  634 + rows.each(function (i, e) {
  635 + ids = ids + "," + e.value;
  636 + })
  637 + ids = ids.substring(1);
  638 + applyReceive(ids);
  639 + } else {
  640 + alert("请选择要认领的内容!");
  641 + }
  642 + }
  643 + }
  644 +
  645 + //认领选中请求
  646 + function applyReceive(ids) {
  647 + $.post("/comments/receive?ids=" + ids, function (data) {
  648 + if (data.errorCode == 0) {
  649 + alert(data.errorMessage);
  650 + location.href = location.href;
  651 + } else {
  652 + alert(data.errorMessage);
  653 + }
  654 + })
  655 + }
  656 +
  657 + //认领多条请求
  658 + function applyReceiveNum(num) {
  659 + $.post("/comments/receive?num=" + num, function (data) {
  660 + if (data.errorCode == 0) {
  661 + alert(data.errorMessage);
  662 + location.href = location.href;
  663 + } else {
  664 + alert(data.errorMessage);
  665 + }
  666 + })
  667 + }
  668 +
  669 + //退领选中内容
  670 + function retReceive() {
  671 + var rows = $("[name=btSelectItem]:checkbox:checked");
  672 + if (rows.length > 0) {
  673 + var r = confirm("您确定退领选中的" + rows.length + "条评论吗?");
  674 + if (r == true) {
  675 + var ids = "";
  676 + rows.each(function (i, e) {
  677 + ids = ids + "," + e.value;
  678 + })
  679 + ids = ids.substring(1);
  680 + applyRetReceive(ids);
  681 + }
  682 + } else {
  683 + alert("没有选中的数据!");
  684 + }
  685 + }
  686 +
  687 + //退领
  688 + function applyRetReceive(ids) {
  689 + $.post("/comments/retReceive?ids=" + ids, function (data) {
  690 + if (data.errorCode == 0) {
  691 + alert(data.errorMessage);
  692 + location.href = location.href;
  693 + } else {
  694 + alert(data.errorMessage);
  695 + }
  696 + })
  697 + }
  698 +
  699 + //拒绝(打回)
  700 + function repulse() {
  701 + var rows = $("[name=btSelectItem]:checkbox:checked");
  702 + if (rows.length > 0) {
  703 + var r = confirm("您确定拒绝选中的" + rows.length + "条内容吗?");
  704 + if (r == true) {
  705 + $('#msgModal').modal('show');
  706 + }
  707 + } else {
  708 + alert("没有选中的数据!");
  709 + }
  710 + }
  711 +
  712 + //提交打回
  713 + function repulseSubmit() {
  714 + var rows = $("[name=btSelectItem]:checkbox:checked");
  715 + var ids = "";
  716 + rows.each(function (i, e) {
  717 + ids = ids + "," + e.value;
  718 + })
  719 + ids = ids.substring(1);
  720 + var msg = $("#reviewMsg").val();
  721 + $.post("/comments/repulse?ids=" + ids + "&msg=" + msg, function (data) {
  722 + if (data.errorCode == 0) {
  723 + alert(data.errorMessage);
  724 + location.href = location.href;
  725 + } else {
  726 + alert(data.errorMessage);
  727 + }
  728 + })
  729 + }
  730 + //批量提交
  731 + function morePass() {
  732 + var rows = $("[name=btSelectItem]:checkbox:checked");
  733 + if (rows.length > 0) {
  734 + var r = confirm("您确定通过选中的" + rows.length + "条内容吗?");
  735 + if (r == true) {
  736 + var ids = "";
  737 + rows.each(function (i, e) {
  738 + ids = ids + "," + e.value;
  739 + })
  740 + ids = ids.substring(1);
  741 + $.post("/comments/pass?ids=" + ids, function (data) {
  742 + if (data.errorCode == 0) {
  743 + alert(data.errorMessage);
  744 + location.href = location.href;
  745 + } else {
  746 + alert(data.errorMessage);
  747 + }
  748 + })
  749 + }
  750 + } else {
  751 + alert("没有选中的数据!");
  752 + }
  753 + }
  754 + </script>
  755 + <script>
  756 + /*时间插件*/
  757 + $('.date').datetimepicker({
  758 +// format: 'YYYY-MM-DD HH:mm:ss',
  759 + format: 'YYYY-MM-DD',
  760 + locale: "zh-CN",
  761 + toolbarPlacement: 'bottom',
  762 + showClear: true,
  763 + });
  764 + $(function () {
  765 + $("[data-toggle='tooltip']").tooltip();
  766 + });
  767 + </script>
  768 +
  769 + <footer th:replace="../templates/common/foot::foot"></footer>
  770 +
  771 + <!-- Add the sidebar's background. This div must be placed
  772 + immediately after the control sidebar -->
  773 + <div class="control-sidebar-bg" style="position: fixed; height: auto;"></div>
  774 +
  775 +</div><!-- ./wrapper -->
  776 +
  777 +
  778 +<!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
  779 +<script type="text/javascript">
  780 + $('div.alert').not('.alert-danger').delay(3000).slideUp(300);
  781 +</script>
  782 +
  783 +<!-- AdminLTE App -->
  784 +<script src="../../static/js/app.min.js"></script>
  785 +<!-- AdminLTE for demo purposes -->
  786 +<script src="../../static/js/sidebar.js"></script>
  787 +
  788 +
  789 +</body>
  790 +</html>
0 \ No newline at end of file 791 \ No newline at end of file
src/main/resources/templates/page/content.html
@@ -282,8 +282,15 @@ @@ -282,8 +282,15 @@
282 282
283 <!--分页处理--> 283 <!--分页处理-->
284 <div class="fixed-table-pagination" style="display: block;"> 284 <div class="fixed-table-pagination" style="display: block;">
285 - <div class="pull-left pagination-detail"><span class="pagination-info"  
286 - th:text="'共 '+${contentPage.total}+' 条记录'">共 0 条记录</span> 285 + <div class="pull-left pagination-detail">
  286 + <span class="pagination-info" th:text="'共 '+${contentPage.total}+' 条记录,每页显示'">共 0 条记录</span>
  287 + <select class="" id="pageSize" name="pageSize">
  288 + <option value="10" th:selected="${pageSize==10}">10</option>
  289 + <option value="20" th:selected="${pageSize==20}">20</option>
  290 + <option value="50" th:selected="${pageSize==50}">50</option>
  291 + <option value="100" th:selected="${pageSize==100}">100</option>
  292 + </select>
  293 + <span class="pagination-info" >条记录</span>
287 </div> 294 </div>
288 <div class="pull-right pagination"> 295 <div class="pull-right pagination">
289 <ul class="pagination" th:if="${contentPage.pages>1}"> 296 <ul class="pagination" th:if="${contentPage.pages>1}">
@@ -334,7 +341,7 @@ @@ -334,7 +341,7 @@
334 //按钮颜色设置 341 //按钮颜色设置
335 var receive_status = [[${param.receive_status}]] ? [[${param.receive_status}]][0] : null; 342 var receive_status = [[${param.receive_status}]] ? [[${param.receive_status}]][0] : null;
336 // var receive = [[${param.receive}]] ? [[${param.receive}]][0] : null; 343 // var receive = [[${param.receive}]] ? [[${param.receive}]][0] : null;
337 - var stateIsNull = $.trim(state) == ""; 344 + var stateIsNull = $.trim(receive_status) == "";
338 // var receiveIsNull = $.trim(receive) == ""; 345 // var receiveIsNull = $.trim(receive) == "";
339 if (stateIsNull) { 346 if (stateIsNull) {
340 $("#quanbu").addClass("btn-info"); 347 $("#quanbu").addClass("btn-info");
@@ -352,16 +359,14 @@ @@ -352,16 +359,14 @@
352 function fanye(page) { 359 function fanye(page) {
353 var param = location.search; 360 var param = location.search;
354 if (param.indexOf("page=") != -1) { 361 if (param.indexOf("page=") != -1) {
355 - if (page < 10) {  
356 - param = param.substring(1, param.length - 7);  
357 - } else if (page < 100) {  
358 - param = param.substring(1, param.length - 8);  
359 - } else if (page < 1000) {  
360 - param = param.substring(1, param.length - 9);  
361 - } else if (page < 10000) {  
362 - param = param.substring(1, param.length - 10); 362 + var se = param.replace("?", "");//去掉问号,防止问号和要去掉的参数相连
  363 + var split = se.split("&");
  364 + var h = "";
  365 + for (var i = 0; i < split.length; i++) {
  366 + var s = split[i];
  367 + if (s.indexOf("page=") < 0) h = h + "&" + split[i];
363 } 368 }
364 - window.location.href = "/content/page?" + param + "&page=" + page; 369 + window.location.href = "/content/page?" + h + "&page=" + page;
365 } else { 370 } else {
366 param = param.substring(1, param.length); 371 param = param.substring(1, param.length);
367 window.location.href = "/content/page?" + param + "&page=" + page; 372 window.location.href = "/content/page?" + param + "&page=" + page;
@@ -389,7 +394,7 @@ @@ -389,7 +394,7 @@
389 var spId=[[${session.sessionUser.spid}]]; 394 var spId=[[${session.sessionUser.spid}]];
390 if(spId==0){ 395 if(spId==0){
391 sp_desc = $("#sp_desc").val(); 396 sp_desc = $("#sp_desc").val();
392 - count = $("#count").val(); 397 + count = $("#pageSize").val();
393 contentId = $("#contentId").val(); 398 contentId = $("#contentId").val();
394 content_tag = $("#content_tag").val(); 399 content_tag = $("#content_tag").val();
395 } 400 }
src/main/resources/templates/page/live.html
@@ -303,8 +303,15 @@ @@ -303,8 +303,15 @@
303 303
304 <!--分页处理--> 304 <!--分页处理-->
305 <div class="fixed-table-pagination" style="display: block;"> 305 <div class="fixed-table-pagination" style="display: block;">
306 - <div class="pull-left pagination-detail"><span class="pagination-info"  
307 - th:text="'共 '+${livePage.total}+' 条记录'">共 0 条记录</span> 306 + <div class="pull-left pagination-detail">
  307 + <span class="pagination-info" th:text="'共 '+${livePage.total}+' 条记录,每页显示'">共 0 条记录</span>
  308 + <select class="" id="pageSize" name="pageSize">
  309 + <option value="20" th:selected="${pageSize==20}">20</option>
  310 + <option value="40" th:selected="${pageSize==40}">40</option>
  311 + <option value="60" th:selected="${pageSize==60}">60</option>
  312 + <option value="80" th:selected="${pageSize==80}">80</option>
  313 + </select>
  314 + <span class="pagination-info" >条记录</span>
308 </div> 315 </div>
309 <div class="pull-right pagination"> 316 <div class="pull-right pagination">
310 <ul class="pagination" th:if="${livePage.pages>1}"> 317 <ul class="pagination" th:if="${livePage.pages>1}">
@@ -441,6 +448,7 @@ @@ -441,6 +448,7 @@
441 activity_status = $("#activity_status").val(); 448 activity_status = $("#activity_status").val();
442 start_date = $("#start_date").val(); 449 start_date = $("#start_date").val();
443 end_date = $("#end_date").val(); 450 end_date = $("#end_date").val();
  451 + count = $("#pageSize").val();
444 var spId=[[${session.sessionUser.spid}]]; 452 var spId=[[${session.sessionUser.spid}]];
445 if(spId==0){ 453 if(spId==0){
446 sp_desc = $("#sp_desc").val(); 454 sp_desc = $("#sp_desc").val();
@@ -673,16 +681,14 @@ @@ -673,16 +681,14 @@
673 function fanye(page) { 681 function fanye(page) {
674 var param = location.search; 682 var param = location.search;
675 if (param.indexOf("page=") != -1) { 683 if (param.indexOf("page=") != -1) {
676 - if (page < 10) {  
677 - param = param.substring(1, param.length - 7);  
678 - } else if (page < 100) {  
679 - param = param.substring(1, param.length - 8);  
680 - } else if (page < 1000) {  
681 - param = param.substring(1, param.length - 9);  
682 - } else if (page < 10000) {  
683 - param = param.substring(1, param.length - 10);  
684 - }  
685 - window.location.href = "/live/page?" + param + "&page=" + page; 684 + var se = param.replace("?", "");//去掉问号,防止问号和要去掉的参数相连
  685 + var split = se.split("&");
  686 + var h = "";
  687 + for (var i = 0; i < split.length; i++) {
  688 + var s = split[i];
  689 + if (s.indexOf("page=") < 0) h = h + "&" + split[i];
  690 + }
  691 + window.location.href = "/live/page?" + h + "&page=" + page;
686 } else { 692 } else {
687 param = param.substring(1, param.length); 693 param = param.substring(1, param.length);
688 window.location.href = "/live/page?" + param + "&page=" + page; 694 window.location.href = "/live/page?" + param + "&page=" + page;
src/main/resources/templates/page/site.html
@@ -36,7 +36,7 @@ @@ -36,7 +36,7 @@
36 </div> 36 </div>
37 </div> 37 </div>
38 <div class="columns columns-right btn-group pull-right"> 38 <div class="columns columns-right btn-group pull-right">
39 - <button class="btn btn-default" type="button" name="refresh" title="搜索" onclick="javascript:$('#searchForm').submit();">搜索</button> 39 + <button class="btn btn-default" type="button" name="refresh" title="搜索" id="site_query">搜索</button>
40 <ul class="dropdown-menu" role="menu"> 40 <ul class="dropdown-menu" role="menu">
41 <li><label><input type="checkbox" data-field="sp_id" value="0" 41 <li><label><input type="checkbox" data-field="sp_id" value="0"
42 checked="checked"> spID</label></li> 42 checked="checked"> spID</label></li>
@@ -60,7 +60,7 @@ @@ -60,7 +60,7 @@
60 </div> 60 </div>
61 <div class="pull-right search"> 61 <div class="pull-right search">
62 <form id="searchForm"> 62 <form id="searchForm">
63 - <input class="form-control" type="text" placeholder="搜索" name="keyword" th:value="${param.keyword}"> 63 + <input class="form-control" type="text" placeholder="搜索" id="keyword" name="keyword" th:value="${param.keyword}">
64 </form> 64 </form>
65 </div> 65 </div>
66 </div> 66 </div>
@@ -125,39 +125,51 @@ @@ -125,39 +125,51 @@
125 </div> 125 </div>
126 126
127 <div class="fixed-table-pagination" style="display: block;"> 127 <div class="fixed-table-pagination" style="display: block;">
128 - <div class="pull-left pagination-detail"><span class="pagination-info" th:text="'共 '+${sitePage.total}+' 条记录'">共 0 条记录</span></div> 128 + <div class="pull-left pagination-detail">
  129 + <span class="pagination-info" th:text="'共 '+${sitePage.total}+' 条记录,每页显示'">共 0 条记录</span>
  130 + <select class="" id="pageSize" name="pageSize">
  131 + <option value="10" th:selected="${pageSize==10}">10</option>
  132 + <option value="20" th:selected="${pageSize==20}">20</option>
  133 + <option value="50" th:selected="${pageSize==50}">50</option>
  134 + <option value="100" th:selected="${pageSize==100}">100</option>
  135 + </select>
  136 + <span class="pagination-info" >条记录</span>
  137 + </div>
129 <div class="pull-right pagination"> 138 <div class="pull-right pagination">
130 - <ul class="pagination" th:if="${sitePage.pages>1 and param.keyword!=null}">  
131 - <li class="page-pre"><a th:href="@{'/sites/page?keyword='+${param.keyword}}">‹‹</a></li>  
132 - <li class="page-pre" th:if="${!sitePage.isFirstPage}"><a th:href="@{'/sites/page?page='+${sitePage.pageNum-1}+'&keyword='+${param.keyword}}">‹</a></li>  
133 -  
134 - <li class="page-number" th:if="${sitePage.pageNum-3>=1}"><a th:href="@{'/sites/page?page='+${sitePage.pageNum-3}+'&keyword='+${param.keyword}}" th:text="${sitePage.pageNum-3}">2</a></li>  
135 - <li class="page-number" th:if="${sitePage.pageNum-2>=1}"><a th:href="@{'/sites/page?page='+${sitePage.pageNum-2}+'&keyword='+${param.keyword}}" th:text="${sitePage.pageNum-2}">2</a></li>  
136 - <li class="page-number" th:if="${sitePage.pageNum-1>=1}"><a th:href="@{'/sites/page?page='+${sitePage.pageNum-1}+'&keyword='+${param.keyword}}" th:text="${sitePage.pageNum-1}">2</a></li>  
137 - <li class="page-number active"><a href="javaScript:void(0);" th:text="${sitePage.pageNum}">2</a></li>  
138 - <li class="page-number" th:if="${sitePage.pageNum+1<=sitePage.pages}"><a th:href="@{'/sites/page?page='+${sitePage.pageNum+1}+'&keyword='+${param.keyword}}" th:text="${sitePage.pageNum+1}">2</a></li>  
139 - <li class="page-number" th:if="${sitePage.pageNum+2<=sitePage.pages}"><a th:href="@{'/sites/page?page='+${sitePage.pageNum+2}+'&keyword='+${param.keyword}}" th:text="${sitePage.pageNum+2}">2</a></li>  
140 - <li class="page-number" th:if="${sitePage.pageNum+3<=sitePage.pages}"><a th:href="@{'/sites/page?page='+${sitePage.pageNum+3}+'&keyword='+${param.keyword}}" th:text="${sitePage.pageNum+3}">2</a></li>  
141 -  
142 - <li class="page-next" th:if="${!sitePage.isLastPage}"><a th:href="@{'/sites/page?page='+${sitePage.pageNum+1}+'&keyword='+${param.keyword}}">›</a></li>  
143 - <li class="page-next"><a th:href="@{'/sites/page?page='+${sitePage.pages}+'&keyword='+${param.keyword}}">››</a></li>  
144 - </ul>  
145 -  
146 - <ul class="pagination" th:if="${sitePage.pages>1 and param.keyword==null}">  
147 - <li class="page-pre"><a th:href="@{'/sites/page'}">‹‹</a></li>  
148 - <li class="page-pre" th:if="${!sitePage.isFirstPage}"><a th:href="@{'/sites/page?page='+${sitePage.pageNum-1}}">‹</a></li> 139 + <ul class="pagination" th:if="${sitePage.pages>1}">
  140 + <li class="page-pre"><a th:href="'javascript:fanye(1);'">‹‹</a></li>
  141 + <li class="page-pre" th:if="${!sitePage.isFirstPage}"><a
  142 + th:onclick="'javascript:fanye(\''+${sitePage.pageNum-1}+'\');'">‹</a>
  143 + </li>
149 144
150 - <li class="page-number" th:if="${sitePage.pageNum-3>=1}"><a th:href="@{'/sites/page?page='+${sitePage.pageNum-3}}" th:text="${sitePage.pageNum-3}">2</a></li>  
151 - <li class="page-number" th:if="${sitePage.pageNum-2>=1}"><a th:href="@{'/sites/page?page='+${sitePage.pageNum-2}}" th:text="${sitePage.pageNum-2}">2</a></li>  
152 - <li class="page-number" th:if="${sitePage.pageNum-1>=1}"><a th:href="@{'/sites/page?page='+${sitePage.pageNum-1}}" th:text="${sitePage.pageNum-1}">2</a></li>  
153 - <li class="page-number active"><a href="javaScript:void(0);" th:text="${sitePage.pageNum}">2</a></li>  
154 - <li class="page-number" th:if="${sitePage.pageNum+1<=sitePage.pages}"><a th:href="@{'/sites/page?page='+${sitePage.pageNum+1}}" th:text="${sitePage.pageNum+1}">2</a></li>  
155 - <li class="page-number" th:if="${sitePage.pageNum+2<=sitePage.pages}"><a th:href="@{'/sites/page?page='+${sitePage.pageNum+2}}" th:text="${sitePage.pageNum+2}">2</a></li>  
156 - <li class="page-number" th:if="${sitePage.pageNum+3<=sitePage.pages}"><a th:href="@{'/sites/page?page='+${sitePage.pageNum+3}}" th:text="${sitePage.pageNum+3}">2</a></li> 145 + <li class="page-number" th:if="${sitePage.pageNum-3>=1}"><a
  146 + th:onclick="'javascript:fanye(\''+${sitePage.pageNum-3}+'\');'"
  147 + th:text="${sitePage.pageNum-3}">2</a></li>
  148 + <li class="page-number" th:if="${sitePage.pageNum-2>=1}"><a
  149 + th:onclick="'javascript:fanye(\''+${sitePage.pageNum-2}+'\');'"
  150 + th:text="${sitePage.pageNum-2}">2</a></li>
  151 + <li class="page-number" th:if="${sitePage.pageNum-1>=1}"><a
  152 + th:onclick="'javascript:fanye(\''+${sitePage.pageNum-1}+'\');'"
  153 + th:text="${sitePage.pageNum-1}">2</a></li>
  154 + <li class="page-number active"><a href="javaScript:void(0);"
  155 + th:text="${sitePage.pageNum}">2</a></li>
  156 + <li class="page-number" th:if="${sitePage.pageNum+1<=sitePage.pages}"><a
  157 + th:onclick="'javascript:fanye(\''+${sitePage.pageNum+1}+'\');'"
  158 + th:text="${sitePage.pageNum+1}">2</a></li>
  159 + <li class="page-number" th:if="${sitePage.pageNum+2<=sitePage.pages}"><a
  160 + th:onclick="'javascript:fanye(\''+${sitePage.pageNum+2}+'\');'"
  161 + th:text="${sitePage.pageNum+2}">2</a></li>
  162 + <li class="page-number" th:if="${sitePage.pageNum+3<=sitePage.pages}"><a
  163 + th:onclick="'javascript:fanye(\''+${sitePage.pageNum+3}+'\');'"
  164 + th:text="${sitePage.pageNum+3}">2</a></li>
157 165
158 - <li class="page-next" th:if="${!sitePage.isLastPage}"><a th:href="@{'/sites/page?page='+${sitePage.pageNum+1}}">›</a></li>  
159 - <li class="page-next"><a th:href="@{'/sites/page?page='+${sitePage.pages}}">››</a></li>  
160 - </ul> 166 + <li class="page-next" th:if="${!sitePage.isLastPage}"><a
  167 + th:onclick="'javascript:fanye(\''+${sitePage.pageNum+1}+'\');'">›</a>
  168 + </li>
  169 + <li class="page-next"><a
  170 + th:onclick="'javascript:fanye(\''+${sitePage.pages}+'\');'">››</a>
  171 + </li>
  172 + </ul>
161 </div> 173 </div>
162 </div> 174 </div>
163 </div> 175 </div>
@@ -224,6 +236,31 @@ @@ -224,6 +236,31 @@
224 } 236 }
225 $('#editModal').modal('show'); 237 $('#editModal').modal('show');
226 } 238 }
  239 +
  240 + //翻页函数
  241 + function fanye(page) {
  242 + var param = location.search;
  243 + if (param.indexOf("page=") != -1) {
  244 + var se = param.replace("?", "");//去掉问号,防止问号和要去掉的参数相连
  245 + var split = se.split("&");
  246 + var h = "";
  247 + for (var i = 0; i < split.length; i++) {
  248 + var s = split[i];
  249 + if (s.indexOf("page=") < 0) h = h + "&" + split[i];
  250 + }
  251 + window.location.href = "/sites/page?" + h + "&page=" + page;
  252 + } else {
  253 + param = param.substring(1, param.length);
  254 + window.location.href = "/sites/page?" + param + "&page=" + page;
  255 + }
  256 + }
  257 +
  258 + //搜索
  259 + $('#site_query').click(function () {
  260 + var keyword = $("#keyword").val();
  261 + var pageSize = $("#pageSize").val();
  262 + window.location.href = "/sites/page?keyword=" + keyword + "&pageSize=" + pageSize;
  263 + });
227 264
228 </script> 265 </script>
229 266
src/main/resources/templates/page/video.html
@@ -130,12 +130,12 @@ @@ -130,12 +130,12 @@
130 <input class="form-control" type="text" value="" id="sp_desc"> 130 <input class="form-control" type="text" value="" id="sp_desc">
131 </div> 131 </div>
132 </div> 132 </div>
133 - <div class="col-md-6" style="padding: 0;width: 15%;" th:if="${session.sessionUser.spid==0}">  
134 - <label for="count" class="control-label cb-toolbar">每页条数:</label>  
135 - <div class="col-sm-5" style="padding: 0;">  
136 - <input class="form-control" type="text" value="" id="count">  
137 - </div>  
138 - </div> 133 +<!-- <div class="col-md-6" style="padding: 0;width: 15%;" th:if="${session.sessionUser.spid==0}"> -->
  134 +<!-- <label for="count" class="control-label cb-toolbar">每页条数:</label> -->
  135 +<!-- <div class="col-sm-5" style="padding: 0;"> -->
  136 +<!-- <input class="form-control" type="text" value="" id="count"> -->
  137 +<!-- </div> -->
  138 +<!-- </div> -->
139 </div> 139 </div>
140 </div> 140 </div>
141 <!-- <div class="btn-group margin-bottom col-md-6" style="padding: 0;width: 1%;float: left;"> --> 141 <!-- <div class="btn-group margin-bottom col-md-6" style="padding: 0;width: 1%;float: left;"> -->
@@ -269,8 +269,15 @@ @@ -269,8 +269,15 @@
269 269
270 <!--分页处理--> 270 <!--分页处理-->
271 <div class="fixed-table-pagination" style="display: block;"> 271 <div class="fixed-table-pagination" style="display: block;">
272 - <div class="pull-left pagination-detail"><span class="pagination-info"  
273 - th:text="'共 '+${videoPage.total}+' 条记录'">共 0 条记录</span> 272 + <div class="pull-left pagination-detail">
  273 + <span class="pagination-info" th:text="'共 '+${videoPage.total}+' 条记录,每页显示'">共 0 条记录</span>
  274 + <select class="" id="pageSize" name="pageSize">
  275 + <option value="10" th:selected="${pageSize==10}">10</option>
  276 + <option value="20" th:selected="${pageSize==20}">20</option>
  277 + <option value="50" th:selected="${pageSize==50}">50</option>
  278 + <option value="100" th:selected="${pageSize==100}">100</option>
  279 + </select>
  280 + <span class="pagination-info" >条记录</span>
274 </div> 281 </div>
275 <div class="pull-right pagination"> 282 <div class="pull-right pagination">
276 <ul class="pagination" th:if="${videoPage.pages>1}"> 283 <ul class="pagination" th:if="${videoPage.pages>1}">
@@ -339,16 +346,14 @@ @@ -339,16 +346,14 @@
339 function fanye(page) { 346 function fanye(page) {
340 var param = location.search; 347 var param = location.search;
341 if (param.indexOf("page=") != -1) { 348 if (param.indexOf("page=") != -1) {
342 - if (page < 10) {  
343 - param = param.substring(1, param.length - 7);  
344 - } else if (page < 100) {  
345 - param = param.substring(1, param.length - 8);  
346 - } else if (page < 1000) {  
347 - param = param.substring(1, param.length - 9);  
348 - } else if (page < 10000) {  
349 - param = param.substring(1, param.length - 10); 349 + var se = param.replace("?", "");//去掉问号,防止问号和要去掉的参数相连
  350 + var split = se.split("&");
  351 + var h = "";
  352 + for (var i = 0; i < split.length; i++) {
  353 + var s = split[i];
  354 + if (s.indexOf("page=") < 0) h = h + "&" + split[i];
350 } 355 }
351 - window.location.href = "/videos/page?" + param + "&page=" + page; 356 + window.location.href = "/videos/page?" + h + "&page=" + page;
352 } else { 357 } else {
353 param = param.substring(1, param.length); 358 param = param.substring(1, param.length);
354 window.location.href = "/videos/page?" + param + "&page=" + page; 359 window.location.href = "/videos/page?" + param + "&page=" + page;
@@ -378,7 +383,7 @@ @@ -378,7 +383,7 @@
378 var spId=[[${session.sessionUser.spid}]]; 383 var spId=[[${session.sessionUser.spid}]];
379 if(spId==0){ 384 if(spId==0){
380 sp_desc = $("#sp_desc").val(); 385 sp_desc = $("#sp_desc").val();
381 - count = $("#count").val(); 386 + count = $("#pageSize").val();
382 } 387 }
383 } 388 }
384 389