Skip to content

Let's use AI to Earn!

feat: 1. 【发布作品弹框】填写发布参数时未选中的账户参数自动填写。 2. 【发布作品弹框】切换步骤0->1保持展开状态

gaoSirf803c73c9871
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 7e793ea3..38fc1af3 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,11 +4,10 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
- <list default="true" id="90ed3383-49aa-4e32-95a2-9f070c0da49b" name="更改" comment="feat: 【发布弹框】参数校验完成">
+ <list default="true" id="90ed3383-49aa-4e32-95a2-9f070c0da49b" name="更改" comment="fix: 【PubParmasTextarea.tsx】修复了初始化后会执行onChange的bug">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/src/components/PublishDialog/compoents/PubParmasTextarea/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/PublishDialog/compoents/PubParmasTextarea/index.tsx" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/src/components/PublishDialog/publishDialog.module.scss" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/PublishDialog/publishDialog.module.scss" 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/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" />
@@ -108,7 +107,7 @@
<workItem from="1750932869295" duration="11763000" />
<workItem from="1750989950480" duration="7000" />
<workItem from="1750989966702" duration="688000" />
- <workItem from="1751010085244" duration="2357000" />
+ <workItem from="1751010085244" duration="5249000" />
</task>
<task id="LOCAL-00001" summary="feat: 日历完善">
<option name="closed" value="true" />
@@ -222,7 +221,15 @@
<option name="project" value="LOCAL" />
<updated>1750945952212</updated>
</task>
- <option name="localTasksCounter" value="15" />
+ <task id="LOCAL-00015" summary="fix: 【PubParmasTextarea.tsx】修复了初始化后会执行onChange的bug">
+ <option name="closed" value="true" />
+ <created>1751013073544</created>
+ <option name="number" value="00015" />
+ <option name="presentableId" value="LOCAL-00015" />
+ <option name="project" value="LOCAL" />
+ <updated>1751013073544</updated>
+ </task>
+ <option name="localTasksCounter" value="16" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@@ -256,6 +263,7 @@
<MESSAGE value="feat: 【发布弹框】精细化参数处理" />
<MESSAGE value="feat: 【发布弹框】展开和隐藏、光标自动聚焦和自动到最后一位" />
<MESSAGE value="feat: 【发布弹框】参数校验完成" />
- <option name="LAST_COMMIT_MESSAGE" value="feat: 【发布弹框】参数校验完成" />
+ <MESSAGE value="fix: 【PubParmasTextarea.tsx】修复了初始化后会执行onChange的bug" />
+ <option name="LAST_COMMIT_MESSAGE" value="fix: 【PubParmasTextarea.tsx】修复了初始化后会执行onChange的bug" />
</component>
</project>
\ No newline at end of file
diff --git a/src/components/PublishDialog/index.tsx b/src/components/PublishDialog/index.tsx
index 5e7dd569..dbbec2f0 100644
--- a/src/components/PublishDialog/index.tsx
+++ b/src/components/PublishDialog/index.tsx
@@ -203,6 +203,9 @@ const PublishDialog = memo(
setStep(1);
}
}
+ if (newPubListChoosed.length === 1) {
+ setExpandedPubItem(newPubListChoosed[0]);
+ }
setPubListChoosed(newPubListChoosed);
}}
>
@@ -269,6 +272,7 @@ const PublishDialog = memo(
<Button
size="large"
onClick={() => {
+ setExpandedPubItem(undefined);
setStep(1);
}}
>
diff --git a/src/components/PublishDialog/usePublishDialog.ts b/src/components/PublishDialog/usePublishDialog.ts
index 23785ae4..2021cb4e 100644
--- a/src/components/PublishDialog/usePublishDialog.ts
+++ b/src/components/PublishDialog/usePublishDialog.ts
@@ -17,7 +17,7 @@ export interface IPublishDialogStore {
commonPubParams: IPubParams;
// 当前步骤,0=所有账号没有参数,要设置参数。 1=所有账号有参数,详细设置参数
step: number;
- // 第二部时需要,展开的账户参数
+ // 第二步时需要,展开的账户参数
expandedPubItem?: PubItem;
// 错误提示
errParamsMap?: ErrPubParamsMapType;
@@ -98,6 +98,7 @@ export const usePublishDialog = create(
setAccountAllParams(pubParmas: Partial<IPubParams>) {
const pubList = [...get().pubList];
const commonPubParams = { ...get().commonPubParams };
+ let pubListChoosed = [...get().pubListChoosed];
for (const key in commonPubParams) {
if (pubParmas.hasOwnProperty(key)) {
@@ -110,9 +111,16 @@ export const usePublishDialog = create(
}
}
+ pubListChoosed = pubListChoosed.map((v) => {
+ const findData = pubList.find((k) => k.account.id === v.account.id);
+ if (findData) return findData;
+ return v;
+ });
+
set({
pubList,
commonPubParams,
+ pubListChoosed,
});
},
@@ -129,6 +137,14 @@ export const usePublishDialog = create(
}
}
+ pubList.map((v) => {
+ if (!pubListChoosed.some((k) => k.account.id === v.account.id)) {
+ v.params.des = pubParmas.des || "";
+ v.params.video = pubParmas.video;
+ v.params.images = pubParmas.images;
+ }
+ });
+
pubListChoosed = pubListChoosed.map((v) => {
const findData = pubList.find((k) => k.account.id === v.account.id);
if (findData) return findData;