perf: 提示WhatsApp商业号切换

dev/emitter
Lei OT 10 months ago
parent 5ecea03566
commit 2f4d619ace

@ -1,5 +1,5 @@
import React, { useState, useRef, useEffect } from 'react'; import React, { useState, useRef, useEffect } from 'react';
import { App, Input, Flex, Button, Image } from 'antd'; import { App, Input, Flex, Button, Image, Alert } from 'antd';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
// import { Input } from 'react-chat-elements'; // import { Input } from 'react-chat-elements';
import useAuthStore from '@/stores/AuthStore'; import useAuthStore from '@/stores/AuthStore';
@ -84,7 +84,7 @@ const InputComposer = ({ channel, currentActive }) => {
from: fromIM, from: fromIM,
date: new Date(), date: new Date(),
status: 'waiting', status: 'waiting',
...(referenceMsg.id ? { context: { message_id: referenceMsg.id }, message_origin: referenceMsg } : {}), ...(referenceMsg.id ? { context: { message_id: referenceMsg.id }, message_origin: referenceMsg, from: referenceMsg.waba } : {}),
...msgObj, ...msgObj,
id: `${currentConversation.sn}.${uuid()}`, id: `${currentConversation.sn}.${uuid()}`,
}; };
@ -239,13 +239,23 @@ const InputComposer = ({ channel, currentActive }) => {
} }
}; };
const [wabaWarning, setWabaWarning] = useState('');
useEffect(() => { useEffect(() => {
if (currentActive) focusInput(); if (currentActive) focusInput();
return () => {}; if (!isEmpty(referenceMsg) && referenceMsg.waba !== fromIM.replace('+', '')) {
setWabaWarning('注意: 回复的消息与当前使用的WABA账户不一致. 请到个人资料页面切换WABA商业号身份.')
} else {
setWabaWarning('');
}
return () => {
setWabaWarning('');
};
}, [referenceMsg, complexMsg, currentActive]); }, [referenceMsg, complexMsg, currentActive]);
return ( return (
<div> <div>
{wabaWarning && <Alert message={wabaWarning} type="error" showIcon /> }
{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='flex flex-col referrer-msg border-l-3 border-y-0 border-r-0 border-slate-300 border-solid pl-2 pr-1 py-1'> <div className='flex flex-col referrer-msg border-l-3 border-y-0 border-r-0 border-slate-300 border-solid pl-2 pr-1 py-1'>

Loading…
Cancel
Save