diff --git a/src/pages/ChatLogs/ChatUtils.tsx b/src/pages/ChatLogs/ChatUtils.tsx index cc4cd1e..b7d7785 100644 --- a/src/pages/ChatLogs/ChatUtils.tsx +++ b/src/pages/ChatLogs/ChatUtils.tsx @@ -190,22 +190,37 @@ type IGroupIcon = { */ export const GroupIcon: React.FC = (props) => { const [list, setList] = useState([[], [], []]); + const [size, setSize] = useState(12); useEffect(() => { let temp: any = [[], [], []]; const { groupList } = props; - for (let index = 0; index < 9; index++) { - const element = groupList[index]; - if (index < 3) { - temp[0].push(element); - } else if (index < 6) { - temp[1].push(element); - } else { - temp[2].push(element); + // groupList.reverse(); + if (groupList.length <= 4) { + setSize(18); + for (let index = 0; index < 9; index++) { + const element = groupList[index]; + if (index < 2) { + temp[0].push(element); + } else { + temp[1].push(element); + } + } + } else { + setSize(12); + for (let index = 0; index < 9; index++) { + const element = groupList[index]; + if (index < 3) { + temp[0].push(element); + } else if (index < 6) { + temp[1].push(element); + } else if (index < 9) { + temp[2].push(element); + } } } temp.reverse(); - setList(temp); + setList(JSON.parse(JSON.stringify(temp))); }, [props.groupList]); return ( @@ -217,7 +232,7 @@ export const GroupIcon: React.FC = (props) => { return el ? (
{el.avatar ? ( { if (Array.isArray(res.data) && res.data.length) { setSelectStaff(res.data[0]); selectStaffRef.current = res.data[0]; - // res.data.forEach((element: IStaffsItem) => { - // if (element.user_id == 'yangxb') { - // setSelectStaff(element); - // selectStaffRef.current = element; - // } - // }); + res.data.forEach((element: IStaffsItem) => { + if (element.user_id == 'yangxb') { + setSelectStaff(element); + selectStaffRef.current = element; + } + }); setStaffsList(res.data); setInnerStaffsList(res.data); getCustFollowsList();