diff --git a/public/css/chat.css b/public/css/chat.css index 770c068..2f20f97 100644 --- a/public/css/chat.css +++ b/public/css/chat.css @@ -261,6 +261,43 @@ a:hover { gap: 3px; } +/* 欢迎语下拉浮层 */ +.welcome-menu { + position: absolute; + bottom: calc(100% + 4px); + left: 0; + z-index: 9000; + background: #fff; + border: 1px solid #b0c8e0; + border-radius: 6px; + box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18); + min-width: 280px; + max-width: 360px; + padding: 4px 0; +} + +.welcome-menu-item { + padding: 6px 12px; + font-size: 12px; + color: #224466; + cursor: pointer; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + border-bottom: 1px solid #eef4fb; + transition: background 0.1s; +} + +.welcome-menu-item:last-child { + border-bottom: none; +} + +.welcome-menu-item:hover { + background: #ddeeff; + color: #003366; +} + + .input-bar select, .input-bar input[type="text"], .input-bar input[type="checkbox"] { diff --git a/resources/views/chat/partials/games/baccarat-panel.blade.php b/resources/views/chat/partials/games/baccarat-panel.blade.php index f710992..f5eb862 100644 --- a/resources/views/chat/partials/games/baccarat-panel.blade.php +++ b/resources/views/chat/partials/games/baccarat-panel.blade.php @@ -537,7 +537,10 @@ this.settledResult = data.result; this.resultLabel = data.result_label; this.phase = 'settled'; - this.show = true; + // 只有本局有押注的用户才弹出结算面板 + if (this.myBet) { + this.show = true; + } // 判断本人是否中奖(从后端拿到的 result 与我的下注 type 比较) if (this.myBet && this.myBetType === data.result && data.result !== 'kill') { diff --git a/resources/views/chat/partials/layout/input-bar.blade.php b/resources/views/chat/partials/layout/input-bar.blade.php index ab61439..0358529 100644 --- a/resources/views/chat/partials/layout/input-bar.blade.php +++ b/resources/views/chat/partials/layout/input-bar.blade.php @@ -71,6 +71,35 @@ + @if ($user->id === 1 || $user->activePosition()->exists()) + {{-- 欢迎语快捷按钮 + 下拉浮层 --}} +
+ + +
+ @endif + @if ( $user->user_level >= (int) \App\Models\Sysparam::getValue('level_announcement', '10') || $room->master == $user->username) diff --git a/resources/views/chat/partials/scripts.blade.php b/resources/views/chat/partials/scripts.blade.php index e20cb66..7063228 100644 --- a/resources/views/chat/partials/scripts.blade.php +++ b/resources/views/chat/partials/scripts.blade.php @@ -117,6 +117,44 @@ + + // ── 欢迎语快捷菜单 ────────────────────────────────────── + /** + * 切换欢迎语下拉浮层的显示/隐藏 + */ + function toggleWelcomeMenu(event) { + event.stopPropagation(); + const menu = document.getElementById('welcome-menu'); + if (!menu) { return; } + menu.style.display = menu.style.display === 'none' ? 'block' : 'none'; + } + + /** + * 将选中的欢迎语模板填入输入框,{name} 替换为当前选中的聊天对象 + * + * @param {string} tpl 欢迎语模板,含 {name} 占位符 + */ + function sendWelcomeTpl(tpl) { + const toUser = document.getElementById('to_user')?.value || '大家'; + const name = toUser === '大家' ? '大家' : toUser; + const msg = tpl.replace(/\{name\}/g, name); + + const input = document.getElementById('content'); + if (input) { + input.value = msg; + input.focus(); + } + + const menu = document.getElementById('welcome-menu'); + if (menu) { menu.style.display = 'none'; } + } + + // 点击页面任意位置,关闭欢迎语浮层 + document.addEventListener('click', function () { + const menu = document.getElementById('welcome-menu'); + if (menu) { menu.style.display = 'none'; } + }); + // ── 动作选择 ────────────────────────────────────── /** * 设置发言动作并聚焦输入框