Skip to content

Let's use AI to Earn!

fix(日历): 修复更新的问题

gaoSir050ab2e23049
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index dd5569fb..a02315d7 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,9 +4,11 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
- <list default="true" id="8ce961ad-7c9e-494c-bc53-9ecde4358af8" name="更改" comment="chore(发布弹框): daysjs 时区统一管理">
+ <list default="true" id="8ce961ad-7c9e-494c-bc53-9ecde4358af8" name="更改" comment="chore(发布弹框): 拖动修改发布时间完成">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/CalendarRecord.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/CalendarRecord.tsx" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/CalendarTimingItem.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/CalendarTimingItem.tsx" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/accounts/components/CalendarTiming/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/accounts/components/CalendarTiming/index.tsx" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -92,7 +94,7 @@
<workItem from="1752118620733" duration="566000" />
<workItem from="1752130881346" duration="11774000" />
<workItem from="1752200550278" duration="253000" />
- <workItem from="1752200816463" duration="19995000" />
+ <workItem from="1752200816463" duration="20322000" />
</task>
<task id="LOCAL-00001" summary="feat(CalendarTiming): 优化发布记录列表展示&#10;- 调整日历记录项的样式和布局&#10;- 优化 RecordCore组件,添加平台图标和时间显示&#10;- 修改 CalendarTimingItem 组件,移除不必要的 Fragment&#10;-调整 index.tsx 中的日期格式化逻辑">
<option name="closed" value="true" />
@@ -230,7 +232,15 @@
<option name="project" value="LOCAL" />
<updated>1752240837323</updated>
</task>
- <option name="localTasksCounter" value="18" />
+ <task id="LOCAL-00018" summary="chore(发布弹框): 拖动修改发布时间完成">
+ <option name="closed" value="true" />
+ <created>1752243765854</created>
+ <option name="number" value="00018" />
+ <option name="presentableId" value="LOCAL-00018" />
+ <option name="project" value="LOCAL" />
+ <updated>1752243765854</updated>
+ </task>
+ <option name="localTasksCounter" value="19" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@@ -267,6 +277,7 @@
<MESSAGE value="feat(发布弹框): 添加选择账户一系列逻辑: 1. 选择账户时,开启发布弹框会默认选择,右侧选择的账户。 2. 添加日历header选择用户展示的样式。" />
<MESSAGE value="feat(发布弹框): 发布弹框对不支持上传 图片/视频 的平台做了限制" />
<MESSAGE value="chore(发布弹框): daysjs 时区统一管理" />
- <option name="LAST_COMMIT_MESSAGE" value="chore(发布弹框): daysjs 时区统一管理" />
+ <MESSAGE value="chore(发布弹框): 拖动修改发布时间完成" />
+ <option name="LAST_COMMIT_MESSAGE" value="chore(发布弹框): 拖动修改发布时间完成" />
</component>
</project>
\ No newline at end of file
diff --git a/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/CalendarRecord.tsx b/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/CalendarRecord.tsx
index 377264f2..9c3f66a8 100644
--- a/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/CalendarRecord.tsx
+++ b/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/CalendarRecord.tsx
@@ -74,7 +74,6 @@ const CalendarRecord = memo(
newRecordMap.set(newTimeStr, list);
setRecordMap(newRecordMap);
-
// 更新API
updatePublishRecordTimeApi({
id: publishRecord.id,
diff --git a/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/CalendarTimingItem.tsx b/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/CalendarTimingItem.tsx
index 021420a3..e5646055 100644
--- a/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/CalendarTimingItem.tsx
+++ b/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/CalendarTimingItem.tsx
@@ -9,6 +9,8 @@ import CalendarRecord from "@/app/[lng]/accounts/components/CalendarTiming/Calen
import { CustomDragLayer } from "@/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/CustomDragLayer";
import dayjs from "dayjs";
import { PublishRecordItem } from "@/api/plat/types/publish.types";
+import { useCalendarTiming } from "@/app/[lng]/accounts/components/CalendarTiming/useCalendarTiming";
+import { useShallow } from "zustand/react/shallow";
export interface ICalendarTimingItemRef {}
@@ -56,6 +58,11 @@ const CalendarTimingItem = memo(
[],
);
const [isMore, setIsMore] = useState(false);
+ const { recordMap } = useCalendarTiming(
+ useShallow((state) => ({
+ recordMap: state.recordMap,
+ })),
+ );
const recordsLast = useMemo(() => {
if (!records) return [];
@@ -64,7 +71,7 @@ const CalendarTimingItem = memo(
} else {
return records?.slice(0, 3 - reservationsTimes.length);
}
- }, [isMore, records, reservationsTimes]);
+ }, [isMore, records, reservationsTimes, recordMap]);
return (
<div
diff --git a/src/app/[lng]/accounts/components/CalendarTiming/index.tsx b/src/app/[lng]/accounts/components/CalendarTiming/index.tsx
index 7bda9057..28949b76 100644
--- a/src/app/[lng]/accounts/components/CalendarTiming/index.tsx
+++ b/src/app/[lng]/accounts/components/CalendarTiming/index.tsx
@@ -93,6 +93,10 @@ const CalendarTiming = memo(
return () => window.removeEventListener("resize", handleResize);
}, []);
+ useEffect(() => {
+ console.log(recordMap);
+ }, [recordMap]);
+
// 处理窗口大小变化
const handleResize = () => {
setTimeout(() => {