优化:系统消息改为公告样式、不可点击;新增清屏按钮
- 系统用户(钓鱼播报、星海小博士、系统传音)消息不再显示「对大家说:」,直接公告
- 系统用户名不可点击设为聊天对象
- 钓鱼按钮旁新增「🔄 清屏」按钮
- 头像修改后同步更新 Redis 在线用户列表
- headface 访问器增加 set mutator
This commit is contained in:
@@ -90,6 +90,9 @@
|
|||||||
<button type="button" id="fishing-btn" onclick="startFishing()"
|
<button type="button" id="fishing-btn" onclick="startFishing()"
|
||||||
style="font-size: 11px; padding: 1px 6px; background: #2563eb; color: #fff; border: none; border-radius: 2px; cursor: pointer;">🎣
|
style="font-size: 11px; padding: 1px 6px; background: #2563eb; color: #fff; border: none; border-radius: 2px; cursor: pointer;">🎣
|
||||||
钓鱼</button>
|
钓鱼</button>
|
||||||
|
<button type="button" onclick="location.reload()"
|
||||||
|
style="font-size: 11px; padding: 1px 6px; background: #64748b; color: #fff; border: none; border-radius: 2px; cursor: pointer;">🔄
|
||||||
|
清屏</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- 第二行:输入框 + 发送 --}}
|
{{-- 第二行:输入框 + 发送 --}}
|
||||||
|
|||||||
@@ -263,9 +263,15 @@
|
|||||||
|
|
||||||
const timeStr = msg.sent_at || '';
|
const timeStr = msg.sent_at || '';
|
||||||
|
|
||||||
// 用户名(单击切换发言对象,双击查看资料)
|
// 系统用户名列表(不可被选为聊天对象)
|
||||||
const clickableUser = (uName, color) =>
|
const systemUsers = ['钓鱼播报', '星海小博士', '系统传音', '系统公告'];
|
||||||
`<span class="msg-user" style="color: ${color}; cursor: pointer;" onclick="switchTarget('${uName}')" ondblclick="showUserInfoInSay2('${uName}')">${uName}</span>`;
|
// 用户名(单击切换发言对象,双击查看资料;系统用户仅显示文本)
|
||||||
|
const clickableUser = (uName, color) => {
|
||||||
|
if (systemUsers.includes(uName)) {
|
||||||
|
return `<span class="msg-user" style="color: ${color};">${uName}</span>`;
|
||||||
|
}
|
||||||
|
return `<span class="msg-user" style="color: ${color}; cursor: pointer;" onclick="switchTarget('${uName}')" ondblclick="showUserInfoInSay2('${uName}')">${uName}</span>`;
|
||||||
|
};
|
||||||
|
|
||||||
// 获取发言者头像
|
// 获取发言者头像
|
||||||
const senderInfo = onlineUsers[msg.from_user];
|
const senderInfo = onlineUsers[msg.from_user];
|
||||||
@@ -275,7 +281,11 @@
|
|||||||
|
|
||||||
let html = '';
|
let html = '';
|
||||||
|
|
||||||
if (msg.is_secret) {
|
// 系统用户消息直接显示为公告(不显示「对大家说:」)
|
||||||
|
if (systemUsers.includes(msg.from_user)) {
|
||||||
|
html =
|
||||||
|
`${headImg}<span class="msg-user" style="color: ${fontColor}; font-weight: bold;">${msg.from_user}:</span><span class="msg-content" style="color: ${fontColor}">${msg.content}</span>`;
|
||||||
|
} else if (msg.is_secret) {
|
||||||
// 悄悄话样式(原版:紫色斜体)
|
// 悄悄话样式(原版:紫色斜体)
|
||||||
html =
|
html =
|
||||||
`<span class="msg-secret">${headImg}${clickableUser(msg.from_user, '#cc00cc')}对${clickableUser(msg.to_user, '#cc00cc')}`;
|
`<span class="msg-secret">${headImg}${clickableUser(msg.from_user, '#cc00cc')}对${clickableUser(msg.to_user, '#cc00cc')}`;
|
||||||
|
|||||||
Reference in New Issue
Block a user