引用: 图片, 视频

dev/chat
Lei OT 2 years ago
parent 07b7493a60
commit 39bf2e717b

@ -81,7 +81,7 @@ export const sentMsgTypeMapped = {
message: msg.message_origin.text, message: msg.message_origin.text,
title: msg.message_origin.senderName || 'Reference', title: msg.message_origin.senderName || 'Reference',
titleColor: msg.message_origin?.senderName !== 'me' ? '#a791ff' : '#128c7e', titleColor: msg.message_origin?.senderName !== 'me' ? '#a791ff' : '#128c7e',
// titleColor: "#a791ff", photoURL: msg.message_origin?.data?.uri || '',
}, },
} }
: {}), : {}),
@ -213,6 +213,7 @@ export const whatsappMsgTypeMapped = {
id: msg.wamid, id: msg.wamid,
text: msg.image.caption, text: msg.image.caption,
data: { id: msg.wamid, uri: msg.image.link, width: '100%', height: 200, alt: msg.image.caption, }, data: { id: msg.wamid, uri: msg.image.link, width: '100%', height: 200, alt: msg.image.caption, },
originText: msg.image?.caption || '',
onOpen: () => { onOpen: () => {
console.log('Open image', msg.image.link); console.log('Open image', msg.image.link);
}, },
@ -227,6 +228,9 @@ export const whatsappMsgTypeMapped = {
id: msg.wamid, id: msg.wamid,
data: { id: msg.wamid, uri: msg.sticker.link, width: '100%', height: 120, alt: '' }, data: { id: msg.wamid, uri: msg.sticker.link, width: '100%', height: 120, alt: '' },
}), }),
renderForReply: (msg) => ({
id: msg.wamid, photoURL: msg.sticker.link, width: '100%', height: 200, alt: '', message: '[表情]'
}),
}, },
video: { video: {
type: 'video', type: 'video',
@ -243,7 +247,7 @@ export const whatsappMsgTypeMapped = {
}, },
}), }),
renderForReply: (msg) => ({ renderForReply: (msg) => ({
id: msg.wamid, videoURL: msg.video.link, width: 200, height: 200, alt: '', id: msg.wamid, videoURL: msg.video.link, photoURL: msg.video.link, message: msg.video?.caption || '[视频]', width: 200, height: 200, alt: '',
}), }),
}, },
audio: { audio: {
@ -263,7 +267,10 @@ export const whatsappMsgTypeMapped = {
}, },
document: { document: {
type: 'file', type: 'file',
data: (msg) => ({ id: msg.wamid, title: msg.document?.filename || '', text: msg.document?.caption || msg.document?.filename || '', data: { uri: msg.document.link, extension: 'PDF', status: { click: false, download: true, loading: 0, } } }), data: (msg) => ({ id: msg.wamid, title: msg.document?.filename || '', text: msg.document?.caption || msg.document?.filename || '', data: { uri: msg.document.link, extension: 'PDF', status: { click: false, download: true, loading: 0, } }, originText: msg.document?.caption || msg.document?.filename || '', }),
renderForReply: (msg) => ({
id: msg.wamid, message: msg.document?.caption || msg.document?.filename || '',
}),
}, },
// location: 'location', // location: 'location',
// contact: 'contact', // contact: 'contact',

@ -97,8 +97,9 @@ const InputComposer = () => {
{referenceMsg.id && ( {referenceMsg.id && (
<Flex justify='space-between' className='reply-to bg-gray-100 p-1 rounded-none text-slate-500'> <Flex justify='space-between' className='reply-to bg-gray-100 p-1 rounded-none text-slate-500'>
<div className='referrer-msg border-l-3 border-y-0 border-r-0 border-slate-300 border-solid pl-2 pr-1 py-1'> <div className='referrer-msg border-l-3 border-y-0 border-r-0 border-slate-300 border-solid pl-2 pr-1 py-1'>
<span className=' text-primary pr-1 italic'>{referenceMsg.senderName}</span> <span className=' text-primary pr-1 italic align-top'>{referenceMsg.senderName}</span>
{referenceMsg.originText} {referenceMsg.type === 'photo' && <Image width={100} src={referenceMsg.data.uri} />}
<span className='px-1'>{referenceMsg.originText}</span>
</div> </div>
<Button type='text' title='取消引用' className=' rounded-none text-slate-500' icon={<CloseCircleOutlined />} size={'middle'} onClick={() => setReferenceMsg({})} /> <Button type='text' title='取消引用' className=' rounded-none text-slate-500' icon={<CloseCircleOutlined />} size={'middle'} onClick={() => setReferenceMsg({})} />
</Flex> </Flex>

Loading…
Cancel
Save