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 事件监听 ────────────────────────────