管理员可以直观查看白名单

This commit is contained in:
2026-07-28 16:23:20 +08:00
parent 8b022bd949
commit dc93451775
2 changed files with 22 additions and 0 deletions

View File

@@ -109,3 +109,18 @@ body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-
.fullscreen-overlay .fullscreen-text th {background: #f0f0f0;}
.detail-row { margin-bottom: 8px; }
.white-list-tag {
font-size: 12px;
color: #555;
background: #f0f0f0;
padding: 2px 8px;
border-radius: 10px;
margin-right: 6px;
max-width: 80px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
display: inline-block;
vertical-align: middle;
}

View File

@@ -72,6 +72,12 @@ function renderChatList() {
container.innerHTML = Store.rooms.map(room => {
const lastMsg = room.last_message || '暂无消息';
const lastTime = room.last_time || '';
// 处理白名单(管理员可见)
let whiteListHtml = '';
if (isAdmin && room.white_list && room.white_list.trim() !== '') {
const members = room.white_list.split(',').map(s => s.trim()).filter(Boolean).join(', ');
whiteListHtml = `<span class="white-list-tag" title="${escapeHtml(members)}">${escapeHtml(members)}</span>`;
}
return `
<div class="chat-item" data-room-id="${room.id}">
<div class="avatar" onclick="openChat('${room.id}')">${escapeHtml(room.name.charAt(0))}</div>
@@ -82,6 +88,7 @@ function renderChatList() {
<div class="chat-right">
<div class="chat-time" onclick="openChat('${room.id}')">${lastTime}</div>
${isAdmin ? `<div class="room-actions">
${whiteListHtml}
<button class="edit-room-btn" onclick="event.stopPropagation(); openManageRoom('${room.id}')" title="编辑群聊">
<svg viewBox="0 0 24 24"><path d="M12 20h9"></path><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"></path></svg>
</button>