Skip to content

Commit 6049e50

Browse files
committed
v1.4.0 - bugfix
1 parent 243c2da commit 6049e50

File tree

4 files changed

+56
-42
lines changed

4 files changed

+56
-42
lines changed

src/components/TaskBar.vue

Lines changed: 25 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ interface TaskBarSlotProps {
4242
currentTimeScale?: TimelineScale
4343
rowHeight: number
4444
dayWidth: number
45-
// 新增:动态样式对象
46-
dynamicStyles: Record<string, string>
4745
}
4846
4947
const props = defineProps<Props>()
@@ -246,13 +244,13 @@ const taskBarStyle = computed(() => {
246244
const startDateOnly = new Date(
247245
startDate.getFullYear(),
248246
startDate.getMonth(),
249-
startDate.getDate(),
247+
startDate.getDate()
250248
)
251249
const endDateOnly = new Date(endDate.getFullYear(), endDate.getMonth(), endDate.getDate())
252250
const baseStartOnly = new Date(
253251
baseStart.getFullYear(),
254252
baseStart.getMonth(),
255-
baseStart.getDate(),
253+
baseStart.getDate()
256254
)
257255
258256
if (props.currentTimeScale === TimelineScale.YEAR) {
@@ -274,15 +272,15 @@ const taskBarStyle = computed(() => {
274272
const startPosition = calculatePositionFromTimelineData(
275273
startDateOnly,
276274
props.timelineData,
277-
props.currentTimeScale,
275+
props.currentTimeScale
278276
)
279277
// 计算结束位置:为结束日期添加一天来获取正确的结束位置
280278
const nextDay = new Date(endDateOnly)
281279
nextDay.setDate(nextDay.getDate() + 1)
282280
let endPosition = calculatePositionFromTimelineData(
283281
nextDay,
284282
props.timelineData,
285-
props.currentTimeScale,
283+
props.currentTimeScale
286284
)
287285
288286
// 如果结束日期+1天超出范围,使用结束日期的位置+一天的宽度
@@ -297,7 +295,7 @@ const taskBarStyle = computed(() => {
297295
calculatePositionFromTimelineData(
298296
endDateOnly,
299297
props.timelineData,
300-
props.currentTimeScale,
298+
props.currentTimeScale
301299
) + dayWidth
302300
}
303301
@@ -306,7 +304,7 @@ const taskBarStyle = computed(() => {
306304
} else {
307305
// 日视图:基于日期的简单计算
308306
const startDiff = Math.floor(
309-
(startDateOnly.getTime() - baseStartOnly.getTime()) / (1000 * 60 * 60 * 24),
307+
(startDateOnly.getTime() - baseStartOnly.getTime()) / (1000 * 60 * 60 * 24)
310308
)
311309
312310
// 计算持续天数(基于日期,忽略时间)
@@ -395,7 +393,6 @@ const slotPayload = computed(() => ({
395393
currentTimeScale: props.currentTimeScale,
396394
rowHeight: props.rowHeight,
397395
dayWidth: props.dayWidth,
398-
dynamicStyles: getNameStyles(),
399396
}))
400397
401398
// 判断是否已完成
@@ -504,7 +501,7 @@ const handleMouseMove = (e: MouseEvent) => {
504501
mouseX: e.clientX,
505502
isDragging: isDragging.value || isResizingLeft.value || isResizingRight.value,
506503
},
507-
}),
504+
})
508505
)
509506
510507
// 更新拖拽提示框位置
@@ -769,7 +766,7 @@ const handleMouseMove = (e: MouseEvent) => {
769766
const newDurationDays = newWidth / props.dayWidth
770767
const newEndDate = addDaysToLocalDate(
771768
props.startDate,
772-
resizeStartLeft.value / props.dayWidth + newDurationDays - 1,
769+
resizeStartLeft.value / props.dayWidth + newDurationDays - 1
773770
)
774771
775772
// 只更新临时数据,不触发事件
@@ -801,7 +798,7 @@ const handleMouseUp = () => {
801798
mouseX: 0,
802799
isDragging: false,
803800
},
804-
}),
801+
})
805802
)
806803
807804
// 如果有临时数据,说明发生了拖拽或拉伸,提交数据更新
@@ -885,7 +882,7 @@ watch(
885882
reportBarPosition()
886883
})
887884
},
888-
{ deep: true },
885+
{ deep: true }
889886
)
890887
891888
// 处理TaskBar双击事件
@@ -1174,7 +1171,7 @@ watch(
11741171
}
11751172
}, 200)
11761173
}
1177-
},
1174+
}
11781175
)
11791176
11801177
// 监听外部hideBubbles属性变化,确保Timeline的容器变化能及时反应
@@ -1187,7 +1184,7 @@ watch(
11871184
// 强制重新计算bubbleIndicator,确保容器宽度变化后正确显示半圆
11881185
})
11891186
}
1190-
},
1187+
}
11911188
)
11921189
11931190
// 监听TaskBar可见性变化,只在滚动时实现重新出现动画
@@ -1196,7 +1193,7 @@ watch(
11961193
() => {
11971194
// TaskBar重新出现时,不需要动画效果
11981195
// 半圆会自然消失,TaskBar会立即显示
1199-
},
1196+
}
12001197
)
12011198
12021199
// 监听页面缩放和大小变化,重新计算气泡位置
@@ -1356,13 +1353,13 @@ const calculateYearViewPosition = (targetDate: Date, baseStartDate: Date): numbe
13561353
const daysInHalfYear =
13571354
month <= 6
13581355
? Math.floor(
1359-
(new Date(targetYear, 6, 1).getTime() - new Date(targetYear, 0, 1).getTime()) /
1360-
(1000 * 60 * 60 * 24),
1361-
)
1356+
(new Date(targetYear, 6, 1).getTime() - new Date(targetYear, 0, 1).getTime()) /
1357+
(1000 * 60 * 60 * 24)
1358+
)
13621359
: Math.floor(
1363-
(new Date(targetYear + 1, 0, 1).getTime() - new Date(targetYear, 6, 1).getTime()) /
1364-
(1000 * 60 * 60 * 24),
1365-
)
1360+
(new Date(targetYear + 1, 0, 1).getTime() - new Date(targetYear, 6, 1).getTime()) /
1361+
(1000 * 60 * 60 * 24)
1362+
)
13661363
13671364
const dayPositionInHalfYear = (dayOffset / daysInHalfYear) * halfYearWidth
13681365
position += dayPositionInHalfYear
@@ -1386,7 +1383,7 @@ const calculatePositionFromTimelineData = (
13861383
subDays: Array<{ date: Date; dayOfWeek?: number }>
13871384
}>
13881385
}>,
1389-
timeScale: TimelineScale,
1386+
timeScale: TimelineScale
13901387
) => {
13911388
let cumulativePosition = 0
13921389
@@ -1404,11 +1401,11 @@ const calculatePositionFromTimelineData = (
14041401
// 找到目标日期所在的季度
14051402
const quarterWidth = 60
14061403
const daysInQuarter = Math.ceil(
1407-
(quarterEnd.getTime() - quarterStart.getTime()) / (1000 * 60 * 60 * 24),
1404+
(quarterEnd.getTime() - quarterStart.getTime()) / (1000 * 60 * 60 * 24)
14081405
)
14091406
const dayWidth = quarterWidth / daysInQuarter
14101407
const dayInQuarter = Math.ceil(
1411-
(targetDate.getTime() - quarterStart.getTime()) / (1000 * 60 * 60 * 24),
1408+
(targetDate.getTime() - quarterStart.getTime()) / (1000 * 60 * 60 * 24)
14121409
)
14131410
return cumulativePosition + dayInQuarter * dayWidth
14141411
}
@@ -1566,14 +1563,9 @@ onUnmounted(() => {
15661563
@mousedown="e => (isInteractionDisabled ? null : handleMouseDown(e, 'drag'))"
15671564
>
15681565
<!-- 任务名称 -->
1569-
<div ref="taskBarNameRef">
1570-
<slot
1571-
v-if="hasContentSlot"
1572-
name="custom-task-content"
1573-
v-bind="slotPayload"
1574-
:style="getNameStyles()"
1575-
/>
1576-
<div v-else class="task-name" :style="getNameStyles()">
1566+
<div ref="taskBarNameRef" :style="getNameStyles()">
1567+
<slot v-if="hasContentSlot" name="custom-task-content" v-bind="slotPayload" />
1568+
<div v-else class="task-name">
15771569
{{ task.name }}
15781570
</div>
15791571
</div>

src/components/TaskDrawer.vue

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ watch(
6868
() => [props.task?.isTimerRunning, props.task?.timerStartTime, props.task?.timerElapsedTime],
6969
() => {
7070
updateTimer()
71-
},
71+
}
7272
)
7373
7474
// 计时器本地状态,保证点击后UI立即切换
@@ -84,7 +84,7 @@ watch(
8484
timerInterval.value = null
8585
}
8686
},
87-
{ immediate: true },
87+
{ immediate: true }
8888
)
8989
9090
// 修正计时器每秒递增逻辑,保证计时器正常跳动
@@ -102,7 +102,7 @@ watch(
102102
updateTimer()
103103
}
104104
},
105-
{ immediate: true },
105+
{ immediate: true }
106106
)
107107
108108
onUnmounted(() => {
@@ -153,7 +153,7 @@ const availableParentTasks = computed(() => {
153153
.filter(
154154
task =>
155155
task.id !== props.task?.id && // 排除当前任务自己
156-
(task.type === 'story' || task.type === 'task'), // 只显示story和task类型
156+
(task.type === 'story' || task.type === 'task') // 只显示story和task类型
157157
)
158158
.map(task => ({
159159
...task,
@@ -346,7 +346,7 @@ watch(
346346
// 抽屉显示时重新请求任务数据,确保前置任务列表是最新的
347347
window.dispatchEvent(new CustomEvent('request-task-list'))
348348
}
349-
},
349+
}
350350
)
351351
352352
// 监听 isVisible 变化,同步到父组件
@@ -363,7 +363,7 @@ watch(
363363
formData.parentId = newTask.parentId ?? undefined
364364
}
365365
},
366-
{ immediate: true },
366+
{ immediate: true }
367367
)
368368
369369
// 重置表单
@@ -548,7 +548,7 @@ watch(
548548
newValue => {
549549
progressDisplayValue.value = (newValue || 0).toString()
550550
},
551-
{ immediate: true },
551+
{ immediate: true }
552552
)
553553
554554
// 修正计时器首次启动不跳动问题:每次打开抽屉时重置 timerElapsed,且 timerStartTime 为空时立即赋值
@@ -566,7 +566,7 @@ watch(
566566
}
567567
}
568568
},
569-
{ immediate: true },
569+
{ immediate: true }
570570
)
571571
572572
const handleStartTimer = (desc?: string) => {
@@ -978,6 +978,7 @@ function confirmTimer(desc: string) {
978978
979979
/* 抽屉遮罩层 */
980980
.drawer-overlay {
981+
height: 100%;
981982
position: fixed;
982983
top: 0;
983984
left: 0;

src/components/Timeline.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3122,7 +3122,6 @@ const handleAddSuccessor = (task: Task) => {
31223122
/* 暗色主题下的竖直线 */
31233123
:global(html[data-theme='dark']) .month-first-vertical-line {
31243124
background-color: var(--gantt-primary-light, #66b1ff);
3125-
opacity: 0.7;
31263125
}
31273126
31283127
/* 周视图背景列样式 */

src/styles/app.css

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,25 @@
8080
background: #ebb563;
8181
border-color: #ebb563;
8282
}
83+
84+
/* 黑暗模式全局样式 */
85+
html[data-theme='dark'] {
86+
background: #1e1e1e !important;
87+
color-scheme: dark !important;
88+
}
89+
90+
html[data-theme='dark'] body {
91+
background: #1e1e1e !important;
92+
color: #e5e5e5 !important;
93+
}
94+
95+
/* 明亮模式全局样式 */
96+
html[data-theme='light'] {
97+
background: #ffffff !important;
98+
color-scheme: light !important;
99+
}
100+
101+
html[data-theme='light'] body {
102+
background: #ffffff !important;
103+
color: #333333 !important;
104+
}

0 commit comments

Comments
 (0)