Skip to content

Let's use AI to Earn!

通知zh

bulaienaofutuojiesenzhang9c5ef1206f3a
diff --git a/src/app/i18n/locales/zh-CN/notification.json b/src/app/i18n/locales/zh-CN/notification.json
new file mode 100644
index 00000000..499c8997
--- /dev/null
+++ b/src/app/i18n/locales/zh-CN/notification.json
@@ -0,0 +1,89 @@
+{
+ "title": "消息通知",
+ "detailTitle": "通知详情",
+ "markAllAsRead": "全部标记为已读",
+ "markAsRead": "标记为已读",
+ "delete": "删除",
+ "close": "关闭",
+ "noNotifications": "暂无通知",
+ "confirmDelete": "确定要删除这条通知吗?",
+ "confirm": "确定",
+ "cancel": "取消",
+ "deleteSuccess": "删除成功",
+ "deleteFailed": "删除失败",
+ "markSuccess": "标记成功",
+ "markFailed": "标记失败",
+ "markAllSuccess": "全部标记成功",
+ "getNotificationListFailed": "获取通知列表失败",
+ "getNotificationDetailFailed": "获取通知详情失败",
+ "createTime": "创建时间",
+ "readTime": "已读时间",
+ "taskDetail": "任务详情",
+ "acceptTask": "接受任务",
+ "noTaskDetails": "暂无任务详情",
+ "taskProcessing": "任务处理中...",
+ "acceptingTask": "正在接受任务...",
+ "publishingTask": "正在发布任务...",
+ "submittingTask": "正在提交任务...",
+ "taskCompleted": "任务完成",
+ "taskProcessFailed": "任务处理失败",
+ "acceptTaskFailed": "接受任务失败",
+ "publishTaskFailed": "发布任务失败",
+ "submitTaskFailed": "提交任务失败",
+ "getTaskDetailFailed": "获取任务详情失败",
+ "accountInfoFailed": "账号信息获取失败",
+ "appRequiredNotice": "⚠️ 注意:",
+ "appRequiredMessage": "发布账号({{platform}})的任务需要在移动端App中操作,请下载对应App后继续。",
+ "mediaPreview": "媒体预览",
+ "pageInfo": "第 {{start}}-{{end}} 条,共 {{total}} 条",
+ "notificationTypes": {
+ "system": "系统通知",
+ "user": "用户通知",
+ "material": "素材通知",
+ "task_reminder": "任务提醒",
+ "other": "其他通知"
+ },
+ "taskStatus": {
+ "active": "进行中",
+ "inactive": "已结束"
+ },
+ "taskInfo": {
+ "description": "描述",
+ "publisherAccount": "发布账号",
+ "reward": "奖励",
+ "taskType": "任务类型"
+ },
+ "taskTypes": {
+ "video": "视频",
+ "article": "图文",
+ "article2": "纯文字"
+ },
+ "platforms": {
+ "tiktok": "TikTok",
+ "youtube": "YouTube",
+ "twitter": "Twitter",
+ "bilibili": "哔哩哔哩",
+ "KWAI": "快手",
+ "douyin": "抖音",
+ "xhs": "小红书",
+ "wxSph": "微信视频号",
+ "wxGzh": "微信公众号",
+ "facebook": "Facebook",
+ "instagram": "Instagram",
+ "threads": "Threads",
+ "pinterest": "Pinterest"
+ },
+ "time": {
+ "justNow": "刚刚",
+ "minutesAgo": "{{minutes}}分钟前",
+ "hoursAgo": "{{hours}}小时前",
+ "daysAgo": "{{days}}天前"
+ },
+ "accountSelect": {
+ "title": "选择发布账号",
+ "description": "请选择用于发布任务的账号:",
+ "noAccounts": "没有符合条件的账号,请先添加账号",
+ "accountId": "账号ID",
+ "description": "描述"
+ }
+}
diff --git a/src/components/notification/NotificationPanel.tsx b/src/components/notification/NotificationPanel.tsx
index ccf67192..dd0e7244 100644
--- a/src/components/notification/NotificationPanel.tsx
+++ b/src/components/notification/NotificationPanel.tsx
@@ -35,7 +35,7 @@ interface NotificationPanelProps {
}
const NotificationPanel: React.FC<NotificationPanelProps> = ({ visible, onClose }) => {
- const { t } = useTransClient("common");
+ const { t } = useTransClient("notification" as any);
const token = useUserStore((state) => state.token);
const router = useRouter();
const { lng } = useParams();
@@ -44,7 +44,7 @@ const NotificationPanel: React.FC<NotificationPanelProps> = ({ visible, onClose
const [unreadCount, setUnreadCount] = useState(0);
const [notificationPagination, setNotificationPagination] = useState({
current: 1,
- pageSize: 20,
+ pageSize: 10,
total: 0
});
const [selectedNotification, setSelectedNotification] = useState<NotificationItem | null>(null);
@@ -76,13 +76,18 @@ const NotificationPanel: React.FC<NotificationPanelProps> = ({ visible, onClose
const [taskProgress, setTaskProgress] = useState({
currentStep: 0,
steps: [
- { title: '正在接受任务...', status: 'processing' },
- { title: '正在发布任务...', status: 'wait' },
- { title: '正在提交任务...', status: 'wait' },
- { title: '任务完成', status: 'wait' }
+ { title: t('acceptingTask' as any), status: 'processing' },
+ { title: t('publishingTask' as any), status: 'wait' },
+ { title: t('submittingTask' as any), status: 'wait' },
+ { title: t('taskCompleted' as any), status: 'wait' }
]
});
+ // 账号选择弹窗状态
+ const [accountSelectVisible, setAccountSelectVisible] = useState(false);
+ const [availableAccounts, setAvailableAccounts] = useState<SocialAccount[]>([]);
+ const [selectedAccount, setSelectedAccount] = useState<SocialAccount | null>(null);
+
// 获取通知列表
const fetchNotifications = async (page: number = 1, pageSize: number = 20) => {
// 如果没有登录信息,不发送请求
@@ -103,7 +108,7 @@ const NotificationPanel: React.FC<NotificationPanelProps> = ({ visible, onClose
}));
}
} catch (error) {
- message.error("获取通知列表失败");
+ message.error(t('getNotificationListFailed'));
} finally {
setLoading(false);
}
@@ -148,11 +153,11 @@ const NotificationPanel: React.FC<NotificationPanelProps> = ({ visible, onClose
const handleMarkAsRead = async (id: string) => {
try {
await markNotificationAsRead([id]);
- message.success("标记成功");
+ message.success(t('markSuccess'));
fetchNotifications();
fetchUnreadCount();
} catch (error) {
- message.error("标记失败");
+ message.error(t('markFailed'));
}
};
@@ -160,11 +165,11 @@ const NotificationPanel: React.FC<NotificationPanelProps> = ({ visible, onClose
const handleMarkAllAsRead = async () => {
try {
await markAllNotificationsAsRead();
- message.success("全部标记成功");
+ message.success(t('markAllSuccess'));
fetchNotifications();
fetchUnreadCount();
} catch (error) {
- message.error("标记失败");
+ message.error(t('markFailed'));
}
};
@@ -187,10 +192,10 @@ const NotificationPanel: React.FC<NotificationPanelProps> = ({ visible, onClose
handleMarkAsRead(notification.id);
}
} else {
- message.error("获取通知详情失败");
+ message.error(t('getNotificationDetailFailed'));
}
} catch (error) {
- message.error("获取通知详情失败");
+ message.error(t('getNotificationDetailFailed'));
console.error("获取通知详情失败:", error);
}
};
@@ -203,17 +208,17 @@ const NotificationPanel: React.FC<NotificationPanelProps> = ({ visible, onClose
if (response && response.data && response.code === 0) {
setSelectedTask(response.data);
} else {
- console.error("获取任务详情失败");
+ console.error(t('getTaskDetailFailed'));
}
} catch (error) {
- console.error("获取任务详情失败:", error);
+ console.error(t('getTaskDetailFailed'), error);
} finally {
setTaskLoading(false);
}
};
// 接受任务
- const handleAcceptTask = async () => {
+ const handleAcceptTask = async (account?: SocialAccount) => {
if (!selectedTask) return;
// 显示进度弹窗
@@ -237,14 +242,15 @@ const NotificationPanel: React.FC<NotificationPanelProps> = ({ visible, onClose
...prev,
currentStep: 1,
steps: [
- { title: '正在接受任务...', status: 'finish' },
- { title: '正在发布任务...', status: 'processing' },
- { title: '发布完成', status: 'wait' }
+ { title: t('acceptingTask' as any), status: 'finish' },
+ { title: t('publishingTask' as any), status: 'processing' },
+ { title: t('taskCompleted' as any), status: 'wait' }
]
}));
// 第二步:发布任务
- const publishAccount = getAccountById(selectedTask.accountId);
+ // 优先使用传入的账号,其次使用任务指定的账号
+ const publishAccount = account || getAccountById(selectedTask.accountId);
if (publishAccount) {
// 处理素材链接,确保使用完整链接
const processedMaterials = selectedTask.materials?.map((material: any) => ({
@@ -284,10 +290,10 @@ const NotificationPanel: React.FC<NotificationPanelProps> = ({ visible, onClose
...prev,
currentStep: 2,
steps: [
- { title: '正在接受任务...', status: 'finish' },
- { title: '正在发布任务...', status: 'finish' },
- { title: '正在提交任务...', status: 'processing' },
- { title: '任务完成', status: 'wait' }
+ { title: t('acceptingTask' as any), status: 'finish' },
+ { title: t('publishingTask' as any), status: 'finish' },
+ { title: t('submittingTask' as any), status: 'processing' },
+ { title: t('taskCompleted' as any), status: 'wait' }
]
}));
@@ -302,10 +308,10 @@ const NotificationPanel: React.FC<NotificationPanelProps> = ({ visible, onClose
...prev,
currentStep: 3,
steps: [
- { title: '正在接受任务...', status: 'finish' },
- { title: '正在发布任务...', status: 'finish' },
- { title: '正在提交任务...', status: 'finish' },
- { title: '任务完成', status: 'finish' }
+ { title: t('acceptingTask' as any), status: 'finish' },
+ { title: t('publishingTask' as any), status: 'finish' },
+ { title: t('submittingTask' as any), status: 'finish' },
+ { title: t('taskCompleted' as any), status: 'finish' }
]
}));
@@ -330,14 +336,14 @@ const NotificationPanel: React.FC<NotificationPanelProps> = ({ visible, onClose
}
} catch (error) {
console.error("任务处理失败:", error);
- message.error("任务处理失败");
+ message.error(t('taskProcessFailed'));
setTaskProgressVisible(false);
}
};
// 检查任务类型并显示相应的操作提示
const handleTaskAction = (task: TaskItem) => {
- // 根据发布账号类型判断PC是否能接任务
+ // 如果任务指定了账号,使用指定账号的逻辑
if (task.accountId) {
const publishAccount = getAccountById(task.accountId);
if (publishAccount) {
@@ -360,38 +366,51 @@ const NotificationPanel: React.FC<NotificationPanelProps> = ({ visible, onClose
return;
}
}
+
+ // 直接使用指定账号接受任务
+ handleAcceptTask(publishAccount);
+ return;
}
}
- // 如果没有发布账号信息,回退到原来的逻辑
- if (!task.accountTypes || task.accountTypes.length === 0) {
- // 没有账号类型限制,直接接取任务
- handleAcceptTask();
+ // 如果没有指定账号,需要用户选择账号
+ const availableAccounts = getAvailableAccounts(task.accountTypes || []);
+
+ if (availableAccounts.length === 0) {
+ message.error(t('accountSelect.noAccounts' as any));
return;
}
-
- // 检查需要App操作的平台
- const appRequiredPlatforms = getTasksRequiringApp(task.accountTypes);
- if (appRequiredPlatforms.length > 0) {
- // 有需要App操作的平台,显示第一个平台的下载提示
- const firstPlatform = appRequiredPlatforms[0];
- const config = getAppDownloadConfig(firstPlatform);
+ if (availableAccounts.length === 1) {
+ // 只有一个符合条件的账号,直接使用
+ const account = availableAccounts[0];
- if (config) {
- setDownloadAppConfig({
- platform: config.platform,
- appName: config.appName,
- downloadUrl: config.downloadUrl,
- qrCodeUrl: config.qrCodeUrl
- });
- setDownloadAppVisible(true);
- return;
+ // 检查是否需要App操作
+ const appRequiredPlatforms = getTasksRequiringApp([account.type]);
+ if (appRequiredPlatforms.length > 0) {
+ const firstPlatform = appRequiredPlatforms[0];
+ const config = getAppDownloadConfig(firstPlatform);
+
+ if (config) {
+ setDownloadAppConfig({
+ platform: config.platform,
+ appName: config.appName,
+ downloadUrl: config.downloadUrl,
+ qrCodeUrl: config.qrCodeUrl
+ });
+ setDownloadAppVisible(true);
+ return;
+ }
}
+
+ // 直接使用这个账号接受任务
+ handleAcceptTask(account);
+ return;
}
- // 其他任务类型正常接取
- handleAcceptTask();
+ // 多个符合条件的账号,显示选择弹窗
+ setAvailableAccounts(availableAccounts);
+ setAccountSelectVisible(true);
};
// 格式化时间
@@ -403,21 +422,21 @@ const NotificationPanel: React.FC<NotificationPanelProps> = ({ visible, onClose
const hours = Math.floor(diff / (1000 * 60 * 60));
const days = Math.floor(diff / (1000 * 60 * 60 * 24));
- if (minutes < 1) return "刚刚";
- if (minutes < 60) return `${minutes}分钟前`;
- if (hours < 24) return `${hours}小时前`;
- if (days < 7) return `${days}天前`;
+ if (minutes < 1) return t('time.justNow' as any);
+ if (minutes < 60) return t('time.minutesAgo' as any, { minutes });
+ if (hours < 24) return t('time.hoursAgo' as any, { hours });
+ if (days < 7) return t('time.daysAgo' as any, { days });
return date.toLocaleDateString();
};
// 获取通知类型文本
const getNotificationTypeText = (type: string) => {
const typeMap: Record<string, string> = {
- system: "系统通知",
- user: "用户通知",
- material: "素材通知",
- task_reminder: "任务提醒",
- other: "其他通知"
+ system: t('notificationTypes.system' as any),
+ user: t('notificationTypes.user' as any),
+ material: t('notificationTypes.material' as any),
+ task_reminder: t('notificationTypes.task_reminder' as any),
+ other: t('notificationTypes.other' as any)
};
return typeMap[type] || type;
};
@@ -438,11 +457,11 @@ const NotificationPanel: React.FC<NotificationPanelProps> = ({ visible, onClose
const handleDeleteNotification = async (id: string) => {
try {
await deleteNotifications([id]);
- message.success("删除成功");
+ message.success(t('deleteSuccess'));
fetchNotifications();
fetchUnreadCount();
} catch (error) {
- message.error("删除失败");
+ message.error(t('deleteFailed'));
}
};
@@ -454,21 +473,21 @@ const NotificationPanel: React.FC<NotificationPanelProps> = ({ visible, onClose
return type;
}
- // 中文显示名称
+ // 使用国际化显示名称
const platformNames: Record<string, string> = {
- 'tiktok': 'TikTok',
- 'youtube': 'YouTube',
- 'twitter': 'Twitter',
- 'bilibili': '哔哩哔哩',
- 'KWAI': '快手',
- 'douyin': '抖音',
- 'xhs': '小红书',
- 'wxSph': '微信视频号',
- 'wxGzh': '微信公众号',
- 'facebook': 'Facebook',
- 'instagram': 'Instagram',
- 'threads': 'Threads',
- 'pinterest': 'Pinterest',
+ 'tiktok': t('platforms.tiktok' as any),
+ 'youtube': t('platforms.youtube' as any),
+ 'twitter': t('platforms.twitter' as any),
+ 'bilibili': t('platforms.bilibili' as any),
+ 'KWAI': t('platforms.KWAI' as any),
+ 'douyin': t('platforms.douyin' as any),
+ 'xhs': t('platforms.xhs' as any),
+ 'wxSph': t('platforms.wxSph' as any),
+ 'wxGzh': t('platforms.wxGzh' as any),
+ 'facebook': t('platforms.facebook' as any),
+ 'instagram': t('platforms.instagram' as any),
+ 'threads': t('platforms.threads' as any),
+ 'pinterest': t('platforms.pinterest' as any),
};
return platformNames[type] || type;
};
@@ -476,9 +495,9 @@ const NotificationPanel: React.FC<NotificationPanelProps> = ({ visible, onClose
// 获取任务类型显示名称
const getTaskTypeName = (type: string) => {
const taskTypeNames: Record<string, string> = {
- 'video': '视频',
- 'article': '图文',
- 'article2': '纯文字',
+ 'video': t('taskTypes.video' as any),
+ 'article': t('taskTypes.article' as any),
+ 'article2': t('taskTypes.article2' as any),
};
return taskTypeNames[type] || type;
};
@@ -488,6 +507,14 @@ const NotificationPanel: React.FC<NotificationPanelProps> = ({ visible, onClose
return accountList.find(account => account.id === accountId) || null;
};
+ // 获取符合条件的账号列表
+ const getAvailableAccounts = (accountTypes: string[]): SocialAccount[] => {
+ if (!accountTypes || accountTypes.length === 0) {
+ return accountList; // 如果没有类型限制,返回所有账号
+ }
+ return accountList.filter(account => accountTypes.includes(account.type));
+ };
+
// 处理媒体点击
const handleMediaClick = (media: any, materialTitle?: string, materialCoverUrl?: string) => {
if (media.type === 'video') {
@@ -533,6 +560,33 @@ const NotificationPanel: React.FC<NotificationPanelProps> = ({ visible, onClose
fetchNotifications(page, pageSize || notificationPagination.pageSize);
};
+ // 处理账号选择
+ const handleAccountSelect = (account: SocialAccount) => {
+ setSelectedAccount(account);
+ setAccountSelectVisible(false);
+
+ // 检查是否需要App操作
+ const appRequiredPlatforms = getTasksRequiringApp([account.type]);
+ if (appRequiredPlatforms.length > 0) {
+ const firstPlatform = appRequiredPlatforms[0];
+ const config = getAppDownloadConfig(firstPlatform);
+
+ if (config) {
+ setDownloadAppConfig({
+ platform: config.platform,
+ appName: config.appName,
+ downloadUrl: config.downloadUrl,
+ qrCodeUrl: config.qrCodeUrl
+ });
+ setDownloadAppVisible(true);
+ return;
+ }
+ }
+
+ // 使用选择的账号接受任务
+ handleAcceptTask(account);
+ };
+
useEffect(() => {
if (visible) {
fetchNotifications();
@@ -547,7 +601,7 @@ const NotificationPanel: React.FC<NotificationPanelProps> = ({ visible, onClose
title={
<div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
<Badge count={unreadCount} size="small">
- <span style={{ fontSize: '16px', fontWeight: '600' }}>消息通知</span>
+ <span style={{ fontSize: '16px', fontWeight: '600' }}>{t('title')}</span>
</Badge>
</div>
}
@@ -558,7 +612,7 @@ const NotificationPanel: React.FC<NotificationPanelProps> = ({ visible, onClose
{t('markAllAsRead')}
</Button>,
<Button key="close" onClick={onClose}>
- {t('actions.cancel')}
+ {t('cancel')}
</Button>
]}
width={700}
@@ -584,7 +638,7 @@ const NotificationPanel: React.FC<NotificationPanelProps> = ({ visible, onClose
onChange: handleNotificationPageChange,
showSizeChanger: true,
showQuickJumper: true,
- showTotal: (total, range) => `第 ${range[0]}-${range[1]} 条,共 ${total} 条`,
+ showTotal: (total, range) => t('pageInfo' as any, { start: range[0], end: range[1], total }),
pageSizeOptions: ['10', '20', '50', '100']
}}
renderItem={(item) => (
@@ -597,68 +651,70 @@ const NotificationPanel: React.FC<NotificationPanelProps> = ({ visible, onClose
type="text"
size="small"
icon={<CheckOutlined />}
- onClick={() => handleMarkAsRead(item.id)}
+ onClick={(e) => {
+ e.stopPropagation();
+ handleMarkAsRead(item.id);
+ }}
>
{t('markAsRead')}
</Button>
),
<Popconfirm
key="delete"
- title="确定要删除这条通知吗?"
+ title={t('confirmDelete')}
onConfirm={() => handleDeleteNotification(item.id)}
- okText="确定"
- cancelText="取消"
+ okText={t('confirm')}
+ cancelText={t('cancel')}
>
<Button
type="text"
size="small"
danger
icon={<DeleteOutlined />}
+ onClick={(e) => e.stopPropagation()}
>
- 删除
+ {t('delete')}
</Button>
</Popconfirm>
]}
>
- <List.Item.Meta
- title={
- <div className={styles.notificationTitle}>
- <span>{item.title}</span>
- {item.status === 'unread' && <Badge status="processing" />}
- </div>
- }
- description={
- <div className={styles.notificationContent}>
- <div className={styles.notificationMeta}>
- <Tag color={getNotificationTypeColor(item.type)}>
- {getNotificationTypeText(item.type)}
- </Tag>
- <span className={styles.time}>
- <ClockCircleOutlined style={{ marginRight: 4 }} />
- {formatTime(item.createdAt)}
- </span>
+ <div
+ className={styles.notificationClickableArea}
+ onClick={() => handleViewDetail(item)}
+ style={{
+ cursor: 'pointer',
+ width: '100%',
+ padding: '8px 0'
+ }}
+ >
+ <List.Item.Meta
+ title={
+ <div className={styles.notificationTitle}>
+ <span>{item.title}</span>
+ {item.status === 'unread' && <Badge status="processing" />}
</div>
- <div className={styles.content}>
- {item.content.length > 100
- ? `${item.content.substring(0, 100)}...`
- : item.content
- }
- </div>
- <div className={styles.actions}>
- <Tooltip title="查看详情">
- <Button
- type="link"
- size="small"
- icon={<EyeOutlined />}
- onClick={() => handleViewDetail(item)}
- >
- {t('viewAll')}
- </Button>
- </Tooltip>
+ }
+ description={
+ <div className={styles.notificationContent}>
+ <div className={styles.notificationMeta}>
+ <Tag color={getNotificationTypeColor(item.type)}>
+ {getNotificationTypeText(item.type)}
+ </Tag>
+ <span className={styles.time}>
+ <ClockCircleOutlined style={{ marginRight: 4 }} />
+ {formatTime(item.createdAt)}
+ </span>
+ </div>
+ <div className={styles.content}>
+ {item.content.length > 100
+ ? `${item.content.substring(0, 100)}...`
+ : item.content
+ }
+ </div>
</div>
- </div>
- }
- />
+ }
+ />
+ </div>
</List.Item>
)}
/>
@@ -672,7 +728,7 @@ const NotificationPanel: React.FC<NotificationPanelProps> = ({ visible, onClose
<Modal
title={
<div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
- <span style={{ fontSize: '16px', fontWeight: '600' }}>通知详情</span>
+ <span style={{ fontSize: '16px', fontWeight: '600' }}>{t('detailTitle')}</span>
</div>
}
zIndex={2000}
@@ -686,7 +742,7 @@ const NotificationPanel: React.FC<NotificationPanelProps> = ({ visible, onClose
setDetailModalVisible(false);
setSelectedTask(null);
}} type="primary">
- 关闭
+ {t('close')}
</Button>
]}
width={800}
@@ -712,11 +768,11 @@ const NotificationPanel: React.FC<NotificationPanelProps> = ({ visible, onClose
<div style={{ display: 'flex', flexDirection: 'column', gap: '4px' }}>
<span>
<ClockCircleOutlined style={{ marginRight: 4 }} />
- 创建时间: {formatTime(selectedNotification.createdAt)}
+ {t('createTime')}: {formatTime(selectedNotification.createdAt)}
</span>
{selectedNotification.readAt && (
<span style={{ color: '#52c41a' }}>
- 已读时间: {formatTime(selectedNotification.readAt)}
+ {t('readTime')}: {formatTime(selectedNotification.readAt)}
</span>
)}
</div>
@@ -728,25 +784,25 @@ const NotificationPanel: React.FC<NotificationPanelProps> = ({ visible, onClose
{/* 任务详情部分 */}
{selectedNotification.type === 'task_reminder' && (
<div className={styles.taskDetail}>
- <h4 style={{ marginBottom: '16px', color: '#1890ff' }}>任务详情</h4>
+ <h4 style={{ marginBottom: '16px', color: '#1890ff' }}>{t('taskDetail')}</h4>
<Spin spinning={taskLoading}>
{selectedTask ? (
<div className={styles.taskInfo}>
<div className={styles.taskHeader}>
<h5>{selectedTask.title}</h5>
<Tag color={selectedTask.status === 'active' ? 'green' : 'red'}>
- {selectedTask.status === 'active' ? '进行中' : '已结束'}
+ {selectedTask.status === 'active' ? t('taskStatus.active' as any) : t('taskStatus.inactive' as any)}
</Tag>
</div>
<div className={styles.taskContent}>
- <p><strong>描述:</strong>
+ <p><strong>{t('taskInfo.description' as any)}:</strong>
<div dangerouslySetInnerHTML={{ __html: selectedTask.description }} />
</p>
{/* 发布账号信息 */}
{selectedTask.accountId && (() => {
const publishAccount = getAccountById(selectedTask.accountId);
return publishAccount ? (
- <p><strong>发布账号:</strong>
+ <p><strong>{t('taskInfo.publisherAccount' as any)}:</strong>
<div style={{ display: 'flex', alignItems: 'center', marginLeft: '4px', gap: '8px' }}>
<img
src={publishAccount.avatar ? getOssUrl(publishAccount.avatar) : '/default-avatar.png'}
@@ -767,17 +823,17 @@ const NotificationPanel: React.FC<NotificationPanelProps> = ({ visible, onClose
</div>
</p>
) : (
- <p><strong>发布账号:</strong>
+ <p><strong>{t('taskInfo.publisherAccount' as any)}:</strong>
<Tag color="red" style={{ marginLeft: '4px' }}>
- 账号信息获取失败
+ {t('accountInfoFailed')}
</Tag>
</p>
);
})()}
- <p><strong>奖励:</strong>¥{selectedTask.reward}</p>
+ <p><strong>{t('taskInfo.reward' as any)}:</strong>¥{selectedTask.reward/100}</p>
{/* <p><strong>招募人数:</strong>{selectedTask.currentRecruits}/{selectedTask.maxRecruits}</p> */}
- <p><strong>任务类型:</strong>
+ <p><strong>{t('taskInfo.taskType' as any)}:</strong>
<Tag color="blue" style={{ marginLeft: '4px' }}>
{getTaskTypeName(selectedTask.type)}
</Tag>
@@ -793,7 +849,7 @@ const NotificationPanel: React.FC<NotificationPanelProps> = ({ visible, onClose
{/* 任务素材展示 */}
{selectedTask.materials && selectedTask.materials.length > 0 && (
<div style={{ marginTop: '16px' }}>
- <p><strong>任务素材:</strong></p>
+ <p><strong>{t('taskInfo.taskType' as any)}:</strong></p>
<div style={{ display: 'flex', gap: '8px', flexWrap: 'wrap' }}>
{selectedTask.materials.map((material: any, index: number) => (
<div key={index} style={{
@@ -928,8 +984,8 @@ const NotificationPanel: React.FC<NotificationPanelProps> = ({ visible, onClose
borderRadius: '6px',
color: '#d46b08'
}}>
- <strong>⚠️ 注意:</strong>
- 发布账号({getPlatformName(publishAccount.type)})的任务需要在移动端App中操作,请下载对应App后继续。
+ <strong>{t('appRequiredNotice')}</strong>
+ {t('appRequiredMessage' as any, { platform: getPlatformName(publishAccount.type) })}
</div>
);
}
@@ -943,14 +999,14 @@ const NotificationPanel: React.FC<NotificationPanelProps> = ({ visible, onClose
onClick={() => handleTaskAction(selectedTask)}
style={{ marginTop: '12px' }}
>
- 接受任务
+ {t('acceptTask')}
</Button>
</div>
)}
</div>
) : !taskLoading && (
<div style={{ textAlign: 'center', color: '#999' }}>
- 暂无任务详情
+ {t('noTaskDetails')}
</div>
)}
</Spin>
@@ -972,13 +1028,13 @@ const NotificationPanel: React.FC<NotificationPanelProps> = ({ visible, onClose
{/* 媒体预览弹窗 */}
<Modal
- title={previewMedia?.title || '媒体预览'}
+ title={previewMedia?.title || t('mediaPreview')}
open={mediaPreviewVisible}
onCancel={handleCloseMediaPreview}
afterClose={handleCloseMediaPreview}
footer={[
<Button key="close" onClick={handleCloseMediaPreview}>
- 关闭
+ {t('close')}
</Button>
]}
width={previewMedia?.type === 'video' ? 800 : 600}
@@ -1029,7 +1085,7 @@ const NotificationPanel: React.FC<NotificationPanelProps> = ({ visible, onClose
{/* 任务进度弹窗 */}
<Modal
- title="任务处理中..."
+ title={t('taskProcessing')}
open={taskProgressVisible}
closable={false}
maskClosable={false}
@@ -1048,13 +1104,92 @@ const NotificationPanel: React.FC<NotificationPanelProps> = ({ visible, onClose
items={taskProgress.steps.map((step, index) => ({
title: step.title,
status: step.status as 'wait' | 'process' | 'finish' | 'error',
- description: index === 0 ? '正在调用接受任务接口...' :
- index === 1 ? '正在调用发布任务接口...' :
- index === 2 ? '正在调用提交任务接口...' :
- '任务处理完成,即将跳转...'
+ description: index === 0 ? t('acceptingTask' as any) :
+ index === 1 ? t('publishingTask' as any) :
+ index === 2 ? t('submittingTask' as any) :
+ t('taskCompleted' as any)
}))}
/>
</Modal>
+
+ {/* 账号选择弹窗 */}
+ <Modal
+ title={t('accountSelect.title' as any)}
+ open={accountSelectVisible}
+ onCancel={() => setAccountSelectVisible(false)}
+ footer={null}
+ width={600}
+ zIndex={2000}
+ styles={{
+ header: {
+ borderBottom: '1px solid #f0f0f0',
+ paddingBottom: '16px'
+ },
+ body: {
+ padding: '24px'
+ }
+ }}
+ >
+ <div style={{ marginBottom: '16px' }}>
+ <p style={{ margin: 0, color: '#666' }}>
+ {t('accountSelect.description' as any)}
+ </p>
+ </div>
+ <List
+ dataSource={availableAccounts}
+ renderItem={(account) => (
+ <List.Item
+ style={{
+ cursor: 'pointer',
+ padding: '16px',
+ border: '1px solid #f0f0f0',
+ borderRadius: '8px',
+ marginBottom: '8px',
+ transition: 'all 0.3s ease'
+ }}
+ onClick={() => handleAccountSelect(account)}
+ onMouseEnter={(e) => {
+ e.currentTarget.style.borderColor = '#1890ff';
+ e.currentTarget.style.backgroundColor = '#f6ffed';
+ }}
+ onMouseLeave={(e) => {
+ e.currentTarget.style.borderColor = '#f0f0f0';
+ e.currentTarget.style.backgroundColor = 'transparent';
+ }}
+ >
+ <List.Item.Meta
+ avatar={
+ <img
+ src={account.avatar ? getOssUrl(account.avatar) : '/default-avatar.png'}
+ alt="账号头像"
+ style={{
+ width: '48px',
+ height: '48px',
+ borderRadius: '50%',
+ objectFit: 'cover'
+ }}
+ onError={(e) => {
+ e.currentTarget.src = '/default-avatar.png';
+ }}
+ />
+ }
+ title={
+ <div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
+ <span style={{ fontWeight: '600' }}>{account.nickname}</span>
+ <Tag color="blue">{getPlatformName(account.type)}</Tag>
+ </div>
+ }
+ description={
+ <div style={{ color: '#666' }}>
+ <div>{t('accountSelect.accountId' as any)}: {account.account}</div>
+ {account.nickname && <div>{t('accountSelect.description' as any)}: {account.nickname}</div>}
+ </div>
+ }
+ />
+ </List.Item>
+ )}
+ />
+ </Modal>
</>
);
};