消息类型: contact: 复制; location

dev/chat
Lei OT 2 years ago
parent 7002f72cbf
commit c30628681d

@ -363,7 +363,20 @@ export const whatsappMsgTypeMapped = {
data: msg.contacts.map(ele => ({ id: ele.phones[0].wa_id, wa_id: ele.phones[0].wa_id, name: ele.name.formatted_name })),
}),
},
// location: 'location',
location: {
type: 'location',
data: (msg) => ({
id: msg.wamid,
title: msg.location.name || '位置信息',
text: msg.location.address || '位置',
src: msg.location.url || 'https://cdn.pixabay.com/photo/2016/03/22/04/23/map-1272165_1280.png',
data: {
longitude: msg.location?.longitude,
latitude: msg.location?.latitude,
},
originText: msg.location?.address || '',
}),
},
// contact: 'contact',
// 'contact-card': 'contact-card',
// 'contact-card-with-photo': 'contact-card-with-photo',

@ -6,8 +6,9 @@ import useConversationStore from '@/stores/ConversationStore';
import { useShallow } from 'zustand/react/shallow';
import { isEmpty, olog } from '@/utils/utils';
const MessagesList = ({ reference, ...props }) => {
const MessagesList = ({ reference, contactsModalOpen, setContactsModalOpen, ...props }) => {
const setReferenceMsg = useConversationStore(useShallow((state) => state.setReferenceMsg));
olog('render message list');
const scrollToMessage = (id, index) => {
const _i = index || props.dataSource.findIndex((msg) => msg.id === id);
@ -137,23 +138,7 @@ const MessagesList = ({ reference, ...props }) => {
})}
{...(message.type === 'meetingLink'
? {
actionButtons:
message.data.length === 1
? [
{
onClickButton: () => {
alert(`发消息 ${message.text}`);
},
Component: () => <div>发消息</div>,
},
]
: [
{
onClickButton: () => {
alert(`${message.text}`);
},
Component: () => <div>查看</div>, //
},
actionButtons: [
{
onClickButton: () => {
navigator.clipboard.writeText(message.text);

Loading…
Cancel
Save