index.html 9.1 KB

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