This commit is contained in:
2026-07-28 19:26:26 +08:00
parent 2e9da6c1ac
commit 05266703e8
5 changed files with 64 additions and 57 deletions

View File

@@ -59,9 +59,11 @@ body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-
.purchase-month-group { margin-bottom: 20px; }
.purchase-month-group summary { list-style: none; cursor: pointer; }
.purchase-month-group summary::-webkit-details-marker { display: none; }
.purchase-month-group summary::after { content: '▼'; font-size: 11px; margin-left: 8px; color: #888; }
.purchase-month-group[open] summary::after { content: '▲'; }
.purchase-month-header { background: #f5f5f5; font-size: 16px; font-weight: 600; padding: 10px 8px; border-radius: 4px; display: flex; justify-content: space-between; }
.purchase-month-header { background: #f5f5f5; font-size: 16px; font-weight: 600; padding: 10px 8px; border-radius: 4px; display: flex; justify-content: space-between; align-items: center; }
.purchase-month-header span:last-child { margin-left: auto; margin-right: 4px; }
.month-arrow { width: 16px; height: 16px; stroke: #888; fill: none; stroke-width: 2; flex-shrink: 0; margin-left: 6px; transition: transform 0.2s; }
.purchase-month-group[open] .month-arrow { transform: rotate(180deg); }
.purchase-month-header span:last-child { margin-left: auto; margin-right: 4px; }
.purchase-item { padding: 12px 8px; border-bottom: 1px solid #f0f0f0; cursor: pointer; }
.purchase-item:active { background: #f9f9f9; }
.purchase-item .item-main { display: flex; justify-content: space-between; align-items: baseline; }
@@ -140,10 +142,10 @@ body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-
.edit-section { margin-top: 8px; border-top: 1px solid #eee; padding-top: 8px; }
.edit-section-header { font-size: 13px; font-weight: 600; color: #555; cursor: pointer; display: flex; justify-content: space-between; align-items: center; padding: 2px 0; }
.edit-section-header svg { width: 16px; height: 16px; stroke: #888; fill: none; stroke-width: 2; }
.history-summary { list-style: none; }
.history-summary { list-style: none; display: flex; align-items: center; gap: 6px; }
.history-summary::-webkit-details-marker { display: none; }
.history-summary::after { content: '展开'; font-size: 12px; color: #3b82f6; font-weight: 400; }
details[open] .history-summary::after { content: '收起'; }
.history-summary .section-arrow { width: 14px; height: 14px; stroke: #888; fill: none; stroke-width: 2; flex-shrink: 0; transition: transform 0.2s; }
details[open] .history-summary .section-arrow { transform: rotate(180deg); }
.attach-gallery { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.attach-thumb-wrap { position: relative; display: inline-block; }
.attach-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; border: 1px solid #eee; }

View File

@@ -215,7 +215,7 @@
<!-- 操作历史(折叠) -->
<details class="edit-section" id="edit-history-section">
<summary class="edit-section-header history-summary"><span>操作历史</span></summary>
<summary class="edit-section-header history-summary"><span>操作历史</span><svg class="section-arrow" viewBox="0 0 24 24"><polyline points="6 9 12 15 18 9"/></svg></summary>
<ul class="history-list" id="edit-history"></ul>
</details>
@@ -237,9 +237,7 @@
<script>
// 版本号
(function() {
var d = new Date();
var pad = function(n) { return n < 10 ? '0' + n : '' + n; };
document.getElementById('version-text').textContent = 'v2.8-' + (d.getFullYear() % 100) + pad(d.getMonth() + 1) + pad(d.getDate());
document.getElementById('version-text').textContent = 'v2.8-260728';
})();
document.addEventListener('input', function(e) {
if (e.target.id === 'msg-input' || e.target.id === 'purchase-msg-input') {

View File

@@ -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'));

View File

@@ -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('');
}