【操盘手】 选择好友支持筛选设备

This commit is contained in:
wong
2025-05-14 17:29:32 +08:00
parent dd49381683
commit 22559866df
2 changed files with 18 additions and 2 deletions

View File

@@ -39,9 +39,10 @@ interface WechatFriendSelectorProps {
onOpenChange: (open: boolean) => void
selectedFriends: WechatFriend[]
onSelect: (friends: WechatFriend[]) => void
devices?: number[]
}
export function WechatFriendSelector({ open, onOpenChange, selectedFriends, onSelect }: WechatFriendSelectorProps) {
export function WechatFriendSelector({ open, onOpenChange, selectedFriends, onSelect, devices = [] }: WechatFriendSelectorProps) {
const [searchQuery, setSearchQuery] = useState("")
const [friends, setFriends] = useState<WechatFriend[]>([])
const [loading, setLoading] = useState(false)
@@ -67,6 +68,10 @@ export function WechatFriendSelector({ open, onOpenChange, selectedFriends, onSe
...(searchQuery ? { keyword: searchQuery } : {})
})
if (devices && devices.length > 0) {
queryParams.append('deviceIds', devices.join(','))
}
const response = await api.get<ApiResponse<FriendListResponse>>(`/v1/friend?${queryParams.toString()}`)
if (response.code === 200 && response.data) {