开发: 成员聊天页面
This commit is contained in:
@@ -1,54 +1,33 @@
|
||||
import { FileTextFilled } from '@ant-design/icons';
|
||||
import { IChatItem } from '../ChatLogsType';
|
||||
import styles from './index.module.scss';
|
||||
|
||||
export const ChatWeapp: React.FC<IChatItem> = (props) => {
|
||||
function content() {
|
||||
try {
|
||||
const msg = JSON.parse(props.chat?.content as string);
|
||||
console.log(msg);
|
||||
// console.log(msg);
|
||||
|
||||
return (
|
||||
<a
|
||||
style={{ display: 'flex', color: '#000' }}
|
||||
download={msg.file_name}
|
||||
href={`/api/${msg.path}`}
|
||||
>
|
||||
<div style={{ wordBreak: 'break-all', paddingRight: 8 }}>{msg.file_name}</div>
|
||||
<FileTextFilled style={{ fontSize: 40, color: '#FA9D3B', flexShrink: 0 }} />
|
||||
</a>
|
||||
<div style={{ display: 'flex', color: '#000' }}>
|
||||
<svg viewBox="0 0 1024 1024" width="40" height="40">
|
||||
<path d="M512 0a512 512 0 1 0 512 512A512 512 0 0 0 512 0z m256.717 460.186a151.962 151.962 0 0 1-87.347 65.74 83.251 83.251 0 0 1-24.474 4.096 29.082 29.082 0 0 1 0-58.163 15.667 15.667 0 0 0 6.451-1.229 91.443 91.443 0 0 0 55.91-40.96 75.264 75.264 0 0 0 11.06-39.628c0-45.978-42.496-83.866-94.31-83.866a105.267 105.267 0 0 0-51.2 13.414 81.92 81.92 0 0 0-43.725 70.452v244.224a138.445 138.445 0 0 1-72.704 120.422 159.642 159.642 0 0 1-79.77 20.48c-84.378 0-153.6-63.488-153.6-142.029a136.192 136.192 0 0 1 19.763-69.837 151.962 151.962 0 0 1 87.347-65.74 85.914 85.914 0 0 1 24.474-4.096 29.082 29.082 0 1 1 0 58.163 15.667 15.667 0 0 0-6.451 1.229 95.949 95.949 0 0 0-55.91 40.96 75.264 75.264 0 0 0-11.06 39.628c0 45.978 42.496 83.866 94.925 83.866a105.267 105.267 0 0 0 51.2-13.414 81.92 81.92 0 0 0 43.622-70.452V390.35a138.752 138.752 0 0 1 72.807-120.525 151.245 151.245 0 0 1 79.155-21.504c84.378 0 153.6 63.488 153.6 142.029a136.192 136.192 0 0 1-19.763 69.837z"></path>
|
||||
</svg>
|
||||
<div style={{ wordBreak: 'break-all', paddingLeft: 12, minWidth: 100 }}>
|
||||
<div>{msg.title}</div>
|
||||
<div>{msg.description}</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
} catch (_e) {
|
||||
return (
|
||||
<div>
|
||||
<div style={{ wordBreak: 'break-all', paddingRight: 8 }}>{props.chat?.content}</div>
|
||||
<FileTextFilled style={{ fontSize: 40, color: '#FA9D3B', flexShrink: 0 }} />
|
||||
<svg viewBox="0 0 1024 1024" width="40" height="40">
|
||||
<path d="M512 0a512 512 0 1 0 512 512A512 512 0 0 0 512 0z m256.717 460.186a151.962 151.962 0 0 1-87.347 65.74 83.251 83.251 0 0 1-24.474 4.096 29.082 29.082 0 0 1 0-58.163 15.667 15.667 0 0 0 6.451-1.229 91.443 91.443 0 0 0 55.91-40.96 75.264 75.264 0 0 0 11.06-39.628c0-45.978-42.496-83.866-94.31-83.866a105.267 105.267 0 0 0-51.2 13.414 81.92 81.92 0 0 0-43.725 70.452v244.224a138.445 138.445 0 0 1-72.704 120.422 159.642 159.642 0 0 1-79.77 20.48c-84.378 0-153.6-63.488-153.6-142.029a136.192 136.192 0 0 1 19.763-69.837 151.962 151.962 0 0 1 87.347-65.74 85.914 85.914 0 0 1 24.474-4.096 29.082 29.082 0 1 1 0 58.163 15.667 15.667 0 0 0-6.451 1.229 95.949 95.949 0 0 0-55.91 40.96 75.264 75.264 0 0 0-11.06 39.628c0 45.978 42.496 83.866 94.925 83.866a105.267 105.267 0 0 0 51.2-13.414 81.92 81.92 0 0 0 43.622-70.452V390.35a138.752 138.752 0 0 1 72.807-120.525 151.245 151.245 0 0 1 79.155-21.504c84.378 0 153.6 63.488 153.6 142.029a136.192 136.192 0 0 1-19.763 69.837z"></path>
|
||||
</svg>
|
||||
<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()}</>;
|
||||
};
|
||||
|
Reference in New Issue
Block a user