Skip to content

Let's use AI to Earn!

feat(发布):b站添加标题参数

gaoSir7f9cd6be6865
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a02315d7..50f7589c 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,11 +4,18 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
- <list default="true" id="8ce961ad-7c9e-494c-bc53-9ecde4358af8" name="更改" comment="chore(发布弹框): 拖动修改发布时间完成">
+ <list default="true" id="8ce961ad-7c9e-494c-bc53-9ecde4358af8" name="更改" comment="fix(日历): 修复更新的问题">
+ <change afterPath="$PROJECT_DIR$/src/components/PublishDialog/compoents/PlatParamsSetting/common/CommonTitleInput.tsx" afterDir="false" />
<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" />
+ <change beforePath="$PROJECT_DIR$/src/app/config/platConfig.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/config/platConfig.ts" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/src/components/PublishDialog/compoents/PlatParamsSetting/platParamsSetting.module.scss" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/PublishDialog/compoents/PlatParamsSetting/platParamsSetting.module.scss" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/src/components/PublishDialog/compoents/PlatParamsSetting/plats/BilibParams.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/PublishDialog/compoents/PlatParamsSetting/plats/BilibParams.tsx" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/src/components/PublishDialog/compoents/PubParmasTextarea/pubCommonComps.module.scss" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/PublishDialog/compoents/PubParmasTextarea/pubCommonComps.module.scss" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/src/components/PublishDialog/hooks/usePubParamsVerify.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/PublishDialog/hooks/usePubParamsVerify.tsx" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/src/components/PublishDialog/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/PublishDialog/index.tsx" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/src/components/PublishDialog/publishDialog.type.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/PublishDialog/publishDialog.type.ts" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/src/components/PublishDialog/usePublishDialog.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/PublishDialog/usePublishDialog.ts" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -18,6 +25,7 @@
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
+ <option value="vue3组件模板" />
<option value="tsx组件模板" />
</list>
</option>
@@ -94,7 +102,7 @@
<workItem from="1752118620733" duration="566000" />
<workItem from="1752130881346" duration="11774000" />
<workItem from="1752200550278" duration="253000" />
- <workItem from="1752200816463" duration="20322000" />
+ <workItem from="1752200816463" duration="23446000" />
</task>
<task id="LOCAL-00001" summary="feat(CalendarTiming): 优化发布记录列表展示&#10;- 调整日历记录项的样式和布局&#10;- 优化 RecordCore组件,添加平台图标和时间显示&#10;- 修改 CalendarTimingItem 组件,移除不必要的 Fragment&#10;-调整 index.tsx 中的日期格式化逻辑">
<option name="closed" value="true" />
@@ -240,7 +248,15 @@
<option name="project" value="LOCAL" />
<updated>1752243765854</updated>
</task>
- <option name="localTasksCounter" value="19" />
+ <task id="LOCAL-00019" summary="fix(日历): 修复更新的问题">
+ <option name="closed" value="true" />
+ <created>1752244094407</created>
+ <option name="number" value="00019" />
+ <option name="presentableId" value="LOCAL-00019" />
+ <option name="project" value="LOCAL" />
+ <updated>1752244094407</updated>
+ </task>
+ <option name="localTasksCounter" value="20" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@@ -278,6 +294,7 @@
<MESSAGE value="feat(发布弹框): 发布弹框对不支持上传 图片/视频 的平台做了限制" />
<MESSAGE value="chore(发布弹框): daysjs 时区统一管理" />
<MESSAGE value="chore(发布弹框): 拖动修改发布时间完成" />
- <option name="LAST_COMMIT_MESSAGE" value="chore(发布弹框): 拖动修改发布时间完成" />
+ <MESSAGE value="fix(日历): 修复更新的问题" />
+ <option name="LAST_COMMIT_MESSAGE" value="fix(日历): 修复更新的问题" />
</component>
</project>
\ No newline at end of file
diff --git a/src/app/[lng]/accounts/components/CalendarTiming/index.tsx b/src/app/[lng]/accounts/components/CalendarTiming/index.tsx
index 28949b76..7bda9057 100644
--- a/src/app/[lng]/accounts/components/CalendarTiming/index.tsx
+++ b/src/app/[lng]/accounts/components/CalendarTiming/index.tsx
@@ -93,10 +93,6 @@ const CalendarTiming = memo(
return () => window.removeEventListener("resize", handleResize);
}, []);
- useEffect(() => {
- console.log(recordMap);
- }, [recordMap]);
-
// 处理窗口大小变化
const handleResize = () => {
setTimeout(() => {
diff --git a/src/app/config/platConfig.ts b/src/app/config/platConfig.ts
index 8d157855..a5e52ec9 100644
--- a/src/app/config/platConfig.ts
+++ b/src/app/config/platConfig.ts
@@ -93,6 +93,7 @@ export const AccountPlatInfoMap = new Map<PlatType, IAccountPlatInfo>([
pubTypes: new Set([PubType.VIDEO]),
commonPubParamsConfig: {
topicMax: 4,
+ titleMax: 20,
},
themeColor: "blue",
},
diff --git a/src/components/PublishDialog/compoents/PlatParamsSetting/common/CommonTitleInput.tsx b/src/components/PublishDialog/compoents/PlatParamsSetting/common/CommonTitleInput.tsx
new file mode 100644
index 00000000..c46acb91
--- /dev/null
+++ b/src/components/PublishDialog/compoents/PlatParamsSetting/common/CommonTitleInput.tsx
@@ -0,0 +1,55 @@
+import { ForwardedRef, forwardRef, memo, useMemo } from "react";
+import styles from "../platParamsSetting.module.scss";
+import { Input } from "antd";
+import { AccountPlatInfoMap } from "@/app/config/platConfig";
+import { PubItem } from "@/components/PublishDialog/publishDialog.type";
+import { usePublishDialog } from "@/components/PublishDialog/usePublishDialog";
+import { useShallow } from "zustand/react/shallow";
+
+export interface ICommonTitleInputRef {}
+
+export interface ICommonTitleInputProps {
+ pubItem: PubItem;
+}
+
+const CommonTitleInput = memo(
+ forwardRef(
+ (
+ { pubItem }: ICommonTitleInputProps,
+ ref: ForwardedRef<ICommonTitleInputRef>,
+ ) => {
+ const platConfig = useMemo(() => {
+ return AccountPlatInfoMap.get(pubItem.account.type)!;
+ }, [pubItem]);
+
+ const { setOnePubParams, pubList } = usePublishDialog(
+ useShallow((state) => ({
+ setOnePubParams: state.setOnePubParams,
+ pubList: state.pubList,
+ })),
+ );
+
+ return (
+ <div className={styles.commonTitleInput}>
+ <div className="platParamsSetting-label">标题</div>
+ <Input
+ value={pubItem.params.title}
+ maxLength={platConfig.commonPubParamsConfig.titleMax || 20}
+ placeholder="请输入标题"
+ showCount
+ onChange={(e) => {
+ setOnePubParams(
+ {
+ title: e.target.value,
+ },
+ pubItem.account.id,
+ );
+ }}
+ />
+ </div>
+ );
+ },
+ ),
+);
+
+export default CommonTitleInput;
diff --git a/src/components/PublishDialog/compoents/PlatParamsSetting/platParamsSetting.module.scss b/src/components/PublishDialog/compoents/PlatParamsSetting/platParamsSetting.module.scss
index 8370249b..6c9845a3 100644
--- a/src/components/PublishDialog/compoents/PlatParamsSetting/platParamsSetting.module.scss
+++ b/src/components/PublishDialog/compoents/PlatParamsSetting/platParamsSetting.module.scss
@@ -22,10 +22,20 @@
padding-left: 15px;
color: var(--grayColor11);
}
+
+ .platParamsSetting-label {
+ flex-shrink: 0;
+ width: 90px;
+ }
}
}
.platParamsSetting_expand {
display: flex;
align-items: center;
-}
\ No newline at end of file
+}
+
+.commonTitleInput {
+ display: flex;
+ align-items: center;
+}
diff --git a/src/components/PublishDialog/compoents/PlatParamsSetting/plats/BilibParams.tsx b/src/components/PublishDialog/compoents/PlatParamsSetting/plats/BilibParams.tsx
index 30ffdbac..e5b46f37 100644
--- a/src/components/PublishDialog/compoents/PlatParamsSetting/plats/BilibParams.tsx
+++ b/src/components/PublishDialog/compoents/PlatParamsSetting/plats/BilibParams.tsx
@@ -5,6 +5,7 @@ import {
} from "@/components/PublishDialog/compoents/PlatParamsSetting/plats/plats.type";
import PubParmasTextarea from "@/components/PublishDialog/compoents/PubParmasTextarea";
import usePlatParamsCommon from "@/components/PublishDialog/compoents/PlatParamsSetting/hooks/usePlatParamsCoomon";
+import CommonTitleInput from "@/components/PublishDialog/compoents/PlatParamsSetting/common/CommonTitleInput";
const BilibParams = memo(
forwardRef(
@@ -13,7 +14,14 @@ const BilibParams = memo(
return (
<>
- <PubParmasTextarea {...pubParmasTextareaCommonParams} />
+ <PubParmasTextarea
+ {...pubParmasTextareaCommonParams}
+ extend={
+ <>
+ <CommonTitleInput pubItem={pubItem} />
+ </>
+ }
+ />
</>
);
},
diff --git a/src/components/PublishDialog/compoents/PubParmasTextarea/pubCommonComps.module.scss b/src/components/PublishDialog/compoents/PubParmasTextarea/pubCommonComps.module.scss
index e87e52ec..5eb0e8f9 100644
--- a/src/components/PublishDialog/compoents/PubParmasTextarea/pubCommonComps.module.scss
+++ b/src/components/PublishDialog/compoents/PubParmasTextarea/pubCommonComps.module.scss
@@ -124,6 +124,7 @@ $boxHegiht: 110px;
.pubParmasTextarea-other {
border-top: 1px solid var(--grayColor4);
+ padding: 10px 15px;
}
}
}
diff --git a/src/components/PublishDialog/hooks/usePubParamsVerify.tsx b/src/components/PublishDialog/hooks/usePubParamsVerify.tsx
index 285fe392..bf0da1e8 100644
--- a/src/components/PublishDialog/hooks/usePubParamsVerify.tsx
+++ b/src/components/PublishDialog/hooks/usePubParamsVerify.tsx
@@ -36,6 +36,13 @@ export default function usePubParamsVerify(data: PubItem[]) {
});
}
+ // 强制需要标题
+ if (v.account.type === PlatType.BILIBILI && !v.params.title) {
+ return errParamsMapTemp.set(v.account.id, {
+ parErrMsg: "标题是必须的",
+ });
+ }
+
// 快手要求封面必须大于 400x400
if (
v.account?.type === PlatType.KWAI &&
diff --git a/src/components/PublishDialog/index.tsx b/src/components/PublishDialog/index.tsx
index 6300c506..4020f897 100644
--- a/src/components/PublishDialog/index.tsx
+++ b/src/components/PublishDialog/index.tsx
@@ -152,7 +152,7 @@ const PublishDialog = memo(
type: item.params.video?.cover.ossUrl
? PubType.VIDEO
: PubType.ImageText,
- title: "测试视频标题",
+ title: item.params.title || "",
desc: item.params.des,
accountId: item.account.account,
accountType: item.account.type,
diff --git a/src/components/PublishDialog/publishDialog.type.ts b/src/components/PublishDialog/publishDialog.type.ts
index 244cb716..3a0fe001 100644
--- a/src/components/PublishDialog/publishDialog.type.ts
+++ b/src/components/PublishDialog/publishDialog.type.ts
@@ -44,6 +44,8 @@ export interface IPubParams {
video?: IVideoFile;
// 话题
topics?: string[];
+ // 标题
+ title?: string;
}
export interface PubItem {
diff --git a/src/components/PublishDialog/usePublishDialog.ts b/src/components/PublishDialog/usePublishDialog.ts
index 98213587..57365fe1 100644
--- a/src/components/PublishDialog/usePublishDialog.ts
+++ b/src/components/PublishDialog/usePublishDialog.ts
@@ -31,6 +31,7 @@ const store: IPublishDialogStore = {
pubList: [],
step: 0,
commonPubParams: {
+ title: "",
des: "",
video: undefined,
images: [],