index.html 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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>访客IP设置列表</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/iplimit/add.html?type=2">
  31. <button class="btn btn-primary" type="button" style="margin-top:10px"><strong>新增IP</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" style="margin-top: 5px;">
  37. <div class="form-group">
  38. <label>IP:</label>
  39. <input type="text" class="form-control" id="content" name="content" value="" placeholder="请输入IP">
  40. <input style="display: none">
  41. </div>
  42. <div class="form-group">
  43. <button class="btn btn-primary" type="button" style="margin-top:5px" id="search"><strong>搜 索</strong>
  44. </button>
  45. </div>
  46. </div>
  47. </form>
  48. <!--搜索框结束-->
  49. <div class="example-wrap">
  50. <div class="example">
  51. <table id="cusTable">
  52. <thead>
  53. <th data-field="id">ID</th>
  54. <th data-field="ip">IP/IP范围</th>
  55. <th data-field="utime">修改时间</th>
  56. <th data-field="admin">管理员</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","#eee");
  79. $("#current2").css("background","#fff");
  80. $("#add").attr('href','/admin/iplimit/add.html?type=1');
  81. } else if (id == 2) {
  82. $("#current2").css({"background":"#eee"});
  83. $("#current1").css({"background":"#fff"});
  84. $("#add").attr('href','/admin/iplimit/add.html?type=2');
  85. }
  86. initTable()
  87. }
  88. function initTable() {
  89. //先销毁表格
  90. $('#cusTable').bootstrapTable('destroy');
  91. let type = $('#type').val();
  92. //初始化表格,动态从服务器加载数据
  93. $("#cusTable").bootstrapTable({
  94. method: "get", //使用get请求到服务器获取数据
  95. url: "{:url('iplimit/index')}", //获取数据的地址
  96. striped: true, //表格显示条纹
  97. pagination: true, //启动分页
  98. pageSize: 50, //每页显示的记录数
  99. pageNumber:1, //当前第几页
  100. pageList: [20, 50], //记录数可选列表
  101. sidePagination: "server", //表示服务端请求
  102. paginationFirstText: "首页",
  103. paginationPreText: "上一页",
  104. paginationNextText: "下一页",
  105. paginationLastText: "尾页",
  106. queryParamsType : "undefined",
  107. queryParams: function queryParams(params) { //设置查询参数
  108. var param = {
  109. pageNumber: params.pageNumber,
  110. type: type,
  111. pageSize: params.pageSize,
  112. searchText:$('#content').val()
  113. };
  114. return param;
  115. },
  116. onLoadSuccess: function(res){ //加载成功时执行
  117. if(111 == res.code){
  118. window.location.reload();
  119. }
  120. layer.msg("加载成功", {time : 1000});
  121. },
  122. onLoadError: function(){ //加载失败时执行
  123. layer.msg("加载数据失败");
  124. }
  125. });
  126. }
  127. function showSuccess(res){
  128. layer.ready(function(){
  129. layer.close(index);
  130. if(1 == res.code){
  131. layer.alert(res.msg, {title: '友情提示', icon: 1, closeBtn: 0}, function(){
  132. window.location.href = myHost + '/admin/iplimit/index';
  133. });
  134. }else if(111 == res.code){
  135. window.location.reload();
  136. }else{
  137. layer.msg(res.msg, {anim: 6});
  138. }
  139. });
  140. }
  141. $(document).ready(function () {
  142. //调用函数,初始化表格
  143. initTable();
  144. //当点击查询按钮的时候执行
  145. $("#search").bind("click", initTable);
  146. });
  147. function Del(id){
  148. layer.confirm('确认删除此ip?', {icon: 3, title:'提示'}, function(index){
  149. //do something
  150. $.getJSON("{:url('iplimit/del')}", {'id' : id}, function(res){
  151. if(1 == res.code){
  152. layer.alert(res.msg, {title: '友情提示', icon: 1, closeBtn: 0}, function(){
  153. initTable();
  154. });
  155. }else if(111 == res.code){
  156. window.location.reload();
  157. }else{
  158. layer.alert(res.msg, {title: '友情提示', icon: 2});
  159. }
  160. });
  161. layer.close(index);
  162. })
  163. }
  164. </script>
  165. </body>
  166. </html>