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)} |
| 来源 | 游戏名 | UID | 绑定时间 | 操作 |
|---|---|---|---|---|
| ${it.source==='netease'?'网易端':'皮肤站'} | ${U.esc(it.game_name)} | ${U.esc(it.game_uid||'-')} | ${U.date(it.created_at)} | ${idents.length > 1 ? `` : '主身份'} |
同一账号可同时绑定网易端与皮肤站身份,提交工单时选择使用哪个身份。
| 月份 | 数量 |
|---|---|
| ${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); }, showAddIdentity() { U.modal('绑定身份', ` `); document.getElementById('ident-source').onchange = () => { const isNetease = document.getElementById('ident-source').value === 'netease'; document.getElementById('ident-uid-group').style.display = isNetease ? '' : 'none'; document.getElementById('ident-uid').required = isNetease; }; document.getElementById('ident-form').onsubmit = async e => { e.preventDefault(); try { await API.post('/auth/identities', { source: document.getElementById('ident-source').value, game_name: document.getElementById('ident-name').value, game_uid: document.getElementById('ident-uid').value, }); App.closeModal(); this.mount(); } catch (ex) { const el = document.getElementById('ident-err'); el.textContent = ex.message; el.classList.remove('hidden'); } }; }, async removeIdentity(id) { if (!await U.confirm('确认解绑该身份?')) return; try { await API.delete(`/auth/identities/${id}`); this.mount(); } catch (ex) { alert(ex.message); } }, 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 {} } };