From 88cc2eb3aed385c2ebd922e0ca453b158b17ba35 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Mon, 14 Oct 2024 09:18:22 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=A7=BB=E5=8A=A8=E7=AB=AF:=20?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E6=B8=A0=E9=81=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Online/Input/EmailChannelTab.jsx | 37 +++++++++++++++---- .../Conversations/Online/ReplyWrapper.jsx | 13 ++++--- src/views/mobile/Chat.jsx | 3 +- 3 files changed, 40 insertions(+), 13 deletions(-) diff --git a/src/views/Conversations/Online/Input/EmailChannelTab.jsx b/src/views/Conversations/Online/Input/EmailChannelTab.jsx index ff330c8..8b65866 100644 --- a/src/views/Conversations/Online/Input/EmailChannelTab.jsx +++ b/src/views/Conversations/Online/Input/EmailChannelTab.jsx @@ -1,32 +1,55 @@ import { useState } from 'react'; -import { Button, Flex } from 'antd'; -import 'react-quill/dist/quill.snow.css'; +import { Button, ConfigProvider, Dropdown, Flex } from 'antd'; +import { DownOutlined } from '@ant-design/icons'; import EmailEditorPopup from './EmailEditorPopup'; +import useStyleStore from '@/stores/StyleStore'; const EmailComposer = ({ ...props }) => { + const [mobile] = useStyleStore((state) => [state.mobile]); const [open, setOpen] = useState(false); const [fromEmail, setFromEmail] = useState(''); const openEditor = (email_addr, i) => { setOpen(true); setFromEmail(email_addr); }; + const [pickEmail, setPickEmail] = useState({ label: 'LYT', key: 'lyt@hainatravel.com' }); return ( - + 新邮件: - {[ + + ', key: 'lyt@hainatravel.com' }, + { email: 'lot@hainatravel.com', label: 'LOT ', key: 'lot@hainatravel.com' }, + ], + onClick: ({ key }) => { + // todo: 读取邮箱列表 + console.log(key); + setPickEmail({ label: key, key }); + }, + }} + onClick={() => openEditor(pickEmail.key)} + type='primary' className='w-auto' + icon={}> + {pickEmail.label} <{pickEmail.key}> + + + {/* {[ { email: 'lyt@hainatravel.com', name: 'LYT' }, { email: 'lot@hainatravel.com', name: 'LOT' }, ].map(({ email, name }, i) => ( - ))} + ))} */} {/* */} - + {/* */} ); diff --git a/src/views/Conversations/Online/ReplyWrapper.jsx b/src/views/Conversations/Online/ReplyWrapper.jsx index 3eccb85..4c22189 100644 --- a/src/views/Conversations/Online/ReplyWrapper.jsx +++ b/src/views/Conversations/Online/ReplyWrapper.jsx @@ -6,6 +6,7 @@ import EmailComposer from './Input/EmailChannelTab'; import { WABIcon } from '@/components/Icons'; import useConversationStore from '@/stores/ConversationStore'; import { useShallow } from 'zustand/react/shallow'; +import useStyleStore from '@/stores/StyleStore'; const DEFAULT_CHANNEL = 'waba'; const Wabas = [ @@ -29,7 +30,7 @@ const WABASwitcher = ({ onSelect, }) => { }, }}> - + {/* */} {pickV.label || 'WABA'} @@ -38,6 +39,7 @@ const WABASwitcher = ({ onSelect, }) => { }; const ReplyWrapper = () => { + const [mobile] = useStyleStore(state => [state.mobile]); const [activeChannel, setActiveChannel] = useState(DEFAULT_CHANNEL); const onChannelTabsChange = (activeKey) => { setActiveChannel(activeKey); @@ -49,15 +51,16 @@ const ReplyWrapper = () => { useEffect(() => { const len = activeMessages.length; const thisLastChannel = activeMessages.length > 0 ? activeMessages[len - 1]?.type : DEFAULT_CHANNEL; - setActiveChannel(thisLastChannel); + const channel = thisLastChannel === 'email' ? 'email' : DEFAULT_CHANNEL; + setActiveChannel(channel); return () => {}; }, [activeMessages]); const replyTypes = [ - { key: 'waba0', label: (), children: }, + { key: 'waba', label: mobile ? '' : (), icon: , children: }, // { key: 'waba', label: 'WABA-Global Highlights', icon: , children: }, - { key: 'email', label: 'Email', icon: , children: }, - { key: 'whatsapp', label: 'WhatsApp', icon: , children: }, + { key: 'email', label: mobile ? '' : 'Email', icon: , children: }, + // { key: 'whatsapp', label: mobile ? '' : 'WhatsApp', icon: , children: }, ]; return ( diff --git a/src/views/mobile/Chat.jsx b/src/views/mobile/Chat.jsx index 8a47945..985cfbf 100644 --- a/src/views/mobile/Chat.jsx +++ b/src/views/mobile/Chat.jsx @@ -4,6 +4,7 @@ import MessagesWrapper from '@/views/Conversations/Online/MessagesWrapper'; import InputComposer from '@/views/Conversations/Online/Input/InputComposer'; import { UnorderedListOutlined, MenuUnfoldOutlined, MenuFoldOutlined } from '@ant-design/icons'; import { useNavigate } from 'react-router-dom'; +import ReplyWrapper from '../Conversations/Online/ReplyWrapper'; const { Content, Header, Footer } = Layout; @@ -21,7 +22,7 @@ function Chat() {