Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
feat(CalendarTiming): 优化发布记录列表展示 - 调整日历记录项的样式和布局 - 优化 RecordCore组件,添加平台图标和时间显示 - 调整 index.tsx 中的日期格式化逻辑
gaoSir522962b2bf9c
diff --git a/.idea/workspace.xml b/.idea/workspace.xmlindex f3338c45..9d1d08ad 100644--- a/.idea/workspace.xml+++ b/.idea/workspace.xml@@ -4,14 +4,13 @@<option name="autoReloadType" value="SELECTIVE" /></component><component name="ChangeListManager">- <list default="true" id="8ce961ad-7c9e-494c-bc53-9ecde4358af8" name="更改" comment="">- <change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />- <change beforePath="$PROJECT_DIR$/.idea/material_theme_project_new.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/material_theme_project_new.xml" afterDir="false" />+ <list default="true" id="8ce961ad-7c9e-494c-bc53-9ecde4358af8" name="更改" comment="feat(CalendarTiming): 优化发布记录列表展示 - 调整日历记录项的样式和布局 - 优化 RecordCore组件,添加平台图标和时间显示 - 修改 CalendarTimingItem 组件,移除不必要的 Fragment -调整 index.tsx 中的日期格式化逻辑"><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/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/CalendarTimingItem/RecordCore.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/RecordCore.tsx" afterDir="false" />- <change beforePath="$PROJECT_DIR$/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/calendarTimingItem.module.scss" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/calendarTimingItem.module.scss" 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" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/recordCore.module.scss" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/recordCore.module.scss" afterDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/demo/demoPublish.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/demo/demoPublish.tsx" afterDir="false" />+ <change beforePath="$PROJECT_DIR$/src/components/AvatarPlat/avatarPlat.module.scss" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/AvatarPlat/avatarPlat.module.scss" afterDir="false" />+ <change beforePath="$PROJECT_DIR$/src/store/account.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/store/account.ts" afterDir="false" /></list><option name="SHOW_DIALOG" value="false" /><option name="HIGHLIGHT_CONFLICTS" value="true" />@@ -19,6 +18,7 @@<option name="LAST_RESOLUTION" value="IGNORE" /></component><component name="Git.Settings">+ <option name="PUSH_AUTO_UPDATE" value="true" /><option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /></component><component name="ProjectColorInfo"><![CDATA[{@@ -39,6 +39,7 @@"node.js.selected.package.eslint": "(autodetect)","node.js.selected.package.tslint": "(autodetect)","nodejs_package_manager_path": "npm",+ "settings.editor.selected.configurable": "project.propVCSSupport.CommitDialog","ts.external.directory.path": "E:\\project-dev\\web\\艺咖\\aitoearn-web\\node_modules\\typescript\\lib","vue.rearranger.settings.migration": "true"}@@ -60,11 +61,26 @@<option name="number" value="Default" /><option name="presentableId" value="Default" /><updated>1751977665735</updated>- <workItem from="1751977666787" duration="855000" />+ <workItem from="1751977666787" duration="3029000" /></task>+ <task id="LOCAL-00001" summary="feat(CalendarTiming): 优化发布记录列表展示 - 调整日历记录项的样式和布局 - 优化 RecordCore组件,添加平台图标和时间显示 - 修改 CalendarTimingItem 组件,移除不必要的 Fragment -调整 index.tsx 中的日期格式化逻辑">+ <option name="closed" value="true" />+ <created>1751978595304</created>+ <option name="number" value="00001" />+ <option name="presentableId" value="LOCAL-00001" />+ <option name="project" value="LOCAL" />+ <updated>1751978595304</updated>+ </task>+ <option name="localTasksCounter" value="2" /><servers /></component><component name="TypeScriptGeneratedFilesManager"><option name="version" value="3" /></component>+ <component name="VcsManagerConfiguration">+ <option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />+ <option name="CHECK_NEW_TODO" value="false" />+ <MESSAGE value="feat(CalendarTiming): 优化发布记录列表展示 - 调整日历记录项的样式和布局 - 优化 RecordCore组件,添加平台图标和时间显示 - 修改 CalendarTimingItem 组件,移除不必要的 Fragment -调整 index.tsx 中的日期格式化逻辑" />+ <option name="LAST_COMMIT_MESSAGE" value="feat(CalendarTiming): 优化发布记录列表展示 - 调整日历记录项的样式和布局 - 优化 RecordCore组件,添加平台图标和时间显示 - 修改 CalendarTimingItem 组件,移除不必要的 Fragment -调整 index.tsx 中的日期格式化逻辑" />+ </component></project>\ No newline at end of filediff --git a/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/RecordCore.tsx b/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/RecordCore.tsxindex e948d41c..443af9a2 100644--- a/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/RecordCore.tsx+++ b/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/RecordCore.tsx@@ -1,11 +1,19 @@import { ForwardedRef, forwardRef, memo, useMemo } from "react";-import { Button } from "antd";+import { Button, Dropdown, Image, Popover } from "antd";import { useCalendarTiming } from "@/app/[lng]/accounts/components/CalendarTiming/useCalendarTiming";import { useShallow } from "zustand/react/shallow";import { PublishRecordItem } from "@/api/plat/types/publish.types";import styles from "./recordCore.module.scss";import dayjs from "dayjs";import { AccountPlatInfoMap } from "@/app/config/platConfig";+import {+ FieldTimeOutlined,+ FullscreenOutlined,+ MoreOutlined,+} from "@ant-design/icons";+import AvatarPlat from "@/components/AvatarPlat";+import { useAccountStore } from "@/store/account";+import type { MenuProps } from "antd";export interface IRecordCoreRef {}@@ -24,28 +32,81 @@ const RecordCore = memo(calendarCallWidth: state.calendarCallWidth,})),);+ const { accountUidMap } = useAccountStore(+ useShallow((state) => ({+ accountUidMap: state.accountUidMap,+ })),+ );+ const dropdownItems: MenuProps["items"] = [+ {+ key: "2",+ label: "复制链接",+ },+ {+ key: "3",+ danger: true,+ label: "删除",+ },+ ];const days = useMemo(() => {return dayjs(publishRecord.publishTime);}, [publishRecord]);+ const account = useMemo(() => {+ return accountUidMap.get(publishRecord.flowId)!;+ }, [accountUidMap, publishRecord.flowId]);+const platIcon = useMemo(() => {return AccountPlatInfoMap.get(publishRecord.accountType)?.icon;}, [publishRecord]);return (- <Button- className={styles.recordCore}- style={{ width: calendarCallWidth + "px" }}+ <Popover+ placement="right"+ rootClassName={styles.recordPopover}+ content={+ <div className={styles.recordDetails}>+ <div className="recordDetails-top">+ <div className="recordDetails-top-left">+ {days.format("YYYY-MM-DD HH:MM")}+ <FieldTimeOutlined />+ </div>+ <Button icon={<FullscreenOutlined />} size="small" />+ </div>+ <div className="recordDetails-center">+ <div className="recordDetails-center-left">+ <AvatarPlat account={account} size="large" />+ <span className="recordDetails-center-title">+ {account.nickname}+ </span>+ </div>+ <div className="recordDetails-center-right">+ <Image src={publishRecord.coverUrl} />+ </div>+ </div>+ <div className="recordDetails-bottom">+ <Dropdown menu={{ items: dropdownItems }} placement="top">+ <Button icon={<MoreOutlined />} />+ </Dropdown>+ </div>+ </div>+ }+ trigger="click">- <div className="recordCore-left">- <img src={platIcon} />- <div className="recordCore-left-date">{days.format("HH:mm")}</div>- </div>- <div className="recordCore-right">- <img src={publishRecord.coverUrl} />- </div>- </Button>+ <Button+ className={styles.recordCore}+ style={{ width: calendarCallWidth + "px" }}+ >+ <div className="recordCore-left">+ <img src={platIcon} />+ <div className="recordCore-left-date">{days.format("HH:MM")}</div>+ </div>+ <div className="recordCore-right">+ <img src={publishRecord.coverUrl} />+ </div>+ </Button>+ </Popover>);},),diff --git a/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/recordCore.module.scss b/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/recordCore.module.scssindex 74d33410..e0ba9681 100644--- a/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/recordCore.module.scss+++ b/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/recordCore.module.scss@@ -33,4 +33,65 @@background: #fff !important;}}+}++.recordDetails {+ width: 450px;+ box-sizing: border-box;+ :global {+ .recordDetails-top {+ display: flex;+ justify-content: space-between;+ align-items: center;+ border-bottom: 1px solid var(--grayColor2);+ padding: 12px;+ &-left {+ font-weight: 600;+ .anticon {+ margin-left: 8px;+ }+ }+ }++ .recordDetails-center {+ padding: 12px;+ display: flex;+ justify-content: space-between;+ border-bottom: 1px solid var(--grayColor2);+ &-left {+ }+ &-right {+ img {+ width: 145px;+ height: 145px;+ object-fit: contain;+ }+ }+ &-title {+ margin-left: 10px;+ display: inline-block;+ font-weight: 700;+ }+ }++ .recordDetails-bottom {+ padding: 12px;+ display: flex;+ justify-content: right;+ :global {+ .anticon {+ font-size: 18px !important;+ font-weight: 900 !important;+ }+ }+ }+ }+}++.recordPopover {+ :global {+ .ant-popover-inner {+ padding: 0 !important;+ }+ }}\ No newline at end of filediff --git a/src/app/[lng]/demo/demoPublish.tsx b/src/app/[lng]/demo/demoPublish.tsxindex b9bb312b..c79c51b0 100644--- a/src/app/[lng]/demo/demoPublish.tsx+++ b/src/app/[lng]/demo/demoPublish.tsx@@ -1,13 +1,10 @@"use client";-import {- AccountType,- apiCreatePublish,- apiGetPublishList,-} from "@/api/publish";import { PubType } from "@/app/config/publishConfig";import dayjs from "dayjs";import utc from "dayjs/plugin/utc";+import { apiCreatePublish } from "@/api/plat/publish";+import { PlatType } from "@/app/config/platConfig";// import timezone from "dayjs/plugin/timezone";dayjs.extend(utc);@@ -23,7 +20,7 @@ export const DemoPublish = () => {title: "测试视频标题",desc: "测试视频描述",accountId: "686ba36565c9020dc1f3a043",- accountType: AccountType.BILIBILI,+ accountType: PlatType.BILIBILI,videoUrl:"https://v2-zj-bjcm.kwaicdn.com/upic/2025/06/24/09/BMjAyNTA2MjQwOTI3MjlfNDQwMjk3NjY1Nl8xNjc1OTkwOTUzNzBfMl8z_b_Bea472124f75ea09e1483d87c112ede39.mp4?tag=1-1751887066-unknown-0-uqpbdciha7-0f5473b4478e400b&provider=self&clientCacheKey=3xcwhdmk5jcyv8y_b.mp4&di=dfa08272&bp=14944&x-ks-ptid=167599095370&Aecs=172.17.4.195&ocid=100001260&tt=b&ss=vpm",coverUrl: "https://education.yikart.cn/images/swiper/swiper1.png",@@ -48,23 +45,11 @@ export const DemoPublish = () => {}};- const getPublishList = async () => {- try {- const res: any = await apiGetPublishList(1, 10, {});- if (res?.data?.data) {- console.log("获取记录列表成功:", res.data.data);- }- } catch (error) {- console.error("获取记录列表失败:", error);- }- };-return (<div><div>========= 发布记录 ==============</div><div><button onClick={createPublish}>创建记录</button>- <button onClick={getPublishList}>获取记录列表</button></div><div style={{ marginTop: "20px" }}>diff --git a/src/components/AvatarPlat/avatarPlat.module.scss b/src/components/AvatarPlat/avatarPlat.module.scssindex 6ac9cf41..7333c2c8 100644--- a/src/components/AvatarPlat/avatarPlat.module.scss+++ b/src/components/AvatarPlat/avatarPlat.module.scss@@ -1,6 +1,6 @@.avatarPlat {position: relative;- display: flex;+ display: inline-block;justify-content: center;& > img {position: absolute;diff --git a/src/store/account.ts b/src/store/account.tsindex e55fca93..7247c1e6 100644--- a/src/store/account.ts+++ b/src/store/account.ts@@ -11,6 +11,8 @@ export interface AccountGroup extends AccountGroupItem {export interface IAccountStore {accountList: SocialAccount[];accountMap: Map<string, SocialAccount>;+ // key=uid,value=账户+ accountUidMap: Map<string, SocialAccount>;accountGroupList: AccountGroup[];accountGroupMap: Map<string, AccountGroup>;accountLoading: boolean;@@ -23,6 +25,7 @@ const store: IAccountStore = {accountGroupList: [],accountGroupMap: new Map([]),accountMap: new Map([]),+ accountUidMap: new Map([]),accountLoading: false,};@@ -53,17 +56,20 @@ export const useAccountStore = create(set({ accountLoading: true });const accountMap = new Map<string, SocialAccount>([]);+ const accountUidMap = new Map<string, SocialAccount>([]);const result = await getAccountListApi();if (result?.code !== 0) return;for (const item of result.data) {accountMap.set(item.id, item);+ accountUidMap.set(item.uid, item);}set({accountList: result.data,accountMap,+ accountUidMap,});await methods.getAccountGroup();