feat(calendar): simplify holiday highlight styles and improve accessibility
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 27s
Docker Build & Deploy / Deploy to Production (push) Successful in 6s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 2s
Docker Build & Deploy / WeChat Notification (push) Successful in 2s

- Introduced a new visual style for holiday highlights in the calendar component, replacing complex gradients with solid colors for better clarity.
- Removed the holiday badge to reduce visual noise and enhance user experience.
- Ensured that holiday information remains accessible through long-press interactions.
- Updated specifications to reflect the new design decisions and requirements for both light and dark themes.
- Added tasks for implementation, including style adjustments and accessibility enhancements.
This commit is contained in:
SunCheng
2026-02-12 21:39:27 +08:00
parent aff0cbb55e
commit 803f09cc97
21 changed files with 713 additions and 52 deletions

View File

@@ -31,6 +31,7 @@
v-for="day in week"
:key="day.date"
class="day-cell"
:aria-label="getAriaLabel(day)"
@click="onDayClick(day)"
@touchstart="onTouchStartHoliday($event, day)"
@touchend="onTouchEndHoliday"
@@ -48,13 +49,6 @@
}"
>
{{ day.dayNumber }}
<!-- 节假日标记 -->
<span
v-if="day.isHoliday"
class="holiday-badge"
>
{{ day.isWorkday ? '班' : '休' }}
</span>
</div>
<div
v-if="day.amount"
@@ -369,6 +363,25 @@ const formatDateKey = (date) => {
return `${year}-${month}-${day}`
}
// 生成无障碍标签
const getAriaLabel = (day) => {
const date = new Date(day.date)
const dateStr = formatDateKey(date)
let label = dateStr
if (day.isHoliday) {
const type = day.isWorkday ? '调休工作日' : '休息日'
label += ` ${day.holidayName} ${type}`
}
if (day.hasData) {
const amountType = day.isProfitable ? '收入' : '支出'
label += ` ${amountType} ${day.amount}`
}
return label
}
// 点击日期
const onDayClick = (day) => {
emit('dayClick', day)
@@ -500,7 +513,6 @@ const onTouchEnd = () => {
position: relative;
width: 100%;
overflow: hidden; /* 保持 hidden 以支持切换动画 */
padding-top: 4px; /* 新增:为第一行的徽章留出空间 */
}
.calendar-grid {
@@ -508,7 +520,6 @@ const onTouchEnd = () => {
flex-direction: column;
gap: var(--spacing-lg);
width: 100%;
padding-top: 4px; /* 新增:为第一行徽章留出空间 */
}
.calendar-week {
@@ -527,7 +538,6 @@ const onTouchEnd = () => {
}
.day-number {
position: relative; /* 为绝对定位的徽章提供定位上下文 */
display: flex;
align-items: center;
justify-content: center;
@@ -545,9 +555,25 @@ const onTouchEnd = () => {
font-weight: var(--font-semibold);
}
/* ========== 节假日样式 ========== */
/* 节假日放假样式(绿色系) */
.day-number.day-holiday {
background-color: #E8F5E9;
color: #2E7D32;
font-weight: var(--font-bold);
}
/* 调休工作日样式(橙色/黄色系) */
.day-number.day-workday {
background-color: #FFF3E0;
color: #E65100;
font-weight: var(--font-bold);
}
/* 选中状态优先级最高 */
.day-number.day-selected {
background-color: var(--accent-primary);
color: #FFFFFF;
background-color: var(--accent-primary) !important;
color: #FFFFFF !important;
font-weight: var(--font-bold);
}
@@ -570,37 +596,6 @@ const onTouchEnd = () => {
color: var(--accent-success);
}
/* ========== 节假日样式 ========== */
/* 节假日放假样式(绿色系) */
.day-number.day-holiday {
background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 100%);
color: #2E7D32;
font-weight: var(--font-bold);
}
/* 调休工作日样式(橙色/黄色系) */
.day-number.day-workday {
background: linear-gradient(135deg, #FFF3E0 0%, #FFE0B2 100%);
color: #E65100;
font-weight: var(--font-bold);
}
/* 节假日标记 */
.holiday-badge {
position: absolute;
top: -2px;
right: -2px;
font-size: 9px;
background-color: var(--accent-danger);
color: white;
border-radius: 4px;
padding: 1px 3px;
line-height: 1.2;
font-weight: var(--font-bold);
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
z-index: 100;
}
/* 节假日提示浮层 */
.holiday-tooltip-wrapper {
display: flex;