index.html 9.7 KB

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