()
| 1972 | |
| 1973 | // 加载最近注册的账号 |
| 1974 | async function loadRecentAccounts() { |
| 1975 | try { |
| 1976 | const data = await api.get('/accounts?page=1&page_size=10'); |
| 1977 | |
| 1978 | if (data.accounts.length === 0) { |
| 1979 | elements.recentAccountsTable.innerHTML = ` |
| 1980 | <tr> |
| 1981 | <td colspan="5"> |
| 1982 | <div class="empty-state" style="padding: var(--spacing-md);"> |
| 1983 | <div class="empty-state-icon">📭</div> |
| 1984 | <div class="empty-state-title">暂无已注册账号</div> |
| 1985 | </div> |
| 1986 | </td> |
| 1987 | </tr> |
| 1988 | `; |
| 1989 | return; |
| 1990 | } |
| 1991 | |
| 1992 | elements.recentAccountsTable.innerHTML = data.accounts.map(account => ` |
| 1993 | <tr data-id="${account.id}"> |
| 1994 | <td>${account.id}</td> |
| 1995 | <td> |
| 1996 | <span style="display:inline-flex;align-items:center;gap:4px;"> |
| 1997 | <span title="${escapeHtml(account.email)}">${escapeHtml(account.email)}</span> |
| 1998 | <button class="btn-copy-icon copy-email-btn" data-email="${escapeHtml(account.email)}" title="复制邮箱">📋</button> |
| 1999 | </span> |
| 2000 | </td> |
| 2001 | <td class="password-cell"> |
| 2002 | ${account.password |
| 2003 | ? `<span style="display:inline-flex;align-items:center;gap:4px;"> |
| 2004 | <span class="password-hidden" title="点击查看">${escapeHtml(account.password.substring(0, 8))}...</span> |
| 2005 | <button class="btn-copy-icon copy-pwd-btn" data-pwd="${escapeHtml(account.password)}" title="复制密码">📋</button> |
| 2006 | </span>` |
| 2007 | : '-'} |
| 2008 | </td> |
| 2009 | <td> |
| 2010 | ${getStatusIcon(account.status)} |
| 2011 | </td> |
| 2012 | </tr> |
| 2013 | `).join(''); |
| 2014 | |
| 2015 | // 绑定复制按钮事件 |
| 2016 | elements.recentAccountsTable.querySelectorAll('.copy-email-btn').forEach(btn => { |
| 2017 | btn.addEventListener('click', (e) => { e.stopPropagation(); copyToClipboard(btn.dataset.email); }); |
| 2018 | }); |
| 2019 | elements.recentAccountsTable.querySelectorAll('.copy-pwd-btn').forEach(btn => { |
| 2020 | btn.addEventListener('click', (e) => { e.stopPropagation(); copyToClipboard(btn.dataset.pwd); }); |
| 2021 | }); |
| 2022 | |
| 2023 | } catch (error) { |
| 2024 | console.error('加载账号列表失败:', error); |
| 2025 | } |
| 2026 | } |
| 2027 | |
| 2028 | // 开始账号列表轮询 |
| 2029 | function startAccountsPolling() { |
no test coverage detected