From b63b7090322e44cff505102f9b367cc5fa6f7ba6 Mon Sep 17 00:00:00 2001 From: lkddi Date: Wed, 18 Mar 2026 20:51:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=89=8B=E6=9C=BA=E7=AB=AF?= =?UTF-8?q?=E5=8F=8C=E8=A7=A6=E5=8F=91=E5=BC=B9=E7=AA=97=EF=BC=9A=E5=90=8D?= =?UTF-8?q?=E5=8D=95=20item=20=E5=92=8C=E6=B6=88=E6=81=AF=E5=90=8D?= =?UTF-8?q?=E5=AD=97=E5=9D=87=E6=94=AF=E6=8C=81=20touchend=20double-tap=20?= =?UTF-8?q?=E5=BC=B9=E5=87=BA=E7=94=A8=E6=88=B7=E5=90=8D=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chat/partials/layout/input-bar.blade.php | 54 +++++++++---------- .../views/chat/partials/scripts.blade.php | 53 ++++++++++++++---- 2 files changed, 68 insertions(+), 39 deletions(-) diff --git a/resources/views/chat/partials/layout/input-bar.blade.php b/resources/views/chat/partials/layout/input-bar.blade.php index e73ef81..c9e9182 100644 --- a/resources/views/chat/partials/layout/input-bar.blade.php +++ b/resources/views/chat/partials/layout/input-bar.blade.php @@ -73,35 +73,33 @@ - @if ($user->id === 1 || $user->activePosition()->exists()) - {{-- 欢迎语快捷按钮 + 下拉浮层 --}} -
- - + {{-- 欢迎语快捷按钮 + 下拉浮层 --}} +
+ + - @endif +
@if ( $user->user_level >= (int) \App\Models\Sysparam::getValue('level_announcement', '10') || diff --git a/resources/views/chat/partials/scripts.blade.php b/resources/views/chat/partials/scripts.blade.php index 075cec1..906a702 100644 --- a/resources/views/chat/partials/scripts.blade.php +++ b/resources/views/chat/partials/scripts.blade.php @@ -311,18 +311,25 @@ document.getElementById('content').focus(); }, 250); }; - // 双击打开用户名片弹窗(全局统一入口);手机端同时关闭名单抽屉 - item.ondblclick = () => { - // 取消尚未执行的单击定时器 - if (_clickTimer) { - clearTimeout(_clickTimer); - _clickTimer = null; - } - if (typeof closeMobileDrawer === 'function') { - closeMobileDrawer(); - } + // 双击 / 手机端双触发 打开用户名片弹窗 + const _openCardFromList = () => { + if (_clickTimer) { clearTimeout(_clickTimer); _clickTimer = null; } + if (typeof closeMobileDrawer === 'function') { closeMobileDrawer(); } openUserCard(username); }; + item.ondblclick = _openCardFromList; + // 手机端:检测 300ms 内两次 touchend 触发双击 + let _tapTime = 0; + item.addEventListener('touchend', (e) => { + const now = Date.now(); + if (now - _tapTime < 300) { + e.preventDefault(); + _openCardFromList(); + _tapTime = 0; + } else { + _tapTime = now; + } + }, { passive: false }); targetContainer.appendChild(item); }); } @@ -490,7 +497,7 @@ if (systemUsers.includes(uName) || isGameLabel(uName)) { return `${uName}`; } - return `${uName}`; + return `${uName}`; }; // 系统播报用户(不包含 AI小班长)使用军号图标,AI小班长用专属图,普通用户用头像 @@ -663,6 +670,30 @@ if (typeof window.initChat === 'function') { window.initChat(window.chatContext.roomId); } + + // 手机端:在公屏(say1)和包厢(say2)容器上注册 touchend 委托 + // 检测 300ms 内两次触摸同一 [data-u] 用户名 span,触发 openUserCard + let _msgTapTarget = null; + let _msgTapTime = 0; + ['say1', 'say2'].forEach(id => { + const el = document.getElementById(id); + if (!el) { return; } + el.addEventListener('touchend', (e) => { + const span = e.target.closest('[data-u]'); + if (!span) { return; } + const uName = span.dataset.u; + const now = Date.now(); + if (uName === _msgTapTarget && now - _msgTapTime < 300) { + e.preventDefault(); + openUserCard(uName); + _msgTapTarget = null; + _msgTapTime = 0; + } else { + _msgTapTarget = uName; + _msgTapTime = now; + } + }, { passive: false }); + }); }); // ── WebSocket 事件监听 ────────────────────────────