From 4a1b7212aeba2f0006fb725e1696714cd508ee64 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Tue, 19 Mar 2024 17:18:21 +0800 Subject: [PATCH] fix: ConversationsList navigate replace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit test: 移动端键盘事件 fix: 历史记录: 搜索组件 --- src/components/SearchInput.jsx | 2 +- src/views/Conversations/Components/ConversationsList.jsx | 8 ++++---- src/views/Conversations/Components/InputComposer.jsx | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/SearchInput.jsx b/src/components/SearchInput.jsx index ef75603..58feb91 100644 --- a/src/components/SearchInput.jsx +++ b/src/components/SearchInput.jsx @@ -36,7 +36,7 @@ function DebounceSelect({ fetchOptions, debounceTimeout = 800, ...props }) { optionFilterProp='label' > {options.map((d) => ( - + {d.label} ))} diff --git a/src/views/Conversations/Components/ConversationsList.jsx b/src/views/Conversations/Components/ConversationsList.jsx index 0631632..408ea47 100644 --- a/src/views/Conversations/Components/ConversationsList.jsx +++ b/src/views/Conversations/Components/ConversationsList.jsx @@ -11,7 +11,8 @@ import useAuthStore from '@/stores/AuthStore'; * [] */ const Conversations = ({ mobile }) => { - const routerReplace = mobile === undefined ? false : true; + const routerReplace = mobile === undefined ? true : false; // : true; + const routePrefix = mobile === undefined ? `/order/chat` : `/m/chat`; const { state: orderRow } = useLocation(); const { coli_guest_WhatsApp } = orderRow || {}; const { order_sn } = useParams(); @@ -80,13 +81,12 @@ const Conversations = ({ mobile }) => { const onSwitchConversation = async (item) => { setCurrentConversation(item); - const routePrefix = mobile === undefined ? `/order/chat` : `/m/chat`; if (isEmpty(item.coli_sn)) { navigate(routePrefix, { replace: true }); } else { setSwitchToC(item); setShouldFetchCList(false); - navigate(`${routePrefix}/${item.coli_sn}`, { replace: routePrefix }); + navigate(`${routePrefix}/${item.coli_sn}`, { replace: routerReplace }); } // if (!isEmpty(item.coli_sn)) { // setSwitchToC(item); @@ -102,7 +102,7 @@ const Conversations = ({ mobile }) => { await fetchConversationItemClose({ conversationid: item.sn, opisn: item.opi_sn }); delConversationitem(item); if (String(order_sn) === String(item.coli_sn)) { - navigate(`/order/chat`, { replace: routerReplace }); + navigate(routePrefix, { replace: routerReplace }); } }; diff --git a/src/views/Conversations/Components/InputComposer.jsx b/src/views/Conversations/Components/InputComposer.jsx index 0c1a0c4..4c0a3c3 100644 --- a/src/views/Conversations/Components/InputComposer.jsx +++ b/src/views/Conversations/Components/InputComposer.jsx @@ -186,6 +186,7 @@ const InputComposer = ({ mobile }) => { const focusInput = () => { textInputRef.current.focus({ cursor: 'end', preventScroll: true }); + window.dispatchEvent(new Event('resize')); }; const addEmoji = (emoji) => {