From 28e938a462a7805448b6f37751c5cb107638490d Mon Sep 17 00:00:00 2001 From: lkddi Date: Fri, 27 Feb 2026 00:47:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=85=E7=90=86=EF=BC=9A=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E5=B7=B2=E5=BA=9F=E5=BC=83=E7=9A=84=20executeAdminAction=20?= =?UTF-8?q?=E5=87=BD=E6=95=B0=EF=BC=88=E7=BA=A690=E8=A1=8C=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 管理操作已迁移到名片弹窗(user-actions.blade.php),输入栏下拉也已移除 --- .../views/chat/partials/scripts.blade.php | 91 ------------------- 1 file changed, 91 deletions(-) diff --git a/resources/views/chat/partials/scripts.blade.php b/resources/views/chat/partials/scripts.blade.php index b058257..dcf0ef2 100644 --- a/resources/views/chat/partials/scripts.blade.php +++ b/resources/views/chat/partials/scripts.blade.php @@ -584,97 +584,6 @@ } } - // ── 管理操作执行(下拉选择 + 目标用户) ───────────── - async function executeAdminAction() { - const select = document.getElementById('admin-action-select'); - if (!select) return; - const action = select.value; - if (!action) { - alert('请先选择一个管理操作。'); - return; - } - - // 获取聊天对象下拉框中选中的用户作为目标 - const toUserSelect = document.getElementById('to_user'); - const targetUser = toUserSelect ? toUserSelect.value : ''; - - if (!targetUser || targetUser === '大家') { - alert('请先在「对...说」下拉中选择要操作的用户。'); - return; - } - - // 操作名称映射 - const actionNames = { - warn: '警告', - kick: '踢出', - mute: '禁言', - ban: '封号', - banip: '封IP', - whispers: '查看私聊' - }; - const actionName = actionNames[action] || action; - - // 查看私聊:直接打开新窗口 - if (action === 'whispers') { - window.open(`/command/whispers/${encodeURIComponent(targetUser)}`, '_blank'); - select.value = ''; - return; - } - - // 警告需要输入内容 - let warnMessage = ''; - if (action === 'warn') { - warnMessage = prompt('请输入警告内容:', '请注意聊天室规则,文明发言!'); - if (!warnMessage) return; - } - - // 禁言需要输入时长 - let duration = 5; - if (action === 'mute') { - const input = prompt('请输入禁言时长(分钟):', '5'); - if (!input) return; - duration = parseInt(input) || 5; - } - - // 二次确认 - const confirmMsg = action === 'banip' ? - `⚠️ 严重操作:确定要封禁 ${targetUser} 的IP地址吗?该用户将被封号+封IP!` : - `确定要对 ${targetUser} 执行「${actionName}」操作吗?`; - if (!confirm(confirmMsg)) return; - - try { - const body = { - room_id: window.chatContext.roomId - }; - if (action === 'mute') body.duration = duration; - if (action === 'warn') body.reason = warnMessage; - - // 警告走 /command/warn 路由,其他走 /user/{username}/{action} - let url; - if (action === 'warn') { - body.username = targetUser; - url = '/command/warn'; - } else { - url = `/user/${encodeURIComponent(targetUser)}/${action}`; - } - - const res = await fetch(url, { - method: 'POST', - headers: { - 'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').getAttribute( - 'content'), - 'Content-Type': 'application/json', - 'Accept': 'application/json' - }, - body: JSON.stringify(body) - }); - const data = await res.json(); - alert(data.message); - } catch (e) { - alert('操作失败:' + e.message); - } - select.value = ''; // 重置下拉 - } // ── 设置房间公告 ───────────────────────────────────── async function promptAnnouncement() {