index.html 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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. <div class="ibox-title">
  19. <h5>会员列表</h5>
  20. </div>
  21. <div class="ibox-content">
  22. <!--搜索框开始-->
  23. <form id='commentForm' role="form" method="post" class="form-inline pull-right">
  24. <div class="content clearfix m-b">
  25. <div class="form-group">
  26. <label>注册日期:</label>
  27. <input type="text" class="form-control" id="start" value="<?php echo date('Y-m-d',time()-604800);?>" style="width: 100px;"> --
  28. <input type="text" class="form-control" id="end" value="<?php echo date('Y-m-d',time());?>" style="width: 100px;">
  29. </div>
  30. <div class="form-group">
  31. <label>用户名称:</label>
  32. <input type="text" class="form-control" id="username" name="user_name">
  33. </div>
  34. <div class="form-group">
  35. <button class="btn btn-primary" type="button" style="margin-top:5px" id="search"><strong>搜 索</strong>
  36. </button>
  37. </div>
  38. </div>
  39. </form>
  40. <!--搜索框结束-->
  41. <div class="example-wrap">
  42. <div class="example">
  43. <table id="cusTable">
  44. <thead>
  45. <th data-field="account_name">用户名称</th>
  46. <th data-field="nick_name">用户昵称</th>
  47. <th data-field="account_email">用户邮箱</th>
  48. <th data-field="account_phone">用户电话</th>
  49. <th data-field="add_time">注册时间</th>
  50. <th data-field="last_login_time">最近一次访问时间</th>
  51. <th data-field="address">地址</th>
  52. <th data-field="label">标签</th>
  53. <th data-field="remark">备注</th>
  54. <th data-field="user_name">负责人</th>
  55. <th data-field="operate">操作</th>
  56. </thead>
  57. </table>
  58. </div>
  59. </div>
  60. <!-- End Example Pagination -->
  61. </div>
  62. </div>
  63. </div>
  64. <!-- End Panel Other -->
  65. <script src="__JS__/jquery.min.js?v=2.1.4"></script>
  66. <script src="__JS__/bootstrap.min.js?v=3.3.6"></script>
  67. <script src="__JS__/content.min.js?v=1.0.0"></script>
  68. <script src="__JS__/plugins/bootstrap-table/bootstrap-table.min.js"></script>
  69. <script src="__JS__/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
  70. <script src="__JS__/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
  71. <script src="__JS__/plugins/layer/layer.min.js"></script>
  72. <script type="text/javascript">
  73. function initTable() {
  74. //先销毁表格
  75. $('#cusTable').bootstrapTable('destroy');
  76. //初始化表格,动态从服务器加载数据
  77. $("#cusTable").bootstrapTable({
  78. method: "get", //使用get请求到服务器获取数据
  79. url: "{:url('accounts/index')}", //获取数据的地址
  80. striped: true, //表格显示条纹
  81. pagination: true, //启动分页
  82. pageSize: 50, //每页显示的记录数
  83. pageNumber:1, //当前第几页
  84. pageList: [20,50], //记录数可选列表
  85. sidePagination: "server", //表示服务端请求
  86. paginationFirstText: "首页",
  87. paginationPreText: "上一页",
  88. paginationNextText: "下一页",
  89. paginationLastText: "尾页",
  90. queryParamsType : "undefined",
  91. queryParams: function queryParams(params) { //设置查询参数
  92. var param = {
  93. pageNumber: params.pageNumber,
  94. pageSize: params.pageSize,
  95. searchText:$('#username').val(),
  96. start:$('#start').val(),
  97. end:$('#end').val()
  98. };
  99. return param;
  100. },
  101. onLoadSuccess: function(res){ //加载成功时执行
  102. if(111 == res.code){
  103. window.location.reload();
  104. }
  105. layer.msg("加载成功", {time : 1000});
  106. },
  107. onLoadError: function(){ //加载失败时执行
  108. layer.msg("加载数据失败");
  109. }
  110. });
  111. }
  112. $(document).ready(function () {
  113. //调用函数,初始化表格
  114. initTable();
  115. //当点击查询按钮的时候执行
  116. $("#search").bind("click", initTable);
  117. });
  118. function accountDel(id){
  119. layer.confirm('确认删除此用户?', {icon: 3, title:'提示'}, function(index){
  120. //do something
  121. $.getJSON("{:url('accounts/delAccount')}", {'id' : id}, function(res){
  122. if(1 == res.code){
  123. layer.alert(res.msg, {title: '友情提示', icon: 1, closeBtn: 0}, function(){
  124. initTable();
  125. });
  126. }else if(111 == res.code){
  127. window.location.reload();
  128. }else{
  129. layer.alert(res.msg, {title: '友情提示', icon: 2});
  130. }
  131. });
  132. layer.close(index);
  133. })
  134. }
  135. function resetPwd(id){
  136. layer.confirm('确认重置密码?', {icon: 3, title:'提示'}, function(index){
  137. //do something
  138. $.getJSON("{:url('accounts/resetPwd')}", {'id' : id}, function(res){
  139. if(1 == res.code){
  140. layer.alert(res.msg, {title: '友情提示', icon: 1, closeBtn: 0}, function(){
  141. initTable();
  142. });
  143. }else if(111 == res.code){
  144. window.location.reload();
  145. }else{
  146. layer.alert(res.msg, {title: '友情提示', icon: 2});
  147. }
  148. });
  149. layer.close(index);
  150. })
  151. }
  152. </script>
  153. </body>
  154. </html>