引用: 图片, 视频

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

@ -81,7 +81,7 @@ export const sentMsgTypeMapped = {
message: msg.message_origin.text,
title: msg.message_origin.senderName || 'Reference',
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,
text: msg.image.caption,
data: { id: msg.wamid, uri: msg.image.link, width: '100%', height: 200, alt: msg.image.caption, },
originText: msg.image?.caption || '',
onOpen: () => {
console.log('Open image', msg.image.link);
},
@ -227,6 +228,9 @@ export const whatsappMsgTypeMapped = {
id: msg.wamid,
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: {
type: 'video',
@ -243,7 +247,7 @@ export const whatsappMsgTypeMapped = {
},
}),
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: {
@ -263,7 +267,10 @@ export const whatsappMsgTypeMapped = {
},
document: {
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',
// contact: 'contact',

@ -97,8 +97,9 @@ const InputComposer = () => {
{referenceMsg.id && (
<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'>
<span className=' text-primary pr-1 italic'>{referenceMsg.senderName}</span>
{referenceMsg.originText}
<span className=' text-primary pr-1 italic align-top'>{referenceMsg.senderName}</span>
{referenceMsg.type === 'photo' && <Image width={100} src={referenceMsg.data.uri} />}
<span className='px-1'>{referenceMsg.originText}</span>
</div>
<Button type='text' title='取消引用' className=' rounded-none text-slate-500' icon={<CloseCircleOutlined />} size={'middle'} onClick={() => setReferenceMsg({})} />
</Flex>

Loading…
Cancel
Save