Skip to content

Let's use AI to Earn!

feat: Delete the preview box on the right side of the post pop-up and add the chat writing assistant

gaoSirb8dc13979599
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index b256ee20..c41df0ef 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,9 +4,15 @@
<option name="autoReloadType" value="NONE" />
</component>
<component name="ChangeListManager">
- <list default="true" id="8ce961ad-7c9e-494c-bc53-9ecde4358af8" name="更改" comment="feat: 1. 站点地图优化">
+ <list default="true" id="8ce961ad-7c9e-494c-bc53-9ecde4358af8" name="更改" comment="fix: Fix the deprecated feature of Modal">
+ <change afterPath="$PROJECT_DIR$/src/components/Chat/index.tsx" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/next-sitemap.config.js" beforeDir="false" afterPath="$PROJECT_DIR$/next-sitemap.config.js" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/appChat/AppChatCore.tsx" beforeDir="false" />
+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/appChat/page.tsx" beforeDir="false" />
+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/material/ai-generate/page.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/material/ai-generate/page.tsx" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/src/components/PublishDialog/compoents/PublishDialogAi.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/PublishDialog/compoents/PublishDialogAi.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.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" />
@@ -98,7 +104,7 @@
&quot;node.js.selected.package.standard&quot;: &quot;&quot;,
&quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
&quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
- &quot;settings.editor.selected.configurable&quot;: &quot;preferences.pluginManager&quot;,
+ &quot;settings.editor.selected.configurable&quot;: &quot;vcs.Git&quot;,
&quot;show.migrate.to.gradle.popup&quot;: &quot;false&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;
@@ -125,11 +131,11 @@
<recent name="E:\project-dev\web\艺咖\aitoearn-web\src\assets\fonts" />
</key>
<key name="MoveFile.RECENT_KEYS">
+ <recent name="E:\project-dev\web\艺咖\aitoearn-web\src\components\PublishDialog\compoents\PublishDialogChat" />
+ <recent name="E:\project-dev\web\艺咖\aitoearn-web\src\components\PublishDialog\compoents" />
<recent name="E:\project-dev\web\艺咖\aitoearn-web\src\app\[lng]\aiRank" />
<recent name="E:\project-dev\web\艺咖\aitoearn-web\src\app\[lng]\hotContent\components\HotEvent\svgs" />
<recent name="E:\project-dev\web\艺咖\aitoearn-web\src\app\[lng]\hotContent\components\HotContent\svgs" />
- <recent name="E:\project-dev\web\艺咖\aitoearn-web\src\app\[lng]\hotContent\svgs" />
- <recent name="E:\project-dev\web\艺咖\aitoearn-web\src\images" />
</key>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="应用程序级" UseSingleDictionary="true" transferred="true" />
@@ -220,22 +226,8 @@
<workItem from="1758505349114" duration="516000" />
<workItem from="1758510004297" duration="4147000" />
<workItem from="1758514243321" duration="7846000" />
- </task>
- <task id="LOCAL-00036" summary="feat: password 密码登录、重置密码,添加md5加密">
- <option name="closed" value="true" />
- <created>1754043972876</created>
- <option name="number" value="00036" />
- <option name="presentableId" value="LOCAL-00036" />
- <option name="project" value="LOCAL" />
- <updated>1754043972876</updated>
- </task>
- <task id="LOCAL-00037" summary="fix: 将之前转发的逻辑改为直连">
- <option name="closed" value="true" />
- <created>1755227480731</created>
- <option name="number" value="00037" />
- <option name="presentableId" value="LOCAL-00037" />
- <option name="project" value="LOCAL" />
- <updated>1755227480731</updated>
+ <workItem from="1760177932390" duration="506000" />
+ <workItem from="1760180248062" duration="1347000" />
</task>
<task id="LOCAL-00038" summary="fix: 删除代理地址">
<option name="closed" value="true" />
@@ -613,7 +605,23 @@
<option name="project" value="LOCAL" />
<updated>1758526826569</updated>
</task>
- <option name="localTasksCounter" value="85" />
+ <task id="LOCAL-00085" summary="fix: fix publish dialog first step&#10; textarea bug">
+ <option name="closed" value="true" />
+ <created>1760091349955</created>
+ <option name="number" value="00085" />
+ <option name="presentableId" value="LOCAL-00085" />
+ <option name="project" value="LOCAL" />
+ <updated>1760091349956</updated>
+ </task>
+ <task id="LOCAL-00086" summary="fix: Fix the deprecated feature of Modal">
+ <option name="closed" value="true" />
+ <created>1760178341130</created>
+ <option name="number" value="00086" />
+ <option name="presentableId" value="LOCAL-00086" />
+ <option name="project" value="LOCAL" />
+ <updated>1760178341130</updated>
+ </task>
+ <option name="localTasksCounter" value="87" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@@ -664,8 +672,6 @@
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
<option name="CHECK_NEW_TODO" value="false" />
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
- <MESSAGE value="feat(热门内容): 恢复新热门内容" />
- <MESSAGE value="feat(热门内容): 添加侧边栏、标签数据、构建获取数据的基本逻辑及缓存逻辑" />
<MESSAGE value="feat(热门内容): 热门内容添加日期选择" />
<MESSAGE value="feat(热门内容): 热门内容添加表格" />
<MESSAGE value="feat(热门内容): 热门内容,抖音、快手、b站、小红书优化完成。视频号数据需要对一下,微信公众号需要分两个,阅读榜、低粉爆文榜" />
@@ -689,6 +695,8 @@
<MESSAGE value="fix: 热门内容边界处理" />
<MESSAGE value="feat: 1. 删除demo。 2. 优化站点地图" />
<MESSAGE value="feat: 1. 站点地图优化" />
- <option name="LAST_COMMIT_MESSAGE" value="feat: 1. 站点地图优化" />
+ <MESSAGE value="fix: fix publish dialog first step&#10; textarea bug" />
+ <MESSAGE value="fix: Fix the deprecated feature of Modal" />
+ <option name="LAST_COMMIT_MESSAGE" value="fix: Fix the deprecated feature of Modal" />
</component>
</project>
\ No newline at end of file
diff --git a/src/app/[lng]/appChat/AppChatCore.tsx b/src/app/[lng]/appChat/AppChatCore.tsx
deleted file mode 100644
index 6d631120..00000000
--- a/src/app/[lng]/appChat/AppChatCore.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-"use client";
-
-import * as React from "react";
-import { useEffect, useState } from "react";
-
-export const AppChatCore = () => {
- const [iframeUrl, setIframeUrl] = useState("");
-
- useEffect(() => {
- setIframeUrl(
- `${
- location.origin.includes("localhost")
- ? "https://dev.aitoearn.ai"
- : location.origin
- }/chat/#/new-chat?mask=100000`,
- );
- }, []);
-
- return <iframe src={iframeUrl} style={{ height: "100%", border: "none" }} />;
-};
diff --git a/src/app/[lng]/appChat/page.tsx b/src/app/[lng]/appChat/page.tsx
deleted file mode 100644
index ca3fa1d9..00000000
--- a/src/app/[lng]/appChat/page.tsx
+++ /dev/null
@@ -1,17 +0,0 @@
-import { PageParams } from "@/app/globals";
-import * as React from "react";
-import { getMetadata } from "@/utils/general";
-import { AppChatCore } from "@/app/[lng]/appChat/AppChatCore";
-
-export async function generateMetadata({ params }: PageParams) {
- return await getMetadata(
- {
- title: "Chat",
- },
- "en",
- );
-}
-
-export default function Page({ params }: PageParams) {
- return <AppChatCore />;
-}
diff --git a/src/app/[lng]/material/ai-generate/page.tsx b/src/app/[lng]/material/ai-generate/page.tsx
index 51d9b477..85a0023f 100644
--- a/src/app/[lng]/material/ai-generate/page.tsx
+++ b/src/app/[lng]/material/ai-generate/page.tsx
@@ -11,7 +11,7 @@ import { uploadToOss } from "@/api/oss";
import { getMediaGroupList, createMedia } from "@/api/media";
import { useTransClient } from "@/app/i18n/client";
import { md2CardTemplates, defaultMarkdown } from "./md2card";
-import { AppChatCore } from "@/app/[lng]/appChat/AppChatCore";
+import Chat from "@/components/Chat";
const { TextArea } = Input;
const { Option } = Select;
@@ -758,7 +758,7 @@ export default function AIGeneratePage() {
{activeImageTab === 'chat' && (
<div className={styles.chatSection}>
<div className={styles.chatContainer}>
- <AppChatCore />
+ <Chat defaultMask='100000' />
</div>
</div>
)}
diff --git a/src/components/Chat/index.tsx b/src/components/Chat/index.tsx
new file mode 100644
index 00000000..53993b46
--- /dev/null
+++ b/src/components/Chat/index.tsx
@@ -0,0 +1,33 @@
+import { ForwardedRef, forwardRef, memo, useEffect, useState } from "react";
+import * as React from "react";
+
+export interface IChatRef {}
+
+export interface IChatProps {
+ defaultMask?: string;
+}
+
+const Chat = memo(
+ forwardRef(({ defaultMask }: IChatProps, ref: ForwardedRef<IChatRef>) => {
+ const [iframeUrl, setIframeUrl] = useState("");
+
+ useEffect(() => {
+ setIframeUrl(
+ `${
+ location.origin.includes("localhost")
+ ? "https://dev.aitoearn.ai"
+ : location.origin
+ }/chat/#/new-chat?mask=${defaultMask}`,
+ );
+ }, []);
+
+ return (
+ <iframe
+ src={iframeUrl}
+ style={{ height: "100%", border: "none", width: "100%" }}
+ />
+ );
+ }),
+);
+
+export default Chat;
diff --git a/src/components/PublishDialog/compoents/PublishDialogAi.tsx b/src/components/PublishDialog/compoents/PublishDialogAi.tsx
index 31058e33..364044bb 100644
--- a/src/components/PublishDialog/compoents/PublishDialogAi.tsx
+++ b/src/components/PublishDialog/compoents/PublishDialogAi.tsx
@@ -1,5 +1,6 @@
import { ForwardedRef, forwardRef, memo } from "react";
import styles from "../publishDialog.module.scss";
+import Chat from "@/components/Chat";
export interface IPublishDialogAiRef {}
@@ -11,7 +12,10 @@ const PublishDialogAi = memo(
({}: IPublishDialogAiProps, ref: ForwardedRef<IPublishDialogAiRef>) => {
return (
<div className={styles.publishDialogAi}>
- <div className="publishDialogAi-wrapper">AI写作</div>
+ <h1>写作助手</h1>
+ <div className="publishDialogAi-wrapper">
+ <Chat />
+ </div>
</div>
);
},
diff --git a/src/components/PublishDialog/index.tsx b/src/components/PublishDialog/index.tsx
index dc44306d..078769b5 100644
--- a/src/components/PublishDialog/index.tsx
+++ b/src/components/PublishDialog/index.tsx
@@ -20,7 +20,6 @@ import {
InfoCircleOutlined,
} from "@ant-design/icons";
import PublishDialogAi from "@/components/PublishDialog/compoents/PublishDialogAi";
-import PublishDialogPreview from "@/components/PublishDialog/compoents/PublishDialogPreview";
import { CSSTransition } from "react-transition-group";
import { SocialAccount } from "@/api/types/account.type";
import { AccountPlatInfoMap } from "@/app/config/platConfig";
@@ -51,7 +50,10 @@ import { bilibiliSkip } from "@/app/[lng]/accounts/plat/BilibiliLogin";
import { youtubeSkip } from "@/app/[lng]/accounts/plat/YoutubeLogin";
import { twitterSkip } from "@/app/[lng]/accounts/plat/TwtterLogin";
import { tiktokSkip } from "@/app/[lng]/accounts/plat/TiktokLogin";
-import { facebookSkip, FacebookPagesModal } from "@/app/[lng]/accounts/plat/FacebookLogin";
+import {
+ facebookSkip,
+ FacebookPagesModal,
+} from "@/app/[lng]/accounts/plat/FacebookLogin";
import { instagramSkip } from "@/app/[lng]/accounts/plat/InstagramLogin";
import { threadsSkip } from "@/app/[lng]/accounts/plat/ThreadsLogin";
import { wxGzhSkip } from "@/app/[lng]/accounts/plat/WxGzh";
@@ -129,95 +131,104 @@ const PublishDialog = memo(
const [createLoading, setCreateLoading] = useState(false);
// 内容安全检测状态
const [moderationLoading, setModerationLoading] = useState(false);
- const [moderationResult, setModerationResult] = useState<boolean | null>(null);
+ const [moderationResult, setModerationResult] = useState<boolean | null>(
+ null,
+ );
const [moderationDesc, setModerationDesc] = useState<string>("");
const [moderationLevel, setModerationLevel] = useState<any>(null);
// 下载App弹窗状态
const [downloadModalVisible, setDownloadModalVisible] = useState(false);
- const [currentPlatform, setCurrentPlatform] = useState<string>('');
+ const [currentPlatform, setCurrentPlatform] = useState<string>("");
// Facebook页面选择弹窗状态
- const [showFacebookPagesModal, setShowFacebookPagesModal] = useState(false);
+ const [showFacebookPagesModal, setShowFacebookPagesModal] =
+ useState(false);
const { t } = useTransClient("publish");
const router = useRouter();
-
+
// 获取账户store
const { accountGroupList, getAccountList } = useAccountStore(
useShallow((state) => ({
accountGroupList: state.accountGroupList,
getAccountList: state.getAccountList,
- }))
+ })),
);
// 处理离线账户头像点击,直接跳转到对应平台授权页面
- const handleOfflineAvatarClick = useCallback(async (account: SocialAccount) => {
- const platform = account.type;
- const targetSpaceId = account.groupId; // 使用账户原本的空间ID
-
- try {
- // 记录授权前的账号数量,用于后续识别新账号
- const beforeAuthCount = accountGroupList.reduce((total, group) => total + group.children.length, 0);
+ const handleOfflineAvatarClick = useCallback(
+ async (account: SocialAccount) => {
+ const platform = account.type;
+ const targetSpaceId = account.groupId; // 使用账户原本的空间ID
- // 根据平台类型调用对应的授权函数,传递目标空间ID
- switch (platform) {
- case PlatType.KWAI:
- await kwaiSkip(platform, targetSpaceId);
- break;
- case PlatType.BILIBILI:
- await bilibiliSkip(platform, targetSpaceId);
- break;
- case PlatType.YouTube:
- await youtubeSkip(platform, targetSpaceId);
- break;
- case PlatType.Twitter:
- await twitterSkip(platform, targetSpaceId);
- break;
- case PlatType.Tiktok:
- await tiktokSkip(platform, targetSpaceId);
- break;
- case PlatType.Facebook:
+ try {
+ // 记录授权前的账号数量,用于后续识别新账号
+ const beforeAuthCount = accountGroupList.reduce(
+ (total, group) => total + group.children.length,
+ 0,
+ );
+
+ // 根据平台类型调用对应的授权函数,传递目标空间ID
+ switch (platform) {
+ case PlatType.KWAI:
+ await kwaiSkip(platform, targetSpaceId);
+ break;
+ case PlatType.BILIBILI:
+ await bilibiliSkip(platform, targetSpaceId);
+ break;
+ case PlatType.YouTube:
+ await youtubeSkip(platform, targetSpaceId);
+ break;
+ case PlatType.Twitter:
+ await twitterSkip(platform, targetSpaceId);
+ break;
+ case PlatType.Tiktok:
+ await tiktokSkip(platform, targetSpaceId);
+ break;
+ case PlatType.Facebook:
+ try {
+ await facebookSkip(platform, targetSpaceId);
+ // Facebook授权成功后显示页面选择弹窗
+ handleFacebookAuthSuccess();
+ } catch (error) {
+ console.error("Facebook授权失败:", error);
+ }
+ break;
+ case PlatType.Instagram:
+ await instagramSkip(platform, targetSpaceId);
+ break;
+ case PlatType.Threads:
+ await threadsSkip(platform, targetSpaceId);
+ break;
+ case PlatType.WxGzh:
+ await wxGzhSkip(platform, targetSpaceId);
+ break;
+ case PlatType.Pinterest:
+ await pinterestSkip(platform, targetSpaceId);
+ break;
+ case PlatType.LinkedIn:
+ await linkedinSkip(platform, targetSpaceId);
+ break;
+ default:
+ console.warn(`未支持的平台类型: ${platform}`);
+ message.warning(`暂不支持 ${platform} 平台的直接授权`);
+ return;
+ }
+
+ // 授权完成后刷新账号列表
+ setTimeout(async () => {
try {
- await facebookSkip(platform, targetSpaceId);
- // Facebook授权成功后显示页面选择弹窗
- handleFacebookAuthSuccess();
+ await getAccountList();
+ console.log("账号列表已刷新");
} catch (error) {
- console.error('Facebook授权失败:', error);
+ console.error("刷新账号列表失败:", error);
}
- break;
- case PlatType.Instagram:
- await instagramSkip(platform, targetSpaceId);
- break;
- case PlatType.Threads:
- await threadsSkip(platform, targetSpaceId);
- break;
- case PlatType.WxGzh:
- await wxGzhSkip(platform, targetSpaceId);
- break;
- case PlatType.Pinterest:
- await pinterestSkip(platform, targetSpaceId);
- break;
- case PlatType.LinkedIn:
- await linkedinSkip(platform, targetSpaceId);
- break;
- default:
- console.warn(`未支持的平台类型: ${platform}`);
- message.warning(`暂不支持 ${platform} 平台的直接授权`);
- return;
+ }, 3000); // 等待3秒让授权完成
+ } catch (error) {
+ console.error("授权失败:", error);
+ message.error("授权失败,请重试");
}
-
- // 授权完成后刷新账号列表
- setTimeout(async () => {
- try {
- await getAccountList();
- console.log('账号列表已刷新');
- } catch (error) {
- console.error('刷新账号列表失败:', error);
- }
- }, 3000); // 等待3秒让授权完成
- } catch (error) {
- console.error('授权失败:', error);
- message.error('授权失败,请重试');
- }
- }, [accountGroupList, getAccountList]);
+ },
+ [accountGroupList, getAccountList],
+ );
// 处理Facebook授权成功后的页面选择
const handleFacebookAuthSuccess = () => {
@@ -246,24 +257,28 @@ const PublishDialog = memo(
message.warning("请先输入内容");
return;
}
-
+
try {
setModerationLoading(true);
setModerationResult(null);
setModerationDesc("");
setModerationLevel(null);
const result = await toolsApi.textModeration(contentToCheck);
- console.log("result",result);
-
+ console.log("result", result);
+
if (result?.code === 0) {
- const data: any = result?.data || {} as any;
- const descriptions: string = (data && (data.descriptions as string)) || "";
+ const data: any = result?.data || ({} as any);
+ const descriptions: string =
+ (data && (data.descriptions as string)) || "";
const labels: string = (data && (data.labels as string)) || "";
- const reason: any = (data && (data.reason ? JSON.parse(data.reason) : ""));
+ const reason: any =
+ data && (data.reason ? JSON.parse(data.reason) : "");
const isSafe = !descriptions && !labels && !reason;
setModerationResult(isSafe);
setModerationLevel(reason);
- setModerationDesc(isSafe ? "" : (descriptions || reason || "内容不安全"));
+ setModerationDesc(
+ isSafe ? "" : descriptions || reason || "内容不安全",
+ );
if (isSafe) {
message.success("内容安全");
} else {
@@ -283,9 +298,13 @@ const PublishDialog = memo(
if (step === 0 && pubListChoosed.length >= 2) {
return !!(commonPubParams.des && commonPubParams.des.trim());
} else if (step === 1 && expandedPubItem) {
- return !!(expandedPubItem.params.des && expandedPubItem.params.des.trim());
+ return !!(
+ expandedPubItem.params.des && expandedPubItem.params.des.trim()
+ );
} else if (pubListChoosed.length === 1) {
- return !!(pubListChoosed[0].params.des && pubListChoosed[0].params.des.trim());
+ return !!(
+ pubListChoosed[0].params.des && pubListChoosed[0].params.des.trim()
+ );
}
return false;
}, [step, pubListChoosed, commonPubParams, expandedPubItem]);
@@ -295,7 +314,11 @@ const PublishDialog = memo(
setModerationResult(null);
setModerationDesc("");
setModerationLevel(null);
- }, [commonPubParams.des, expandedPubItem?.params.des, pubListChoosed.map(item => item.params.des).join(',')]);
+ }, [
+ commonPubParams.des,
+ expandedPubItem?.params.des,
+ pubListChoosed.map((item) => item.params.des).join(","),
+ ]);
// 当内容被清空时,也重置检测状态
useEffect(() => {
@@ -456,7 +479,9 @@ const PublishDialog = memo(
// 离线账号(status === 0)不可参与发布:如被默认选中则自动移除
useEffect(() => {
- const filtered = pubListChoosed.filter((item) => item.account.status !== 0);
+ const filtered = pubListChoosed.filter(
+ (item) => item.account.status !== 0,
+ );
if (filtered.length !== pubListChoosed.length) {
setPubListChoosed(filtered);
}
@@ -603,8 +628,14 @@ const PublishDialog = memo(
accountType: item.account.type,
videoUrl: item.params.video?.ossUrl,
coverUrl:
- item.params.video?.cover.ossUrl || (item.params.images && item.params.images.length > 0 ? item.params.images[0].ossUrl : undefined),
- imgUrlList: item.params.images?.map((v) => v.ossUrl).filter((url): url is string => url !== undefined) || [],
+ item.params.video?.cover.ossUrl ||
+ (item.params.images && item.params.images.length > 0
+ ? item.params.images[0].ossUrl
+ : undefined),
+ imgUrlList:
+ item.params.images
+ ?.map((v) => v.ossUrl)
+ .filter((url): url is string => url !== undefined) || [],
publishTime,
option: item.params.option,
});
@@ -686,8 +717,7 @@ const PublishDialog = memo(
</div>
</div>
<div className="publishDialog-con-acconts">
- {pubList
- .map((pubItem) => {
+ {pubList.map((pubItem) => {
const platConfig = AccountPlatInfoMap.get(
pubItem.account.type,
)!;
@@ -695,19 +725,21 @@ const PublishDialog = memo(
(v) => v.account.id === pubItem.account.id,
);
const isOffline = pubItem.account.status === 0;
- const isPcNotSupported = platConfig && platConfig.pcNoThis === true;
- const isTikTokForbidden = pubItem.account.type === PlatType.Tiktok;
+ const isPcNotSupported =
+ platConfig && platConfig.pcNoThis === true;
+ const isTikTokForbidden =
+ pubItem.account.type === PlatType.Tiktok;
return (
<Tooltip
title={
isTikTokForbidden
- ? t('tips.tiktokForbidden' as any)
- : isPcNotSupported
- ? t('tips.pcNotSupported' as any)
- : isOffline
- ? t('tips.accountOffline' as any)
- : undefined
+ ? t("tips.tiktokForbidden" as any)
+ : isPcNotSupported
+ ? t("tips.pcNotSupported" as any)
+ : isOffline
+ ? t("tips.accountOffline" as any)
+ : undefined
}
key={pubItem.account.id}
>
@@ -724,143 +756,145 @@ const PublishDialog = memo(
: "transparent",
}}
onClick={(e) => {
- e.stopPropagation();
- // TikTok 禁止发布,直接禁止点击
- if (isTikTokForbidden) {
- return;
- }
- // 离线账户的点击由头像容器处理,这里不处理
- if (isOffline) {
- return;
- }
- if (isPcNotSupported) {
- setCurrentPlatform(platConfig?.name || '');
- setDownloadModalVisible(true);
- return;
- }
- const newPubListChoosed = [...pubListChoosed];
- // 查找当前账户是否已被选择
- const index = newPubListChoosed.findIndex(
- (v) => v.account.id === pubItem.account.id,
- );
- if (index !== -1) {
- newPubListChoosed.splice(index, 1);
- } else {
- newPubListChoosed.push(pubItem);
- }
- // 是否自动回到第一步
- if (newPubListChoosed.length === 0 && step === 1) {
- const isBack = newPubListChoosed.every(
- (v) =>
- !v.params.des &&
- !v.params.video &&
- !v.params.images?.length,
- );
- if (isBack) {
- setStep(0);
+ e.stopPropagation();
+ // TikTok 禁止发布,直接禁止点击
+ if (isTikTokForbidden) {
+ return;
+ }
+ // 离线账户的点击由头像容器处理,这里不处理
+ if (isOffline) {
+ return;
}
- }
- // 是否自动前往第二步
- if (step === 0 && newPubListChoosed.length !== 0) {
- const isFront = newPubListChoosed.every(
- (v) =>
- v.params.des ||
- v.params.video ||
- v.params.images?.length !== 0,
+ if (isPcNotSupported) {
+ setCurrentPlatform(platConfig?.name || "");
+ setDownloadModalVisible(true);
+ return;
+ }
+ const newPubListChoosed = [...pubListChoosed];
+ // 查找当前账户是否已被选择
+ const index = newPubListChoosed.findIndex(
+ (v) => v.account.id === pubItem.account.id,
);
- if (isFront) {
- setStep(1);
+ if (index !== -1) {
+ newPubListChoosed.splice(index, 1);
+ } else {
+ newPubListChoosed.push(pubItem);
}
- }
- if (newPubListChoosed.length === 1) {
- setExpandedPubItem(newPubListChoosed[0]);
- }
- setPubListChoosed(newPubListChoosed);
- }}
- >
- {/* 账号头像:离线或PC不支持显示遮罩并禁用 */}
- <div
- style={{ position: "relative" }}
-
- >
- <AvatarPlat
- className={`publishDialog-con-acconts-item-avatar ${!isChoosed || isOffline || isPcNotSupported || isTikTokForbidden ? 'disabled' : ''}`}
- account={pubItem.account}
- size="large"
- disabled={isOffline || !isChoosed || isPcNotSupported || isTikTokForbidden}
- />
- {isTikTokForbidden && (
- <div
- style={{
- position: "absolute",
- inset: 0,
- background: "rgba(0,0,0,0.6)",
- borderRadius: "50%",
- display: "flex",
- alignItems: "center",
- justifyContent: "center",
- color: "#fff",
- fontSize: 12,
- fontWeight: 600,
- pointerEvents: "none",
- }}
- >
- {t('badges.forbidden' as any)}
- </div>
- )}
- {isOffline && (
- <div
- onClick={(e) => {
- // TikTok 禁止发布:不允许任何点击
- if (isTikTokForbidden) {
- return;
+ // 是否自动回到第一步
+ if (newPubListChoosed.length === 0 && step === 1) {
+ const isBack = newPubListChoosed.every(
+ (v) =>
+ !v.params.des &&
+ !v.params.video &&
+ !v.params.images?.length,
+ );
+ if (isBack) {
+ setStep(0);
}
- // 只有离线账户才触发授权跳转
- if (isOffline) {
- handleOfflineAvatarClick(pubItem.account);
+ }
+ // 是否自动前往第二步
+ if (step === 0 && newPubListChoosed.length !== 0) {
+ const isFront = newPubListChoosed.every(
+ (v) =>
+ v.params.des ||
+ v.params.video ||
+ v.params.images?.length !== 0,
+ );
+ if (isFront) {
+ setStep(1);
}
- // 正常账户的点击事件由父容器处理,这里不需要额外处理
- }}
- style={{
- position: "absolute",
- inset: 0,
- background: "rgba(0,0,0,0.45)",
- borderRadius: "50%",
- display: "flex",
- alignItems: "center",
- justifyContent: "center",
- color: "#fff",
- fontSize: 12,
- fontWeight: 600,
- pointerEvents: "auto",
- cursor: "pointer",
- }}
- >
- {t('badges.offline' as any)}
- </div>
- )}
- {isPcNotSupported && !isOffline && (
- <div
- style={{
- position: "absolute",
- inset: 0,
- background: "rgba(0,0,0,0.6)",
- borderRadius: "50%",
- display: "flex",
- alignItems: "center",
- justifyContent: "center",
- color: "#fff",
- fontSize: 10,
- fontWeight: 600,
- pointerEvents: "none",
- textAlign: "center",
- lineHeight: 1.2,
- }}
- >
- APP
- </div>
- )}
- </div>
+ }
+ if (newPubListChoosed.length === 1) {
+ setExpandedPubItem(newPubListChoosed[0]);
+ }
+ setPubListChoosed(newPubListChoosed);
+ }}
+ >
+ {/* 账号头像:离线或PC不支持显示遮罩并禁用 */}
+ <div style={{ position: "relative" }}>
+ <AvatarPlat
+ className={`publishDialog-con-acconts-item-avatar ${!isChoosed || isOffline || isPcNotSupported || isTikTokForbidden ? "disabled" : ""}`}
+ account={pubItem.account}
+ size="large"
+ disabled={
+ isOffline ||
+ !isChoosed ||
+ isPcNotSupported ||
+ isTikTokForbidden
+ }
+ />
+ {isTikTokForbidden && (
+ <div
+ style={{
+ position: "absolute",
+ inset: 0,
+ background: "rgba(0,0,0,0.6)",
+ borderRadius: "50%",
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "center",
+ color: "#fff",
+ fontSize: 12,
+ fontWeight: 600,
+ pointerEvents: "none",
+ }}
+ >
+ {t("badges.forbidden" as any)}
+ </div>
+ )}
+ {isOffline && (
+ <div
+ onClick={(e) => {
+ // TikTok 禁止发布:不允许任何点击
+ if (isTikTokForbidden) {
+ return;
+ }
+ // 只有离线账户才触发授权跳转
+ if (isOffline) {
+ handleOfflineAvatarClick(pubItem.account);
+ }
+ // 正常账户的点击事件由父容器处理,这里不需要额外处理
+ }}
+ style={{
+ position: "absolute",
+ inset: 0,
+ background: "rgba(0,0,0,0.45)",
+ borderRadius: "50%",
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "center",
+ color: "#fff",
+ fontSize: 12,
+ fontWeight: 600,
+ pointerEvents: "auto",
+ cursor: "pointer",
+ }}
+ >
+ {t("badges.offline" as any)}
+ </div>
+ )}
+ {isPcNotSupported && !isOffline && (
+ <div
+ style={{
+ position: "absolute",
+ inset: 0,
+ background: "rgba(0,0,0,0.6)",
+ borderRadius: "50%",
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "center",
+ color: "#fff",
+ fontSize: 10,
+ fontWeight: 600,
+ pointerEvents: "none",
+ textAlign: "center",
+ lineHeight: 1.2,
+ }}
+ >
+ APP
+ </div>
+ )}
+ </div>
</div>
</Tooltip>
);
@@ -918,7 +952,10 @@ const PublishDialog = memo(
>
<PublishDialogDataPicker />
- <div className="publishDialog-footer-btns" style={{ display: 'flex', flexDirection: 'row', gap: 12 }}>
+ <div
+ className="publishDialog-footer-btns"
+ style={{ display: "flex", flexDirection: "row", gap: 12 }}
+ >
{step === 0 && pubListChoosed.length >= 2 ? (
<Button
size="large"
@@ -932,21 +969,50 @@ const PublishDialog = memo(
</Button>
) : (
<>
- <div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
+ <div
+ style={{
+ display: "flex",
+ alignItems: "center",
+ gap: 12,
+ }}
+ >
{moderationResult !== null && (
- <div style={{ display: 'flex', flexDirection: 'column' }}>
- <span style={{
- fontSize: 14,
- color: moderationResult ? '#52c41a' : '#ff4d4f',
- fontWeight: 500,
- }}>
- {moderationResult ? t('actions.contentSafe' as any) : (moderationLevel?.riskLevel ? `${t('actions.riskLevel' as any)} ${moderationLevel.riskLevel}` : t('actions.contentUnsafe' as any))}
+ <div
+ style={{ display: "flex", flexDirection: "column" }}
+ >
+ <span
+ style={{
+ fontSize: 14,
+ color: moderationResult ? "#52c41a" : "#ff4d4f",
+ fontWeight: 500,
+ }}
+ >
+ {moderationResult
+ ? t("actions.contentSafe" as any)
+ : moderationLevel?.riskLevel
+ ? `${t("actions.riskLevel" as any)} ${moderationLevel.riskLevel}`
+ : t("actions.contentUnsafe" as any)}
</span>
{!moderationResult && !!moderationDesc && (
- <span style={{ fontSize: 12, color: '#ff4d4f', maxWidth: 360, whiteSpace: 'pre-wrap', display: 'inline-flex', alignItems: 'center', gap: 6 }}>
+ <span
+ style={{
+ fontSize: 12,
+ color: "#ff4d4f",
+ maxWidth: 360,
+ whiteSpace: "pre-wrap",
+ display: "inline-flex",
+ alignItems: "center",
+ gap: 6,
+ }}
+ >
{moderationDesc}
- <Tooltip title={moderationLevel?.riskTips || ''} placement="top">
- <InfoCircleOutlined style={{ color: '#ff4d4f' }} />
+ <Tooltip
+ title={moderationLevel?.riskTips || ""}
+ placement="top"
+ >
+ <InfoCircleOutlined
+ style={{ color: "#ff4d4f" }}
+ />
</Tooltip>
</span>
)}
@@ -958,19 +1024,40 @@ const PublishDialog = memo(
size="large"
loading={moderationLoading}
onClick={handleContentModeration}
- type={moderationResult === true ? "primary" : moderationResult === false ? "default" : "default"}
+ type={
+ moderationResult === true
+ ? "primary"
+ : moderationResult === false
+ ? "default"
+ : "default"
+ }
style={{
- backgroundColor: moderationResult === true ? '#52c41a' : moderationResult === false ? '#ff4d4f' : undefined,
- borderColor: moderationResult === true ? '#52c41a' : moderationResult === false ? '#ff4d4f' : undefined,
- color: moderationResult === true || moderationResult === false ? '#fff' : undefined
+ backgroundColor:
+ moderationResult === true
+ ? "#52c41a"
+ : moderationResult === false
+ ? "#ff4d4f"
+ : undefined,
+ borderColor:
+ moderationResult === true
+ ? "#52c41a"
+ : moderationResult === false
+ ? "#ff4d4f"
+ : undefined,
+ color:
+ moderationResult === true ||
+ moderationResult === false
+ ? "#fff"
+ : undefined,
}}
>
- {moderationLoading ? t('actions.checkingContent' as any) : t('actions.contentModeration' as any)}
+ {moderationLoading
+ ? t("actions.checkingContent" as any)
+ : t("actions.contentModeration" as any)}
</Button>
)}
-
</div>
- <div style={{ display: 'flex', gap: 12 }}>
+ <div style={{ display: "flex", gap: 12 }}>
<Button size="large" onClick={closeDialog}>
{t("buttons.cancelPublish")}
</Button>
@@ -1009,7 +1096,7 @@ const PublishDialog = memo(
classNames="right"
unmountOnExit
>
- <PublishDialogPreview />
+ <PublishDialogAi />
</CSSTransition>
</Modal>
@@ -1018,7 +1105,11 @@ const PublishDialog = memo(
open={draftModalOpen}
onCancel={() => setDraftModalOpen(false)}
footer={null}
- title={selectedGroup ? t("draft.selectDraftItem") : t("draft.selectDraftGroup")}
+ title={
+ selectedGroup
+ ? t("draft.selectDraftItem")
+ : t("draft.selectDraftGroup")
+ }
width={720}
>
{!selectedGroup ? (
@@ -1180,7 +1271,11 @@ const PublishDialog = memo(
open={libraryModalOpen}
onCancel={() => setLibraryModalOpen(false)}
footer={null}
- title={selectedLibraryGroup ? t("draft.selectLibraryItem") : t("draft.selectLibraryGroup")}
+ title={
+ selectedLibraryGroup
+ ? t("draft.selectLibraryItem")
+ : t("draft.selectLibraryGroup")
+ }
width={720}
>
{!selectedLibraryGroup ? (
@@ -1257,7 +1352,9 @@ const PublishDialog = memo(
item.type === "img" ? "#52c41a" : "#1890ff",
}}
>
- {item.type === "img" ? t("draft.imageGroup") : t("draft.videoGroup")}
+ {item.type === "img"
+ ? t("draft.imageGroup")
+ : t("draft.videoGroup")}
</div>
</div>
</List.Item>
diff --git a/src/components/PublishDialog/publishDialog.module.scss b/src/components/PublishDialog/publishDialog.module.scss
index 2742caef..16183f49 100644
--- a/src/components/PublishDialog/publishDialog.module.scss
+++ b/src/components/PublishDialog/publishDialog.module.scss
@@ -1,4 +1,4 @@
-$assistantWidth: 330px;
+$assistantWidth: 400px;
.publishDialog {
width: auto !important;
@@ -135,10 +135,20 @@ $assistantWidth: 330px;
}
.publishDialogAi {
- margin-right: 15px;
+ display: flex;
+ flex-direction: column;
+ margin-left: 15px;
:global {
+ h1 {
+ font-size: var(--fs-md);
+ font-weight: 600;
+ text-align: left;
+ padding: 15px 0 0 15px;
+ }
.publishDialogAi-wrapper {
min-width: $assistantWidth;
+ height: 100%;
+ min-height: 0;
}
}
}