user.art 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. {{extend './common/layout.art'}}
  2. {{block 'main'}}
  3. <!-- 子模板的相对路径相对的是当前文件,因为它是由模板引擎解析的,而不是浏览器-->
  4. {{include './common/header.art'}}
  5. <!-- 主体内容 -->
  6. <div class="content">
  7. {{include './common/sider.art'}}
  8. <div class="main">
  9. <!-- 分类标题 -->
  10. <div class="title">
  11. <h4>用户</h4>
  12. <span>找到1个用户</span>
  13. <a href="/admin/user-edit" class="btn btn-primary new">新增用户</a>
  14. </div>
  15. <!-- /分类标题 -->
  16. <!-- 内容列表 -->
  17. <table class="table table-striped table-bordered table-hover custom-table">
  18. <thead>
  19. <tr>
  20. <th>ID</th>
  21. <th>用户名</th>
  22. <th>邮箱</th>
  23. <th>角色</th>
  24. <th>状态</th>
  25. <th>操作</th>
  26. </tr>
  27. </thead>
  28. <tbody>
  29. {{each users}}
  30. <tr>
  31. <td>{{@$value._id}}</td>
  32. <td>{{$value.username}}</td>
  33. <td>{{$value.email}}</td>
  34. <td>{{$value.role == 'admin' ? '超级管理员' : '普通用户'}}</td>
  35. <td>{{$value.state ? '禁用' : '启用'}}</td>
  36. <td>
  37. <a href="/admin/user-edit?id={{@$value._id}}" class="glyphicon glyphicon-edit"></a>
  38. <i class="glyphicon glyphicon-remove delete" data-toggle="modal" data-target=".confirm-modal" data-id="{{@$value._id}}"></i>
  39. </td>
  40. </tr>
  41. {{/each}}
  42. </tbody>
  43. </table>
  44. <!-- /内容列表 -->
  45. <!-- 分页 -->
  46. <ul class="pagination">
  47. <li style="display: <%= page-1 < 1 ? 'none': 'inline' %>">
  48. <a href="/admin/user?page=<%=page-1%>">
  49. <span>&laquo;</span>
  50. </a>
  51. </li>
  52. <% for(var i = 1; i <= total; i++){ %>
  53. <li><a href="/admin/user?page=<%=i%>"><%=i%></a></li>
  54. <% } %>
  55. <li style="display: <%= page-0+1 > total ? 'none': 'inline' %>">
  56. <a href="/admin/user?page=<%=page-0+1%>">
  57. <span>&raquo;</span>
  58. </a>
  59. </li>
  60. </ul>
  61. <!-- /分页 -->
  62. </div>
  63. </div>
  64. <!-- /主体内容 -->
  65. <!-- 删除确认弹出框 -->
  66. <div class="modal fade confirm-modal">
  67. <div class="modal-dialog modal-lg">
  68. <form class="modal-content" action="/admin/user-delete">
  69. <div class="modal-header">
  70. <button type="button" class="close" data-dismiss="modal"><span>&times;</span></button>
  71. <h4 class="modal-title">请确认</h4>
  72. </div>
  73. <div class="modal-body">
  74. <p>您确定要删除这个用户吗?</p>
  75. <input type='hidden' name="id" id="deleteUserId" >
  76. </div>
  77. <div class="modal-footer">
  78. <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
  79. <input type="submit" class="btn btn-primary">
  80. </div>
  81. </form>
  82. </div>
  83. </div>
  84. <!-- /删除确认弹出框 -->
  85. {{/block}}
  86. {{block 'script'}}
  87. <script>
  88. $('.delete').on('click', function() {
  89. var id = $(this).attr('data-id');
  90. $('#deleteUserId').val(id);
  91. })
  92. </script>
  93. {{/block}}