From 3a333535ea0135a042dbbadd7d7d5ccd1bbeaabf Mon Sep 17 00:00:00 2001 From: iven Date: Fri, 24 Apr 2026 12:48:53 +0800 Subject: [PATCH] =?UTF-8?q?feat(miniprogram):=20=E9=9A=8F=E8=AE=BF?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E9=A1=B5=E6=88=AA=E6=AD=A2=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=E5=80=92=E8=AE=A1=E6=97=B6=20+=20=E7=8A=B6=E6=80=81=E8=89=B2?= =?UTF-8?q?=E5=A2=9E=E5=BC=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加截止日期倒计时(还剩 X 天 / 今天截止 / 已过期 X 天) - 紧急倒计时(≤3天/已过期)使用红色警告样式 - 状态标签增加颜色区分:已完成(绿)/已过期(红)/待完成(黄) --- .../src/pages/followup/detail/index.scss | 23 ++++++++++++++ .../src/pages/followup/detail/index.tsx | 30 ++++++++++++++++++- 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/apps/miniprogram/src/pages/followup/detail/index.scss b/apps/miniprogram/src/pages/followup/detail/index.scss index 16b054e..da83984 100644 --- a/apps/miniprogram/src/pages/followup/detail/index.scss +++ b/apps/miniprogram/src/pages/followup/detail/index.scss @@ -42,6 +42,29 @@ .detail-value { font-size: 26px; color: $tx; + + &.status-completed { color: $acc; } + &.status-overdue { color: $dan; } + &.status-pending { color: $wrn; } +} + +.countdown { + margin-top: 12px; + padding: 12px 16px; + background: $wrn-l; + border-radius: $r-sm; +} + +.countdown-urgent { + background: $dan-l; +} + +.countdown-text { + font-size: 24px; + color: $wrn; + font-weight: bold; + + .countdown-urgent & { color: $dan; } } .detail-desc { diff --git a/apps/miniprogram/src/pages/followup/detail/index.tsx b/apps/miniprogram/src/pages/followup/detail/index.tsx index be0d18e..ec50e54 100644 --- a/apps/miniprogram/src/pages/followup/detail/index.tsx +++ b/apps/miniprogram/src/pages/followup/detail/index.tsx @@ -60,6 +60,24 @@ export default function FollowUpDetail() { return '待完成'; }; + const getStatusClass = (status: string) => { + if (status === 'completed') return 'status-completed'; + if (status === 'overdue') return 'status-overdue'; + return 'status-pending'; + }; + + const getCountdown = (dueDate: string, status: string) => { + if (status === 'completed') return null; + const now = new Date(); + const due = new Date(dueDate); + const diffMs = due.getTime() - now.getTime(); + const diffDays = Math.ceil(diffMs / (1000 * 60 * 60 * 24)); + if (diffDays < 0) return { text: `已过期 ${Math.abs(diffDays)} 天`, urgent: true }; + if (diffDays === 0) return { text: '今天截止', urgent: true }; + if (diffDays <= 3) return { text: `还剩 ${diffDays} 天`, urgent: true }; + return { text: `还剩 ${diffDays} 天`, urgent: false }; + }; + if (loading) { return ( @@ -84,12 +102,22 @@ export default function FollowUpDetail() { {task.task_type} 状态 - {getStatusLabel(task.status)} + + {getStatusLabel(task.status)} + 截止日期 {task.due_date} + {(() => { + const cd = getCountdown(task.due_date, task.status); + return cd ? ( + + {cd.text} + + ) : null; + })()} {task.description && ( {task.description}