index.html 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>敏感词列表</title>
  7. <link rel="shortcut icon" href="favicon.ico">
  8. <link href="__CSS__/bootstrap.min.css?v=3.3.6" rel="stylesheet">
  9. <link href="__CSS__/font-awesome.min.css?v=4.4.0" rel="stylesheet">
  10. <link href="__CSS__/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
  11. <link href="__CSS__/animate.min.css" rel="stylesheet">
  12. <link href="__CSS__/style.min.css?v=4.1.0" rel="stylesheet">
  13. </head>
  14. <body class="gray-bg">
  15. <div class="wrapper wrapper-content animated fadeInRight">
  16. <!-- Panel Other -->
  17. <div class="ibox float-e-margins">
  18. <input style="display:none;" type="text" value="1" id="type">
  19. <div style="display: flex;">
  20. <div class="ibox-title" style="width: 100px; cursor:pointer;" id="current1" onclick="current(1)">
  21. <h5>客服敏感词</h5>
  22. </div>
  23. <div class="ibox-title" id="current2" style="width: 100px; cursor:pointer; background: #eee" onclick="current(2)">
  24. <h5>用户敏感词</h5>
  25. </div>
  26. <div class="ibox-title" style="width: calc(100% - 200px); background: #eee;">
  27. </div>
  28. </div>
  29. <div class="ibox-content">
  30. <a href="/admin/sensitivec/addsensitive.html">
  31. <button class="btn btn-primary" type="button" style="margin-top:5px"><strong>新 增</strong>
  32. </button>
  33. </a>
  34. <!--搜索框开始-->
  35. <form id='commentForm' role="form" method="post" class="form-inline pull-right">
  36. <div class="content clearfix m-b">
  37. <div class="form-group">
  38. <label>敏感词关键字:</label>
  39. <input type="text" class="form-control" id="content" name="content" value="" placeholder="请输入敏感词">
  40. </div>
  41. <div class="form-group">
  42. <button class="btn btn-primary" type="button" style="margin-top:5px" id="search"><strong>搜 索</strong>
  43. </button>
  44. </div>
  45. </div>
  46. </form>
  47. <!--搜索框结束-->
  48. <div class="example-wrap">
  49. <div class="example">
  50. <table id="cusTable">
  51. <thead>
  52. <th data-field="sensitivewords_id">ID</th>
  53. <th data-field="sensitivewords_word">内容</th>
  54. <th data-field="sensitivewords_time">时间</th>
  55. <th data-field="user_name">操作人</th>
  56. <th data-field="sensitivewords_status">状态</th>
  57. <th data-field="operate">操作</th>
  58. </thead>
  59. </table>
  60. </div>
  61. </div>
  62. <!-- End Example Pagination -->
  63. </div>
  64. </div>
  65. </div>
  66. <!-- End Panel Other -->
  67. <script src="__JS__/jquery.min.js?v=2.1.4"></script>
  68. <script src="__JS__/bootstrap.min.js?v=3.3.6"></script>
  69. <script src="__JS__/content.min.js?v=1.0.0"></script>
  70. <script src="__JS__/plugins/bootstrap-table/bootstrap-table.min.js"></script>
  71. <script src="__JS__/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
  72. <script src="__JS__/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
  73. <script src="__JS__/plugins/layer/layer.min.js"></script>
  74. <script type="text/javascript">
  75. function current(id) {
  76. $("#type").val(id);
  77. if (id == 1) {
  78. $("#current1").css("background","#fff");
  79. $("#current2").css("background","#eee");
  80. } else if (id == 2) {
  81. $("#current2").css({"background":"#fff"});
  82. $("#current1").css({"background":"#eee"});
  83. }
  84. initTable()
  85. }
  86. function initTable() {
  87. //先销毁表格
  88. $('#cusTable').bootstrapTable('destroy');
  89. let type = $('#type').val();
  90. //初始化表格,动态从服务器加载数据
  91. $("#cusTable").bootstrapTable({
  92. method: "get", //使用get请求到服务器获取数据
  93. url: "{:url('sensitivec/index')}", //获取数据的地址
  94. striped: true, //表格显示条纹
  95. pagination: true, //启动分页
  96. pageSize: 10, //每页显示的记录数
  97. pageNumber:1, //当前第几页
  98. pageList: [5, 10, 15, 20, 25], //记录数可选列表
  99. sidePagination: "server", //表示服务端请求
  100. paginationFirstText: "首页",
  101. paginationPreText: "上一页",
  102. paginationNextText: "下一页",
  103. paginationLastText: "尾页",
  104. queryParamsType : "undefined",
  105. queryParams: function queryParams(params) { //设置查询参数
  106. var param = {
  107. pageNumber: params.pageNumber,
  108. type: type,
  109. pageSize: params.pageSize,
  110. searchText:$('#content').val()
  111. };
  112. return param;
  113. },
  114. onLoadSuccess: function(res){ //加载成功时执行
  115. if(111 == res.code){
  116. window.location.reload();
  117. }
  118. layer.msg("加载成功", {time : 1000});
  119. },
  120. onLoadError: function(){ //加载失败时执行
  121. layer.msg("加载数据失败");
  122. }
  123. });
  124. }
  125. $(document).ready(function () {
  126. //调用函数,初始化表格
  127. initTable();
  128. //当点击查询按钮的时候执行
  129. $("#search").bind("click", initTable);
  130. });
  131. function userDel(id){
  132. layer.confirm('确认删除此敏感词?', {icon: 3, title:'提示'}, function(index){
  133. //do something
  134. $.getJSON("{:url('sensitivec/delWord')}", {'id' : id}, function(res){
  135. if(1 == res.code){
  136. layer.alert(res.msg, {title: '友情提示', icon: 1, closeBtn: 0}, function(){
  137. initTable();
  138. });
  139. }else if(111 == res.code){
  140. window.location.reload();
  141. }else{
  142. layer.alert(res.msg, {title: '友情提示', icon: 2});
  143. }
  144. });
  145. layer.close(index);
  146. })
  147. }
  148. </script>
  149. </body>
  150. </html>