From afd02b38e3874d49e6590b4e06678d853e57de79 Mon Sep 17 00:00:00 2001 From: lkddi Date: Wed, 18 Mar 2026 20:58:33 +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=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=EF=BC=9A=E5=90=8D=E5=8D=95item=E8=A1=A5touch?= =?UTF-8?q?end=E5=8F=8C=E5=87=BB=E6=A3=80=E6=B5=8B=EF=BC=8C=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E5=90=8D=E5=AD=97=E5=8A=A0=E4=BA=8B=E4=BB=B6=E5=A7=94?= =?UTF-8?q?=E6=89=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/chat/partials/scripts.blade.php | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/resources/views/chat/partials/scripts.blade.php b/resources/views/chat/partials/scripts.blade.php index 906a702..d8c502e 100644 --- a/resources/views/chat/partials/scripts.blade.php +++ b/resources/views/chat/partials/scripts.blade.php @@ -37,6 +37,33 @@ const onlineCount = document.getElementById('online-count'); const onlineCountBottom = document.getElementById('online-count-bottom'); + // ── 消息区:手机端双触发打开用户名片(PC 端靠 ondblclick 内联属性)── + // span[data-u] 由 clickableUser() 生成,touchend 委托至容器避免每条消息单独绑定 + (function _bindMsgDoubleTap() { + let _lastTapTarget = null; + let _lastTapTime = 0; + + /** touchend 委托处理函数 */ + function _onMsgTouch(e) { + const span = e.target.closest('[data-u]'); + if (!span) return; + const now = Date.now(); + if (span === _lastTapTarget && now - _lastTapTime < 300) { + e.preventDefault(); + openUserCard(span.dataset.u); + _lastTapTarget = null; + _lastTapTime = 0; + } else { + _lastTapTarget = span; + _lastTapTime = now; + } + } + + // 两个聊天容器(公屏 + 包厢)都绑定 + [container, container2].forEach(c => { + if (c) { c.addEventListener('touchend', _onMsgTouch, { passive: false }); } + }); + })(); let onlineUsers = {}; let autoScroll = true; let _maxMsgId = 0; // 记录当前收到的最大消息 ID