diff --git a/resources/views/chat/partials/input-bar.blade.php b/resources/views/chat/partials/input-bar.blade.php index 7526122..d510035 100644 --- a/resources/views/chat/partials/input-bar.blade.php +++ b/resources/views/chat/partials/input-bar.blade.php @@ -58,33 +58,6 @@ - {{-- 管理操作(根据权限显示) --}} - @if ($user->user_level >= $levelKick || $room->master == $user->username) - - - @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 462f2a4..569b6c9 100644 --- a/resources/views/chat/partials/scripts.blade.php +++ b/resources/views/chat/partials/scripts.blade.php @@ -162,20 +162,8 @@ toUserSelect.value = username; document.getElementById('content').focus(); }; - // 双击打开用户名片弹窗 - item.ondblclick = () => { - if (username !== window.chatContext.username) { - // 触发 Alpine.js 用户名片弹窗 - const modalContainer = document.getElementById('user-modal-container'); - if (modalContainer && modalContainer.__x) { - modalContainer.__x.$data.fetchUser(username); - } else if (modalContainer) { - // Alpine v3 使用 _x_dataStack - const alpineData = Alpine.$data(modalContainer); - if (alpineData) alpineData.fetchUser(username); - } - } - }; + // 双击打开用户名片弹窗(全局统一入口) + item.ondblclick = () => openUserCard(username); userList.appendChild(item); if (username !== window.chatContext.username) { @@ -236,6 +224,21 @@ document.getElementById('content').focus(); } + /** + * 全局函数:双击用户名打开名片弹窗 + * + * 聊天消息区和右侧用户列表统一调用此函数。 + * 通过 Alpine.js 的 fetchUser 方法加载用户资料并显示弹窗。 + */ + function openUserCard(username) { + if (username === window.chatContext.username) return; + const el = document.getElementById('user-modal-container'); + if (el) { + const data = Alpine.$data(el); + if (data) data.fetchUser(username); + } + } + /** * 双击用户名 → 在包厢窗口(say2)显示用户基本信息 */ @@ -288,7 +291,7 @@ if (systemUsers.includes(uName)) { return `${uName}`; } - return `${uName}`; + return `${uName}`; }; // 获取发言者头像