| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <!DOCTYPE html>
- <html lang="zh-CN">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>用户管理</title>
- <link rel="stylesheet" href="../../css/admin.css">
- </head>
- <body>
- <div class="page-content active">
- <div class="page-header">
- <h2>用户列表</h2>
- <button class="btn-primary" id="refreshUsersBtn">刷新</button>
- </div>
- <div class="table-container">
- <table class="data-table">
- <thead>
- <tr>
- <th>ID</th>
- <th>用户名</th>
- <th>手机号</th>
- <th>Ani币</th>
- <th>注册时间</th>
- <th>操作</th>
- </tr>
- </thead>
- <tbody id="usersTableBody">
- <tr>
- <td colspan="6" class="loading-text">加载中...</td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <!-- 编辑用户弹窗 -->
- <div id="editUserModal" class="modal" style="display: none;">
- <div class="modal-content">
- <div class="modal-header">
- <h3>编辑用户</h3>
- <button class="modal-close" id="closeEditUserModal">×</button>
- </div>
- <form id="editUserForm" class="modal-form">
- <input type="hidden" id="editUserId">
- <div class="form-group">
- <label>用户名</label>
- <input type="text" id="editUsername" required>
- </div>
- <div class="form-group">
- <label>手机号</label>
- <input type="text" id="editPhone" required>
- </div>
- <div class="form-group">
- <label>Ani币</label>
- <input type="number" id="editPoints" min="0" required>
- </div>
- <div class="modal-actions">
- <button type="button" class="btn-secondary" id="cancelEditUser">取消</button>
- <button type="submit" class="btn-primary">保存</button>
- </div>
- </form>
- </div>
- </div>
- <script src="../../js/users/users.js"></script>
- <script>
- // 初始化用户管理器
- (function() {
- let apiBaseUrl = 'http://localhost:3000';
-
- // 尝试从父窗口获取 API 地址(file:// 协议下会失败,使用默认值)
- try {
- if (window.parent && window.parent.getApiBaseUrl) {
- apiBaseUrl = window.parent.getApiBaseUrl();
- }
- } catch (e) {
- console.log('[UsersManager] 使用默认 API 地址:', apiBaseUrl);
- }
-
- if (!window.usersManager) {
- window.usersManager = new UsersManager({
- apiBaseUrl: apiBaseUrl,
- tbody: document.getElementById('usersTableBody')
- });
- }
- })();
- </script>
- </body>
- </html>
|