From 56a2f41aef471faa325b48ad35402b3862fcc9a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AC=94=E8=AE=B0=E6=9C=AC=E9=87=8C=E7=9A=84=E6=B0=B8?= =?UTF-8?q?=E5=B9=B3?= Date: Fri, 18 Jul 2025 21:56:03 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9C=AC=E6=AC=A1=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=86=85=E5=AE=B9=E5=A6=82=E4=B8=8B=20?= =?UTF-8?q?=E6=96=B0=E7=89=88=E6=9C=AC=E6=A0=B7=E5=BC=8F=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/workspace/moments-sync/Detail.tsx | 135 ++++++++++++------ Cunkebao/src/types/moments-sync.ts | 18 +-- nkebao/src/pages/home/index.module.scss | 8 ++ nkebao/src/pages/home/index.tsx | 48 ++----- 4 files changed, 117 insertions(+), 92 deletions(-) diff --git a/Cunkebao/src/pages/workspace/moments-sync/Detail.tsx b/Cunkebao/src/pages/workspace/moments-sync/Detail.tsx index 283f96be..8500a585 100644 --- a/Cunkebao/src/pages/workspace/moments-sync/Detail.tsx +++ b/Cunkebao/src/pages/workspace/moments-sync/Detail.tsx @@ -1,19 +1,26 @@ -import React, { useState, useEffect, useCallback } from 'react'; -import { useParams, useNavigate } from 'react-router-dom'; -import { Button } from '@/components/ui/button'; -import { Card } from '@/components/ui/card'; -import { Badge } from '@/components/ui/badge'; -import { Switch } from '@/components/ui/switch'; -import { useToast } from '@/components/ui/toast'; -import { - fetchMomentsSyncTaskDetail, - toggleMomentsSyncTask, - syncMoments -} from '@/api/momentsSync'; -import { MomentsSyncTask } from '@/types/moments-sync'; -import { ChevronLeft, Edit2, RefreshCw, Clock, Database, Smartphone } from 'lucide-react'; -import Layout from '@/components/Layout'; -import BottomNav from '@/components/BottomNav'; +import React, { useState, useEffect, useCallback } from "react"; +import { useParams, useNavigate } from "react-router-dom"; +import { Button } from "@/components/ui/button"; +import { Card } from "@/components/ui/card"; +import { Badge } from "@/components/ui/badge"; +import { Switch } from "@/components/ui/switch"; +import { useToast } from "@/components/ui/toast"; +import { + fetchMomentsSyncTaskDetail, + toggleMomentsSyncTask, + syncMoments, +} from "@/api/momentsSync"; +import { MomentsSyncTask } from "@/types/moments-sync"; +import { + ChevronLeft, + Edit2, + RefreshCw, + Clock, + Database, + Smartphone, +} from "lucide-react"; +import Layout from "@/components/Layout"; +import BottomNav from "@/components/BottomNav"; export default function MomentsSyncDetail() { const { id } = useParams(); @@ -31,7 +38,7 @@ export default function MomentsSyncDetail() { setTask(taskData); } } catch (error) { - toast({ title: '获取任务详情失败', variant: 'destructive' }); + toast({ title: "获取任务详情失败", variant: "destructive" }); } finally { setLoading(false); } @@ -49,9 +56,9 @@ export default function MomentsSyncDetail() { const newStatus = task.status === 1 ? 2 : 1; await toggleMomentsSyncTask(id, newStatus.toString()); setTask({ ...task, status: newStatus }); - toast({ title: newStatus === 1 ? '任务已开启' : '任务已暂停' }); + toast({ title: newStatus === 1 ? "任务已开启" : "任务已暂停" }); } catch (error) { - toast({ title: '操作失败', variant: 'destructive' }); + toast({ title: "操作失败", variant: "destructive" }); } }; @@ -59,10 +66,10 @@ export default function MomentsSyncDetail() { if (!id) return; try { await syncMoments(id); - toast({ title: '同步任务已启动' }); + toast({ title: "同步任务已启动" }); fetchTaskDetail(); // 刷新任务详情 } catch (error) { - toast({ title: '同步失败', variant: 'destructive' }); + toast({ title: "同步失败", variant: "destructive" }); } }; @@ -91,7 +98,10 @@ export default function MomentsSyncDetail() {

任务不存在

-
@@ -106,7 +116,11 @@ export default function MomentsSyncDetail() {
-

朋友圈同步任务详情

@@ -116,10 +130,10 @@ export default function MomentsSyncDetail() { 编辑 - + */}
@@ -137,7 +151,10 @@ export default function MomentsSyncDetail() { {task.status === 1 ? "进行中" : "已暂停"}
- +
@@ -154,7 +171,9 @@ export default function MomentsSyncDetail() {
内容库 - {task.contentLib || '未设置'} + + {task.contentLib || "未设置"} +
已同步 @@ -180,11 +199,15 @@ export default function MomentsSyncDetail() {
上次同步 - {task.lastSyncTime || '暂无'} + + {task.lastSyncTime || "暂无"} +
更新时间 - {task.updateTime || '暂无'} + + {task.updateTime || "暂无"} +
@@ -203,35 +226,51 @@ export default function MomentsSyncDetail() { 同步间隔 {task.syncInterval} 秒 -
- 每日最大 - {task.maxSyncPerDay || 100} 条 -
+
+ 每日最大 + + {task.maxSyncPerDay || 100} 条 + +
时间范围 - {task.timeRange.start} - {task.timeRange.end} + + {task.timeRange?.start && task.timeRange?.end + ? `${task.timeRange.start} - ${task.timeRange.end}` + : "未设置"} +
同步模式 - {task.syncMode === 'auto' ? '自动' : '手动'} + + {task.syncMode === "auto" ? "自动" : "手动"} +
-
- 今日同步 - {task.todaySyncCount || 0} 条 -
-
- 总同步数 - {task.totalSyncCount || task.syncCount || 0} 条 -
+
+ 今日同步 + + {task.todaySyncCount || 0} 条 + +
+
+ 总同步数 + + {task.totalSyncCount || task.syncCount || 0} 条 + +
目标标签 - {task.targetTags.length} 个 + + {task.targetTags?.length || 0} 个 +
内容类型 - {task.contentTypes.join(', ')} + + {task.contentTypes?.join(", ") || "未设置"} +
@@ -242,11 +281,13 @@ export default function MomentsSyncDetail() {

最近同步记录

暂无同步记录

-

任务开始执行后将显示同步记录

+

+ 任务开始执行后将显示同步记录 +

); -} \ No newline at end of file +} diff --git a/Cunkebao/src/types/moments-sync.ts b/Cunkebao/src/types/moments-sync.ts index 4b66f7d7..ebd1d7c5 100644 --- a/Cunkebao/src/types/moments-sync.ts +++ b/Cunkebao/src/types/moments-sync.ts @@ -26,17 +26,17 @@ export interface MomentsSyncTask { creatorName: string; syncInterval: number; maxSyncPerDay: number; - timeRange: { start: string; end: string }; - contentTypes: ContentType[]; - targetTags: string[]; + timeRange?: { start: string; end: string }; + contentTypes?: ContentType[]; + targetTags?: string[]; syncMode: SyncMode; - filterKeywords: string[]; + filterKeywords?: string[]; contentLib?: string; - devices: string[]; - friends: string[]; - todaySyncCount: number; - totalSyncCount: number; - updateTime: string; + devices?: string[]; + friends?: string[]; + todaySyncCount?: number; + totalSyncCount?: number; + updateTime?: string; config?: MomentsSyncConfig; } diff --git a/nkebao/src/pages/home/index.module.scss b/nkebao/src/pages/home/index.module.scss index 1a7b7b1b..0d92815b 100644 --- a/nkebao/src/pages/home/index.module.scss +++ b/nkebao/src/pages/home/index.module.scss @@ -131,6 +131,14 @@ justify-content: center; margin: 0 auto 6px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); + overflow: hidden; +} + +.scene-image { + width: 100%; + height: 100%; + object-fit: cover; + border-radius: 8px; } .scene-value { diff --git a/nkebao/src/pages/home/index.tsx b/nkebao/src/pages/home/index.tsx index b088548a..ce27e61f 100644 --- a/nkebao/src/pages/home/index.tsx +++ b/nkebao/src/pages/home/index.tsx @@ -16,33 +16,6 @@ import style from "./index.module.scss"; import LineChart from "@/components/LineChart"; import { getPlanStats } from "./api"; -const sceneStats = [ - { - label: "公众号", - value: 234, - icon: , - gradient: "linear-gradient(135deg, #4caf50 0%, #45a049 100%)", - }, - { - label: "海报", - value: 167, - icon: , - gradient: "linear-gradient(135deg, #ff9800 0%, #f57c00 100%)", - }, - { - label: "抖音", - value: 156, - icon: , - gradient: "linear-gradient(135deg, #2196f3 0%, #1976d2 100%)", - }, - { - label: "小红书", - value: 89, - icon: , - gradient: "linear-gradient(135deg, #e91e63 0%, #c2185b 100%)", - }, -]; - const todayStats = [ { label: "朋友圈", @@ -71,9 +44,11 @@ const todayStats = [ ]; const Home: React.FC = () => { + const [sceneStats, setSceneStats] = useState([]); useEffect(() => { getPlanStats({ num: 4 }).then((res: any) => { - console.log(res); + // console.log(res); + setSceneStats(res); }); }, []); @@ -133,15 +108,16 @@ const Home: React.FC = () => {
{sceneStats.map((item) => ( -
-
- {item.icon} +
+
+ {item.name}
-
{item.value}
-
{item.label}
+
{item.allNum}
+
{item.name}
))}