fix css
This commit is contained in:
@@ -22,7 +22,7 @@ function renderPurchasePanel(items) {
|
||||
Object.keys(groups).sort().reverse().forEach(month => {
|
||||
const monthItems = groups[month];
|
||||
const monthTotal = monthItems.reduce((s, i) => s + (i.amount||0), 0);
|
||||
html += '<details class="purchase-month-group" open><summary class="purchase-month-header"><span>' + month + '</span><span>¥' + monthTotal + '</span></summary>';
|
||||
html += '<details class="purchase-month-group" open><summary class="purchase-month-header"><span>' + month + '</span><span style="display:flex;align-items:center;gap:6px;">¥' + monthTotal + '<svg class="month-arrow" viewBox="0 0 24 24"><polyline points="6 9 12 15 18 9"/></svg></span></summary>';
|
||||
monthItems.forEach(item => {
|
||||
const timeShort = item.created_at.split(' ')[1]?.substring(0,5) || '';
|
||||
const dateShort = item.created_at.split(' ')[0]?.substring(5) || '';
|
||||
@@ -79,16 +79,9 @@ async function openDetail(pid) {
|
||||
document.getElementById('edit-history').innerHTML = historyHtml || '<li style="color:#888;">暂无操作记录</li>';
|
||||
document.getElementById('edit-history-section').open = false;
|
||||
|
||||
// 删除按钮仅管理员可见
|
||||
const isAdmin = localStorage.getItem('isAdmin') === 'true';
|
||||
const delBtn = document.getElementById('delete-purchase-btn');
|
||||
if (isAdmin) {
|
||||
delBtn.style.display = '';
|
||||
delBtn.style.marginLeft = '';
|
||||
} else {
|
||||
delBtn.style.display = 'none';
|
||||
delBtn.style.marginLeft = '0';
|
||||
}
|
||||
// 删除按钮
|
||||
document.getElementById('delete-purchase-btn').style.display = '';
|
||||
document.getElementById('delete-purchase-btn').style.marginLeft = '';
|
||||
|
||||
// 折叠所有编辑组
|
||||
document.querySelectorAll('.edit-group-detail').forEach(el => el.classList.add('hidden'));
|
||||
|
||||
@@ -69,32 +69,35 @@ async function loadRooms() {
|
||||
function renderChatList() {
|
||||
const container = document.getElementById('chat-list-container');
|
||||
const isAdmin = localStorage.getItem('isAdmin') === 'true';
|
||||
const currentUser = localStorage.getItem('currentUser');
|
||||
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>`;
|
||||
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="openPurchasePage('${room.id}')">${escapeHtml(room.name.charAt(0))}</div>
|
||||
<div class="chat-info" onclick="openPurchasePage('${room.id}')">
|
||||
<div class="chat-name">${escapeHtml(room.name)}</div>
|
||||
<div class="last-msg">${escapeHtml(lastMsg)}</div>
|
||||
</div>
|
||||
<div class="chat-right">
|
||||
<div class="chat-time" onclick="openPurchasePage('${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>
|
||||
</div>` : ''}
|
||||
</div>
|
||||
</div>`;
|
||||
// 编辑按钮:管理员始终可见,普通用户仅自己群聊可见
|
||||
const canEdit = isAdmin || (room.white_list && room.white_list.trim() === currentUser);
|
||||
const editBtnHtml = canEdit ? '<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>' +
|
||||
'</div>' : '';
|
||||
return '<div class="chat-item" data-room-id="' + room.id + '">' +
|
||||
'<div class="avatar" onclick="openPurchasePage(\'' + room.id + '\')">' + escapeHtml(room.name.charAt(0)) + '</div>' +
|
||||
'<div class="chat-info" onclick="openPurchasePage(\'' + room.id + '\')">' +
|
||||
'<div class="chat-name">' + escapeHtml(room.name) + '</div>' +
|
||||
'<div class="last-msg">' + escapeHtml(lastMsg) + '</div>' +
|
||||
'</div>' +
|
||||
'<div class="chat-right">' +
|
||||
'<div class="chat-time" onclick="openPurchasePage(\'' + room.id + '\')">' + lastTime + '</div>' +
|
||||
editBtnHtml +
|
||||
'</div>' +
|
||||
'</div>';
|
||||
}).join('');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user