diff --git a/resources/views/chat/partials/input-bar.blade.php b/resources/views/chat/partials/input-bar.blade.php index 7ea215b..95fd341 100644 --- a/resources/views/chat/partials/input-bar.blade.php +++ b/resources/views/chat/partials/input-bar.blade.php @@ -90,6 +90,9 @@ + {{-- 第二行:输入框 + 发送 --}} diff --git a/resources/views/chat/partials/scripts.blade.php b/resources/views/chat/partials/scripts.blade.php index 4bcf3bc..0b89c6d 100644 --- a/resources/views/chat/partials/scripts.blade.php +++ b/resources/views/chat/partials/scripts.blade.php @@ -263,9 +263,15 @@ const timeStr = msg.sent_at || ''; - // 用户名(单击切换发言对象,双击查看资料) - const clickableUser = (uName, color) => - `${uName}`; + // 系统用户名列表(不可被选为聊天对象) + const systemUsers = ['钓鱼播报', '星海小博士', '系统传音', '系统公告']; + // 用户名(单击切换发言对象,双击查看资料;系统用户仅显示文本) + const clickableUser = (uName, color) => { + if (systemUsers.includes(uName)) { + return `${uName}`; + } + return `${uName}`; + }; // 获取发言者头像 const senderInfo = onlineUsers[msg.from_user]; @@ -275,7 +281,11 @@ let html = ''; - if (msg.is_secret) { + // 系统用户消息直接显示为公告(不显示「对大家说:」) + if (systemUsers.includes(msg.from_user)) { + html = + `${headImg}${msg.from_user}:${msg.content}`; + } else if (msg.is_secret) { // 悄悄话样式(原版:紫色斜体) html = `${headImg}${clickableUser(msg.from_user, '#cc00cc')}对${clickableUser(msg.to_user, '#cc00cc')}`;