|
|
|
@ -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 (
|
|
|
|
|
<Flex gap={8} className='p-2 bg-gray-200 justify-end items-center rounded rounded-b-none border-gray-300 border-solid border border-b-0 border-x-0'>
|
|
|
|
|
<Flex gap={8} className='p-2 bg-gray-200 rounded rounded-b-none border-gray-300 border-solid border border-b-0 border-x-0' align={'center'} justify={'flex-end'}>
|
|
|
|
|
<span>新邮件:</span>
|
|
|
|
|
{[
|
|
|
|
|
<ConfigProvider theme={{ token: { colorPrimary: '#6366f1' } }}>
|
|
|
|
|
<Dropdown.Button
|
|
|
|
|
menu={{
|
|
|
|
|
selectable: true,
|
|
|
|
|
items: [
|
|
|
|
|
{ email: 'lyt@hainatravel.com', label: 'LYT <lyt@hainatravel.com>', key: 'lyt@hainatravel.com' },
|
|
|
|
|
{ email: 'lot@hainatravel.com', label: 'LOT <lot@hainatravel.com>', key: 'lot@hainatravel.com' },
|
|
|
|
|
],
|
|
|
|
|
onClick: ({ key }) => {
|
|
|
|
|
// todo: 读取邮箱列表
|
|
|
|
|
console.log(key);
|
|
|
|
|
setPickEmail({ label: key, key });
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
onClick={() => openEditor(pickEmail.key)}
|
|
|
|
|
type='primary' className='w-auto'
|
|
|
|
|
icon={<DownOutlined />}>
|
|
|
|
|
{pickEmail.label} <{pickEmail.key}>
|
|
|
|
|
</Dropdown.Button>
|
|
|
|
|
</ConfigProvider>
|
|
|
|
|
{/* {[
|
|
|
|
|
{ email: 'lyt@hainatravel.com', name: 'LYT' },
|
|
|
|
|
{ email: 'lot@hainatravel.com', name: 'LOT' },
|
|
|
|
|
].map(({ email, name }, i) => (
|
|
|
|
|
<Button
|
|
|
|
|
key={email}
|
|
|
|
|
type='primary'
|
|
|
|
|
type='primary' size='small'
|
|
|
|
|
className='bg-indigo-500 shadow shadow-indigo-300 hover:!bg-indigo-400 active:bg-indigo-400 focus:bg-indigo-400'
|
|
|
|
|
onClick={() => openEditor(email, i)}>
|
|
|
|
|
{name} <{email}>
|
|
|
|
|
</Button>
|
|
|
|
|
))}
|
|
|
|
|
))} */}
|
|
|
|
|
{/* <EmailEditor {...{ open, setOpen }} fromEmail={fromEmail} key={'email-editor'} /> */}
|
|
|
|
|
<EmailEditorPopup {...{ open, setOpen }} fromEmail={fromEmail} key={'email-editor-popup'}/>
|
|
|
|
|
<EmailEditorPopup {...{ open, setOpen }} fromEmail={fromEmail} key={'email-editor-popup'} />
|
|
|
|
|
{/* <EmailEditorPopup2 {...{ open, setOpen }} fromEmail={fromEmail} key={'email-editor-popup2'} /> */}
|
|
|
|
|
</Flex>
|
|
|
|
|
);
|
|
|
|
|