diff --git a/nkebao/src/pages/mobile/workspace/auto-group/list/index.tsx b/nkebao/src/pages/mobile/workspace/auto-group/list/index.tsx index 1b0a9094..a52e621e 100644 --- a/nkebao/src/pages/mobile/workspace/auto-group/list/index.tsx +++ b/nkebao/src/pages/mobile/workspace/auto-group/list/index.tsx @@ -1,26 +1,23 @@ import React, { useState } from "react"; import { useNavigate } from "react-router-dom"; -import { Button, Card, ProgressBar, Popover, Toast, NavBar } from "antd-mobile"; +import { Button, Card, Popover, Toast } from "antd-mobile"; import { Input, Switch } from "antd"; import { MoreOutline, AddCircleOutline, UserAddOutline, ClockCircleOutline, - TeamOutline, - CalendarOutline, } from "antd-mobile-icons"; import { ReloadOutlined, - SettingOutlined, PlusOutlined, - ArrowLeftOutlined, SearchOutlined, } from "@ant-design/icons"; import Layout from "@/components/Layout/Layout"; import style from "./index.module.scss"; +import NavCommon from "@/components/NavCommon"; interface GroupTask { id: string; @@ -167,25 +164,14 @@ const AutoGroupList: React.FC = () => { - - navigate(-1)} - /> - - } + 新建任务 } - > - 自动建群 - + /> {/* 搜索栏 */}
diff --git a/nkebao/src/pages/mobile/workspace/auto-like/list/data.ts b/nkebao/src/pages/mobile/workspace/auto-like/list/data.ts new file mode 100644 index 00000000..de39bd28 --- /dev/null +++ b/nkebao/src/pages/mobile/workspace/auto-like/list/data.ts @@ -0,0 +1,119 @@ +// 自动点赞任务状态 +export type LikeTaskStatus = 1 | 2; // 1: 开启, 2: 关闭 + +// 内容类型 +export type ContentType = "text" | "image" | "video" | "link"; + +// 设备信息 +export interface Device { + id: string; + name: string; + status: "online" | "offline"; + lastActive: string; +} + +// 好友信息 +export interface Friend { + id: string; + nickname: string; + wechatId: string; + avatar: string; + tags: string[]; + region: string; + source: string; +} + +// 点赞记录 +export interface LikeRecord { + id: string; + workbenchId: string; + momentsId: string; + snsId: string; + wechatAccountId: string; + wechatFriendId: string; + likeTime: string; + content: string; + resUrls: string[]; + momentTime: string; + userName: string; + operatorName: string; + operatorAvatar: string; + friendName: string; + friendAvatar: string; +} + +// 自动点赞任务 +export interface LikeTask { + id: string; + name: string; + status: LikeTaskStatus; + deviceCount: number; + targetGroup: string; + likeCount: number; + lastLikeTime: string; + createTime: string; + creator: string; + likeInterval: number; + maxLikesPerDay: number; + timeRange: { start: string; end: string }; + contentTypes: ContentType[]; + targetTags: string[]; + devices: string[]; + friends: string[]; + friendMaxLikes: number; + friendTags: string; + enableFriendTags: boolean; + todayLikeCount: number; + totalLikeCount: number; + updateTime: string; +} + +// 创建任务数据 +export interface CreateLikeTaskData { + name: string; + interval: number; + maxLikes: number; + startTime: string; + endTime: string; + contentTypes: ContentType[]; + devices: string[]; + friends?: string[]; + friendMaxLikes: number; + friendTags?: string; + enableFriendTags: boolean; + targetTags: string[]; +} + +// 更新任务数据 +export interface UpdateLikeTaskData extends CreateLikeTaskData { + id: string; +} + +// 任务配置 +export interface TaskConfig { + interval: number; + maxLikes: number; + startTime: string; + endTime: string; + contentTypes: ContentType[]; + devices: string[]; + friends: string[]; + friendMaxLikes: number; + friendTags: string; + enableFriendTags: boolean; +} + +// API响应类型 +export interface ApiResponse { + code: number; + msg: string; + data: T; +} + +// 分页响应类型 +export interface PaginatedResponse { + list: T[]; + total: number; + page: number; + limit: number; +} diff --git a/nkebao/src/pages/mobile/workspace/auto-like/list/index.tsx b/nkebao/src/pages/mobile/workspace/auto-like/list/index.tsx index a4910269..073603ee 100644 --- a/nkebao/src/pages/mobile/workspace/auto-like/list/index.tsx +++ b/nkebao/src/pages/mobile/workspace/auto-like/list/index.tsx @@ -14,7 +14,6 @@ import { MoreOutlined, LikeOutlined, } from "@ant-design/icons"; -import { ArrowLeftOutlined } from "@ant-design/icons"; import Layout from "@/components/Layout/Layout"; import { @@ -23,7 +22,7 @@ import { toggleAutoLikeTask, copyAutoLikeTask, } from "./api"; -import { LikeTask } from "@/pages/workspace/auto-like/record/data"; +import { LikeTask } from "./data"; import style from "./index.module.scss"; // 卡片菜单组件 diff --git a/nkebao/src/pages/mobile/workspace/group-push/list/index.api.ts b/nkebao/src/pages/mobile/workspace/group-push/list/index.api.ts index 0295e2f9..2a6c1153 100644 --- a/nkebao/src/pages/mobile/workspace/group-push/list/index.api.ts +++ b/nkebao/src/pages/mobile/workspace/group-push/list/index.api.ts @@ -1,37 +1,13 @@ import request from "@/api/request"; -export interface GroupPushTask { - id: string; - name: string; - status: number; // 1: 运行中, 2: 已暂停 - deviceCount: number; - targetGroups: string[]; - pushCount: number; - successCount: number; - lastPushTime: string; - createTime: string; - creator: string; - pushInterval: number; - maxPushPerDay: number; - timeRange: { start: string; end: string }; - messageType: "text" | "image" | "video" | "link"; - messageContent: string; - targetTags: string[]; - pushMode: "immediate" | "scheduled"; - scheduledTime?: string; -} - interface ApiResponse { code: number; message: string; data: T; } -export async function fetchGroupPushTasks(): Promise { - const response = await request("/v1/workbench/list", { type: 3 }, "GET"); - if (Array.isArray(response)) return response; - if (response && Array.isArray(response.data)) return response.data; - return []; +export async function fetchGroupPushTasks() { + return request("/v1/workbench/list", { type: 3 }, "GET"); } export async function deleteGroupPushTask(id: string): Promise { diff --git a/nkebao/src/pages/mobile/workspace/group-push/list/index.tsx b/nkebao/src/pages/mobile/workspace/group-push/list/index.tsx index 7634c769..9bfea7b7 100644 --- a/nkebao/src/pages/mobile/workspace/group-push/list/index.tsx +++ b/nkebao/src/pages/mobile/workspace/group-push/list/index.tsx @@ -36,7 +36,6 @@ import { deleteGroupPushTask, toggleGroupPushTask, copyGroupPushTask, - GroupPushTask, } from "./index.api"; import styles from "./index.module.scss"; @@ -44,14 +43,14 @@ const GroupPush: React.FC = () => { const navigate = useNavigate(); const [expandedTaskId, setExpandedTaskId] = useState(null); const [searchTerm, setSearchTerm] = useState(""); - const [tasks, setTasks] = useState([]); + const [tasks, setTasks] = useState([]); const [loading, setLoading] = useState(false); const fetchTasks = async () => { setLoading(true); try { - const list = await fetchGroupPushTasks(); - setTasks(list); + const result = await fetchGroupPushTasks(); + setTasks(result.list); } finally { setLoading(false); } @@ -180,13 +179,7 @@ const GroupPush: React.FC = () => { allowClear size="large" /> - -
@@ -228,39 +221,35 @@ const GroupPush: React.FC = () => { onChange={() => toggleTaskStatus(task.id)} /> - } - onClick={() => handleView(task.id)} - > - 查看 - - } - onClick={() => handleEdit(task.id)} - > - 编辑 - - } - onClick={() => handleCopy(task.id)} - > - 复制 - - } - onClick={() => handleDelete(task.id)} - danger - > - 删除 - - - } + menu={{ + items: [ + { + key: "view", + icon: , + label: "查看", + onClick: () => handleView(task.id), + }, + { + key: "edit", + icon: , + label: "编辑", + onClick: () => handleEdit(task.id), + }, + { + key: "copy", + icon: , + label: "复制", + onClick: () => handleCopy(task.id), + }, + { + key: "delete", + icon: , + label: "删除", + danger: true, + onClick: () => handleDelete(task.id), + }, + ], + }} trigger={["click"]} >
-
执行设备:{task.deviceCount} 个
-
目标群组:{task.targetGroups.length} 个
+
执行设备:{task.deviceCount || 1} 个
+
目标群组:{task.config?.groups?.length || 0} 个
- 推送成功:{task.successCount}/{task.pushCount} + 推送成功:{task.successCount || 0}/{task.pushCount || 0}
-
创建人:{task.creator}
-
-
-
推送成功率
- +
创建人:{task.creatorName || task.creator}
+
- 上次推送:{task.lastPushTime} -
-
- 创建时间:{task.createTime} -
+
创建时间:{task.createTime}
- {expandedTaskId === task.id && ( -
-
-
- 基本设置 -
推送间隔:{task.pushInterval} 秒
-
每日最大推送数:{task.maxPushPerDay} 条
-
- 执行时间段:{task.timeRange.start} -{" "} - {task.timeRange.end} -
-
- 推送模式: - {task.pushMode === "immediate" - ? "立即推送" - : "定时推送"} -
- {task.scheduledTime && ( -
定时时间:{task.scheduledTime}
- )} -
-
- 目标群组 -
- {task.targetGroups.map(group => ( - - ))} -
-
-
- 消息内容 -
- 消息类型:{getMessageTypeText(task.messageType)} -
-
- {task.messageContent} -
-
-
- 执行进度 -
- 今日已推送:{task.pushCount} / {task.maxPushPerDay} -
- - {task.targetTags.length > 0 && ( -
-
目标标签:
-
- {task.targetTags.map(tag => ( - - ))} -
-
- )} -
-
-
- )} )) )}