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

@@ -67,4 +67,8 @@
<symbol id="icon-pencil" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
<path d="m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L6.832 19.82a4.5 4.5 0 0 1-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 0 1 1.13-1.897L16.863 4.487Zm0 0L19.5 7.125"/>
</symbol>
<!-- 星星 -->
<symbol id="icon-star" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
<path d="M11.48 3.499a.562.562 0 0 1 1.04 0l2.125 5.111a.563.563 0 0 0 .475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 0 0-.182.557l1.285 5.385a.562.562 0 0 1-.84.61l-4.725-2.885a.563.563 0 0 0-.586 0L6.982 20.54a.562.562 0 0 1-.84-.61l1.285-5.386a.562.562 0 0 0-.182-.557l-4.204-3.602a.563.563 0 0 1 .321-.988l5.518-.442a.563.563 0 0 0 .475-.345L11.48 3.5Z"/>
</symbol>
</svg>

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

@@ -6,6 +6,7 @@
<title>紫微 · 磁场管理</title>
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
<script>window.__INITIAL_STATS__ = {{ initial_stats | safe }};</script>
<script>window.__INITIAL_WISHES__ = {{ initial_wishes | safe }};</script>
</head>
<body>
{% include "icons.html" %}
@@ -67,6 +68,39 @@
</div>
</div>
<!-- 心愿清单 -->
<div class="wishes-panel" id="wishes-panel">
<div class="wishes-header">
<svg class="icon-sm" style="color:var(--primary)"><use href="#icon-star"/></svg>
<span>心愿清单</span>
<button class="wishes-add-btn edit-only" id="wishes-add-btn" onclick="showWishForm()">
<svg class="icon-sm"><use href="#icon-plus"/></svg>
</button>
<button class="btn-edit-toggle" onclick="toggleWishesEdit(this)" title="编辑">
<svg class="icon-sm"><use href="#icon-pencil"/></svg>
</button>
</div>
<!-- 新增表单 -->
<div class="wish-form" id="wish-form" style="display:none">
<input type="text" id="wish-name" placeholder="心愿名称…" maxlength="50">
<div class="wish-form-row">
<select id="wish-priority">
<option value="高">高优先</option>
<option value="中" selected>中优先</option>
<option value="低">低优先</option>
</select>
<input type="date" id="wish-deadline">
</div>
<div class="wish-form-actions">
<button class="btn-wish-save" onclick="addWish()">添加</button>
<button class="btn-wish-cancel" onclick="hideWishForm()">取消</button>
</div>
</div>
<!-- 列表 -->
<div class="wishes-list" id="wishes-list"></div>
<div class="wishes-empty" id="wishes-empty">暂无心愿,点击 + 添加</div>
</div>
<!-- 功能入口 -->
<nav class="sidebar-nav">
<a class="nav-item active" data-panel="daily" onclick="switchPanel('daily')">