WhatsApp号码判断

dev/chat
Lei OT 2 years ago
parent fda145219e
commit fa89685dd2

@ -128,7 +128,7 @@ const InputComposer = () => {
/> />
<Flex justify={'space-between'} className=' bg-gray-200 p-1 rounded-b'> <Flex justify={'space-between'} className=' bg-gray-200 p-1 rounded-b'>
<Flex gap={4} className='*:text-primary *:rounded-none'> <Flex gap={4} className='*:text-primary *:rounded-none'>
<InputTemplate key='templates' disabled={textabled} invokeSendMessage={invokeSendMessage} /> <InputTemplate key='templates' disabled={!talkabled} invokeSendMessage={invokeSendMessage} />
<InputEmoji key='emoji' disabled={!textabled} inputEmoji={(s) => setTextContent(`${textContent}${s}`)} /> <InputEmoji key='emoji' disabled={!textabled} inputEmoji={(s) => setTextContent(`${textContent}${s}`)} />
{/* <InputImageUpload key={'addNewPic'} disabled={!textabled} invokeSendMessage={invokeSendMessage} /> */} {/* <InputImageUpload key={'addNewPic'} disabled={!textabled} invokeSendMessage={invokeSendMessage} /> */}
{/* <Button type='text' className='' icon={<YoutubeOutlined />} size={'middle'} /> {/* <Button type='text' className='' icon={<YoutubeOutlined />} size={'middle'} />

@ -34,7 +34,7 @@ const Messages = () => {
}; };
const RenderText = memo(function renderText({str}) { const RenderText = memo(function renderText({str}) {
const parts = str.split(/(https?:\/\/[^\s]+|\p{Emoji_Presentation})/gmu); const parts = str.split(/(https?:\/\/[^\s]+|\p{Emoji_Presentation})/gmu).filter(s => s !== '');
// const parts = str.split(/(https?:\/\/[^\s]+|\p{Emoji}\uFE0F?|\b\d+\b)/gu); // const parts = str.split(/(https?:\/\/[^\s]+|\p{Emoji}\uFE0F?|\b\d+\b)/gu);
return ( return (
<> <>
@ -50,10 +50,10 @@ const Messages = () => {
{part} {part}
</a> </a>
); );
// } else if (part.trim() !== '') { } else if (part.trim() !== '') {
// return <span key={`${part}${index}`}>{part}</span>; return <span key={`${part}${index}`}>{part}</span>;
} else { } else {
return <>{part}</>; // <span key={`${part}${index}`}>{part}</span>; return <span key={`${part}${index}`}>{part}</span>;
} }
})} })}
</> </>
@ -65,7 +65,7 @@ const Messages = () => {
<Spin spinning={msgListLoading} tip={'正在读取...'} wrapperClassName='pt-8 '> <Spin spinning={msgListLoading} tip={'正在读取...'} wrapperClassName='pt-8 '>
{activeMessages.map((message, index) => ( {activeMessages.map((message, index) => (
<Dropdown <Dropdown
key={message.key} key={message.id}
menu={{ menu={{
items: [{ label: '回复', key: 'reply', disabled: !['text'].includes(message.whatsapp_msg_type) }], items: [{ label: '回复', key: 'reply', disabled: !['text'].includes(message.whatsapp_msg_type) }],
onClick: ({ key, domEvent }) => { onClick: ({ key, domEvent }) => {

@ -20,9 +20,11 @@ const MessagesHeader = () => {
message='断开连接' message='断开连接'
banner banner
action={ action={
websocketRetrytimes === -1 ? <Tooltip key={'connect'} title='点击重试'> websocketRetrytimes === -1 ? (
<Button key={'connect'} type='text' icon={<ApiOutlined />} onClick={() => connectWebsocket(userId)} className=' text-blue-500' /> <Tooltip key={'connect'} title='点击重试'>
</Tooltip> : null <Button key={'connect'} type='text' icon={<ApiOutlined />} onClick={() => connectWebsocket(userId)} className=' text-blue-500' />
</Tooltip>
) : null
} }
/> />
)} )}
@ -31,8 +33,16 @@ const MessagesHeader = () => {
{/* {currentConversation.customer_name && <Avatar src={`https://api.dicebear.com/7.x/avataaars/svg?seed=${currentConversation.customer_name}`} />} */} {/* {currentConversation.customer_name && <Avatar src={`https://api.dicebear.com/7.x/avataaars/svg?seed=${currentConversation.customer_name}`} />} */}
<Flex flex={'1'} justify='space-between'> <Flex flex={'1'} justify='space-between'>
<Flex vertical={false} gap={12} justify='space-between'> <Flex vertical={false} gap={12} justify='space-between'>
<Typography.Text strong>{currentConversation.customer_name}</Typography.Text> {currentConversation.whatsapp_phone_number ? (
<Typography.Text>{currentConversation.whatsapp_phone_number}</Typography.Text> <>
<Typography.Text strong>{currentConversation.customer_name}</Typography.Text>
<Typography.Text>{currentConversation.whatsapp_phone_number}</Typography.Text>
</>
) : (
<Typography.Text strong type='danger'>
没有WhatsApp号码
</Typography.Text>
)}
</Flex> </Flex>
<Flex vertical={true} justify='space-between'> <Flex vertical={true} justify='space-between'>
<Typography.Text>{/* <LocalTimeClock /> <Typography.Text strong>{order?.location} </Typography.Text> */}</Typography.Text> <Typography.Text>{/* <LocalTimeClock /> <Typography.Text strong>{order?.location} </Typography.Text> */}</Typography.Text>

Loading…
Cancel
Save