index.html 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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="2" id="type">
  19. <div style="display: flex;">
  20. <div class="ibox-title" style="width: 100px; cursor:pointer;" id="current1" onclick="current(2)">
  21. <h5>客服敏感词</h5>
  22. </div>
  23. <div class="ibox-title" id="current2" style="width: 100px; cursor:pointer; background: #eee" onclick="current(1)">
  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 id="add" href="/admin/sensitivec/addsensitive.html?type=2">
  31. <button class="btn btn-primary" type="button" style="margin-top:5px"><strong>新 增</strong>
  32. </button>
  33. </a>
  34. <form action="/admin/sensitivec/inserExcel" enctype="multipart/form-data" method="post" role="form" class="form-inline pull-right">
  35. <div class="content clearfix m-b" style="margin-left: 50px;">
  36. <div class="form-group">
  37. <a href="/static/admin/file/sensitivewords.xlsx" class="btn btn-primary" style="margin-top:5px" >下载敏感词模板文件</a>
  38. </div>
  39. <div class="form-group">
  40. <!--<label>导入敏感词:</label>-->
  41. <input type="file" class="form-control" name="excel" style="width: 200px;border: none;" />
  42. </div>
  43. <div class="form-group">
  44. <input type="submit" class="btn btn-primary" style="margin-top:5px" value="导入">
  45. </div>
  46. </div>
  47. </form>
  48. <!--搜索框开始-->
  49. <form id='commentForm' role="form" method="post" class="form-inline pull-right">
  50. <div class="content clearfix m-b">
  51. <div class="form-group">
  52. <label>敏感词关键字:</label>
  53. <input type="text" class="form-control" id="content" name="content" value="" placeholder="请输入敏感词">
  54. <input style="display: none">
  55. </div>
  56. <div class="form-group">
  57. <button class="btn btn-primary" type="button" style="margin-top:5px" id="search"><strong>搜 索</strong>
  58. </button>
  59. </div>
  60. </div>
  61. </form>
  62. <!--搜索框结束-->
  63. <div class="example-wrap">
  64. <div class="example">
  65. <table id="cusTable">
  66. <thead>
  67. <th data-field="sensitivewords_id">ID</th>
  68. <th data-field="sensitivewords_word">内容</th>
  69. <th data-field="sensitivewords_time">修订时间</th>
  70. <th data-field="user_name">修订人</th>
  71. <th data-field="sensitivewords_status">状态</th>
  72. <th data-field="operate">操作</th>
  73. </thead>
  74. </table>
  75. </div>
  76. </div>
  77. <!-- End Example Pagination -->
  78. </div>
  79. </div>
  80. </div>
  81. <!-- End Panel Other -->
  82. <script src="__JS__/jquery.min.js?v=2.1.4"></script>
  83. <script src="__JS__/bootstrap.min.js?v=3.3.6"></script>
  84. <script src="__JS__/content.min.js?v=1.0.0"></script>
  85. <script src="__JS__/plugins/bootstrap-table/bootstrap-table.min.js"></script>
  86. <script src="__JS__/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
  87. <script src="__JS__/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
  88. <script src="__JS__/plugins/layer/layer.min.js"></script>
  89. <script type="text/javascript">
  90. function current(id) {
  91. $("#type").val(id);
  92. if (id == 1) {
  93. $("#current1").css("background","#eee");
  94. $("#current2").css("background","#fff");
  95. $("#add").attr('href','/admin/sensitivec/addsensitive.html?type=1');
  96. } else if (id == 2) {
  97. $("#current2").css({"background":"#eee"});
  98. $("#current1").css({"background":"#fff"});
  99. $("#add").attr('href','/admin/sensitivec/addsensitive.html?type=2');
  100. }
  101. initTable()
  102. }
  103. function initTable() {
  104. //先销毁表格
  105. $('#cusTable').bootstrapTable('destroy');
  106. let type = $('#type').val();
  107. //初始化表格,动态从服务器加载数据
  108. $("#cusTable").bootstrapTable({
  109. method: "get", //使用get请求到服务器获取数据
  110. url: "{:url('sensitivec/index')}", //获取数据的地址
  111. striped: true, //表格显示条纹
  112. pagination: true, //启动分页
  113. pageSize: 10, //每页显示的记录数
  114. pageNumber:1, //当前第几页
  115. pageList: [5, 10, 15, 20, 25], //记录数可选列表
  116. sidePagination: "server", //表示服务端请求
  117. paginationFirstText: "首页",
  118. paginationPreText: "上一页",
  119. paginationNextText: "下一页",
  120. paginationLastText: "尾页",
  121. queryParamsType : "undefined",
  122. queryParams: function queryParams(params) { //设置查询参数
  123. var param = {
  124. pageNumber: params.pageNumber,
  125. type: type,
  126. pageSize: params.pageSize,
  127. searchText:$('#content').val()
  128. };
  129. return param;
  130. },
  131. onLoadSuccess: function(res){ //加载成功时执行
  132. if(111 == res.code){
  133. window.location.reload();
  134. }
  135. layer.msg("加载成功", {time : 1000});
  136. },
  137. onLoadError: function(){ //加载失败时执行
  138. layer.msg("加载数据失败");
  139. }
  140. });
  141. }
  142. function showSuccess(res){
  143. layer.ready(function(){
  144. layer.close(index);
  145. if(1 == res.code){
  146. layer.alert(res.msg, {title: '友情提示', icon: 1, closeBtn: 0}, function(){
  147. window.location.href = myHost + '/admin/Sensitivec/index';
  148. });
  149. }else if(111 == res.code){
  150. window.location.reload();
  151. }else{
  152. layer.msg(res.msg, {anim: 6});
  153. }
  154. });
  155. }
  156. $(document).ready(function () {
  157. //调用函数,初始化表格
  158. initTable();
  159. //当点击查询按钮的时候执行
  160. $("#search").bind("click", initTable);
  161. });
  162. function userDel(id){
  163. layer.confirm('确认删除此敏感词?', {icon: 3, title:'提示'}, function(index){
  164. //do something
  165. $.getJSON("{:url('sensitivec/delWord')}", {'id' : id}, function(res){
  166. if(1 == res.code){
  167. layer.alert(res.msg, {title: '友情提示', icon: 1, closeBtn: 0}, function(){
  168. initTable();
  169. });
  170. }else if(111 == res.code){
  171. window.location.reload();
  172. }else{
  173. layer.alert(res.msg, {title: '友情提示', icon: 2});
  174. }
  175. });
  176. layer.close(index);
  177. })
  178. }
  179. </script>
  180. </body>
  181. </html>