const Dashboard = { async render() { return '
| 玩家 | 类型 | 原因 | 时长 | 时间 |
|---|---|---|---|---|
| ${U.esc(b.player_name)} | ${b.type==='ban'?'封禁':b.type==='mute'?'禁言':'其他'} | ${U.esc(b.reason||'')} | ${b.duration||'永久'} | ${U.date(b.created_at)} |
| 月份 | 数量 |
|---|---|
| ${m.m} | ${m.c} |
提示: 可在"工单列表"中查看和管理所有工单
`; }, showAddBan() { U.modal('添加封禁', ` `); document.getElementById('ban-form').onsubmit = async e => { e.preventDefault(); try { await API.post('/bans', { player_name: document.getElementById('ban-name').value, player_uid: document.getElementById('ban-uid').value, source: document.getElementById('ban-source').value, type: document.getElementById('ban-type').value, duration: document.getElementById('ban-dur').value, reason: document.getElementById('ban-reason').value }); App.closeModal(); this.mount(); } catch(ex) { alert(ex.message); } }; setTimeout(() => Dashboard.checkMinDuration(), 100); }, async checkMinDuration() { const name = document.getElementById('ban-name')?.value; const uid = document.getElementById('ban-uid')?.value; const type = document.getElementById('ban-type')?.value; if (!name && !uid) return; try { const r = await API.get('/bans/min-duration?player_name='+name+'&player_uid='+uid+'&type='+type); const sel = document.getElementById('ban-dur'); if (r.minDays > 0) { sel.innerHTML = ``; } else { sel.innerHTML = ``; } } catch {} } };