修复:彩票/五子棋广播消息中用户名支持单击双击交互
- 修复彩票购买明细页「中奖等级」列始终显示「等待开奖」的问题 原因:判断条件误用了不存在的 'drawn' 状态,已改为 'settled' - 系统传音广播消息中的【用户名】现在支持单击(切换发言对象) 和双击(查看名片),与普通消息行为一致 - 新增 isGameLabel() 函数,通过游戏名前缀匹配 + 含空格检测, 防止【五子棋】【双色球 第N期 开奖】等标签被误识别为用户名
This commit is contained in:
@@ -86,7 +86,7 @@
|
|||||||
{{ $won ? '+' . number_format($ticket->payout) : '0' }}
|
{{ $won ? '+' . number_format($ticket->payout) : '0' }}
|
||||||
</td>
|
</td>
|
||||||
<td class="px-4 py-3 text-center">
|
<td class="px-4 py-3 text-center">
|
||||||
@if ($issue->status === 'drawn')
|
@if ($issue->status === 'settled')
|
||||||
@if ($won)
|
@if ($won)
|
||||||
<span
|
<span
|
||||||
class="px-2 py-0.5 rounded-full text-xs font-bold bg-amber-100 text-amber-700">
|
class="px-2 py-0.5 rounded-full text-xs font-bold bg-amber-100 text-amber-700">
|
||||||
|
|||||||
@@ -358,9 +358,19 @@
|
|||||||
if (info.type === 'emotion') return `${fromHtml}${info.word}对${toHtml}${verb}:`;
|
if (info.type === 'emotion') return `${fromHtml}${info.word}对${toHtml}${verb}:`;
|
||||||
return `${fromHtml}${info.word}${toHtml},${verb}:`;
|
return `${fromHtml}${info.word}${toHtml},${verb}:`;
|
||||||
};
|
};
|
||||||
// 用户名(单击切换发言对象,双击查看资料;系统用户仅显示文本)
|
// 判断 【】 内的内容是否是游戏/活动标签而非真实用户名
|
||||||
|
// 规则:命中已知游戏前缀,或内容含空格(如「双色球 第012期 开奖」)
|
||||||
|
const isGameLabel = (name) => {
|
||||||
|
const gamePrefixes = ['五子棋', '双色球', '钓鱼', '老虎机', '百家乐', '赛马'];
|
||||||
|
if (gamePrefixes.some(p => name.startsWith(p))) return true;
|
||||||
|
// 含空格 → 一定不是用户名(用户名不允许含空格)
|
||||||
|
if (name.includes(' ')) return true;
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 用户名(单击切换发言对象,双击查看资料;系统用户或游戏标签仅显示文本)
|
||||||
const clickableUser = (uName, color) => {
|
const clickableUser = (uName, color) => {
|
||||||
if (systemUsers.includes(uName)) {
|
if (systemUsers.includes(uName) || isGameLabel(uName)) {
|
||||||
return `<span class="msg-user" style="color: ${color};">${uName}</span>`;
|
return `<span class="msg-user" style="color: ${color};">${uName}</span>`;
|
||||||
}
|
}
|
||||||
return `<span class="msg-user" style="color: ${color}; cursor: pointer;" onclick="switchTarget('${uName}')" ondblclick="openUserCard('${uName}')">${uName}</span>`;
|
return `<span class="msg-user" style="color: ${color}; cursor: pointer;" onclick="switchTarget('${uName}')" ondblclick="openUserCard('${uName}')">${uName}</span>`;
|
||||||
@@ -410,11 +420,16 @@
|
|||||||
`<div style="font-weight: bold; color: #dc2626;">${parsedContent} <span style="color: #999; font-weight: normal;">(${timeStr})</span></div>`;
|
`<div style="font-weight: bold; color: #dc2626;">${parsedContent} <span style="color: #999; font-weight: normal;">(${timeStr})</span></div>`;
|
||||||
timeStrOverride = true;
|
timeStrOverride = true;
|
||||||
} else if (msg.from_user === '系统传音') {
|
} else if (msg.from_user === '系统传音') {
|
||||||
// 自动升级播报 / 赠礼通知:金色左边框,轻量提示样式,不喧宾夺主
|
// 自动升级播报 / 赠礼通知 / 彩票购买广播:金色左边框,轻量提示样式,不喧宾夺主
|
||||||
|
// 解析内容中 【用户名】 片段,使其支持单击(切换发言对象)和双击(查看名片)
|
||||||
div.style.cssText =
|
div.style.cssText =
|
||||||
'background: #fffbeb; border-left: 3px solid #d97706; border-radius: 4px; padding: 4px 10px; margin: 2px 0;';
|
'background: #fffbeb; border-left: 3px solid #d97706; border-radius: 4px; padding: 4px 10px; margin: 2px 0;';
|
||||||
|
let sysTranContent = msg.content;
|
||||||
|
sysTranContent = sysTranContent.replace(/【([^】]+)】/g, function(match, uName) {
|
||||||
|
return '【' + clickableUser(uName, '#000099') + '】';
|
||||||
|
});
|
||||||
html =
|
html =
|
||||||
`<span style="color: #b45309;">🌟 ${msg.content}</span>`;
|
`<span style="color: #b45309;">🌟 ${sysTranContent}</span>`;
|
||||||
} else if (msg.from_user === '系统' && msg.to_user && msg.to_user !== '大家') {
|
} else if (msg.from_user === '系统' && msg.to_user && msg.to_user !== '大家') {
|
||||||
// 系统私人通知(自动存点等):无头像,绿色左边框简洁条形样式
|
// 系统私人通知(自动存点等):无头像,绿色左边框简洁条形样式
|
||||||
div.style.cssText =
|
div.style.cssText =
|
||||||
|
|||||||
Reference in New Issue
Block a user