Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
强制传参
daoyian5691267fe664
diff --git a/src/components/PublishDialog/compoents/PlatParamsSetting/common/CommonTitleInput.tsx b/src/components/PublishDialog/compoents/PlatParamsSetting/common/CommonTitleInput.tsxindex 977b8478..650c9db6 100644--- a/src/components/PublishDialog/compoents/PlatParamsSetting/common/CommonTitleInput.tsx+++ b/src/components/PublishDialog/compoents/PlatParamsSetting/common/CommonTitleInput.tsx@@ -1,7 +1,7 @@import { ForwardedRef, forwardRef, memo, useMemo } from "react";import styles from "../platParamsSetting.module.scss";import { Input } from "antd";-import { AccountPlatInfoMap } from "@/app/config/platConfig";+import { AccountPlatInfoMap, PlatType } from "@/app/config/platConfig";import { PubItem } from "@/components/PublishDialog/publishDialog.type";import { usePublishDialog } from "@/components/PublishDialog/usePublishDialog";import { useShallow } from "zustand/react/shallow";@@ -31,9 +31,15 @@ const CommonTitleInput = memo(})),);+ // 判断是否需要显示必填标识+ const isRequired = pubItem.account.type === PlatType.Pinterest;+return (<div className={styles.commonTitleInput}>- <div className="platParamsSetting-label">{t("form.title")}</div>+ <div className="platParamsSetting-label">+ {t("form.title")}+ {isRequired && <span style={{ color: "#ff4d4f", marginLeft: "4px" }}>*</span>}+ </div><Inputvalue={pubItem.params.title}maxLength={platConfig.commonPubParamsConfig.titleMax || 20}diff --git a/src/components/PublishDialog/compoents/PlatParamsSetting/plats/PinterestParams.tsx b/src/components/PublishDialog/compoents/PlatParamsSetting/plats/PinterestParams.tsxindex 7df13f35..2d70eb28 100644--- a/src/components/PublishDialog/compoents/PlatParamsSetting/plats/PinterestParams.tsx+++ b/src/components/PublishDialog/compoents/PlatParamsSetting/plats/PinterestParams.tsx@@ -166,7 +166,10 @@ const PinterestParams = memo(className={`${styles.commonTitleInput} ${styles.tooltipOverride}`}style={{ marginTop: "10px" }}>- <div className="platParamsSetting-label">{t("pin.selectBoard")}</div>+ <div className="platParamsSetting-label">+ {t("pin.selectBoard")}+ <span style={{ color: "#ff4d4f", marginLeft: "4px" }}>*</span>+ </div><div style={{ display: "flex", alignItems: "center", gap: "8px" }}><Buttonicon={<PushpinOutlined />}diff --git a/src/components/PublishDialog/hooks/usePubParamsVerify.tsx b/src/components/PublishDialog/hooks/usePubParamsVerify.tsxindex 3474a1b6..73322d79 100644--- a/src/components/PublishDialog/hooks/usePubParamsVerify.tsx+++ b/src/components/PublishDialog/hooks/usePubParamsVerify.tsx@@ -189,6 +189,10 @@ export default function usePubParamsVerify(data: PubItem[]) {// Pinterest的强制校验if (v.account.type === PlatType.Pinterest) {+ // 强制需要标题+ if (!v.params.title) {+ return setErrorMsg(t("validation.titleRequired"));+ }// 强制需要选择Boardif (!v.params.option.pinterest?.boardId) {return setErrorMsg(t("validation.boardRequired"));