Skip to content

Let's use AI to Earn!

独立参数

daoyian55410227c767
diff --git a/.env.production b/.env.production
index 71b1cc37..2e697e09 100644
--- a/.env.production
+++ b/.env.production
@@ -1,4 +1,4 @@
NEXT_PUBLIC_EVN=prod
-NEXT_PUBLIC_API_URL=https://aitoearn.ai/api/
-NEXT_PUBLIC_HOST_URL=https://aitoearn.ai
+NEXT_PUBLIC_API_URL=https://dev.aitoearn.ai/api/
+NEXT_PUBLIC_HOST_URL=https://dev.aitoearn.ai
diff --git a/src/app/i18n/locales/en/account.json b/src/app/i18n/locales/en/account.json
index 8aadd65f..c64e0d56 100644
--- a/src/app/i18n/locales/en/account.json
+++ b/src/app/i18n/locales/en/account.json
@@ -21,5 +21,17 @@
"normal": "Normal",
"disabled": "Disabled",
"unknownPlatform": "Unknown Platform",
- "unknownAccount": "Unknown Account"
+ "unknownAccount": "Unknown Account",
+ "facebookPages": {
+ "title": "Select Facebook Pages",
+ "selectAll": "Select All",
+ "cancel": "Cancel",
+ "confirm": "Confirm",
+ "loading": "Loading...",
+ "noPages": "No pages available",
+ "fetchError": "Failed to fetch pages",
+ "submitError": "Failed to select pages",
+ "submitSuccess": "Pages selected successfully",
+ "selectAtLeastOne": "Please select at least one page"
+ }
}
\ No newline at end of file
diff --git a/src/app/i18n/locales/en/common.json b/src/app/i18n/locales/en/common.json
index e0d8791c..5b0342e9 100644
--- a/src/app/i18n/locales/en/common.json
+++ b/src/app/i18n/locales/en/common.json
@@ -9,6 +9,16 @@
"markAsRead": "Mark as read",
"unreadCount": "Unread messages",
"viewAll": "View all",
+ "actions": {
+ "cancel": "Cancel",
+ "confirm": "Confirm",
+ "selectAll": "Select All",
+ "loading": "Loading...",
+ "noData": "No data",
+ "noImage": "No image",
+ "noDescription": "No description",
+ "noContent": "No content"
+ },
"notificationTypes": {
"system": "System Notification",
"user": "User Notification",
diff --git a/src/app/i18n/locales/zh-CN/account.json b/src/app/i18n/locales/zh-CN/account.json
index 30455d92..b6f182c6 100644
--- a/src/app/i18n/locales/zh-CN/account.json
+++ b/src/app/i18n/locales/zh-CN/account.json
@@ -21,5 +21,17 @@
"normal": "正常",
"disabled": "禁用",
"unknownPlatform": "未知平台",
- "unknownAccount": "未知账户"
+ "unknownAccount": "未知账户",
+ "facebookPages": {
+ "title": "选择Facebook页面",
+ "selectAll": "全选",
+ "cancel": "取消",
+ "confirm": "确认选择",
+ "loading": "加载中...",
+ "noPages": "暂无可用页面",
+ "fetchError": "获取页面列表失败",
+ "submitError": "页面选择失败",
+ "submitSuccess": "页面选择成功",
+ "selectAtLeastOne": "请至少选择一个页面"
+ }
}
\ No newline at end of file
diff --git a/src/app/i18n/locales/zh-CN/common.json b/src/app/i18n/locales/zh-CN/common.json
index d6a03b1b..aba15c26 100644
--- a/src/app/i18n/locales/zh-CN/common.json
+++ b/src/app/i18n/locales/zh-CN/common.json
@@ -9,6 +9,16 @@
"markAsRead": "标记为已读",
"unreadCount": "未读消息",
"viewAll": "查看全部",
+ "actions": {
+ "cancel": "取消",
+ "confirm": "确认",
+ "selectAll": "全选",
+ "loading": "加载中...",
+ "noData": "暂无数据",
+ "noImage": "暂无图片",
+ "noDescription": "暂无描述",
+ "noContent": "暂无内容"
+ },
"notificationTypes": {
"system": "系统通知",
"user": "用户通知",
diff --git a/src/components/FacebookPagesModal/index.tsx b/src/components/FacebookPagesModal/index.tsx
index c21f97c6..a5881738 100644
--- a/src/components/FacebookPagesModal/index.tsx
+++ b/src/components/FacebookPagesModal/index.tsx
@@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react';
import { Modal, Checkbox, List, Button, message, Spin, Avatar } from 'antd';
import { apiGetFacebookPages, apiSubmitFacebookPages } from '@/api/plat/facebook';
import { useAccountStore } from '@/store/account';
+import { useTranslation } from 'react-i18next';
import styles from './index.module.scss';
export interface FacebookPageItem {
@@ -21,6 +22,7 @@ const FacebookPagesModal: React.FC<FacebookPagesModalProps> = ({
onClose,
onSuccess,
}) => {
+ const { t } = useTranslation('account');
const [pages, setPages] = useState<FacebookPageItem[]>([]);
const [selectedPageIds, setSelectedPageIds] = useState<string[]>([]);
const [loading, setLoading] = useState(false);
@@ -35,11 +37,11 @@ const FacebookPagesModal: React.FC<FacebookPagesModalProps> = ({
if (res?.code === 0) {
setPages(res.data || []);
} else {
- message.error('获取页面列表失败');
+ message.error(t('facebookPages.fetchError' as any));
}
} catch (error) {
console.error('获取Facebook页面列表失败:', error);
- message.error('获取页面列表失败');
+ message.error(t('facebookPages.fetchError' as any));
} finally {
setLoading(false);
}
@@ -48,7 +50,7 @@ const FacebookPagesModal: React.FC<FacebookPagesModalProps> = ({
// 提交选择的页面
const handleSubmit = async () => {
if (selectedPageIds.length === 0) {
- message.warning('请至少选择一个页面');
+ message.warning(t('facebookPages.selectAtLeastOne' as any));
return;
}
@@ -56,17 +58,17 @@ const FacebookPagesModal: React.FC<FacebookPagesModalProps> = ({
try {
const res = await apiSubmitFacebookPages(selectedPageIds);
if (res?.code === 0) {
- message.success('页面选择成功');
+ message.success(t('facebookPages.submitSuccess' as any));
// 刷新账户列表
await accountStore.getAccountList();
onSuccess();
onClose();
} else {
- message.error('页面选择失败');
+ message.error(t('facebookPages.submitError' as any));
}
} catch (error) {
console.error('提交页面选择失败:', error);
- message.error('页面选择失败');
+ message.error(t('facebookPages.submitError' as any));
} finally {
setSubmitting(false);
}
@@ -99,12 +101,12 @@ const FacebookPagesModal: React.FC<FacebookPagesModalProps> = ({
return (
<Modal
- title="选择Facebook页面"
+ title={t('facebookPages.title' as any)}
open={open}
onCancel={onClose}
footer={[
<Button key="cancel" onClick={onClose}>
- 取消
+ {t('facebookPages.cancel' as any)}
</Button>,
<Button
key="submit"
@@ -112,7 +114,7 @@ const FacebookPagesModal: React.FC<FacebookPagesModalProps> = ({
loading={submitting}
onClick={handleSubmit}
>
- 确认选择
+ {t('facebookPages.confirm' as any)}
</Button>,
]}
width={600}
@@ -124,7 +126,7 @@ const FacebookPagesModal: React.FC<FacebookPagesModalProps> = ({
indeterminate={selectedPageIds.length > 0 && selectedPageIds.length < pages.length}
onChange={(e) => handleSelectAll(e.target.checked)}
>
- 全选
+ {t('facebookPages.selectAll' as any)}
</Checkbox>
</div>
@@ -152,7 +154,7 @@ const FacebookPagesModal: React.FC<FacebookPagesModalProps> = ({
</List.Item>
)}
locale={{
- emptyText: loading ? '加载中...' : '暂无可用页面',
+ emptyText: loading ? t('facebookPages.loading' as any) : t('facebookPages.noPages' as any),
}}
/>
</Spin>
diff --git a/src/components/PublishDialog/compoents/PlatParamsSetting/index.tsx b/src/components/PublishDialog/compoents/PlatParamsSetting/index.tsx
index f000a1a5..a62e55e7 100644
--- a/src/components/PublishDialog/compoents/PlatParamsSetting/index.tsx
+++ b/src/components/PublishDialog/compoents/PlatParamsSetting/index.tsx
@@ -5,6 +5,7 @@ import { AccountPlatInfoMap, PlatType } from "@/app/config/platConfig";
import BilibParams from "@/components/PublishDialog/compoents/PlatParamsSetting/plats/BilibParams";
import KwaiParams from "@/components/PublishDialog/compoents/PlatParamsSetting/plats/KwaiParams";
import FacebookParams from "@/components/PublishDialog/compoents/PlatParamsSetting/plats/FacebookParams";
+import InstagramParams from "@/components/PublishDialog/compoents/PlatParamsSetting/plats/InstagramParams";
import YouTubeParams from "@/components/PublishDialog/compoents/PlatParamsSetting/plats/YouTubeParams";
import { useShallow } from "zustand/react/shallow";
import { PubItem } from "@/components/PublishDialog/publishDialog.type";
@@ -42,6 +43,8 @@ const PlatParamsSetting = memo(
return <BilibParams pubItem={pubItem} />;
case PlatType.Facebook:
return <FacebookParams pubItem={pubItem} />;
+ case PlatType.Instagram:
+ return <InstagramParams pubItem={pubItem} />;
case PlatType.YouTube:
return <YouTubeParams pubItem={pubItem} />;
default:
diff --git a/src/components/PublishDialog/compoents/PlatParamsSetting/plats/BilibParams.tsx b/src/components/PublishDialog/compoents/PlatParamsSetting/plats/BilibParams.tsx
index 1b3c2444..5bf6891b 100644
--- a/src/components/PublishDialog/compoents/PlatParamsSetting/plats/BilibParams.tsx
+++ b/src/components/PublishDialog/compoents/PlatParamsSetting/plats/BilibParams.tsx
@@ -30,6 +30,23 @@ const BilibParams = memo(
getBilibiliPartitions();
}, [getBilibiliPartitions]);
+ // 初始化Bilibili参数
+ useEffect(() => {
+ const option = pubItem.params.option;
+ if (!option.bilibili) {
+ option.bilibili = {};
+ }
+ if (!option.bilibili.copyright) {
+ option.bilibili.copyright = 1;
+ setOnePubParams(
+ {
+ option,
+ },
+ pubItem.account.id,
+ );
+ }
+ }, [pubItem.account.id]);
+
return (
<>
<PubParmasTextarea
diff --git a/src/components/PublishDialog/compoents/PlatParamsSetting/plats/FacebookParams.tsx b/src/components/PublishDialog/compoents/PlatParamsSetting/plats/FacebookParams.tsx
index bb3ef236..49e2f8b5 100644
--- a/src/components/PublishDialog/compoents/PlatParamsSetting/plats/FacebookParams.tsx
+++ b/src/components/PublishDialog/compoents/PlatParamsSetting/plats/FacebookParams.tsx
@@ -1,4 +1,4 @@
-import { ForwardedRef, forwardRef, memo } from "react";
+import { ForwardedRef, forwardRef, memo, useEffect } from "react";
import {
IPlatsParamsProps,
IPlatsParamsRef,
@@ -17,6 +17,25 @@ const FacebookParams = memo(
const { pubParmasTextareaCommonParams, setOnePubParams } =
usePlatParamsCommon(pubItem);
+ // 初始化Facebook参数
+ useEffect(() => {
+ const option = pubItem.params.option;
+ if (!option.facebook || !option.facebook.content_category) {
+ setOnePubParams(
+ {
+ option: {
+ ...option,
+ facebook: {
+ ...option.facebook,
+ content_category: 'video',
+ },
+ },
+ },
+ pubItem.account.id,
+ );
+ }
+ }, [pubItem.account.id, setOnePubParams]);
+
return (
<>
<PubParmasTextarea
@@ -33,13 +52,15 @@ const FacebookParams = memo(
value={pubItem.params.option.facebook?.content_category || 'video'}
onChange={(e) => {
const option = pubItem.params.option;
- if (!option.facebook) {
- option.facebook = {};
- }
- option.facebook.content_category = e.target.value;
setOnePubParams(
{
- option,
+ option: {
+ ...option,
+ facebook: {
+ ...option.facebook,
+ content_category: e.target.value,
+ },
+ },
},
pubItem.account.id,
);
diff --git a/src/components/PublishDialog/compoents/PlatParamsSetting/plats/InstagramParams.tsx b/src/components/PublishDialog/compoents/PlatParamsSetting/plats/InstagramParams.tsx
new file mode 100644
index 00000000..b57496c3
--- /dev/null
+++ b/src/components/PublishDialog/compoents/PlatParamsSetting/plats/InstagramParams.tsx
@@ -0,0 +1,88 @@
+import { ForwardedRef, forwardRef, memo, useEffect } from "react";
+import {
+ IPlatsParamsProps,
+ IPlatsParamsRef,
+} 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";
+import styles from "../platParamsSetting.module.scss";
+import { Radio } from "antd";
+import { useTransClient } from "@/app/i18n/client";
+
+const InstagramParams = memo(
+ forwardRef(
+ ({ pubItem }: IPlatsParamsProps, ref: ForwardedRef<IPlatsParamsRef>) => {
+ const { t } = useTransClient("publish");
+ const { pubParmasTextareaCommonParams, setOnePubParams } =
+ usePlatParamsCommon(pubItem);
+
+ // 初始化Instagram参数
+ useEffect(() => {
+ const option = pubItem.params.option;
+ console.log('InstagramParams - Current option:', option);
+ console.log('InstagramParams - Current instagram:', option.instagram);
+
+ if (!option.instagram || !option.instagram.content_category) {
+ console.log('InstagramParams - Setting default instagram option');
+ setOnePubParams(
+ {
+ option: {
+ ...option,
+ instagram: {
+ ...option.instagram,
+ content_category: 'video',
+ },
+ },
+ },
+ pubItem.account.id,
+ );
+ }
+ }, [pubItem.account.id, setOnePubParams]);
+
+ return (
+ <>
+ <PubParmasTextarea
+ {...pubParmasTextareaCommonParams}
+ extend={
+ <>
+ <CommonTitleInput pubItem={pubItem} />
+ <div
+ className={styles.commonTitleInput}
+ style={{ marginTop: "10px" }}
+ >
+ <div className="platParamsSetting-label">{t("form.type")}</div>
+ <Radio.Group
+ value={pubItem.params.option.instagram?.content_category || 'video'}
+ onChange={(e) => {
+ const option = pubItem.params.option;
+ console.log('InstagramParams - onChange:', e.target.value);
+ setOnePubParams(
+ {
+ option: {
+ ...option,
+ instagram: {
+ ...option.instagram,
+ content_category: e.target.value,
+ },
+ },
+ },
+ pubItem.account.id,
+ );
+ }}
+ >
+ <Radio value="video">Post</Radio>
+ <Radio value="reel">Reel</Radio>
+ <Radio value="story">Story</Radio>
+ </Radio.Group>
+ </div>
+ </>
+ }
+ />
+ </>
+ );
+ },
+ ),
+);
+
+export default InstagramParams;
\ No newline at end of file
diff --git a/src/components/PublishDialog/compoents/PlatParamsSetting/plats/YouTubeParams.tsx b/src/components/PublishDialog/compoents/PlatParamsSetting/plats/YouTubeParams.tsx
index c56c3f70..7aa4cd9e 100644
--- a/src/components/PublishDialog/compoents/PlatParamsSetting/plats/YouTubeParams.tsx
+++ b/src/components/PublishDialog/compoents/PlatParamsSetting/plats/YouTubeParams.tsx
@@ -37,6 +37,23 @@ const YouTubeParams = memo(
getYouTubeRegions();
}, [getYouTubeRegions]);
+ // 初始化YouTube参数
+ useEffect(() => {
+ const option = pubItem.params.option;
+ if (!option.youtube) {
+ option.youtube = {};
+ }
+ if (!option.youtube.privacyStatus) {
+ option.youtube.privacyStatus = 'public';
+ setOnePubParams(
+ {
+ option,
+ },
+ pubItem.account.id,
+ );
+ }
+ }, [pubItem.account.id]);
+
// 当国区变化时,重新获取视频分类
useEffect(() => {
const regionCode = pubItem.params.option.youtube?.regionCode;
diff --git a/src/components/PublishDialog/compoents/PublishDialogPreview.tsx b/src/components/PublishDialog/compoents/PublishDialogPreview.tsx
index 49dd35e8..34858504 100644
--- a/src/components/PublishDialog/compoents/PublishDialogPreview.tsx
+++ b/src/components/PublishDialog/compoents/PublishDialogPreview.tsx
@@ -5,6 +5,7 @@ import { usePublishDialog } from "@/components/PublishDialog/usePublishDialog";
import { useShallow } from "zustand/react/shallow";
import { Swiper, SwiperSlide } from "swiper/react";
import { Navigation, Pagination } from "swiper/modules";
+import { useTranslation } from "react-i18next";
import "swiper/css";
import "swiper/css/pagination";
@@ -19,6 +20,7 @@ const PublishDialogPreview = memo(
{}: IPublishDialogPreviewProps,
ref: ForwardedRef<IPublishDialogPreviewRef>,
) => {
+ const { t } = useTranslation('publish');
const { expandedPubItem } = usePublishDialog(
useShallow((state) => ({
expandedPubItem: state.expandedPubItem,
@@ -36,7 +38,7 @@ const PublishDialogPreview = memo(
return (
<div className={styles.publishDialogPreview}>
<div className="publishDialogPreview-wrapper">
- <div className="publishDialogPreview-title">预览</div>
+ <div className="publishDialogPreview-title">{t('preview.title')}</div>
{expandedPubItem &&
(expandedPubItem?.params.video ||
expandedPubItem?.params.images?.length !== 0) ? (
@@ -87,7 +89,7 @@ const PublishDialogPreview = memo(
</div>
) : (
<div className="publishDialogPreview-empty">
- <Empty description="在这里看到你的作品预览" />
+ <Empty description={t('preview.emptyDescription')} />
</div>
)}
</div>
diff --git a/src/components/PublishDialog/publishDialog.type.ts b/src/components/PublishDialog/publishDialog.type.ts
index 2c3bd902..3a711bf3 100644
--- a/src/components/PublishDialog/publishDialog.type.ts
+++ b/src/components/PublishDialog/publishDialog.type.ts
@@ -51,6 +51,10 @@ export interface IPlatOption {
// 内容类型:video(Post)、reel(Reel)、story(Story)
content_category?: string;
};
+ instagram?: {
+ // 内容类型:video(Post)、reel(Reel)、story(Story)
+ content_category?: string;
+ };
youtube?: {
// 隐私状态:public、unlisted、private
privacyStatus?: string;
diff --git a/src/components/PublishDialog/usePublishDialog.ts b/src/components/PublishDialog/usePublishDialog.ts
index a3c065ed..92a7a582 100644
--- a/src/components/PublishDialog/usePublishDialog.ts
+++ b/src/components/PublishDialog/usePublishDialog.ts
@@ -44,6 +44,9 @@ const store: IPublishDialogStore = {
facebook: {
page_id: undefined,
},
+ instagram: {
+ content_category: undefined,
+ },
},
},
expandedPubItem: undefined,
@@ -163,8 +166,16 @@ export const usePublishDialog = create(
const findedData = pubList.find((v) => v.account.id === accountId);
if (!findedData) return;
+ // 使用lodash的merge来正确处理嵌套对象
+ if (pubParmas.option) {
+ console.log('Setting option:', pubParmas.option);
+ console.log('Current option:', findedData.params.option);
+ findedData.params.option = lodash.merge({}, findedData.params.option, pubParmas.option);
+ console.log('Merged option:', findedData.params.option);
+ }
+
for (const key in pubParmas) {
- if (pubParmas.hasOwnProperty(key)) {
+ if (pubParmas.hasOwnProperty(key) && key !== 'option') {
(findedData.params as any)[key] = (pubParmas as any)[key];
}
}
diff --git a/src/components/notification/NotificationPanel.tsx b/src/components/notification/NotificationPanel.tsx
index 0314c9e9..c704e7ad 100644
--- a/src/components/notification/NotificationPanel.tsx
+++ b/src/components/notification/NotificationPanel.tsx
@@ -142,10 +142,10 @@ const NotificationPanel: React.FC<NotificationPanelProps> = ({ visible, onClose
onCancel={onClose}
footer={[
<Button key="markAll" onClick={handleMarkAllAsRead} disabled={unreadCount === 0}>
- 全部标记为已读
+ {t('markAllAsRead')}
</Button>,
<Button key="close" onClick={onClose}>
- 关闭
+ {t('actions.cancel')}
</Button>
]}
width={600}
@@ -160,14 +160,14 @@ const NotificationPanel: React.FC<NotificationPanelProps> = ({ visible, onClose
className={`${styles.notificationItem} ${!item.isRead ? styles.unread : ""}`}
actions={[
!item.isRead && (
- <Button
- key="mark"
- type="text"
- size="small"
- icon={<CheckOutlined />}
- onClick={() => handleMarkAsRead(item.id)}
+ <Button
+ key="mark"
+ type="text"
+ size="small"
+ icon={<CheckOutlined />}
+ onClick={() => handleMarkAsRead(item.id)}
>
- 标记为已读
+ {t('markAsRead')}
</Button>
)
]}
@@ -196,7 +196,7 @@ const NotificationPanel: React.FC<NotificationPanelProps> = ({ visible, onClose
size="small"
onClick={() => handleViewDetail(item)}
>
- 查看详情
+ {t('viewAll')}
</Button>
</div>
}
@@ -205,19 +205,19 @@ const NotificationPanel: React.FC<NotificationPanelProps> = ({ visible, onClose
)}
/>
) : (
- <Empty description="暂无消息" />
+ <Empty description={t('noNotifications')} />
)}
</Spin>
</Modal>
{/* 通知详情弹窗 */}
<Modal
- title="通知详情"
+ title={t('notifications')}
open={detailModalVisible}
onCancel={() => setDetailModalVisible(false)}
footer={[
<Button key="close" onClick={() => setDetailModalVisible(false)}>
- 关闭
+ {t('actions.cancel')}
</Button>
]}
width={500}