Commit b002079b71226e38c1c17a2f47d8bd057533305d

Authored by 周伟鹏
1 parent 221e5b8b

评论列表按钮显示修改

src/main/resources/templates/page/comment.html
@@ -45,10 +45,10 @@ @@ -45,10 +45,10 @@
45 45
46 <div class="btn-group margin-bottom pull-right"> 46 <div class="btn-group margin-bottom pull-right">
47 <div class="btn-group margin-bottom"> 47 <div class="btn-group margin-bottom">
48 - <button type="button" th:class="${param.state==null and param.receive==null}?'btn btn-info btn-sm margin-r-5 action_bottom':'btn btn-sm margin-r-5 action_bottom'" onclick="searchStatus('','')">全部</button>  
49 - <button type="button" th:class="${param.state==0 and param.receive==null}?'btn btn-warning btn-sm margin-r-5 action_bottom':'btn btn-sm margin-r-5 action_bottom'" onclick="searchStatus('0','')">全部待审</button>  
50 - <button type="button" th:class="${param.state!=null and param.state!=0 and param.receive==true}?'btn btn-success btn-sm margin-r-5 action_bottom':'btn btn-sm margin-r-5 action_bottom'" onclick="searchStatus('1,2',true)">我的已审</button>  
51 - <button type="button" th:class="${param.state==0 and param.receive==true}?'btn btn-danger btn-sm margin-r-5 action_bottom':'btn btn-sm margin-r-5 action_bottom'" onclick="searchStatus('0',true)">我的未审</button> 48 + <button type="button" id="all_button" class="btn btn-sm margin-r-5 action_bottom" onclick="searchStatus('','')">全部</button>
  49 + <button type="button" id="before_button" class="btn btn-sm margin-r-5 action_bottom" onclick="searchStatus('0','')">全部待审</button>
  50 + <button type="button" id="my_after_button" class="btn btn-sm margin-r-5 action_bottom" onclick="searchStatus('1,2',true)">我的已审</button>
  51 + <button type="button" id="my_brfore_button" class="btn btn-sm margin-r-5 action_bottom" onclick="searchStatus('0',true)">我的未审</button>
52 </div> 52 </div>
53 <button type="button" class="btn btn-primary btn-sm margin-r-5" id="query" 53 <button type="button" class="btn btn-primary btn-sm margin-r-5" id="query"
54 onclick="openOrClose(&#39;forms&#39;)">高级查询 54 onclick="openOrClose(&#39;forms&#39;)">高级查询
@@ -336,6 +336,23 @@ @@ -336,6 +336,23 @@
336 }) 336 })
337 } 337 }
338 } 338 }
  339 +
  340 +
  341 + //按钮颜色显示
  342 + var state = [[${param.state}]]?[[${param.state}]][0]:null;
  343 + var receive = [[${param.receive}]]?[[${param.receive}]][0]:null;
  344 + var stateIsNull = $.trim(state)=="";
  345 + var receiveIsNull = $.trim(receive)=="";
  346 + if(stateIsNull&&receiveIsNull){
  347 + $("#all_button").addClass("btn-info");
  348 + }else if(state=='0'&&receiveIsNull){
  349 + $("#before_button").addClass("btn-warning");
  350 + }else if(!stateIsNull&&state!='0'&&receive=='true'){
  351 + $("#my_after_button").addClass("btn-success");
  352 + }else if(state=='0'&&receive=='true'){
  353 + $("#my_brfore_button").addClass("btn-danger");
  354 + }
  355 +
339 }) 356 })
340 //已审、未审、全部,状态切换 357 //已审、未审、全部,状态切换
341 function searchStatus(commentStatus,receive){ 358 function searchStatus(commentStatus,receive){
@@ -364,9 +381,17 @@ @@ -364,9 +381,17 @@
364 var s = split[i]; 381 var s = split[i];
365 if(s.indexOf("state=")<0&&s.indexOf("page=")<0) h = h+"&"+split[i]; 382 if(s.indexOf("state=")<0&&s.indexOf("page=")<0) h = h+"&"+split[i];
366 } 383 }
367 - href =location.origin+location.pathname+"?"+ h.substring(1); 384 + if($.trim(commentStatus)!=''){
  385 + href =location.origin+location.pathname+"?state="+commentStatus+"&"+ h.substring(1);
  386 + }else{
  387 + href =location.origin+location.pathname+"?"+ h.substring(1);
  388 + }
368 }else{//只有state参数,直接拼接链接 389 }else{//只有state参数,直接拼接链接
369 - if($.trim(commentStatus)!='')href = location.origin+location.pathname+"?state="+commentStatus; 390 + if($.trim(commentStatus)!=''){
  391 + href = location.origin+location.pathname+"?state="+commentStatus;
  392 + }else{
  393 + href = location.origin+location.pathname;
  394 + }
370 } 395 }
371 } 396 }
372 //去掉领取参数 397 //去掉领取参数