From fcc48052207d4ef6c34f08cc48bd5b38be43c684 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B6=85=E7=BA=A7=E8=80=81=E7=99=BD=E5=85=94?= Date: Wed, 20 Aug 2025 15:07:17 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=87=AA=E5=8A=A8=E5=BB=BA=E7=BE=A4):=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=86=85=E5=AE=B9=E5=BA=93=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=B9=B6=E9=87=8D=E6=9E=84=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E4=B8=BA=E5=88=86=E6=AD=A5=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加内容库选择组件及相关类型定义 重构自动建群表单为分步式操作流程 新增基础设置、设备选择和内容选择三个步骤组件 完善表单验证逻辑和步骤导航功能 --- .../form/components/BasicSettings.tsx | 291 ++++++++++++ .../form/components/ContentSelector.tsx | 95 ++++ .../form/components/DeviceSelector.tsx | 95 ++++ .../workspace/auto-group/form/index.tsx | 420 +++++++++--------- .../mobile/workspace/auto-group/form/types.ts | 15 + 5 files changed, 694 insertions(+), 222 deletions(-) create mode 100644 Cunkebao/src/pages/mobile/workspace/auto-group/form/components/BasicSettings.tsx create mode 100644 Cunkebao/src/pages/mobile/workspace/auto-group/form/components/ContentSelector.tsx create mode 100644 Cunkebao/src/pages/mobile/workspace/auto-group/form/components/DeviceSelector.tsx diff --git a/Cunkebao/src/pages/mobile/workspace/auto-group/form/components/BasicSettings.tsx b/Cunkebao/src/pages/mobile/workspace/auto-group/form/components/BasicSettings.tsx new file mode 100644 index 00000000..9cba69e9 --- /dev/null +++ b/Cunkebao/src/pages/mobile/workspace/auto-group/form/components/BasicSettings.tsx @@ -0,0 +1,291 @@ +import React, { useImperativeHandle, forwardRef } from "react"; +import { Input, Button, Card, Switch, Form, InputNumber } from "antd"; +import { TextArea } from "antd-mobile"; + +interface BasicSettingsProps { + defaultValues?: { + name: string; + startTime: string; + endTime: string; + groupSizeMin: number; + groupSizeMax: number; + maxGroupsPerDay: number; + groupNameTemplate: string; + groupDescription: string; + status: number; + }; +} + +export interface BasicSettingsRef { + validate: () => Promise; + getValues: () => any; +} + +const BasicSettings = forwardRef( + ({ + defaultValues = { + name: "", + startTime: "06:00", + endTime: "23:59", + groupSizeMin: 20, + groupSizeMax: 50, + maxGroupsPerDay: 10, + groupNameTemplate: "", + groupDescription: "", + status: 1, + }, + }, ref) => { + const [form] = Form.useForm(); + + // 暴露方法给父组件 + useImperativeHandle(ref, () => ({ + validate: async () => { + try { + await form.validateFields(); + return true; + } catch (error) { + console.log("BasicSettings 表单验证失败:", error); + return false; + } + }, + getValues: () => { + return form.getFieldsValue(); + }, + })); + + return ( +
+ +
{ + // 可以在这里处理表单值变化 + }} + > + {/* 任务名称 */} + + + + + {/* 允许建群的时间段 */} + +
+ + + + + + + +
+
+ + {/* 每日最大建群数 */} + +
+ + + +
+
+ + {/* 群组最小人数 */} + +
+ + + +
+
+ + {/* 群组最大人数 */} + +
+ + + +
+
+ + {/* 群名称模板 */} + + + + + {/* 群描述 */} + +