index.html 7.8 KB

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