index.html 8.4 KB

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