v1.1.0 — 心愿清单

- 新增 wishes 表 (schema v2),含名称/优先级/截止时间/完成状态
- API: GET/POST/PUT/DELETE /api/wishes + PUT /api/wishes/reorder
- 侧边栏心愿清单面板:checklist + 新增表单
- 完成勾选 → 删除线;优先级标签(红/黄/灰)
- HTML5 原生拖拽排序,松开即保存
- 编辑模式切换:默认隐藏新增/删除按钮
This commit is contained in:
mac
2026-06-02 23:50:24 +08:00
parent 668576b866
commit 690509bfb3
6 changed files with 494 additions and 3 deletions

View File

@@ -1080,6 +1080,180 @@ body {
.toast.error { background: var(--danger); color: #FFF; }
.toast.info { background: var(--primary); color: #FFF; }
/* ═══════════════════════════════════════════
Wishes Panel
═══════════════════════════════════════════ */
.wishes-panel {
padding: 0 16px 10px;
}
.wishes-panel.editing .edit-only { display: flex; }
.wishes-panel.editing .wish-del { display: inline-flex; }
.wishes-header {
display: flex;
align-items: center;
gap: 8px;
font-size: 13px;
font-weight: 600;
color: var(--text);
margin-bottom: 8px;
}
.wishes-add-btn {
display: none;
align-items: center;
justify-content: center;
width: 22px;
height: 22px;
border: none;
background: var(--primary-light);
color: var(--primary);
border-radius: 6px;
cursor: pointer;
margin-left: auto;
transition: background 0.2s;
}
.wishes-add-btn:hover { background: #DDE3FD; }
.wishes-panel.editing .wishes-add-btn { display: flex; }
.wish-form {
background: var(--bg);
border-radius: var(--radius-sm);
padding: 8px;
margin-bottom: 8px;
}
.wish-form input[type="text"],
.wish-form input[type="date"],
.wish-form select {
width: 100%;
padding: 6px 8px;
border: 1px solid var(--border);
border-radius: 6px;
font-size: 12px;
font-family: inherit;
color: var(--text);
margin-bottom: 6px;
box-sizing: border-box;
}
.wish-form-row {
display: flex;
gap: 6px;
}
.wish-form-row select,
.wish-form-row input { flex: 1; }
.wish-form-actions {
display: flex;
gap: 6px;
}
.btn-wish-save {
flex: 1;
padding: 6px;
border: none;
background: var(--primary);
color: #FFF;
border-radius: 6px;
font-size: 12px;
font-weight: 500;
cursor: pointer;
font-family: inherit;
}
.btn-wish-save:hover { background: var(--primary-dark); }
.btn-wish-cancel {
flex: 1;
padding: 6px;
border: 1px solid var(--border);
background: var(--card);
color: var(--text-dim);
border-radius: 6px;
font-size: 12px;
cursor: pointer;
font-family: inherit;
}
.wishes-list {
display: flex;
flex-direction: column;
gap: 2px;
max-height: 240px;
overflow-y: auto;
}
.wishes-empty {
font-size: 11px;
color: var(--text-muted);
text-align: center;
padding: 12px 0;
}
.wish-item {
display: flex;
align-items: center;
gap: 6px;
padding: 5px 6px;
border-radius: 6px;
transition: background 0.15s;
cursor: default;
}
.wish-item:hover { background: var(--bg); }
.wish-item.dragging { opacity: 0.4; }
.wish-item.drag-over { background: var(--primary-light); box-shadow: inset 0 0 0 1.5px var(--primary); }
.wish-drag-handle {
color: var(--text-muted);
cursor: grab;
flex-shrink: 0;
display: flex;
align-items: center;
}
.wish-drag-handle:active { cursor: grabbing; }
.wish-check {
width: 14px;
height: 14px;
accent-color: var(--success);
flex-shrink: 0;
cursor: pointer;
}
.wish-name {
flex: 1;
font-size: 12px;
color: var(--text);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
min-width: 0;
}
.wish-item.done .wish-name {
text-decoration: line-through;
color: var(--text-muted);
}
.wish-pri {
font-size: 10px;
font-weight: 600;
padding: 1px 6px;
border-radius: 8px;
white-space: nowrap;
flex-shrink: 0;
}
.wish-pri.pri-高 { background: var(--danger-light); color: var(--danger); }
.wish-pri.pri-中 { background: var(--warning-light); color: #D97706; }
.wish-pri.pri-低 { background: var(--bg); color: var(--text-muted); }
.wish-deadline {
font-size: 10px;
color: var(--text-muted);
white-space: nowrap;
flex-shrink: 0;
}
.wish-del {
display: none;
}
.wish-del .icon-xs { width: 12px; height: 12px; }
/* ═══════════════════════════════════════════
SVG icons helpers
═══════════════════════════════════════════ */