From 00900e1ea3ec64a68214ce1df32cbad1445147dd 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: Tue, 22 Jul 2025 19:10:14 +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?=E7=BB=84=E4=BB=B6=E4=BC=98=E5=8C=96=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nkebao/src/components/FriendSelection/index.tsx | 10 ++++++++-- nkebao/src/components/GroupSelection/index.tsx | 8 +++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/nkebao/src/components/FriendSelection/index.tsx b/nkebao/src/components/FriendSelection/index.tsx index 13090569..51598c53 100644 --- a/nkebao/src/components/FriendSelection/index.tsx +++ b/nkebao/src/components/FriendSelection/index.tsx @@ -29,6 +29,7 @@ interface FriendSelectionProps { showInput?: boolean; showSelectedList?: boolean; readonly?: boolean; + onConfirm?: (selectedIds: string[], selectedItems: WechatFriend[]) => void; // 新增 } export default function FriendSelection({ @@ -45,6 +46,7 @@ export default function FriendSelection({ showInput = true, showSelectedList = true, readonly = false, + onConfirm, }: FriendSelectionProps) { const [popupVisible, setPopupVisible] = useState(false); const [friends, setFriends] = useState([]); @@ -168,8 +170,12 @@ export default function FriendSelection({ onSelect(selectedFriends.filter((f) => f !== id)); }; + // 确认按钮逻辑 const handleConfirm = () => { - setPopupVisible(false); + setRealVisible(false); + if (onConfirm) { + onConfirm(selectedFriends, selectedFriendObjs); + } }; // 清空搜索 @@ -404,7 +410,7 @@ export default function FriendSelection({
-
diff --git a/nkebao/src/components/GroupSelection/index.tsx b/nkebao/src/components/GroupSelection/index.tsx index 2027ef90..15d2222a 100644 --- a/nkebao/src/components/GroupSelection/index.tsx +++ b/nkebao/src/components/GroupSelection/index.tsx @@ -35,6 +35,7 @@ interface GroupSelectionProps { showInput?: boolean; showSelectedList?: boolean; readonly?: boolean; + onConfirm?: (selectedIds: string[], selectedItems: WechatGroup[]) => void; // 新增 } export default function GroupSelection({ @@ -49,6 +50,7 @@ export default function GroupSelection({ showInput = true, showSelectedList = true, readonly = false, + onConfirm, }: GroupSelectionProps) { const [popupVisible, setPopupVisible] = useState(false); const [groups, setGroups] = useState([]); @@ -160,8 +162,12 @@ export default function GroupSelection({ return `已选择 ${selectedGroups.length} 个群聊`; }; + // 确认按钮逻辑 const handleConfirm = () => { setRealVisible(false); + if (onConfirm) { + onConfirm(selectedGroups, selectedGroupObjs); + } }; // 清空搜索 @@ -395,7 +401,7 @@ export default function GroupSelection({ setRealVisible(false)}> 取消 - setRealVisible(false)}> + 确定