From 5909bd93e7deb33566b1a0cf2e9c6057944837dd Mon Sep 17 00:00:00 2001 From: Ghost <106998207@qq.com> Date: Thu, 8 Jan 2026 10:46:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=BA=E6=99=AF=E8=8E=B7=E5=AE=A2=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E6=8B=89=E7=BE=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mobile/scenarios/plan/new/index.data.ts | 12 +- src/pages/mobile/scenarios/plan/new/index.tsx | 27 +++++ .../plan/new/steps/GroupSettings.tsx | 110 ++++++++++++++++++ 3 files changed, 147 insertions(+), 2 deletions(-) create mode 100644 src/pages/mobile/scenarios/plan/new/steps/GroupSettings.tsx diff --git a/src/pages/mobile/scenarios/plan/new/index.data.ts b/src/pages/mobile/scenarios/plan/new/index.data.ts index a6e5bad..e88f7fc 100644 --- a/src/pages/mobile/scenarios/plan/new/index.data.ts +++ b/src/pages/mobile/scenarios/plan/new/index.data.ts @@ -1,11 +1,12 @@ -// 步骤定义 - 四个步骤 +// 步骤定义 - 五个步骤 import { DeviceSelectionItem } from "@/components/DeviceSelection/data"; import { GroupSelectionItem } from "@/components/GroupSelection/data"; export const steps = [ { id: 1, title: "步骤一", subtitle: "基础设置" }, { id: 2, title: "步骤二", subtitle: "好友申请设置" }, { id: 3, title: "步骤三", subtitle: "渠道设置" }, - { id: 4, title: "步骤四", subtitle: "消息设置" }, + { id: 4, title: "步骤四", subtitle: "拉群设置" }, + { id: 5, title: "步骤五", subtitle: "消息设置" }, ]; // 类型定义 @@ -31,6 +32,10 @@ export interface FormData { wechatGroups: string[]; wechatGroupsOptions: GroupSelectionItem[]; messagePlans: any[]; + // 拉群设置 + groupInviteEnabled?: boolean; + groupName?: string; + fixedGroupMembers?: any[]; // 固定群成员,使用好友选择组件结构 // 分销相关 distributionEnabled?: boolean; // 选中的分销渠道ID列表(前端使用,提交时转为 distributionChannels) @@ -72,6 +77,9 @@ export const defFormData: FormData = { wechatGroupsOptions: [], contentGroups: [], contentGroupsOptions: [], + groupInviteEnabled: false, + groupName: "", + fixedGroupMembers: [], distributionEnabled: false, distributionChannelIds: [], distributionChannelsOptions: [], diff --git a/src/pages/mobile/scenarios/plan/new/index.tsx b/src/pages/mobile/scenarios/plan/new/index.tsx index 87b2dfa..1a284ae 100644 --- a/src/pages/mobile/scenarios/plan/new/index.tsx +++ b/src/pages/mobile/scenarios/plan/new/index.tsx @@ -5,6 +5,7 @@ import NavCommon from "@/components/NavCommon"; import BasicSettings from "./steps/BasicSettings"; import FriendRequestSettings from "./steps/FriendRequestSettings"; import DistributionSettings from "./steps/DistributionSettings"; +import GroupSettings from "./steps/GroupSettings"; import MessageSettings from "./steps/MessageSettings"; import Layout from "@/components/Layout/Layout"; import StepIndicator from "@/components/StepIndicator"; @@ -112,6 +113,15 @@ export default function NewPlan() { wechatGroupsOptions: detail.wechatGroupsOptions ?? [], contentGroups: detail.contentGroups ?? [], contentGroupsOptions: detail.contentGroupsOptions ?? [], + // 拉群设置 + groupInviteEnabled: detail.groupInviteEnabled ?? false, + groupName: detail.groupName ?? "", + // 优先使用后端返回的 options(完整好友信息),否则退回到 ID 数组或旧字段 + fixedGroupMembers: + detail.groupFixedMembersOptions ?? + detail.fixedGroupMembers ?? + detail.groupFixedMembers ?? + [], status: detail.status ?? 0, messagePlans: detail.messagePlans ?? [], // 分销相关数据回填 @@ -196,11 +206,26 @@ export default function NewPlan() { submitData.distributionEnabled = false; } + // 拉群设置字段转换 + if (formData.groupInviteEnabled) { + submitData.groupInviteEnabled = true; + submitData.groupName = formData.groupName || ""; + // 后端期望的字段:groupFixedMembers,使用好友ID数组 + submitData.groupFixedMembers = (formData.fixedGroupMembers || []).map( + (f: any) => f.id, + ); + } else { + submitData.groupInviteEnabled = false; + submitData.groupName = ""; + submitData.groupFixedMembers = []; + } + // 移除前端使用的字段,避免提交到后端 delete submitData.distributionChannelIds; delete submitData.distributionChannelsOptions; delete submitData.distributionCustomerReward; delete submitData.distributionAddReward; + delete submitData.fixedGroupMembers; if (isEdit && planId) { // 编辑:拼接后端需要的完整参数 @@ -272,6 +297,8 @@ export default function NewPlan() { /> ); case 4: + return ; + case 5: return ; default: return null; diff --git a/src/pages/mobile/scenarios/plan/new/steps/GroupSettings.tsx b/src/pages/mobile/scenarios/plan/new/steps/GroupSettings.tsx new file mode 100644 index 0000000..780cf50 --- /dev/null +++ b/src/pages/mobile/scenarios/plan/new/steps/GroupSettings.tsx @@ -0,0 +1,110 @@ +import React from "react"; +import { Input, Switch } from "antd"; +import styles from "./base.module.scss"; +import FriendSelection from "@/components/FriendSelection"; +import type { FriendSelectionItem } from "@/components/FriendSelection/data"; + +interface GroupSettingsProps { + formData: any; + onChange: (data: any) => void; +} + +const GroupSettings: React.FC = ({ formData, onChange }) => { + const handleToggleGroupInvite = (value: boolean) => { + onChange({ + ...formData, + groupInviteEnabled: value, + }); + }; + + const handleGroupNameChange = (e: React.ChangeEvent) => { + onChange({ + ...formData, + groupName: e.target.value, + }); + }; + + const handleFixedMembersSelect = (friends: FriendSelectionItem[]) => { + onChange({ + ...formData, + fixedGroupMembers: friends, + }); + }; + + return ( + + + + + + 拉群设置 + + + 开启后,可配置群名称和固定群成员,将用户引导到指定微信群 + + + + + + {formData.groupInviteEnabled && ( + + + {/* 固定成员选择,复用好友选择组件 */} + + + 固定群成员 + + + + + )} + + + ); +}; + +export default GroupSettings;