Commit 9fd61386af9eb185366768fe7ab9aeda17fb9084

Authored by 周伟鹏
1 parent 47480c12

评论页完成

src/main/java/com/cnlive/shenhe/controller/CommentsController.java
... ... @@ -9,6 +9,7 @@ import com.cnlive.shenhe.entity.ShyUsers;
9 9 import com.cnlive.shenhe.serviceImpl.CommentsServiceImpl;
10 10 import com.cnlive.shenhe.serviceImpl.UsersServiceImpl;
11 11 import com.cnlive.shenhe.utils.AuditPass;
  12 +import com.cnlive.shenhe.utils.CommonConst;
12 13 import com.cnlive.shenhe.utils.CommonUtils;
13 14 import com.github.pagehelper.PageInfo;
14 15 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -114,16 +115,56 @@ public class CommentsController {
114 115 }
115 116  
116 117 /**
117   - * 评论查看接口
  118 + * 评论详情
118 119 *
119 120 * @param id
120 121 * @return
121 122 */
122   - @RequestMapping("/details")
  123 + @GetMapping("/details/{id}")
  124 + public String getDetailsComments(@PathVariable Integer id, Model model) {
  125 + ShyComments comment = commentsService.getDetailsComment(id);
  126 + model.addAttribute("comment", comment);
  127 + return "page/commentDetail.html";
  128 + }
  129 +
  130 +
  131 + /**
  132 + * 审核通过
  133 + *
  134 + * @param ids
  135 + * @return
  136 + */
  137 + @PostMapping("/pass")
123 138 @ResponseBody
124   - public Object getDetailsComments(Integer id) {
125   - return commentsService.getDetailsComment(id);
  139 + public ResponseBean pass(String ids, HttpSession session) {
  140 + SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
  141 + String userId = sessionUser.getUserId();
  142 + boolean success = commentsService.updateState(ids, CommonConst.AUDIT_SUCCESS, userId);
  143 + if (success) {
  144 + return new ResponseBean();
  145 + } else {
  146 + return new ResponseBean(ErrorEnum.ERROR);
  147 + }
126 148 }
127 149  
  150 + /**
  151 + * 审核拒绝
  152 + *
  153 + * @param ids
  154 + * @return
  155 + */
  156 + @PostMapping("/refuse")
  157 + @ResponseBody
  158 + public ResponseBean refuse(String ids, HttpSession session) {
  159 + SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
  160 + String userId = sessionUser.getUserId();
  161 + boolean success = commentsService.updateState(ids, CommonConst.AUDIT_REFUSE, userId);
  162 + if (success) {
  163 + return new ResponseBean();
  164 + } else {
  165 + return new ResponseBean(ErrorEnum.ERROR);
  166 + }
  167 +
  168 + }
128 169  
129 170 }
... ...
src/main/java/com/cnlive/shenhe/serviceImpl/CommentsServiceImpl.java
... ... @@ -3,8 +3,10 @@ package com.cnlive.shenhe.serviceImpl;
3 3 import com.alibaba.fastjson.JSONObject;
4 4 import com.cnlive.shenhe.entity.ShyComments;
5 5 import com.cnlive.shenhe.entity.ShySites;
  6 +import com.cnlive.shenhe.entity.ShyUsers;
6 7 import com.cnlive.shenhe.mapper.ShyCommentsMapper;
7 8 import com.cnlive.shenhe.mapper.ShySitesMapper;
  9 +import com.cnlive.shenhe.mapper.ShyUsersMapper;
