perf: 新建会话: 加到列表顶部, 置顶的下面

2.0/email-builder
Lei OT 10 months ago
parent ee60c4fff4
commit 9bda8945da

@ -79,12 +79,13 @@ export function useConversationNewItem() {
}
const createdNew = await postNewOrEditConversationItem({ ...newChat, opisn: opisn || userId, conversationid });
// addToConversationList([{...createdNew, sn: createdNew.conversationid}]);
const _list = await fetchConversationsList({ opisn });
addToConversationList(_list);
if (!body.conversationid) {
const newChat = _list.find((item) => item.sn === createdNew.conversationid)
if (isEmpty(newChat)) {
setCurrentConversation({
// const _list = await fetchConversationsList({ opisn });
// addToConversationList(_list, 'top');
if (isEmpty(body.conversationid)) {
// const newChat = _list.find((item) => item.sn === createdNew.conversationid)
const newChat = createdNew;
if (!isEmpty(newChat)) {
const buildChatItem = {
...CHAT_ITEM_RECORD,
...createdNew,
sn: createdNew.conversationid,
@ -96,13 +97,16 @@ export function useConversationNewItem() {
conversation_memo: createdNew.remark,
lasttime: createdNew.session_creatime,
show_default: createdNew.remark || createdNew.guest_name || createdNew.guest_phone || createdNew.guest_email || createdNew.whatsapp_phone_number || '',
})
}
setCurrentConversation(buildChatItem);
addToConversationList([buildChatItem], 'top');
return ;
}
setCurrentConversation({
...newChat,
show_default: newChat.conversation_memo || newChat.whatsapp_name || newChat?.channels?.whatsapp_phone_number || newChat?.channels?.phone_number || newChat?.channels?.email || '',
})
// setCurrentConversation({
// ...newChat,
// show_default: newChat.conversation_memo || newChat.whatsapp_name || newChat?.channels?.whatsapp_phone_number || newChat?.channels?.phone_number || newChat?.channels?.email || '',
// })
return ;
}
};

@ -38,9 +38,12 @@ const MessagesHeader = () => {
<Flex vertical={false} gap={12} justify='space-between'>
{(currentConversation.coli_sn || currentConversation.sn) ? (
<>
<Typography.Text strong>{currentConversation.customer_name}</Typography.Text>
<Typography.Text strong>{currentConversation.show_default}</Typography.Text>
{currentConversation.sn ? (
<Typography.Text>{currentConversation.show_default}</Typography.Text>
<>
<Typography.Text>{currentConversation?.channels?.whatsapp_phone_number}</Typography.Text>
<Typography.Text>{currentConversation?.channels?.email}</Typography.Text>
</>
) : (
<Typography.Text strong type='danger'>
没有WhatsApp号码

Loading…
Cancel
Save