修复手动存点通知重复显示
This commit is contained in:
@@ -2508,15 +2508,15 @@
|
|||||||
msg.is_secret ||
|
msg.is_secret ||
|
||||||
msg.to_user === window.chatContext.username;
|
msg.to_user === window.chatContext.username;
|
||||||
|
|
||||||
// 自动存点通知:标记 data-autosave 属性,每次渲染时先删除旧的,实现"滚动替换"效果
|
// 存点通知:标记 data-autosave 属性,每次渲染时先删除旧的,实现"滚动替换"效果
|
||||||
const isAutoSave = (msg.from_user === '系统' || msg.from_user === '') &&
|
const isAutoSave = (msg.from_user === '系统' || msg.from_user === '') &&
|
||||||
msg.content && msg.content.includes('自动存点');
|
msg.content && (msg.content.includes('自动存点') || msg.content.includes('手动存点'));
|
||||||
if (isAutoSave) {
|
if (isAutoSave) {
|
||||||
div.dataset.autosave = '1';
|
div.dataset.autosave = '1';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isRelatedToMe) {
|
if (isRelatedToMe) {
|
||||||
// 删除旧的自动存点通知,保持包厢窗口整洁
|
// 删除旧的存点通知,保持包厢窗口整洁
|
||||||
if (isAutoSave) {
|
if (isAutoSave) {
|
||||||
container2.querySelectorAll('[data-autosave="1"]').forEach(el => el.remove());
|
container2.querySelectorAll('[data-autosave="1"]').forEach(el => el.remove());
|
||||||
}
|
}
|
||||||
@@ -3745,8 +3745,11 @@
|
|||||||
if (!silent) {
|
if (!silent) {
|
||||||
const detailDiv = document.createElement('div');
|
const detailDiv = document.createElement('div');
|
||||||
detailDiv.className = 'msg-line';
|
detailDiv.className = 'msg-line';
|
||||||
|
detailDiv.dataset.autosave = '1';
|
||||||
detailDiv.innerHTML =
|
detailDiv.innerHTML =
|
||||||
`<span style="color: green;">${escapeHtml(levelInfo + gainInfo)}</span><span class="msg-time">(${timeStr})</span>`;
|
`<span style="color: green;">${escapeHtml(levelInfo + gainInfo)}</span><span class="msg-time">(${timeStr})</span>`;
|
||||||
|
// 手动存点和自动存点共用同一条界面占位,避免包厢窗口堆积旧存点通知。
|
||||||
|
container2.querySelectorAll('[data-autosave="1"]').forEach(el => el.remove());
|
||||||
container2.appendChild(detailDiv);
|
container2.appendChild(detailDiv);
|
||||||
if (autoScroll) container2.scrollTop = container2.scrollHeight;
|
if (autoScroll) container2.scrollTop = container2.scrollHeight;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user