开发: 修改群图标

This commit is contained in:
zhengw
2023-04-24 15:12:52 +08:00
parent 0b850f4ef4
commit 00a69d5759
4 changed files with 33 additions and 18 deletions

View File

@@ -190,22 +190,37 @@ type IGroupIcon = {
*/
export const GroupIcon: React.FC<IGroupIcon> = (props) => {
const [list, setList] = useState<any>([[], [], []]);
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<IGroupIcon> = (props) => {
return el ? (
<div
key={`${el.avatar}_${el.name}`}
style={{ width: 12, height: 12, borderRadius: 2, overflow: 'hidden' }}
style={{ width: size, height: size, borderRadius: 2, overflow: 'hidden' }}
>
{el.avatar ? (
<img

View File

@@ -18,7 +18,7 @@
justify-content: center;
width: 34px;
height: 34px;
background-color: #69b1ff;
background-color: #cfd1d4;
border-radius: 4px;
img {

View File

@@ -66,7 +66,7 @@
height: 40px;
overflow: hidden;
line-height: 1;
background-color: #69b1ff;
background-color: #cfd1d4;
border-radius: 4px;
}

View File

@@ -242,12 +242,12 @@ const ChatLogs: React.FC = () => {
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();