users.html 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  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="stylesheet" href="../../css/admin.css">
  8. </head>
  9. <body>
  10. <div class="page-content active">
  11. <div class="page-header">
  12. <h2>用户列表</h2>
  13. <button class="btn-primary" id="refreshUsersBtn">刷新</button>
  14. </div>
  15. <div class="table-container">
  16. <table class="data-table">
  17. <thead>
  18. <tr>
  19. <th>ID</th>
  20. <th>用户名</th>
  21. <th>手机号</th>
  22. <th>Ani币</th>
  23. <th>注册时间</th>
  24. <th>操作</th>
  25. </tr>
  26. </thead>
  27. <tbody id="usersTableBody">
  28. <tr>
  29. <td colspan="6" class="loading-text">加载中...</td>
  30. </tr>
  31. </tbody>
  32. </table>
  33. </div>
  34. </div>
  35. <!-- 编辑用户弹窗 -->
  36. <div id="editUserModal" class="modal" style="display: none;">
  37. <div class="modal-content">
  38. <div class="modal-header">
  39. <h3>编辑用户</h3>
  40. <button class="modal-close" id="closeEditUserModal">&times;</button>
  41. </div>
  42. <form id="editUserForm" class="modal-form">
  43. <input type="hidden" id="editUserId">
  44. <div class="form-group">
  45. <label>用户名</label>
  46. <input type="text" id="editUsername" required>
  47. </div>
  48. <div class="form-group">
  49. <label>手机号</label>
  50. <input type="text" id="editPhone" required>
  51. </div>
  52. <div class="form-group">
  53. <label>Ani币</label>
  54. <input type="number" id="editPoints" min="0" required>
  55. </div>
  56. <div class="modal-actions">
  57. <button type="button" class="btn-secondary" id="cancelEditUser">取消</button>
  58. <button type="submit" class="btn-primary">保存</button>
  59. </div>
  60. </form>
  61. </div>
  62. </div>
  63. <script src="../../js/users/users.js"></script>
  64. <script>
  65. // 初始化用户管理器
  66. (function() {
  67. let apiBaseUrl = 'http://localhost:3000';
  68. // 尝试从父窗口获取 API 地址(file:// 协议下会失败,使用默认值)
  69. try {
  70. if (window.parent && window.parent.getApiBaseUrl) {
  71. apiBaseUrl = window.parent.getApiBaseUrl();
  72. }
  73. } catch (e) {
  74. console.log('[UsersManager] 使用默认 API 地址:', apiBaseUrl);
  75. }
  76. if (!window.usersManager) {
  77. window.usersManager = new UsersManager({
  78. apiBaseUrl: apiBaseUrl,
  79. tbody: document.getElementById('usersTableBody')
  80. });
  81. }
  82. })();
  83. </script>
  84. </body>
  85. </html>