This commit is contained in:
2026-05-06 20:36:52 +08:00
parent 056eb4798d
commit 1d5f0b4bc0
6 changed files with 114 additions and 16 deletions
+24
View File
@@ -42,3 +42,27 @@
**前端**:添加 `getColorByScheduleType()` 函数,`getEvents` 中使用 scheduleType 映射颜色。
**后端**:只存储 ScheduleType,不处理颜色逻辑。颜色完全由前端 `colorOptions` 控制。
## CalendarDetail 滚动标题快照对比
**功能**:每次 getEvents 存快照,数据变化或宽度变化时重新计算标题滚动。
**实现**
- `pageData.lastEventsSnapshot`:存储上一次的 JSON 快照
- `getEvents()` 末尾对比快照,变化则 `setTimeout(recalcScrollTitles, 150)`
- `ResizeObserver` 监听日历容器宽度变化,防抖 150ms 后重算
- `applyScrollToTitle()`:清除旧状态 → 测量 overflow → 设置 `--scroll-distance``data-truncated` 属性
## CalendarList 编辑/删除按钮改用 canEdit
**改动**
- `CalendarList.vue`:编辑/删除按钮 `v-if` 条件从 `calendar.UserID === userStore.userInfo?.ID` 改为 `calendar.canEdit`
- 移除废弃的 `useUserStore` 导入
## CalendarList 删除改用 ConfirmDialog 组件
**改动**
- `CalendarList.vue` 导入并使用 `ConfirmDialog` 组件
- 新增 `showDeleteModal` + `deletingCalendar` 状态
- `deleteCalendar()` 改为打开确认弹窗,`confirmDelete()` 执行实际删除 API
- i18n 新增 `calendar.confirm_delete_message`:zh-CN「确定要删除日历「{name}」吗?此操作不可撤销。」,en 英文版