优化:系统消息改为公告样式、不可点击;新增清屏按钮
- 系统用户(钓鱼播报、星海小博士、系统传音)消息不再显示「对大家说:」,直接公告
- 系统用户名不可点击设为聊天对象
- 钓鱼按钮旁新增「🔄 清屏」按钮
- 头像修改后同步更新 Redis 在线用户列表
- headface 访问器增加 set mutator
This commit is contained in:
@@ -263,9 +263,15 @@
|
||||
|
||||
const timeStr = msg.sent_at || '';
|
||||
|
||||
// 用户名(单击切换发言对象,双击查看资料)
|
||||
const clickableUser = (uName, color) =>
|
||||
`<span class="msg-user" style="color: ${color}; cursor: pointer;" onclick="switchTarget('${uName}')" ondblclick="showUserInfoInSay2('${uName}')">${uName}</span>`;
|
||||
// 系统用户名列表(不可被选为聊天对象)
|
||||
const systemUsers = ['钓鱼播报', '星海小博士', '系统传音', '系统公告'];
|
||||
// 用户名(单击切换发言对象,双击查看资料;系统用户仅显示文本)
|
||||
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];
|
||||
@@ -275,7 +281,11 @@
|
||||
|
||||
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 =
|
||||
`<span class="msg-secret">${headImg}${clickableUser(msg.from_user, '#cc00cc')}对${clickableUser(msg.to_user, '#cc00cc')}`;
|
||||
|
||||
Reference in New Issue
Block a user