feat(V0.2): 打卡 / 日历 / 清单模块

- 数据: Habit/CheckIn/CheckList/CheckListItem/CheckListTemplate + 迁移 + 重新生成 client
- 后端: server/checkin/period.js 周期计算(日/周/月/年, 周一起始, Asia/Shanghai)
        /api/checkin/* 打卡项CRUD/打卡/撤销/补打/某日详情/月历
        /api/checklists/* 清单与检查项CRUD/勾选/全选/复制/模板(系统预置出差·回老家)
- 前端: 底部新增「打卡」Tab -> /checkin, 页内三视图
        环形进度 RingProgress + 完成特效(粒子/光晕/触感, 可关闭)
        打卡视图: 待办列表/乐观更新/撤销/新建编辑
        日历视图: 月历网格 + 今天·昨天·明天 + 日期标记/完成率
        清单视图: 场景清单/勾选进度条/模板生成/另存模板/归档
- 文档: docs/V0.2/需求文档.md 补充实现约定(附录B)与接口清单
This commit is contained in:
cheney
2026-10-22 11:37:16 +08:00
parent 54a3224f00
commit 004f8c262d
32 changed files with 11030 additions and 63 deletions
+168
View File
@@ -500,3 +500,171 @@ input, textarea, select { font: inherit; }
color: #fff;
}
.oil-day.future .oil-day-status { color: rgba(255,255,255,.85); }
/* ================== 打卡 / 日历 / 清单 (V0.2) ================== */
.checkin-content { padding: 0 0 16px; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.checkin-content .adm-tabs-content { --content-padding: 0; }
/* ----- 环形进度 ----- */
.ring-wrap { position: relative; display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; }
.ring-wrap.clickable { cursor: pointer; }
.ring-wrap.disabled { opacity: .5; }
.ring-svg { display: block; }
.ring-bar { transition: stroke-dashoffset 0.45s cubic-bezier(0.4, 0, 0.2, 1); }
.ring-center {
position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
font-size: 13px; font-weight: 600; color: var(--color-text); font-variant-numeric: tabular-nums;
}
.ring-num em { font-style: normal; font-size: 10px; color: var(--color-muted); font-weight: 400; }
.ring-check { animation: ring-check-in 0.32s ease; }
@keyframes ring-check-in { from { transform: scale(0.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.ring-over {
position: absolute; right: -2px; bottom: -2px; font-size: 10px; font-weight: 600;
color: #fff; background: #ff8f1f; border-radius: 8px; padding: 0 4px; line-height: 14px;
}
/* ----- 完成特效 ----- */
.celebrate { position: absolute; inset: 0; pointer-events: none; z-index: 6; }
.celebrate i {
position: absolute; left: 50%; top: 50%; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px;
border-radius: 50%; animation: burst-fly 0.7s ease-out forwards;
}
@keyframes burst-fly {
0% { transform: rotate(var(--a)) translateX(0) scale(1); opacity: 1; }
70% { opacity: 1; }
100% { transform: rotate(var(--a)) translateX(var(--d)) scale(0.3); opacity: 0; }
}
.celebrate-ring {
position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px;
border-radius: 50%; border: 2px solid var(--color-primary); animation: ring-pulse 0.7s ease-out forwards;
}
@keyframes ring-pulse {
0% { transform: scale(0.3); opacity: 0.9; }
100% { transform: scale(1.7); opacity: 0; }
}
/* ----- 打卡视图 ----- */
.habit-view { padding: 0 12px 20px; }
.habit-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; padding: 10px 2px; }
.habit-date { font-size: 18px; font-weight: 700; color: var(--color-text); }
.habit-summary { font-size: 12px; color: var(--color-muted); margin-top: 2px; }
.habit-summary strong { color: var(--color-primary); font-size: 14px; }
.habit-badge { margin-left: 6px; font-size: 11px; color: #ad6800; background: #fff7e6; border-radius: 4px; padding: 1px 5px; }
.habit-head-right { display: flex; gap: 6px; flex-shrink: 0; }
.checkin-empty { padding: 48px 0; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.habit-list { display: flex; flex-direction: column; gap: 10px; }
.habit-card {
position: relative; background: #fff; border-radius: 10px; padding: 12px;
display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "ring main actions" "foot foot foot";
gap: 8px 12px; box-shadow: 0 1px 2px rgba(0,0,0,.04);
transition: background 0.2s ease;
}
.habit-card:active { background: #fafafa; }
.habit-card.done { background: #f7fbf8; }
.habit-card .ring-wrap { grid-area: ring; }
.habit-main { grid-area: main; min-width: 0; }
.habit-actions { grid-area: actions; display: flex; align-items: center; }
.habit-foot {
grid-area: foot; display: flex; gap: 14px; padding-top: 8px; border-top: 1px dashed var(--color-border);
}
.habit-name { font-size: 15px; font-weight: 600; color: var(--color-text); word-break: break-all; }
.habit-meta { font-size: 12px; color: var(--color-muted); margin-top: 3px; }
.habit-streak { margin-left: 8px; color: #ff8f1f; background: rgba(255,143,31,.12); border-radius: 4px; padding: 1px 6px; }
.habit-note { font-size: 11px; color: var(--color-muted); margin-top: 3px; }
.habit-range { font-size: 11px; color: var(--color-muted); margin-top: 3px; font-variant-numeric: tabular-nums; }
.habit-over { margin-left: 8px; color: #ff8f1f; }
.habit-link { font-size: 12px; color: var(--color-primary); cursor: pointer; }
.habit-link.danger { color: var(--color-danger); }
/* ----- 日历视图 ----- */
.calendar-view { padding: 0 12px 20px; }
.cal-month-bar { display: flex; align-items: center; gap: 10px; padding: 8px 2px; }
.cal-month { font-size: 16px; font-weight: 700; color: var(--color-text); }
.cal-arrow { font-size: 20px; color: var(--color-muted); cursor: pointer; padding: 0 4px; line-height: 1; }
.cal-today-btn { margin-left: auto; font-size: 12px; color: var(--color-primary); cursor: pointer; }
.cal-quick { padding: 2px 0 10px; }
.cal-grid { background: #fff; border-radius: 10px; padding: 8px 6px 10px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.cal-weekday, .cal-days { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-weekday span { text-align: center; font-size: 11px; color: var(--color-muted); padding: 4px 0; }
.cal-day {
position: relative; height: 38px; display: flex; flex-direction: column; align-items: center;
justify-content: center; border-radius: 8px; cursor: pointer;
}
.cal-day-num { font-size: 13px; color: var(--color-text); font-variant-numeric: tabular-nums; }
.cal-day.out .cal-day-num { color: #c8c8c8; }
.cal-day.future .cal-day-num { color: #b0b0b0; }
.cal-day.today .cal-day-num { color: var(--color-primary); font-weight: 700; }
.cal-day.selected { background: var(--color-primary); }
.cal-day.selected .cal-day-num { color: #fff; font-weight: 600; }
.cal-dot { width: 5px; height: 5px; border-radius: 50%; margin-top: 3px; }
.cal-dot.partial { background: #ffc53d; }
.cal-dot.full { background: #00b578; }
.cal-dot.over { background: #a855f7; }
.cal-day.selected .cal-dot { background: #fff; }
.cal-rate { font-size: 12px; color: var(--color-muted); padding: 8px 2px; }
.cal-rate strong { color: var(--color-primary); }
.cal-detail { margin-top: 6px; }
.cal-detail-title { font-size: 14px; font-weight: 600; color: var(--color-text); padding: 6px 2px 8px; }
.cal-item {
position: relative; display: flex; align-items: center; gap: 8px; background: #fff;
border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.cal-item.done { background: #f7fbf8; }
.cal-item-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.cal-item-name { font-size: 14px; font-weight: 600; color: var(--color-text); }
.cal-item-meta { font-size: 11px; color: var(--color-muted); flex: 1; text-align: right; font-variant-numeric: tabular-nums; }
.cal-item-right { flex-shrink: 0; }
.cal-item-plan { font-size: 12px; color: var(--color-muted); }
/* ----- 清单视图 ----- */
.list-view { padding: 0 12px 20px; }
.list-view-head { display: flex; align-items: center; gap: 8px; padding: 8px 0 10px; }
.list-view-head .adm-segmented { flex: 1; }
.checklist-wrap { display: flex; flex-direction: column; gap: 10px; }
.checklist-card {
position: relative; background: #fff; border-radius: 10px; padding: 12px;
box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.checklist-card.done { background: #f7fbf8; }
.checklist-head { cursor: pointer; }
.checklist-title-row { display: flex; align-items: center; gap: 8px; }
.checklist-title { font-size: 15px; font-weight: 600; color: var(--color-text); }
.checklist-scene { font-size: 11px; color: var(--color-primary); background: #f0f5ff; border-radius: 4px; padding: 1px 6px; }
.checklist-progress-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.checklist-bar { flex: 1; height: 6px; border-radius: 3px; background: #f0f0f0; overflow: hidden; }
.checklist-bar-fill { height: 100%; border-radius: 3px; background: #00b578; transition: width 0.4s ease; }
.checklist-count { font-size: 12px; color: var(--color-muted); font-variant-numeric: tabular-nums; }
.checklist-arrow { color: var(--color-muted); transition: transform 0.2s ease; }
.checklist-arrow.open { transform: rotate(90deg); }
.checklist-body { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--color-border); }
.checklist-item { display: flex; align-items: center; gap: 8px; padding: 7px 0; }
.check-box {
width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid #d0d0d0; flex-shrink: 0;
display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
transition: background 0.2s ease, border-color 0.2s ease;
}
.check-box svg { opacity: 0; transition: opacity 0.15s ease; }
.checklist-item.done .check-box { background: #00b578; border-color: #00b578; }
.checklist-item.done .check-box svg { opacity: 1; }
.checklist-item-title { flex: 1; font-size: 14px; color: var(--color-text); cursor: pointer; }
.checklist-item-title em { display: block; font-style: normal; font-size: 11px; color: var(--color-muted); margin-top: 2px; }
.checklist-item.done .checklist-item-title { color: #a0a0a0; text-decoration: line-through; }
.checklist-item-del { color: #ccc; font-size: 18px; line-height: 1; padding: 0 4px; cursor: pointer; }
.checklist-add { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.checklist-add .adm-input { flex: 1; border: 1px solid var(--color-border); border-radius: 6px; padding: 6px 8px; }
.checklist-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; }
/* ----- 表单弹窗 (打卡项 / 清单) ----- */
.form-popup { padding: 16px 16px 8px; }
.form-title { font-size: 16px; font-weight: 700; color: var(--color-text); margin-bottom: 12px; }
.form-field { margin-bottom: 14px; }
.form-field > label { display: block; font-size: 12px; color: var(--color-muted); margin-bottom: 6px; }
.form-field .adm-input { border: 1px solid var(--color-border); border-radius: 8px; padding: 8px 10px; }
.form-actions { margin-top: 18px; }
.color-row { display: flex; gap: 10px; flex-wrap: wrap; }
.color-dot {
width: 26px; height: 26px; border-radius: 50%; cursor: pointer; display: inline-block;
border: 2px solid transparent; transition: transform 0.15s ease;
}
.color-dot.active { border-color: rgba(0,0,0,.25); transform: scale(1.12); }