开发: 修改页面, 修改引入录音js

This commit is contained in:
zhengw
2023-04-19 15:30:29 +08:00
parent 079739223a
commit 21c1790dc4
15 changed files with 423 additions and 545 deletions

View File

@@ -54,10 +54,17 @@ export interface ICustFollow {
state: number;
sync_time: string;
tags: string;
add_way: number;
create_time: string;
user_id: string;
}
export interface IGroup {
admin_list: string;
adminUserIDs: string[];
create_time: string;
group_id: string;
name: string;

View File

@@ -60,6 +60,27 @@ export const adminList = (data: any, groupMembers: any) => {
return <></>;
};
/**
* 返回群管理员 userid 数组
* @param data
* @returns
*/
export const getAdminList = (data: any) => {
if (data) {
try {
const msg = JSON.parse(data);
if (Array.isArray(msg)) {
let arr: string[] = [];
msg.forEach((item) => {
arr.push(item.userid);
});
return arr;
}
} catch (e) {}
}
return [];
};
/**
* 客户等级等信息

View File

@@ -7,28 +7,34 @@ export const Gender: React.FC<IProps> = (props) => {
{props?.gender ? (
<>
{props?.gender == 1 ? (
<svg viewBox="0 0 1024 1024" width="16" height="16">
<path
d="M828.875 765.657c-191.159-16.86-202.516-102.922-202.516-102.922v-85.997c111.656-43.063 145.76-207.699 145.76-207.699 0-65.457-32.153-67.281-32.153-67.281V195.093c7.486-177.753-100.33-136.61-102.25-136.61-1.791 0-60.466-46.774-60.466-46.774-41.751-31.8-134.499 11.262-134.499 11.262l-3.839 0.064c-104.937 2.751-132.387 78.479-132.387 78.479l1.92 196.437c-54.804 0-47.35 76.719-47.35 76.719 0 84.142 147.616 200.148 147.616 200.148 9.47 110.472-49.174 166.46-49.174 166.46s-100.266 3.711-213.84 37.432c-2.72 0.863-5.344 1.6-7.967 2.463C30.617 817.421 0 920.855 0 920.855v101.033l463.579 1.888 68.465-1.92h491.732V943.25c1.92-115.815-194.901-177.593-194.901-177.593z m-244.65 129.22l-71.25 128.675-69.616-128.676-16.124-64.05 30.68-136.354h111.656l29.178 136.354-14.525 64.05z"
fill="#1890ff"
></path>
</svg>
<span title="男" style={{ display: 'inline-flex', alignItems: 'center' }}>
<svg viewBox="0 0 1024 1024" width="16" height="16">
<path
d="M828.875 765.657c-191.159-16.86-202.516-102.922-202.516-102.922v-85.997c111.656-43.063 145.76-207.699 145.76-207.699 0-65.457-32.153-67.281-32.153-67.281V195.093c7.486-177.753-100.33-136.61-102.25-136.61-1.791 0-60.466-46.774-60.466-46.774-41.751-31.8-134.499 11.262-134.499 11.262l-3.839 0.064c-104.937 2.751-132.387 78.479-132.387 78.479l1.92 196.437c-54.804 0-47.35 76.719-47.35 76.719 0 84.142 147.616 200.148 147.616 200.148 9.47 110.472-49.174 166.46-49.174 166.46s-100.266 3.711-213.84 37.432c-2.72 0.863-5.344 1.6-7.967 2.463C30.617 817.421 0 920.855 0 920.855v101.033l463.579 1.888 68.465-1.92h491.732V943.25c1.92-115.815-194.901-177.593-194.901-177.593z m-244.65 129.22l-71.25 128.675-69.616-128.676-16.124-64.05 30.68-136.354h111.656l29.178 136.354-14.525 64.05z"
fill="#1890ff"
></path>
</svg>
</span>
) : (
<svg viewBox="0 0 1025 1024" width="16" height="16">
<path
d="M613.312 626.496v-11.2h151.296V318.08c0-124.736-113.152-225.856-252.608-225.856S259.392 193.344 259.392 318.08v297.216h151.36v11.072h-0.256L115.648 820.16v107.136H908.48v-105.92l-295.168-194.88z m7.68 186.752c-72.192 69.824-109.504-36.416-109.504-36.416s-37.312 106.24-109.568 36.416c0 0-31.744-20.544-35.136-158.208l144.704 121.728L656.192 655.04c-3.392 137.6-35.2 158.208-35.2 158.208z"
fill="#1890ff"
></path>
</svg>
<span title="女" style={{ display: 'inline-flex', alignItems: 'center' }}>
<svg viewBox="0 0 1025 1024" width="16" height="16">
<path
d="M613.312 626.496v-11.2h151.296V318.08c0-124.736-113.152-225.856-252.608-225.856S259.392 193.344 259.392 318.08v297.216h151.36v11.072h-0.256L115.648 820.16v107.136H908.48v-105.92l-295.168-194.88z m7.68 186.752c-72.192 69.824-109.504-36.416-109.504-36.416s-37.312 106.24-109.568 36.416c0 0-31.744-20.544-35.136-158.208l144.704 121.728L656.192 655.04c-3.392 137.6-35.2 158.208-35.2 158.208z"
fill="#1890ff"
></path>
</svg>
</span>
)}
</>
) : (
<svg viewBox="0 0 1024 1024" width="16" height="16">
<path
d="M880.864 704.346c-56.813-25.397-141.118-90.818-265.945-113.298 31.924-34.36 56.084-88.097 80.937-151.754 14.403-36.893 11.935-68.343 11.935-113.121 0-33.073 6.193-86.156-1.97-115.329-27.533-98.59-97.1-125.79-178.61-125.79-81.577 0-151.229 27.328-178.71 126.087-8.097 29.083-1.888 82.044-1.888 115.037 0 44.875-2.422 76.432 12.019 113.383 25.044 63.984 48.854 117.644 80.655 151.86-123.826 22.89-207.498 87.822-263.95 113.138C58.523 756.945 57.95 814.296 57.95 814.296v97.42l940.724-0.112v-97.308s-0.547-57.548-117.809-109.95z"
fill="#1890ff"
></path>
</svg>
<span title="未知" style={{ display: 'inline-flex', alignItems: 'center' }}>
<svg viewBox="0 0 1024 1024" width="16" height="16">
<path
d="M880.864 704.346c-56.813-25.397-141.118-90.818-265.945-113.298 31.924-34.36 56.084-88.097 80.937-151.754 14.403-36.893 11.935-68.343 11.935-113.121 0-33.073 6.193-86.156-1.97-115.329-27.533-98.59-97.1-125.79-178.61-125.79-81.577 0-151.229 27.328-178.71 126.087-8.097 29.083-1.888 82.044-1.888 115.037 0 44.875-2.422 76.432 12.019 113.383 25.044 63.984 48.854 117.644 80.655 151.86-123.826 22.89-207.498 87.822-263.95 113.138C58.523 756.945 57.95 814.296 57.95 814.296v97.42l940.724-0.112v-97.308s-0.547-57.548-117.809-109.95z"
fill="#1890ff"
></path>
</svg>
</span>
)}
</>
);

View File

@@ -0,0 +1,43 @@
export const OwnerSvg = () => {
return (
<span
title="创建者"
style={{
display: 'inline-flex',
alignItems: 'center',
position: 'absolute',
top: 0,
right: 0,
}}
>
<svg viewBox="0 0 1024 1024" width="16" height="16">
<path
d="M880.864 704.346c-56.813-25.397-141.118-90.818-265.945-113.298 31.924-34.36 56.084-88.097 80.937-151.754 14.403-36.893 11.935-68.343 11.935-113.121 0-33.073 6.193-86.156-1.97-115.329-27.533-98.59-97.1-125.79-178.61-125.79-81.577 0-151.229 27.328-178.71 126.087-8.097 29.083-1.888 82.044-1.888 115.037 0 44.875-2.422 76.432 12.019 113.383 25.044 63.984 48.854 117.644 80.655 151.86-123.826 22.89-207.498 87.822-263.95 113.138C58.523 756.945 57.95 814.296 57.95 814.296v97.42l940.724-0.112v-97.308s-0.547-57.548-117.809-109.95z"
fill="#f4ea2a"
></path>
</svg>
</span>
);
};
export const AdminSvg = () => {
return (
<span
title="管理员"
style={{
display: 'inline-flex',
alignItems: 'center',
position: 'absolute',
top: 0,
right: 0,
}}
>
<svg viewBox="0 0 1024 1024" width="16" height="16">
<path
d="M880.864 704.346c-56.813-25.397-141.118-90.818-265.945-113.298 31.924-34.36 56.084-88.097 80.937-151.754 14.403-36.893 11.935-68.343 11.935-113.121 0-33.073 6.193-86.156-1.97-115.329-27.533-98.59-97.1-125.79-178.61-125.79-81.577 0-151.229 27.328-178.71 126.087-8.097 29.083-1.888 82.044-1.888 115.037 0 44.875-2.422 76.432 12.019 113.383 25.044 63.984 48.854 117.644 80.655 151.86-123.826 22.89-207.498 87.822-263.95 113.138C58.523 756.945 57.95 814.296 57.95 814.296v97.42l940.724-0.112v-97.308s-0.547-57.548-117.809-109.95z"
fill="#1890ff"
></path>
</svg>
</span>
);
};

View File

@@ -66,6 +66,19 @@
border-radius: 4px;
}
.inGroupAvatar {
position: relative;
display: flex;
flex-shrink: 0;
align-items: center;
justify-content: center;
width: 56px;
height: 56px;
line-height: 1;
background-color: #69b1ff;
border-radius: 4px;
}
.chatBBox {
position: relative;
height: calc(100vh - 212px - 164px);
@@ -82,8 +95,8 @@
transition: top 0.3s, height 0.3s;
&.delFollowListShow {
top: 0;
height: calc(100% - 34px);
top: 164px;
height: calc(100% - 164px);
}
}

View File

@@ -5,12 +5,13 @@ import { Drawer, Form, Input, Tabs } from 'antd';
import Spin from 'antd/lib/spin';
import { stringify } from 'qs';
import React, { useEffect, useRef, useState } from 'react';
import { CustDetailContent } from '../CustomList/components/CustDetailContent';
import { DepartmentMembersDetail } from '../DepartmentsList/components/DepartmentMemberDetail';
import { IChat, ICustFollow, IGroup, IGroupMembers, IStaffsItem } from './ChatLogsType';
import { adminList, formatTags, groupMembersCount, groupMembersCount2 } from './ChatUtils';
import { adminList, getAdminList, groupMembersCount, groupMembersCount2 } from './ChatUtils';
import { ChatBar } from './components/ChatBar';
import { ChatTime } from './components/ChatTime';
import { Gender } from './components/Gender';
import { AdminSvg, OwnerSvg } from './components/Svgs';
import styles from './index.module.scss';
const ChatLogs: React.FC = () => {
@@ -187,11 +188,22 @@ const ChatLogs: React.FC = () => {
if (res.err_code == 0) {
if (Array.isArray(res.data)) {
groupMembersObjRef.current = {};
let owner: IGroupMembers[] = [];
let admin_list: IGroupMembers[] = [];
let other: IGroupMembers[] = [];
res.data.forEach((item: IGroupMembers) => {
item.avatar = item.staff_avatar || item.avatar;
groupMembersObjRef.current[item.user_id] = item;
if (item.user_id == selectGroupRef.current?.owner) {
owner.push(item);
} else if (selectGroupRef.current?.adminUserIDs.includes(item.user_id)) {
admin_list.push(item);
} else {
other.push(item);
}
});
setGroupMembersList(res.data);
// 对群员 创建者 > 管理员 > 普通成员 排序
setGroupMembersList([...owner, ...admin_list, ...other]);
page(1);
}
}
@@ -256,18 +268,79 @@ const ChatLogs: React.FC = () => {
getStaffsList();
observer.observe(chatBoxRef.current, { childList: true });
const myScript = document.createElement('script');
myScript.src = '/public/scripts/amrnb.js';
myScript.async = false;
document.body.appendChild(myScript);
return () => {
document.removeEventListener('click', show, false);
observer.disconnect();
document.body.removeChild(myScript);
};
}, []);
// 外部联系人Item
const custFollowsListItem = (item: ICustFollow) => {
return (
<div
key={item.cust_id}
className={`${styles.chatB} ${item.state == 0 ? styles.state0 : ''} ${
selectCustFollow?.cust_id == item.cust_id ? styles.active : ''
}`}
onClick={() => {
tabKeyRef.current = tabKey;
setSelectInnerStaff(undefined);
selectInnerStaffRef.current = undefined;
setSelectGroup(undefined);
selectGroupRef.current = undefined;
setSelectCustFollow(item);
selectCustFollowRef.current = item;
page(1);
}}
style={{ display: item.name.includes(searchWord['1']) ? '' : 'none' }}
>
<div className={styles.avatar} style={{ background: item?.avatar ? '#fff' : '' }}>
<img src={item.avatar} alt="" style={{ maxWidth: '100%', maxHeight: '100%', objectFit: 'cover' }} />
</div>
<div className={styles.chatAMsg} style={{ flexDirection: 'column' }}>
<div className={styles.chatAName} title={item.name}>
{item.name}
</div>
<div>{item.remark}</div>
</div>
</div>
);
};
// 客户群聊列表项
const groupListItem = (item: IGroup) => {
return (
<div
key={item.group_id}
className={`${styles.chatB} ${item.state == 0 ? styles.state0 : ''} ${selectGroup?.group_id == item.group_id ? styles.active : ''}`}
onClick={() => {
tabKeyRef.current = tabKey;
setSelectCustFollow(undefined);
selectCustFollowRef.current = undefined;
setSelectInnerStaff(undefined);
selectInnerStaffRef.current = undefined;
setSelectGroup(item);
selectGroupRef.current = item;
selectGroupRef.current.adminUserIDs = getAdminList(item.admin_list);
getGroupMembersList();
}}
style={{ display: item.name.includes(searchWord['2']) ? '' : 'none' }}
>
<div className={styles.avatar}>{item.name ? item.name[0] : '群'}</div>
<div className={styles.chatAMsg} style={{ flexDirection: 'column' }}>
<div className={styles.chatAName} title={item.name}>
{item.name || '未定义群名'}
</div>
<div style={{ color: '#999' }}>{groupStatus[item.status]}</div>
</div>
</div>
);
};
// const { notification } = App.useApp();
const tabContent = () => {
if (tabKey == '0') {
@@ -282,9 +355,7 @@ const ChatLogs: React.FC = () => {
return (
<div
key={`${item.user_id}_${item.name}`}
className={`${styles.chatB} ${
selectInnerStaff?.user_id == item.user_id ? styles.active : ''
}`}
className={`${styles.chatB} ${selectInnerStaff?.user_id == item.user_id ? styles.active : ''}`}
onClick={() => {
tabKeyRef.current = tabKey;
@@ -324,9 +395,7 @@ const ChatLogs: React.FC = () => {
);
})
) : (
<div style={{ lineHeight: '44px', textAlign: 'center', color: '#999' }}>
</div>
<div style={{ lineHeight: '44px', textAlign: 'center', color: '#999' }}></div>
)}
</>
);
@@ -335,53 +404,12 @@ const ChatLogs: React.FC = () => {
<>
{custFollowsList.length ? (
custFollowsList.map((item) => {
if (item.state == 0) return null;
return (
<div
key={item.cust_id}
className={`${styles.chatB} ${item.state == 0 ? styles.state0 : ''} ${
selectCustFollow?.cust_id == item.cust_id ? styles.active : ''
}`}
onClick={() => {
tabKeyRef.current = tabKey;
setSelectInnerStaff(undefined);
selectInnerStaffRef.current = undefined;
setSelectGroup(undefined);
selectGroupRef.current = undefined;
setSelectCustFollow(item);
selectCustFollowRef.current = item;
page(1);
}}
style={{ display: item.name.includes(searchWord['1']) ? '' : 'none' }}
>
<div className={styles.avatar} style={{ background: item?.avatar ? '#fff' : '' }}>
<img
src={item.avatar}
alt=""
style={{ maxWidth: '100%', maxHeight: '100%', objectFit: 'cover' }}
/>
</div>
<div className={styles.chatAMsg} style={{ flexDirection: 'column' }}>
<div className={styles.chatAName} title={item.name}>
{item.name}
</div>
<div>{item.remark}</div>
</div>
</div>
);
return item.state == 0 ? null : custFollowsListItem(item);
})
) : (
<div style={{ lineHeight: '44px', textAlign: 'center', color: '#999' }}>
</div>
<div style={{ lineHeight: '44px', textAlign: 'center', color: '#999' }}></div>
)}
<div
className={`${styles.delFollowList} ${
delFollowListShow ? styles.delFollowListShow : ''
}`}
>
<div className={`${styles.delFollowList} ${delFollowListShow ? styles.delFollowListShow : ''}`}>
<div
className={styles.delFollowListBar}
onClick={() => {
@@ -391,51 +419,9 @@ const ChatLogs: React.FC = () => {
<span></span>
{delFollowListShow ? <UpOutlined /> : <DownOutlined />}
</div>
<div
className={`${styles.delFollowListBox} ${
delFollowListShow ? styles.delFollowListBoxShow : ''
}`}
>
<div className={`${styles.delFollowListBox} ${delFollowListShow ? styles.delFollowListBoxShow : ''}`}>
{custFollowsList.map((item) => {
if (item.state == 1) return null;
return (
<div
key={item.cust_id}
className={`${styles.chatB} ${item.state == 0 ? styles.state0 : ''} ${
selectCustFollow?.cust_id == item.cust_id ? styles.active : ''
}`}
onClick={() => {
tabKeyRef.current = tabKey;
setSelectInnerStaff(undefined);
selectInnerStaffRef.current = undefined;
setSelectGroup(undefined);
selectGroupRef.current = undefined;
setSelectCustFollow(item);
selectCustFollowRef.current = item;
page(1);
}}
style={{ display: item.name.includes(searchWord['1']) ? '' : 'none' }}
>
<div
className={styles.avatar}
style={{ background: item?.avatar ? '#fff' : '' }}
>
<img
src={item.avatar}
alt=""
style={{ maxWidth: '100%', maxHeight: '100%', objectFit: 'cover' }}
/>
</div>
<div className={styles.chatAMsg} style={{ flexDirection: 'column' }}>
<div className={styles.chatAName} title={item.name}>
{item.name}
</div>
<div>{item.remark}</div>
</div>
</div>
);
return item.state == 1 ? null : custFollowsListItem(item);
})}
</div>
</div>
@@ -446,45 +432,12 @@ const ChatLogs: React.FC = () => {
<>
{groupList.length ? (
groupList.map((item) => {
if (item.state == 0) return null;
return (
<div
key={item.group_id}
className={`${styles.chatB} ${item.state == 0 ? styles.state0 : ''} ${
selectGroup?.group_id == item.group_id ? styles.active : ''
}`}
onClick={() => {
tabKeyRef.current = tabKey;
setSelectCustFollow(undefined);
selectCustFollowRef.current = undefined;
setSelectInnerStaff(undefined);
selectInnerStaffRef.current = undefined;
setSelectGroup(item);
selectGroupRef.current = item;
getGroupMembersList();
}}
style={{ display: item.name.includes(searchWord['2']) ? '' : 'none' }}
>
<div className={styles.avatar}>{item.name ? item.name[0] : '群'}</div>
<div className={styles.chatAMsg} style={{ flexDirection: 'column' }}>
<div className={styles.chatAName} title={item.name}>
{item.name || '未定义群名'}
</div>
<div style={{ color: '#999' }}>{groupStatus[item.status]}</div>
</div>
</div>
);
return item.state == 0 ? null : groupListItem(item);
})
) : (
<div style={{ lineHeight: '44px', textAlign: 'center', color: '#999' }}>
</div>
<div style={{ lineHeight: '44px', textAlign: 'center', color: '#999' }}></div>
)}
<div
className={`${styles.delFollowList} ${
delGroupListShow ? styles.delFollowListShow : ''
}`}
>
<div className={`${styles.delFollowList} ${delGroupListShow ? styles.delFollowListShow : ''}`}>
<div
className={styles.delFollowListBar}
onClick={() => {
@@ -494,40 +447,9 @@ const ChatLogs: React.FC = () => {
<span></span>
{delGroupListShow ? <UpOutlined /> : <DownOutlined />}
</div>
<div
className={`${styles.delFollowListBox} ${
delGroupListShow ? styles.delFollowListBoxShow : ''
}`}
>
<div className={`${styles.delFollowListBox} ${delGroupListShow ? styles.delFollowListBoxShow : ''}`}>
{groupList.map((item) => {
if (item.state == 1) return null;
return (
<div
key={item.group_id}
className={`${styles.chatB} ${item.state == 0 ? styles.state0 : ''} ${
selectGroup?.group_id == item.group_id ? styles.active : ''
}`}
onClick={() => {
tabKeyRef.current = tabKey;
setSelectCustFollow(undefined);
selectCustFollowRef.current = undefined;
setSelectInnerStaff(undefined);
selectInnerStaffRef.current = undefined;
setSelectGroup(item);
selectGroupRef.current = item;
getGroupMembersList();
}}
style={{ display: item.name.includes(searchWord['2']) ? '' : 'none' }}
>
<div className={styles.avatar}>{item.name ? item.name[0] : '群'}</div>
<div className={styles.chatAMsg} style={{ flexDirection: 'column' }}>
<div className={styles.chatAName} title={item.name}>
{item.name || '未定义群名'}
</div>
<div style={{ color: '#999' }}>{groupStatus[item.status]}</div>
</div>
</div>
);
return item.state == 1 ? null : groupListItem(item);
})}
</div>
</div>
@@ -536,6 +458,104 @@ const ChatLogs: React.FC = () => {
}
};
// 删除的联系人/群
const tabContentDel = () => {
if (tabKey == '0') {
return <></>;
} else if (tabKey == '1') {
return (
<div className={`${styles.delFollowList} ${delFollowListShow ? styles.delFollowListShow : ''}`}>
<div
className={styles.delFollowListBar}
onClick={() => {
setDelFollowListShow(!delFollowListShow);
}}
>
<span></span>
{delFollowListShow ? <UpOutlined /> : <DownOutlined />}
</div>
<div className={`${styles.delFollowListBox} ${delFollowListShow ? styles.delFollowListBoxShow : ''}`}>
{custFollowsList.map((item) => {
return item.state == 1 ? null : custFollowsListItem(item);
})}
</div>
</div>
);
} else {
return (
<div className={`${styles.delFollowList} ${delGroupListShow ? styles.delFollowListShow : ''}`}>
<div
className={styles.delFollowListBar}
onClick={() => {
setDelGroupListShow(!delGroupListShow);
}}
>
<span></span>
{delGroupListShow ? <UpOutlined /> : <DownOutlined />}
</div>
<div className={`${styles.delFollowListBox} ${delGroupListShow ? styles.delFollowListBoxShow : ''}`}>
{groupList.map((item) => {
return item.state == 1 ? null : groupListItem(item);
})}
</div>
</div>
);
}
};
// 群 Drawer 群员
const groupMembersListItem = (item: IGroupMembers) => {
return (
<div
key={item.user_id}
style={{
display: 'inline-flex',
justifyContent: 'flex-start',
alignItems: 'center',
width: 80,
flexDirection: 'column',
verticalAlign: 'top',
marginTop: 12,
}}
>
<div className={styles.inGroupAvatar}>
{item.avatar ? (
<img
style={{
maxWidth: '100%',
maxHeight: '100%',
objectFit: 'cover',
borderRadius: 4,
}}
src={item.avatar}
alt=""
/>
) : item.name ? (
item.name[0]
) : (
''
)}
{item.user_id == selectGroupRef.current?.owner ? <OwnerSvg /> : null}
{selectGroupRef.current?.adminUserIDs?.includes(item.user_id) ? <AdminSvg /> : null}
</div>
<div
style={{
padding: '0 4px',
whiteSpace: 'nowrap',
minWidth: 0,
textOverflow: 'ellipsis',
overflow: 'hidden',
width: 72,
textAlign: 'center',
}}
title={item.name}
>
{item.name}
</div>
</div>
);
};
return (
<PageContainer>
<div className={styles.box}>
@@ -646,6 +666,7 @@ const ChatLogs: React.FC = () => {
}}
/>
<div className={styles.chatBBox}>{tabContent()}</div>
{tabContentDel()}
</div>
<div style={{ flex: 1 }}>
<div className={styles.logTop}>
@@ -687,53 +708,15 @@ const ChatLogs: React.FC = () => {
{tabKeyRef.current == '0' ? (
<DepartmentMembersDetail record={selectInnerStaff as IStaffsItem} />
) : tabKeyRef.current == '1' ? (
<div>
<div
style={{
display: 'flex',
borderBottom: '1px solid #ddd',
paddingBottom: 12,
marginBottom: 12,
}}
>
<div className={styles.modalAvatar}>
<img src={selectCustFollow?.avatar} alt="" />
</div>
<div style={{ display: 'flex', flexDirection: 'column' }}>
<div style={{ fontSize: 16 }}>
<span style={{ marginRight: 8 }}>{selectCustFollow?.name}</span>
<Gender gender={selectCustFollow?.gender} />
</div>
<div style={{ color: '#666' }}>{selectCustFollow?.description}</div>
</div>
</div>
<div>{selectCustFollow?.remark}</div>
<div
style={{
paddingTop: 12,
marginBottom: 12,
paddingBottom: 12,
borderBottom: '1px solid #ddd',
fontSize: 16,
fontWeight: 'bold',
}}
>
</div>
{formatTags(selectCustFollow?.tags)}
</div>
<CustDetailContent record={selectCustFollow as ICustFollow} />
) : (
<div>
<div style={{ marginBottom: 8, textIndent: '2em' }}>
{groupMembersObjRef.current[selectGroupRef.current?.owner as string]?.name}
</div>
<div style={{ marginBottom: 8 }}>
{adminList(selectGroupRef.current?.admin_list, groupMembersObjRef.current)}
</div>
<div style={{ marginBottom: 8 }}>
{selectGroupRef.current?.create_time}
</div>
<div style={{ marginBottom: 8 }}>{adminList(selectGroupRef.current?.admin_list, groupMembersObjRef.current)}</div>
<div style={{ marginBottom: 8 }}>{selectGroupRef.current?.create_time}</div>
<div style={{ textIndent: '1em' }}>{selectGroupRef.current?.notice}</div>
<div
style={{
@@ -747,54 +730,7 @@ const ChatLogs: React.FC = () => {
{groupMembersList.length}
</div>
{groupMembersList.map((item) => {
if (item.group_members_type == '2' || item.state == 0) return null;
return (
<div
key={item.user_id}
style={{
display: 'inline-flex',
justifyContent: 'flex-start',
alignItems: 'center',
width: 80,
flexDirection: 'column',
verticalAlign: 'top',
marginTop: 12,
}}
>
<div className={styles.avatar}>
{item.avatar ? (
<img
style={{
maxWidth: '100%',
maxHeight: '100%',
objectFit: 'cover',
borderRadius: 4,
}}
src={item.avatar}
alt=""
/>
) : item.name ? (
item.name[0]
) : (
''
)}
</div>
<div
style={{
padding: '0 4px',
whiteSpace: 'nowrap',
minWidth: 0,
textOverflow: 'ellipsis',
overflow: 'hidden',
width: 72,
textAlign: 'center',
}}
title={item.name}
>
{item.name}
</div>
</div>
);
return item.group_members_type == '2' || item.state == 0 ? null : groupMembersListItem(item);
})}
{groupMembersCount2(groupMembersList, '2', 1) != 0 ? (
<div
@@ -810,54 +746,7 @@ const ChatLogs: React.FC = () => {
</div>
) : null}
{groupMembersList.map((item) => {
if (item.group_members_type == '1' || item.state == 0) return null;
return (
<div
key={item.user_id}
style={{
display: 'inline-flex',
justifyContent: 'flex-start',
alignItems: 'center',
width: 80,
flexDirection: 'column',
verticalAlign: 'top',
marginTop: 12,
}}
>
<div className={styles.avatar}>
{item.avatar ? (
<img
style={{
maxWidth: '100%',
maxHeight: '100%',
objectFit: 'cover',
borderRadius: 4,
}}
src={item.avatar}
alt=""
/>
) : item.name ? (
item.name[0]
) : (
''
)}
</div>
<div
style={{
padding: '0 4px',
whiteSpace: 'nowrap',
minWidth: 0,
textOverflow: 'ellipsis',
overflow: 'hidden',
width: 72,
textAlign: 'center',
}}
title={item.name}
>
{item.name}
</div>
</div>
);
return item.group_members_type == '1' || item.state == 0 ? null : groupMembersListItem(item);
})}
{groupMembersCount(groupMembersList, 0) != 0 ? (
<div
@@ -873,54 +762,7 @@ const ChatLogs: React.FC = () => {
</div>
) : null}
{groupMembersList.map((item) => {
if (item.state == 1) return null;
return (
<div
key={item.user_id}
style={{
display: 'inline-flex',
justifyContent: 'flex-start',
alignItems: 'center',
width: 80,
flexDirection: 'column',
verticalAlign: 'top',
marginTop: 12,
}}
>
<div className={styles.avatar}>
{item.avatar ? (
<img
style={{
maxWidth: '100%',
maxHeight: '100%',
objectFit: 'cover',
borderRadius: 4,
}}
src={item.avatar}
alt=""
/>
) : item.name ? (
item.name[0]
) : (
''
)}
</div>
<div
style={{
padding: '0 4px',
whiteSpace: 'nowrap',
minWidth: 0,
textOverflow: 'ellipsis',
overflow: 'hidden',
width: 72,
textAlign: 'center',
}}
title={item.name}
>
{item.name}
</div>
</div>
);
return item.state == 1 ? null : groupMembersListItem(item);
})}
</div>
)}
@@ -931,48 +773,26 @@ const ChatLogs: React.FC = () => {
className={styles.chatLogBox}
ref={chatBoxRef}
onScroll={(e: any) => {
if (
e.target?.scrollTop == 0 &&
!isAllChatRef.current &&
!chatLogLoadingRef.current
) {
if (e.target?.scrollTop == 0 && !isAllChatRef.current && !chatLogLoadingRef.current) {
page(param.curr_page + 1);
}
}}
>
{isAllChatRef.current ? (
<div style={{ marginBottom: 12, textAlign: 'center', color: '#999' }}>
</div>
) : null}
{isAllChatRef.current ? <div style={{ marginBottom: 12, textAlign: 'center', color: '#999' }}></div> : null}
{chatLogs.map((item) => {
if (item.curr_page) {
return (
<div
key={item.curr_page}
className={`curr_page${param.curr_page}`}
style={{ height: 0 }}
/>
);
return <div key={item.curr_page} className={`curr_page${param.curr_page}`} style={{ height: 0 }} />;
} else {
return (
<div key={item.msg_id}>
{/* {item.show_time ? <ChatTime msgtime={item.msg_time}></ChatTime> : null} */}
<ChatTime msgtime={item.msg_time} />
{tabKey == '2' ? (
<ChatBar
from={selectStaff}
to={groupMembersObjRef.current[item.msg_from]}
chat={item}
/>
<ChatBar from={selectStaff} to={groupMembersObjRef.current[item.msg_from]} chat={item} />
) : (
<ChatBar
from={selectStaff}
to={
tabKeyRef.current == '0'
? selectInnerStaffRef.current
: selectCustFollowRef.current
}
to={tabKeyRef.current == '0' ? selectInnerStaffRef.current : selectCustFollowRef.current}
chat={item}
/>
)}