2023-04-11 15:29:40 +08:00
|
|
|
|
import { RedEnvelopeFilled } from '@ant-design/icons';
|
|
|
|
|
import { IChatItem } from '../ChatLogsType';
|
|
|
|
|
|
|
|
|
|
export const ChatRedpacket: React.FC<IChatItem> = (props) => {
|
2023-04-13 17:36:49 +08:00
|
|
|
|
const type: any = {
|
|
|
|
|
1: '普通红包',
|
|
|
|
|
2: '拼手气群红包',
|
|
|
|
|
3: '激励群红包',
|
|
|
|
|
};
|
2023-04-11 15:29:40 +08:00
|
|
|
|
function content() {
|
|
|
|
|
try {
|
|
|
|
|
const msg = JSON.parse(props.chat?.content as string);
|
|
|
|
|
return (
|
|
|
|
|
<div>
|
|
|
|
|
<div style={{ display: 'flex' }}>
|
|
|
|
|
<RedEnvelopeFilled
|
|
|
|
|
style={{ fontSize: 40, color: 'red', flexShrink: 0, paddingRight: 8 }}
|
|
|
|
|
/>
|
|
|
|
|
<div>
|
|
|
|
|
<div style={{ wordBreak: 'break-all' }}>{msg.wish}</div>
|
|
|
|
|
<div style={{ wordBreak: 'break-all' }}>
|
|
|
|
|
{msg.totalcnt}个,{(msg.totalamount / 100).toFixed(2)}元
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2023-04-13 17:36:49 +08:00
|
|
|
|
<div style={{ borderTop: '1px solid #ddd', marginTop: 8, paddingTop: 8, color: '#999' }}>
|
|
|
|
|
{type[msg.type]}
|
|
|
|
|
</div>
|
2023-04-11 15:29:40 +08:00
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
} catch (_e) {
|
|
|
|
|
return (
|
|
|
|
|
<div>
|
|
|
|
|
<div style={{ display: 'flex' }}>
|
|
|
|
|
<RedEnvelopeFilled
|
|
|
|
|
style={{ fontSize: 40, color: 'red', flexShrink: 0, paddingRight: 8 }}
|
|
|
|
|
/>
|
|
|
|
|
<div style={{ wordBreak: 'break-all' }}>{props.chat?.content}</div>
|
|
|
|
|
</div>
|
2023-04-13 17:36:49 +08:00
|
|
|
|
<div style={{ borderTop: '1px solid #ddd', marginTop: 8, paddingTop: 8, color: '#999' }}>
|
|
|
|
|
红包
|
|
|
|
|
</div>
|
2023-04-11 15:29:40 +08:00
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-13 17:36:49 +08:00
|
|
|
|
return <>{content()}</>;
|
2023-04-11 15:29:40 +08:00
|
|
|
|
};
|