8 10 import com.cnlive.shenhe.utils.CommonUtils;
9 11 import com.github.pagehelper.PageHelper;
10 12 import com.github.pagehelper.PageInfo;
... ... @@ -26,6 +28,8 @@ public class CommentsServiceImpl {
26 28 ShyCommentsMapper shyCommentsMapper;
27 29 @Autowired
28 30 ShySitesMapper shySitesMapper;
  31 + @Autowired
  32 + ShyUsersMapper shyUsersMapper;
29 33  
30 34  
31 35 public List<ShySites> getBusiness(ShySites shySites) {
... ... @@ -51,7 +55,7 @@ public class CommentsServiceImpl {
51 55 Example.Criteria criteria = example.createCriteria();
52 56 if (CommonUtils.isNotEmpty(orderByClause)) {
53 57 example.setOrderByClause(orderByClause);
54   - }else {
  58 + } else {
55 59 example.setOrderByClause("comment_time desc");
56 60 }
57 61 if (CommonUtils.isNotNull(start_date) && CommonUtils.isNotNull(end_date)) {
... ... @@ -76,7 +80,7 @@ public class CommentsServiceImpl {
76 80 if (CommonUtils.isNotEmpty(states)) {
77 81 Example.Criteria criteria1 = example.createCriteria();
78 82 String[] stas = states.split(",");
79   - for (String s:stas) {
  83 + for (String s : stas) {
80 84 criteria1.orEqualTo("state", Integer.parseInt(s));
81 85 }
82 86 example.and(criteria1);
... ... @@ -89,8 +93,32 @@ public class CommentsServiceImpl {
89 93  
90 94 public ShyComments getDetailsComment(Integer id) {
91 95 ShyComments comment = shyCommentsMapper.selectByPrimaryKey(id);
  96 + String auditorName = "白名单";
  97 + String auditor_id = comment.getAuditor_id();
  98 + if (CommonUtils.isNotEmpty(auditor_id)) {
  99 + ShyUsers user = new ShyUsers();
  100 + user.setUser_id(auditor_id);
  101 + user = shyUsersMapper.selectOne(user);
  102 + auditorName = user.getUsername() + user.getEmail();
  103 + }
  104 + comment.setAuditor(auditorName);
92 105 return comment;
93 106 }
  107 +
  108 + public boolean updateState(String ids, Integer state, String userId) {
  109 + boolean success = true;
  110 + String[] commentIds = ids.split(",");
  111 + for (String commentId : commentIds) {
  112 + ShyComments comment = shyCommentsMapper.selectByPrimaryKey(Integer.parseInt(commentId));
  113 + comment.setState(state);
  114 + comment.setAuditor_id(userId);
  115 + int i = shyCommentsMapper.updateByPrimaryKeySelective(comment);
  116 + if (i != 1) {
  117 + success = false;
  118 + }
  119 + }
  120 + return success;
  121 + }
94 122 }
95 123  
96 124  
... ...
src/main/resources/templates/page/comment.html
... ... @@ -13,7 +13,6 @@
13 13 <section class="content-header">
14 14 <h1>
15 15 评论审核
16   -
17 16 </h1>
18 17 <ol class="breadcrumb">
19 18 <li>首页</li>
... ... @@ -62,26 +61,31 @@
62 61 <div class="col-md-5" style="padding: 0">
63 62 <label for="activity_id" class="control-label cb-toolbar">活动id:</label>
64 63 <div class="col-sm-9" style="padding: 0;">
65   - <input class="form-control" name="activity_id" type="text" id="activity_id">
  64 + <input class="form-control" name="activity_id" type="text" id="activity_id" th:value="${param.activity_id}">
66 65 </div>
67 66 </div>
68 67 <div class="col-md-4" style="padding: 0">
69 68 <label for="content" class="control-label cb-toolbar">内容:</label>
70 69 <div class="col-sm-9" style="padding: 0;">
71   - <input class="form-control" name="content" type="text" id="content">
  70 + <input class="form-control" name="content" type="text" id="content" th:value="${param.content}">
72 71 </div>
73 72 </div>
74 73 <div class="col-md-3" style="padding: 0">
75 74 <label for="is_hot" class="control-label cb-toolbar">是否热点:</label>
76 75 <div class="col-sm-7" style="padding: 0;">
77 76 <select class="form-control col-sm-2" id="is_hot" name="is_hot">
78   - <option value="0">全部</option>
  77 + <option value="">全部</option>
79 78 <option value="2">是</option>
80 79 <option value="1">否</option>
81 80 </select>
82 81 </div>
83 82 </div>
84   -
  83 + <script th:inline="javascript">
  84 + var isHot = [[${param.is_hot}]];
  85 + if(isHot!=null&&isHot[0]!=""){
  86 + $("#is_hot").val(isHot[0]);
  87 + }
  88 + </script>
85 89  
86 90 </div>
87 91  
... ... @@ -91,7 +95,7 @@
91 95 <label for="start_date" class="control-label cb-toolbar">时间:</label>
92 96 <div class="input-group col-md-9 date">
93 97 <input class="form-control date" name="start_date" type="text"
94   - id="start_date">
  98 + id="start_date" th:value="${param.start_date}">
95 99 <span class="input-group-addon">
96 100 <span class="glyphicon glyphicon-calendar"></span>
97 101 </span>
... ... @@ -100,14 +104,14 @@
100 104 <div class="col-md-6" style="padding: 0;width: 45%;">
101 105 <label for="start_date" class="control-label cb-toolbar">至</label>
102 106 <div class="input-group col-md-9 date">
103   - <input class="form-control date" name="end_date" type="text">
  107 + <input class="form-control date" name="end_date" type="text" th:value="${param.end_date}">
104 108 <span class="input-group-addon">
105 109 <span class="glyphicon glyphicon-calendar"></span>
106 110 </span>
107 111 </div>
108 112 </div>
109 113 <div class="col-md-6" style="padding: 0;width: 2%;" >
110   - <button type="button" class="btn btn-info btn-sm" id="comments_query">查 询
  114 + <button type="button" class="btn btn-info btn-sm" id="comments_query" onclick="javascript:$('#commentForm').submit();">查 询
111 115 </button>
112 116 </div>
113 117 </div>
... ... @@ -116,51 +120,6 @@
116 120  
117 121 </div>
118 122  
119   - <script>
120   - /*查询*/
121   - function openOrClose(id_name_str) {
122   - var id_name = '#' + id_name_str;
123   - if ($(id_name).css('display') == 'block') {
124   - $(id_name).slideUp(350);
125   - $('#a_up').show();
126   - $('#a_down').hide();
127   - } else {
128   - $(id_name).slideDown(350);
129   - $('#a_up').hide();
130   - $('#a_down').show();
131   - }
132   - }
133   -
134   - /*时间插件*/
135   - $('.date').datetimepicker({
136   - format: 'YYYY-MM-DD HH:mm',
137   - locale: "zh-CN",
138   - toolbarPlacement: 'bottom',
139   - showClear: true,
140   - });
141   -
142   -
143   - </script>
144   - <div class="modal fade common" id="modal_comment" tabindex="-1" role="dialog"
145   - aria-labelledby="myModalLabel" aria-hidden="true">
146   - <div class="modal-dialog">
147   - <div class="modal-content">
148   - <div class="modal-header">
149   - <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
150   - ×
151   - </button>
152   - <h4 class="modal-title" id="modal_title"></h4>
153   - </div>
154   - <div class="modal-body">
155   - <div class="alert alert-danger" id="window_msg" style="display: none;">
156   - <p></p>
157   - </div>
158   - <div id="contents">
159   - </div>
160   - </div>
161   - </div>
162   - </div>
163   - </div>
164 123 <div class="bootstrap-table">
165 124 <div class="fixed-table-toolbar"></div>
166 125 <div class="fixed-table-container" style="padding-bottom: 0px;">
... ... @@ -175,7 +134,7 @@
175 134 <tr>
176 135 <th class="bs-checkbox " style="width: 3%; " data-field="state"
177 136 tabindex="0">
178   - <div class="th-inner "><input name="btSelectAll" type="checkbox">
  137 + <div class="th-inner "><input name="btSelectAll" type="checkbox" id="select_all">
179 138 </div>
180 139 <div class="fht-cell"></div>
181 140 </th>
... ... @@ -244,8 +203,8 @@
244 203 </thead>
245 204 <tbody>
246 205 <tr th:data-index="${commentStat.index}" th:each="comment : ${commentPage.list}">
247   - <td class="bs-checkbox "><input data-index="0" name="btSelectItem"
248   - type="checkbox"></td>
  206 + <td class="bs-checkbox ">
  207 + <input data-index="0" name="btSelectItem" type="checkbox" th:value="${comment.id}"></td>
249 208 <td style="text-align: center; width: 5%;" th:text="${session.sessionUser.company}">网加加</td>
250 209 <td style="text-align: center; width: 5%;" th:text="${comment.comment_user_name}">鱼</td>
251 210 <td style="text-align: center; width: 6%;">
... ... @@ -268,20 +227,20 @@
268 227 <td style="text-align: center; width: 4%;" th:if="${comment.is_hot!=2&&comment.is_hot!=1}">全部</td>
269 228 <td style="text-align: center; width: 5%;">
270 229 <span class="btn btn-sm btn-warning" th:if="${comment.state==0}">待审</span>
271   - <span class="btn btn-sm btn-warning" th:if="${comment.state==1}">已审</span>
272   - <span class="btn btn-sm btn-warning" th:if="${comment.state==2}">拒绝</span>
  230 + <span class="btn btn-sm btn-success" th:if="${comment.state==1}">已审</span>
  231 + <span class="btn btn-sm btn-danger" th:if="${comment.state==2}">拒绝</span>
273 232 </td>
274 233 <td style="text-align: center; width: 8%;" th:text="${#dates.format(comment.comment_time, 'yyyy-MM-dd HH:mm:ss')}">2018-11-28 16:08:00</td>
275 234 <td style="text-align: center; width: 22%;">
276   - <a class="detail" href="javascript:void(0)">
  235 + <a class="detail" th:href="@{'/comments/details/'+${comment.id}}">
277 236 <button class="btn btn-info btn-sm">查看</button>
278 237 </a>
279 238 <span> &nbsp;</span>
280   - <a class="pass_one" href="javascript:void(0)">
  239 + <a class="pass_one" th:href="@{'javascript:comment('+${comment.id}+',1)'}">
281 240 <button class="btn btn-success btn-sm">通过</button>
282 241 </a>
283 242 <span> &nbsp;</span>
284   - <a class="failed_one" href="javascript:void(0)">
  243 + <a class="failed_one" th:href="@{'javascript:comment('+${comment.id}+',2)'}">
285 244 <button class="btn btn-danger btn-sm">拒绝</button>
286 245 </a>
287 246 </td>
... ... @@ -333,25 +292,6 @@
333 292 </div>
334 293 <!-- /.content-wrapper -->
335 294  
336   - <!-- 确认弹出框 -->
337   - <div class="modal" id="action_note" role="dialog" aria-labelledby="myModalLabel">
338   - <div class="modal-dialog">
339   - <div class="modal-content">
340   - <div class="modal-header">
341   - <button type="button" class="close" data-dismiss="modal" id="close"> ×</button>
342   - <h4 class="modal-title">温馨提示</h4>
343   - </div>
344   - <div class="modal-body" id="msg2"></div>
345   - <div class="modal-footer">
346   - <button type="button" class="btn btn-default " data-dismiss="modal" id="action_note_no">取消</button>
347   - <button type="button" class="btn btn-primary" id="action_note_yes">确认</button>
348   - <input type="hidden" name="action_note_type" id="action_note_type" value="">
349   - <input type="hidden" name="action_note_id" id="action_note_id" value="">
350   - </div>
351   - </div>
352   - </div>
353   - </div>
354   -
355 295 <script th:inline="javascript">
356 296 var pages = [[${param.page}]];
357 297 var pageNum = 1;
... ... @@ -381,15 +321,15 @@
381 321 }
382 322 }
383 323 })
384   -
  324 + //已审、未审、全部,状态切换
385 325 function searchStatus(commentStatus){
386 326 var href = location.href;
387 327 if(sea==""){//没有参数
388 328 if(href.endsWith("?"))href = href.substring(0,href.length-1);
389 329 href = href+"?state="+commentStatus;
390 330 }else if(sea.indexOf("state=")<0){//没有参数state
  331 + var se = sea.replace("?","");//去掉问号,防止问号和要去掉的参数相连
391 332 if(sea.indexOf("page=")>=0){//有参数page,去掉
392   - var se = sea.replace("?","");//去掉问号,防止问号和要去掉的参数相连
393 333 var split = se.split("&");
394 334 var h = "";
395 335 for (var i = 0; i < split.length; i++) {
... ... @@ -416,118 +356,78 @@
416 356 location.href = href;
417 357 }
418 358  
419   - /*查询字段效果*/
420   - $('#comments_query').click(function () {
421   - $('#table').bootstrapTable('selectPage', 1);
422   - });
423   -
424   -
425   - /**
426   - * 审核按钮的显示--已认领就是未审核的
427   - * @param value
428   - * @param row
429   - * @param index
430   - * @returns {string}
431   - */
432   - function stateFormatter(value, row, index) {
433   - var style = 'btn-sm btn-primary';
434   - switch (row.state_name) {
435   - case '未认领':
436   - case '已认领,未审核':
437   - style = 'btn-sm btn-warning';
438   - break;
439   - case '我的已审核':
440   - style = 'btn-sm btn-success';
441   - break;
442   - case '我的未通过':
443   - style = 'btn-sm btn-danger';
444   - break;
445   - }
446   - return [
447   - '<span class="btn ' + style + '">' + row.state_name_short + '</span>',
448   - ].join('');
449   - }
450   -
451   - function originalFormatter(value, row, index) {
452   - var original = row.original_url;
453   - var commentTitle = row.comment_title;
454   - return [
455   - '<a href="' + original + '" target="_blank">' + commentTitle + '</a>',
456   -// '<a href="http://'+original+'/" target="_blank">' + commentTitle + '</a>',
457   - ]
458   - }
459   -
460   -
461   -
462   - function contentFormatter(value, row, index) {
463   - var shot_content = cutstr(row.content, 100);
464   -// console.log(shot_content.length);
465   -// return false;
466   - var full_content = row.content;
467   -// console.log(full_content);
468   - var f_str = s_str = '';
469   - for (var i = 0; i < full_content.length; i++) {
470   - f_str += full_content.charAt(i);
471   - if (i % 10 == 0 && i > 0) {
472   - f_str += " ";
473   - }
474   -
475   - s_str += shot_content.charAt(i);
476   - if (i % 10 == 0 && i > 0) {
477   - s_str += " ";
478   - }
479   -
480   - }
481   - return [
482   - '<a title="' + f_str + '" style="font-weight:bold;font-size:16px;" data-toggle="tooltip" data-placement="right" >' + s_str + '</a>',
483   - ]
484   - }
485   -
486 359 /*全选的操作*/
487 360 $('#select_all').click(function () {
488   -
489   - $("[name=btSelectItem]:checkbox").each(function () {
490   - $(this).prop('checked', true);
491   - });
492   - });
493   - //反选
494   - $("#no_select_all").click(function () {
495   - $("[name=btSelectItem]:checkbox").each(function () { //遍历每一个复选框
496   - this.checked = !this.checked; //js方法
497   - });
498   - });
499   - //清除
500   - $("#delete_all").click(function () {
501   - $("input[name='btSelectItem']").removeAttr("checked");
  361 + if($("[name=btSelectItem]:checkbox:not(:checked)").length>0){
  362 + $("#select_all").prop('checked', true);
  363 + $("[name=btSelectItem]:checkbox").each(function () {
  364 + $(this).prop('checked', true);
  365 + });
  366 + }else{
  367 + $("#select_all").prop('checked', false);
  368 + $("[name=btSelectItem]:checkbox").each(function () {
  369 + $(this).prop('checked', false);
  370 + });
  371 + }
502 372 });
503 373  
504   -
505   -
  374 + //批量通过
506 375 $('#more_pass').click(function () {
507   - var rows = $('#table').bootstrapTable('getSelections');
  376 + var rows = $("[name=btSelectItem]:checkbox:checked");
508 377 if (rows.length > 0) {
509   - $('#msg').html('您确认通过这<strong><span class="text-danger">' + rows.length + '</span></strong>条信息吗?');
510   - $('#modal_remove').show();
511   - $('#modal_remove').attr('claim', 'more_pass');
  378 + var r=confirm("您确定通过选中的"+rows.length+"条评论吗?");
  379 + if(r==true){
  380 + var ids = "";
  381 + rows.each(function(i,e){
  382 + ids = ids + "," + e.value;
  383 + })
  384 + comment(ids,1);
  385 + }
512 386 } else {
513   - $('#msg').html('请选择要通过的数据!');
514   - $('#modal_remove').hide();
  387 + alert("没有选中的数据!");
515 388 }
516 389  
517 390 });
518   -
  391 + //批量拒绝
519 392 $('#more_reject').click(function () {
520   - var rows = $('#table').bootstrapTable('getSelections');
  393 + var rows = $("[name=btSelectItem]:checkbox:checked");
521 394 if (rows.length > 0) {
522   - $('#msg').html('<span style="color:red;">您确认批量拒绝这<strong><span class="text-danger">' + rows.length + '</span></strong>条信息吗?</span>');
523   - $('#modal_remove').show();
524   - $('#modal_remove').attr('claim', 'more_reject');
  395 + var r=confirm("您确定拒绝选中的"+rows.length+"条评论吗?");
  396 + if(r==true){
  397 + var ids = "";
  398 + rows.each(function(i,e){
  399 + ids = ids + "," + e.value;
  400 + })
  401 + comment(ids,2);
  402 + }
525 403 } else {
526   - $('#msg').html('请选择要拒绝的数据!');
527   - $('#modal_remove').hide();
  404 + alert("没有选中的数据!");
528 405 }
529 406 });
530 407  
  408 + //审核操作,status=1为通过
  409 + function comment(ids,status){
  410 + if(status==1){
  411 + $.post("/comments/pass?ids="+ids,function (data) {
  412 + if (data.errorCode==0){
  413 + alert("操作成功");
  414 + location.href = location.href;
  415 + } else{
  416 + alert("操作失败");
  417 + }
  418 + })
  419 + }else{
  420 + $.post("/comments/refuse?ids="+ids,function (data) {
  421 + if (data.errorCode==0){
  422 + alert("操作成功");
  423 + location.href = location.href;
  424 + } else{
  425 + alert("操作失败");
  426 + }
  427 + })
  428 + }
  429 +
  430 + }
531 431  
532 432 </script>
533 433 <script>
... ...
src/main/resources/templates/page/commentDetail.html
... ... @@ -9,7 +9,6 @@
9 9  
10 10 <div th:replace="../templates/common/frame::frame"></div>
11 11  
12   -
13 12 <div class="content-wrapper" style="min-height: 788px;">
14 13 <section class="content-header">
15 14 <h1>
... ... @@ -35,39 +34,34 @@
35 34 <div class="form-group">
36 35 <label for="comment_title" class="control-label col-sm-2">评论标题:</label>
37 36 <div class="col-sm-10">
38   - <h5 style="font-size:1.5em; font-weight: bold;"></h5>
  37 + <h5 style="font-size:1.5em; font-weight: bold;" th:text="${comment.comment_title}"></h5>
39 38 </div>
40 39 </div>
41 40 <div class="form-group">
42 41  
43 42 <label for="content" class="control-label col-sm-2">评论内容:</label>
44 43 <div class="col-sm-8">
45   - <textarea class="form-control" name="content" cols="50" rows="10" id="content">哈哈哈</textarea>
  44 + <textarea class="form-control" name="content" cols="50" rows="10" id="content" th:text="${comment.comment_content}">哈哈哈</textarea>
46 45 </div>
47 46  
48 47 </div>
49 48 <div class="form-group ">
50 49 <label for="username" class="control-label col-sm-2">状态:</label>
51 50 <div class="col-sm-10 ">
52   - <h5 class="status">待审</h5>
  51 + <h5 class="status" th:if="${comment.state==0}">待审</h5>
  52 + <h5 class="status" th:if="${comment.state==1}">审核通过</h5>
  53 + <h5 class="status" th:if="${comment.state==2}">审核拒绝</h5>
53 54 </div>
54 55 </div>
55   - <div class="form-group">
56   - <label for="cate_tags" class="control-label col-sm-2">分类标签:</label>
57   - <div class="col-sm-10">
58   - <h5></h5>
59   - </div>
60   - </div>
61   -
62 56 <hr>
63 57  
64   - <div class="form-group">
  58 + <!-- <div class="form-group">
65 59 <label class="control-label col-sm-2" for="attr_tags">常用审核意见:</label>
66 60 <div class="col-sm-8">
67 61 <select class="form-control select2 select2-hidden-accessible" multiple="" data-placeholder="选择常用审核意见,可多选" name="attr_tags[]" id="attr_tags" style="width: 100%;" tabindex="-1" aria-hidden="true">
68   - </select><span class="select2 select2-container select2-container--default" dir="ltr" style="width: 100%;"><span class="selection"><span class="select2-selection select2-selection--multiple" role="combobox" aria-autocomplete="list" aria-haspopup="true" aria-expanded="false" tabindex="0"><ul class="select2-selection__rendered"><li class="select2-search select2-search--inline"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" placeholder="选择常用审核意见,可多选" style="width: 509px;"></li></ul></span></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>
  62 + </select><span class="select2 select2-container select2-container&#45;&#45;default" dir="ltr" style="width: 100%;"><span class="selection"><span class="select2-selection select2-selection&#45;&#45;multiple" role="combobox" aria-autocomplete="list" aria-haspopup="true" aria-expanded="false" tabindex="0"><ul class="select2-selection__rendered"><li class="select2-search select2-search&#45;&#45;inline"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" placeholder="选择常用审核意见,可多选" style="width: 509px;"></li></ul></span></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>
69 63 </div>
70   - </div><!-- /.form-group -->
  64 + </div>-->
71 65  
72 66  
73 67 <div class="form-group">
... ... @@ -81,13 +75,13 @@
81 75 <div class="form-group">
82 76 <label for="program_id" class="control-label col-sm-2">节目id:</label>
83 77 <div class="col-sm-10">
84   - <h5>604</h5>
  78 + <h5 th:text="${comment.program_id}">604</h5>
85 79 </div>
86 80 </div>
87 81 <div class="form-group">
88 82 <label for="comment_user_id" class="control-label col-sm-2">评论用户id:</label>
89 83 <div class="col-sm-10">
90   - <h5>821403</h5>
  84 + <h5 th:text="${comment.comment_user_id}">821403</h5>
91 85 </div>
92 86 </div>
93 87  
... ... @@ -95,21 +89,21 @@
95 89 <div class="form-group">
96 90 <label for="activity_id" class="control-label col-sm-2">评论活动id:</label>
97 91 <div class="col-sm-10">
98   - <h5>769:video:comets:604_902dce9848ac482eb433f15c2cb0c401#3025</h5>
  92 + <h5 th:text="${comment.activity_id}">769:video:comets:604_902dce9848ac482eb433f15c2cb0c401#3025</h5>
99 93 </div>
100 94 </div>
101 95  
102 96 <div class="form-group">
103 97 <label for="comment_user_name" class="control-label col-sm-2">用户昵称:</label>
104 98 <div class="col-sm-10">
105   - <h5>鱼</h5>
  99 + <h5 th:text="${comment.comment_user_name}">鱼</h5>
106 100 </div>
107 101 </div>
108 102  
109 103 <div class="form-group">
110 104 <label for="comment_user_avatar" class="control-label col-sm-2">用户头像:</label>
111 105 <div class="col-sm-10">
112   - <h5><img width="160px" src="./222111_files/1532077438500.jpg" alt="用户头像"></h5>
  106 + <h5><img width="160px" th:src="@{${comment.comment_user_avatar}}" alt="用户头像"></h5>
113 107  
114 108 </div>
115 109 </div>
... ... @@ -117,67 +111,44 @@
117 111 <div class="form-group">
118 112 <label for="comment_user_ip" class="control-label col-sm-2">用户来源IP地址:</label>
119 113 <div class="col-sm-10">
120   - <h5>114.242.177.100</h5>
  114 + <h5 th:text="${comment.comment_user_ip}">114.242.177.100</h5>
121 115 </div>
122 116 </div>
123 117  
124 118 <div class="form-group">
125 119 <label for="app_id" class="control-label col-sm-2">appId:</label>
126 120 <div class="col-sm-10">
127   - <h5>769_jetj7bq525</h5>
  121 + <h5 th:text="${comment.app_id}">769_jetj7bq525</h5>
128 122 </div>
129 123 </div>
130 124  
131 125 <div class="form-group">
132 126 <label for="platform" class="control-label col-sm-2">平台:</label>
133 127 <div class="col-sm-10">
134   - <h5>苹果</h5>
135   - </div>
136   - </div>
137   -
138   -
139   - <div class="form-group ">
140   - <label for="mark" class="control-label col-sm-2">是否免审:</label>
141   - <div class="col-sm-10 ">
142   - <h5>否</h5>
143   - </div>
144   - </div>
145   -
146   - <div class="form-group ">
147   - <label for="mark" class="control-label col-sm-2">是否过滤:</label>
148   - <div class="col-sm-10 ">
149   - <h5>否</h5>
150   - </div>
151   - </div>
152   -
153   - <div class="form-group ">
154   - <label for="state" class="control-label col-sm-2">审核日志:</label>
155   - <div class="col-sm-10 ">
156   - <h5 id="state"></h5>
  128 + <h5 th:if="${comment.platform=='i'}">苹果</h5>
  129 + <h5 th:if="${comment.platform=='a'}">安卓</h5>
  130 + <h5 th:if="${comment.platform=='w'}">网页</h5>
157 131 </div>
158 132 </div>
159 133  
160 134 <div class="form-group">
161 135 <label for="auditor" class="control-label col-sm-2">审核员:</label>
162 136 <div class="col-sm-10">
163   - <h5>发布
  137 + <h5 th:text="${comment.auditor}">发布
164 138 openadmin9@cnlive.com</h5>
165 139 </div>
166 140 </div>
167 141  
168   - <div class="form-group">
169   - <label for="claimed_at" class="control-label col-sm-2">领审时间:</label>
  142 + <div class="form-group" th:if="${comment.state!=0}">
  143 + <label for="claimed_at" class="control-label col-sm-2">审核时间:</label>
170 144 <div class="col-sm-10">
171   - <h5>2018-11-29 10:04:35</h5>
  145 + <h5 th:text="${#dates.format(comment.comment_time, 'yyyy-MM-dd HH:mm:ss')}">2018-11-29 10:04:35</h5>
172 146 </div>
173 147 </div>
174 148 </div>
175 149  
176 150 </div>
177   -
178 151 <hr>
179   -
180   -
181 152 </div>
182 153  
183 154 <div class="form-group">
... ... @@ -187,169 +158,47 @@
187 158  
188 159 <div class="box-footer">
189 160 <div class="col-sm-5">
190   - <button type="button" class="btn btn-danger pull-right" id="reject">拒 绝</button>
  161 + <button type="button" class="btn btn-danger pull-right" onclick="comment(2);">拒 绝</button>
191 162 </div>
192 163  
193 164 <div class="col-sm-1" style="margin-right:26px;">
194   - <button type="button" class="btn btn-primary pull-right" id="pass">通 过</button>
  165 + <button type="button" class="btn btn-primary pull-right" onclick="comment(1);">通 过</button>
195 166 </div>
196 167  
197 168 <div class="col-sm-1">
198   - <button type="button" class="btn btn-info pull-right" id="back">返回列表</button>
  169 + <button type="button" class="btn btn-info pull-right" onclick="self.location=document.referrer;">返回列表</button>
199 170 </div>
200 171 </div>
201   -
202   -
203   - <!-- 确认弹出框 -->
204   - <div class="modal" id="action_note" role="dialog" aria-labelledby="myModalLabel">
205   - <div class="modal-dialog">
206   - <div class="modal-content">
207   - <div class="modal-header">
208   - <button type="button" class="close" data-dismiss="modal"> ×</button>
209   - <h4 class="modal-title">温馨提示</h4>
210   - </div>
211   - <div class="modal-body" id="msg2"></div>
212   - <div class="modal-footer">
213   - <button type="button" class="btn btn-default " data-dismiss="modal" id="action_note_no">取消</button>
214   - <button type="button" class="btn btn-primary" id="action_note_yes">确认</button>
215   - <input type="hidden" name="action_note_type" id="action_note_type" value="">
216   - <input type="hidden" name="action_note_id" id="action_note_id" value="">
217   - </div>
218   - </div>
219   - </div>
220   - </div>
221   - <script>
222   - $(function () {
223   - $('#begin_date').datetimepicker({
224   - format: 'YYYY/MM/DD HH:mm',
225   - locale: 'zh-cn'
226   - });
227   - $('#end_date').datetimepicker({
228   - format: 'YYYY/MM/DD HH:mm',
229   - locale: 'zh-cn'
230   - });
231   - });
232   -
233   - //上传图片
234   - var image_url = $('#image_url').val();
235   - var images = [];
236   -
237   - if (image_url == null || image_url.length > 0) {
238   - images = ['<img height="240" src="' + $('#image_url').val() + '">'];
239   - }
240   -
241   - $('#image_file').fileinput({
242   - language: 'zh',
243   - uploadExtraData: {_token: 'YnS6uzLnUDRQyeB4E2tTFbRCDmYio9gvdqwsGiu8'},
244   - allowedFileExtensions: ['jpg', 'gif', 'png'],
245   - initialPreview: images,
246   - maxFileSize: 10240,
247   - resizeImage: true,
248   - maxImageWidth: 640,
249   - maxImageHeight: 960,
250   - });
251   -
252   - $('#image_file').on('fileuploaded', function (event, data) {
253   - $('#image_url').val(data.response.data);
254   - });
255   -
256   - /*拒绝*/
257   - $("#reject").click(function () {
258   - var row_id = $("#comment_id").val();
259   - var attr_tags = $('#attr_tags').val();//获取标签属性信息
260   - var msg = $('#msg').val(); //获取审核msg
261   - if(attr_tags ==null && msg ==''){ //两个都为空 不行
262   - alert('请输入审核备注或者常用审核意见!');
263   - return false;
264   - }
265   - if (typeof(row_id) == "undefined") {
266   - return false;
267   - }
268   - //拒绝弹出框
269   - $('#msg2').html('您确认要拒绝该条评论吗?');
270   - $('#action_note').show();
271   - $("#action_note_type").val('reject');
272   - $("#action_note_id").val('');
273   - // $.ajax({
274   - // type: 'get',
275   - // data: {'_token': 'YnS6uzLnUDRQyeB4E2tTFbRCDmYio9gvdqwsGiu8', 'attr_tags': attr_tags, 'msg': msg},
276   - // url: '/comments/reject/' + row_id,
277   - // success: function (data) {
278   - // window.location.href = '/comments';
279   - // }
280   - // });
281   - });
282   -
283   - //弹出框取消
284   - $("#action_note_no").click(function () {
285   - $("#action_note").hide();
286   - });
287   - //弹出框确认
288   - $("#action_note_yes").click(function () {
289   - var row_id = $("#comment_id").val();
290   - var attr_tags = $('#attr_tags').val();//获取标签属性信息
291   - var msg = $('#msg').val(); //获取审核msg
292   - if(attr_tags ==null && msg ==''){ //两个都为空 不行
293   - alert('请输入审核备注或者常用审核意见!');
294   - return false;
295   - }
296   - if (typeof(row_id) == "undefined") {
297   - return false;
298   - }
299   - var state = 7
300   - $.ajax({
301   - type: 'get',
302   - data: {'_token': 'YnS6uzLnUDRQyeB4E2tTFbRCDmYio9gvdqwsGiu8', 'attr_tags': attr_tags, 'msg': msg},
303   - url: '/comments/reject/' + row_id,
304   - success: function (data) {
305   - window.location.href = '/comments'+ '?state=' + state;
306   - }
307   - });
308   - });
309   -
310   -
311   - /*通过*/
312   - $("#pass").click(function () {
313   -
314   - var row_id = $("#comment_id").val();
315   - var attr_tags = $('#attr_tags').val();//获取标签属性信息
316   - var msg = $('#msg').val(); //获取审核msg
317   - if (typeof(row_id) == "undefined") {
318   - return false;
  172 + <script th:inline="javascript">
  173 + var commentId = [[${comment.id}]];
  174 +
  175 + //审核操作,status=1为通过
  176 + function comment(status){
  177 + if(status==1){
  178 + $.post("/comments/pass?ids="+commentId,function (data) {
  179 + if (data.errorCode==0){
  180 + //location.href = history.back();
  181 + self.location=document.referrer;
  182 + } else{
  183 + alert("操作失败");
  184 + }
  185 + })
  186 + }else{
  187 + $.post("/comments/refuse?ids="+commentId,function (data) {
  188 + if (data.errorCode==0){
  189 + //location.href = history.back();
  190 + self.location=document.referrer;
  191 + } else{
  192 + alert("操作失败");
  193 + }
  194 + })
319 195 }
320   - var state = 7
321   - $.ajax({
322   - type: 'get',
323   - data: {'_token': 'YnS6uzLnUDRQyeB4E2tTFbRCDmYio9gvdqwsGiu8', 'attr_tags': attr_tags, 'msg': msg},
324   - url: '/comments/pass/' + row_id,
325   - success: function (data) {
326   - window.location.href = '/comments'+ '?state=' + state;
327   - }
328   - });
329   - });
330   -
331   - /*返回列表*/
332   - $("#back").click(function () {
333   -// window.history.back(-1);
334   - var state = 2;
335   - window.location.href = '/comments'+'?state=' + state;
336   - });
  196 + }
337 197  
338 198 </script>
339   -
340   -
341   - <!-- Select2 todo xiaohu -->
342   - <script src="../../static/js/select2.full.min.js"></script>
343   - <!-- Select2 todo xiaohu -->
  199 + <!--<script src="../../static/js/select2.full.min.js"></script>
344 200 <link rel="stylesheet" href="../../static/css/select2.min.css">
345   - <link rel="stylesheet" href="../../static/css/AdminLTE.min.css">
346   -
347   - <script>
348   - $(function () {
349   - //Initialize Select2 Elements
350   - $(".select2").select2();
351   - });
352   - </script>
  201 + <link rel="stylesheet" href="../../static/css/AdminLTE.min.css">-->
353 202  
354 203  
355 204 </div>
... ... @@ -364,15 +213,12 @@
364 213  
365 214 <footer th:replace="../templates/common/foot::foot" ></footer>
366 215  
367   -
368 216 <!-- Add the sidebar's background. This div must be placed
369 217 immediately after the control sidebar -->
370 218 <div class="control-sidebar-bg" style="position: fixed; height: auto;"></div>
371 219  
372 220 </div><!-- ./wrapper -->
373 221  
374   -
375   -
376 222 <!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
377 223 <script type="text/javascript">
378 224 $('div.alert').not('.alert-danger').delay(3000).slideUp(300);
... ... @@ -384,9 +230,4 @@
384 230 <script src="../../static/js/sidebar.js"></script>
385 231  
386 232  
387   -
388   -
389   -
390   -
391   -
392 233 </body></html>
393 234 \ No newline at end of file
... ...