Skip to content

Let's use AI to Earn!

fix: 【PubParmasTextarea.tsx】修复了初始化后会执行onChange的bug

gaoSirb8bda8e596ee
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index dd069e27..7e793ea3 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,17 +4,11 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
- <list default="true" id="90ed3383-49aa-4e32-95a2-9f070c0da49b" name="更改" comment="feat: 【发布弹框】展开和隐藏、光标自动聚焦和自动到最后一位">
- <change afterPath="$PROJECT_DIR$/src/components/PublishDialog/hooks/usePubParamsVerify.tsx" afterDir="false" />
- <change afterPath="$PROJECT_DIR$/src/components/PublishDialog/publishDialog.type.ts" afterDir="false" />
+ <list default="true" id="90ed3383-49aa-4e32-95a2-9f070c0da49b" name="更改" comment="feat: 【发布弹框】参数校验完成">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/src/components/PublishDialog/compoents/PlatParamsSetting/hooks/usePlatParamsCoomon.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/PublishDialog/compoents/PlatParamsSetting/hooks/usePlatParamsCoomon.tsx" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/src/components/PublishDialog/compoents/PlatParamsSetting/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/PublishDialog/compoents/PlatParamsSetting/index.tsx" 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$/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/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/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" />
+ <change beforePath="$PROJECT_DIR$/src/components/PublishDialog/publishDialog.module.scss" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/PublishDialog/publishDialog.module.scss" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -49,27 +43,27 @@
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
- <component name="PropertiesComponent"><![CDATA[{
- "keyToString": {
- "ASKED_ADD_EXTERNAL_FILES": "true",
- "ASKED_MARK_IGNORED_FILES_AS_EXCLUDED": "true",
- "ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
- "RunOnceActivity.ShowReadmeOnStart": "true",
- "SHARE_PROJECT_CONFIGURATION_FILES": "true",
- "git-widget-placeholder": "master",
- "ignore.virus.scanning.warn.message": "true",
- "last_opened_file_path": "E:/project-dev/web/艺咖/aitoearn-web/src/components/PublishDialog/hooks",
- "node.js.detected.package.eslint": "true",
- "node.js.detected.package.tslint": "true",
- "node.js.selected.package.eslint": "(autodetect)",
- "node.js.selected.package.tslint": "(autodetect)",
- "nodejs_package_manager_path": "npm",
- "run.code.analysis.last.selected.profile": "pProject Default",
- "settings.editor.selected.configurable": "editor.reader.mode",
- "ts.external.directory.path": "E:\\project-dev\\web\\艺咖\\aitoearn-web\\node_modules\\typescript\\lib",
- "vue.rearranger.settings.migration": "true"
+ <component name="PropertiesComponent">{
+ &quot;keyToString&quot;: {
+ &quot;ASKED_ADD_EXTERNAL_FILES&quot;: &quot;true&quot;,
+ &quot;ASKED_MARK_IGNORED_FILES_AS_EXCLUDED&quot;: &quot;true&quot;,
+ &quot;ASKED_SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;,
+ &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
+ &quot;SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;,
+ &quot;git-widget-placeholder&quot;: &quot;master&quot;,
+ &quot;ignore.virus.scanning.warn.message&quot;: &quot;true&quot;,
+ &quot;last_opened_file_path&quot;: &quot;E:/project-dev/web/艺咖/aitoearn-web/src/components/PublishDialog/hooks&quot;,
+ &quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
+ &quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
+ &quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
+ &quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
+ &quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
+ &quot;run.code.analysis.last.selected.profile&quot;: &quot;pProject Default&quot;,
+ &quot;settings.editor.selected.configurable&quot;: &quot;editor.reader.mode&quot;,
+ &quot;ts.external.directory.path&quot;: &quot;E:\\project-dev\\web\\艺咖\\aitoearn-web\\node_modules\\typescript\\lib&quot;,
+ &quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
}
-}]]></component>
+}</component>
<component name="ReactBuddySettings">
<option name="extensionsIgnore" value="true" />
</component>
@@ -111,7 +105,10 @@
<workItem from="1750763342070" duration="32000" />
<workItem from="1750763376065" duration="41000" />
<workItem from="1750763426455" duration="38708000" />
- <workItem from="1750932869295" duration="11532000" />
+ <workItem from="1750932869295" duration="11763000" />
+ <workItem from="1750989950480" duration="7000" />
+ <workItem from="1750989966702" duration="688000" />
+ <workItem from="1751010085244" duration="2357000" />
</task>
<task id="LOCAL-00001" summary="feat: 日历完善">
<option name="closed" value="true" />
@@ -217,7 +214,15 @@
<option name="project" value="LOCAL" />
<updated>1750940945665</updated>
</task>
- <option name="localTasksCounter" value="14" />
+ <task id="LOCAL-00014" summary="feat: 【发布弹框】参数校验完成">
+ <option name="closed" value="true" />
+ <created>1750945952212</created>
+ <option name="number" value="00014" />
+ <option name="presentableId" value="LOCAL-00014" />
+ <option name="project" value="LOCAL" />
+ <updated>1750945952212</updated>
+ </task>
+ <option name="localTasksCounter" value="15" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@@ -250,6 +255,7 @@
<MESSAGE value="feat: 发布弹框整体设计" />
<MESSAGE value="feat: 【发布弹框】精细化参数处理" />
<MESSAGE value="feat: 【发布弹框】展开和隐藏、光标自动聚焦和自动到最后一位" />
- <option name="LAST_COMMIT_MESSAGE" value="feat: 【发布弹框】展开和隐藏、光标自动聚焦和自动到最后一位" />
+ <MESSAGE value="feat: 【发布弹框】参数校验完成" />
+ <option name="LAST_COMMIT_MESSAGE" value="feat: 【发布弹框】参数校验完成" />
</component>
</project>
\ No newline at end of file
diff --git a/package.json b/package.json
index dc4f6028..656cbe4e 100644
--- a/package.json
+++ b/package.json
@@ -4,8 +4,7 @@
"private": true,
"scripts": {
"postbuild": "next-sitemap",
- "dev": "next dev -p 6060",
- "dev:https": "next dev -p 6060 --experimental-https",
+ "dev": "next dev -p 6060 --experimental-https",
"build": "tsc && next build",
"start": "next start",
"lint": "next lint",
diff --git a/src/components/PublishDialog/compoents/PubParmasTextarea/index.tsx b/src/components/PublishDialog/compoents/PubParmasTextarea/index.tsx
index 884e25a8..724ff7b2 100644
--- a/src/components/PublishDialog/compoents/PubParmasTextarea/index.tsx
+++ b/src/components/PublishDialog/compoents/PubParmasTextarea/index.tsx
@@ -67,7 +67,7 @@ const PubParmasTextarea = memo(
imageFileListValue = [],
videoFileValue,
desValue = "",
- beforeExtend
+ beforeExtend,
}: IPubParmasTextareaProps,
ref: ForwardedRef<IPubParmasTextareaRef>,
) => {
@@ -85,8 +85,16 @@ const PubParmasTextarea = memo(
// 裁剪弹框
const [videoCoverSetingModal, setVideoCoverSetingModal] = useState(false);
const textareaRef = useRef<TextAreaRef>(null);
+ const isFirst = useRef({
+ effect: true,
+ sort: true,
+ });
useEffect(() => {
+ if (isFirst.current.effect) {
+ isFirst.current.effect = false;
+ return;
+ }
const values = {
imgs: imageFileList,
video: videoFile,
@@ -271,7 +279,13 @@ const PubParmasTextarea = memo(
className="pubParmasTextarea-uploads"
list={imageFileList}
animation={250}
- setList={setImageFileList}
+ setList={(newList) => {
+ if (isFirst.current.sort) {
+ isFirst.current.sort = false;
+ return;
+ }
+ setImageFileList(newList);
+ }}
scrollSensitivity={100}
scrollSpeed={15}
id="id"
diff --git a/src/components/PublishDialog/publishDialog.module.scss b/src/components/PublishDialog/publishDialog.module.scss
index 8d7e006c..f0efe072 100644
--- a/src/components/PublishDialog/publishDialog.module.scss
+++ b/src/components/PublishDialog/publishDialog.module.scss
@@ -131,6 +131,7 @@ $assistantWidth: 300px;
margin-left: 15px;
:global {
.publishDialogPreview-wrapper {
+ text-align: left;
min-width: $assistantWidth;
display: flex;
flex-direction: column;