开发: 成员聊天页面

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,6 +1,5 @@
import { EnvironmentFilled } from '@ant-design/icons';
import { IChatItem } from '../ChatLogsType';
import styles from './index.module.scss';
export const ChatLocation: React.FC<IChatItem> = (props) => {
function content() {
@@ -8,49 +7,23 @@ export const ChatLocation: React.FC<IChatItem> = (props) => {
const msg = JSON.parse(props.chat?.content as string);
return (
<a
style={{ display: 'flex', color: '#000' }}
download={msg.file_name}
href={`/api/${msg.path}`}
>
<div style={{ wordBreak: 'break-all', paddingRight: 8 }}>
<div style={{ display: 'flex', color: '#000' }}>
<EnvironmentFilled style={{ fontSize: 40, color: '#FA9D3B', flexShrink: 0 }} />
<div style={{ wordBreak: 'break-all', paddingLeft: 12 }}>
<div>{msg.title}</div>
<div>{msg.address}</div>
</div>
<EnvironmentFilled style={{ fontSize: 40, color: '#FA9D3B', flexShrink: 0 }} />
</a>
</div>
);
} catch (_e) {
return (
<div>
<div style={{ wordBreak: 'break-all', paddingRight: 8 }}>{props.chat?.content}</div>
<EnvironmentFilled style={{ fontSize: 40, color: '#FA9D3B', flexShrink: 0 }} />
<div style={{ wordBreak: 'break-all', paddingLeft: 12 }}>{props.chat?.content}</div>
</div>
);
}
}
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()}</>;
};