index.html 11 KB

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