开发: 成员聊天页面

This commit is contained in:
zhengw
2023-04-13 17:36:49 +08:00
parent e2b466042f
commit b2bf2ade21
27 changed files with 970 additions and 512 deletions

View File

@@ -1,18 +1,25 @@
import { durationFormat } from '@/services/utils';
import { IChatItem } from '../ChatLogsType';
import styles from './index.module.scss';
export const ChatVoiptext: React.FC<IChatItem> = (props) => {
const invitetype: any = {
'1': '单人视频通话',
'2': '单人语音通话',
'3': '多人视频通话',
'4': '多人语音通话',
};
function content() {
try {
// todo ///
const msg = JSON.parse(props.chat?.content as string);
// console.log(msg);
return (
<div style={{ display: 'flex', color: '#000' }}>
<div style={{ display: 'flex', color: '#000', flexDirection: 'column' }}>
<div style={{ wordBreak: 'break-all', paddingRight: 8 }}>
{durationFormat(msg.callduration)}
</div>
<div style={{ borderTop: '1px solid #ddd', marginTop: 8, paddingTop: 8, color: '#999' }}>
{invitetype[msg.invitetype]}
</div>
</div>
);
} catch (_e) {
@@ -24,27 +31,5 @@ export const ChatVoiptext: React.FC<IChatItem> = (props) => {
}
}
return (
<>
{props.from?.user_id == props.chat?.msg_from ? (
<div className={styles.chatRight}>
<div className={styles.chatContentBox}>
<div className={styles.name}>{props.from?.name}</div>
<div className={styles.content}>{content()}</div>
</div>
<div className={styles.chatAvatar}>{props.from?.name[0]}</div>
</div>
) : (
<div className={styles.chatLeft}>
<div className={styles.chatAvatar}>
<img src={props.to?.cust_info.avatar} alt="" />
</div>
<div className={styles.chatContentBox}>
<div className={styles.name}>{props.to?.cust_info.name}</div>
<div className={styles.content}>{content()}</div>
</div>
</div>
)}
</>
);
return <>{content()}</>;
};