新增欢迎语快捷按钮:职务人员/id=1可见,10条预设语,自动填入输入框
This commit is contained in:
@@ -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"] {
|
||||
|
||||
@@ -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') {
|
||||
|
||||
@@ -71,6 +71,35 @@
|
||||
</label>
|
||||
|
||||
|
||||
@if ($user->id === 1 || $user->activePosition()->exists())
|
||||
{{-- 欢迎语快捷按钮 + 下拉浮层 --}}
|
||||
<div style="position:relative;display:inline-block;" id="welcome-btn-wrap">
|
||||
<button type="button" onclick="toggleWelcomeMenu(event)"
|
||||
style="font-size:11px;padding:1px 6px;background:#e07820;color:#fff;border:none;border-radius:2px;cursor:pointer;">
|
||||
💬 欢迎
|
||||
</button>
|
||||
<div id="welcome-menu" class="welcome-menu" style="display:none;">
|
||||
@php
|
||||
$welcomeMessages = [
|
||||
'欢迎【{name}】来到我们的聊天室,请遵守规则,文明聊天!',
|
||||
'【{name}】,你好!欢迎来访,有什么问题随时告诉我们!',
|
||||
'热烈欢迎【{name}】加入,愿您在这里度过愉快的时光!',
|
||||
'欢迎新朋友【{name}】!请先阅读公告,了解聊天室规则哦~',
|
||||
'【{name}】来了!欢迎欢迎,希望你在这里玩得开心!',
|
||||
'亲爱的【{name}】,欢迎光临本聊天室,请保持文明礼貌!',
|
||||
'欢迎【{name}】入驻!有问题请联系管理员,我们随时为您服务!',
|
||||
'【{name}】,初来乍到,欢迎多多关照,我们是一家人!',
|
||||
'大家欢迎新成员【{name}】!请遵守群规,共建和谐聊天环境!',
|
||||
'欢迎【{name}】莅临指导!希望你常来,让我们一起聊天!',
|
||||
];
|
||||
@endphp
|
||||
@foreach ($welcomeMessages as $msg)
|
||||
<div class="welcome-menu-item" onclick="sendWelcomeTpl({{ json_encode($msg) }})">{{ $msg }}</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if (
|
||||
$user->user_level >= (int) \App\Models\Sysparam::getValue('level_announcement', '10') ||
|
||||
$room->master == $user->username)
|
||||
|
||||
@@ -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'; }
|
||||
});
|
||||
|
||||
// ── 动作选择 ──────────────────────────────────────
|
||||
/**
|
||||
* 设置发言动作并聚焦输入框
|
||||
|
||||
Reference in New Issue
Block a user