feat(打卡): 新建打卡项去掉「每年」周期选项
Docker Build and Push / build-image (push) Failing after 1m23s

新建时只保留 每天/每周/每月; 历史遗留的 year 项在编辑时仍显示「每年」, 避免当前周期无选中项
This commit is contained in:
jif2.zhang
2026-11-09 15:23:02 +08:00
parent 902c6a0ebe
commit 3730e55e93
+10 -2
View File
@@ -21,12 +21,15 @@ import {
const GROUP_ORDER = ['day', 'week', 'month']
const GROUP_LABEL = { day: '每天', week: '每周', month: '每月' }
// 新建时只提供 每天 / 每周 / 每月 (「每年」已下线)
const PERIOD_OPTIONS = [
{ label: '每天', value: 'day' },
{ label: '每周', value: 'week' },
{ label: '每月', value: 'month' },
{ label: '每年', value: 'year' },
]
// 历史遗留的 year 项仍可编辑: 仅在编辑该周期时补回「每年」选项,
// 避免打开编辑弹窗时当前周期没有任何选中项
const YEAR_OPTION = { label: '每年', value: 'year' }
const COLORS = ['#1677ff', '#00b578', '#ff8f1f', '#ff3141', '#a855f7', '#14b8a6', '#f43f9e']
const EMPTY_FORM = { id: null, name: '', period: 'day', target: 1, color: COLORS[0], note: '' }
@@ -255,6 +258,11 @@ export default function MergedView({ date, onDateChange }) {
}
// ---------- 渲染 ----------
// 只有编辑历史 year 项时才显示「每年」选项; 新建一律不给该周期
const periodOptions = form.period === 'year'
? [...PERIOD_OPTIONS, YEAR_OPTION]
: PERIOD_OPTIONS
return (
<div className="mv-view">
{/* 月历 */}
@@ -440,7 +448,7 @@ export default function MergedView({ date, onDateChange }) {
<div className="form-field">
<label>周期</label>
<Selector
options={PERIOD_OPTIONS}
options={periodOptions}
value={[form.period]}
onChange={(v) => setForm((f) => ({ ...f, period: v[0] }))}
/>