From 0562a74c28dc4db76e3601347f6463de3d572cfe Mon Sep 17 00:00:00 2001 From: Lei OT Date: Fri, 29 Nov 2024 16:11:13 +0800 Subject: [PATCH 1/5] # --- .../Conversations/Online/Input/EmailComposer.jsx | 2 +- .../Conversations/Online/Input/InputComposer.jsx | 14 ++------------ 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/views/Conversations/Online/Input/EmailComposer.jsx b/src/views/Conversations/Online/Input/EmailComposer.jsx index f295455..2d8e1f1 100644 --- a/src/views/Conversations/Online/Input/EmailComposer.jsx +++ b/src/views/Conversations/Online/Input/EmailComposer.jsx @@ -192,7 +192,7 @@ const EmailComposer = ({ ...props }) => { handleFocus('subject')} suffix={ diff --git a/src/views/Conversations/Online/Input/InputComposer.jsx b/src/views/Conversations/Online/Input/InputComposer.jsx index b100c2f..0a7031d 100644 --- a/src/views/Conversations/Online/Input/InputComposer.jsx +++ b/src/views/Conversations/Online/Input/InputComposer.jsx @@ -1,26 +1,17 @@ import React, { useState, useRef, useEffect } from 'react'; -import { App, Input, Flex, Button, Image, Tooltip } from 'antd'; +import { App, Input, Flex, Button, Image } from 'antd'; import PropTypes from 'prop-types'; // import { Input } from 'react-chat-elements'; import useAuthStore from '@/stores/AuthStore'; import useConversationStore from '@/stores/ConversationStore'; -import { - SendOutlined, - CloseCircleOutlined, - LoadingOutlined, FileOutlined, - DollarOutlined -} from '@ant-design/icons'; +import { SendOutlined, CloseCircleOutlined, LoadingOutlined, FileOutlined } from '@ant-design/icons' import { isEmpty, } from '@/utils/commons'; import { v4 as uuid } from 'uuid'; import { sentMsgTypeMapped, whatsappSupportFileTypes, uploadProgressSimulate } from '@/channel/bubbleMsgUtils'; -import InputTemplate from './Template'; -import InputEmoji from './Emoji'; -import InputMediaUpload from './MediaUpload'; import { OSS_URL as aliOSSHost } from '@/config'; import { postUploadFileItem } from '@/actions/CommonActions'; import dayjs from 'dayjs'; import useStyleStore from '@/stores/StyleStore'; -import { useOrderStore } from '@/stores/OrderStore' import ComposerTools from './ComposerTools'; const ButtonStyleClsMapped = @@ -34,7 +25,6 @@ const InputComposer = ({ channel, currentActive }) => { const [mobile] = useStyleStore((state) => [state.mobile]); const {userId, whatsAppBusiness} = useAuthStore((state) => state.loginUser); - const [openPaymentDrawer] = useOrderStore((state) => [state.openDrawer]) const websocket = useConversationStore((state) => state.websocket); const websocketOpened = useConversationStore((state) => state.websocketOpened); From 68e46c8ba706952f0206d81f13bb71e6d439e270 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Fri, 29 Nov 2024 16:33:14 +0800 Subject: [PATCH 2/5] =?UTF-8?q?perf:=20=E6=98=BE=E7=A4=BA=E5=95=86?= =?UTF-8?q?=E4=B8=9A=E5=8F=B7=E8=B4=A6=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Conversations/Online/ReplyWrapper.jsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/views/Conversations/Online/ReplyWrapper.jsx b/src/views/Conversations/Online/ReplyWrapper.jsx index e24efcb..8a39fc9 100644 --- a/src/views/Conversations/Online/ReplyWrapper.jsx +++ b/src/views/Conversations/Online/ReplyWrapper.jsx @@ -10,6 +10,7 @@ import useStyleStore from '@/stores/StyleStore'; import { isEmpty } from '@/utils/commons'; import { DEFAULT_CHANNEL } from '@/config'; import { WABAccounts, WABAccountsMapped } from '@/channel/bubbleMsgUtils'; +import useAuthStore from '@/stores/AuthStore'; /** * @ignore @@ -40,6 +41,7 @@ const WABASwitcher = ({ onSelect, }) => { const ReplyWrapper = () => { const [mobile] = useStyleStore(state => [state.mobile]); + const {userId, whatsAppBusiness} = useAuthStore((state) => state.loginUser); const [activeChannel, setActiveChannel] = useState(DEFAULT_CHANNEL); const onChannelTabsChange = (activeKey) => { @@ -52,9 +54,12 @@ const ReplyWrapper = () => { ); useEffect(() => { const len = activeMessages.length; - const thisLastChannel = activeMessages.length > 0 ? activeMessages[len - 1]?.type : DEFAULT_CHANNEL; + const thisLastChannel = activeMessages.length > 0 ? activeMessages[len - 1]?.msg_source : DEFAULT_CHANNEL; const channel = thisLastChannel === 'email' ? 'email' : DEFAULT_CHANNEL; - setActiveChannel(channel); + setActiveChannel(thisLastChannel.toLowerCase()); + + + return () => {}; }, [activeMessages]); @@ -68,7 +73,7 @@ const ReplyWrapper = () => { const replyTypes = [ // { key: 'waba', label: mobile ? '' : (), icon: , children: }, - { key: 'waba', label: mobile ? '' : '商业号', icon: , children: }, + { key: 'waba', label: mobile ? '' : `商业号(${WABAccountsMapped[whatsAppBusiness]?.verifiedName || '-'})`, icon: , children: }, { key: 'email', label: mobile ? '' : '邮件', icon: , children: }, // { key: 'whatsapp', label: mobile ? '' : 'WhatsApp', icon: , children: }, { key: 'wa', label: mobile ? '' : 'WhatsApp', icon: , children:
正在开发……敬请期待
}, From a9724d098277ead033620e0010e413628e22e15a Mon Sep 17 00:00:00 2001 From: Lei OT Date: Fri, 29 Nov 2024 16:59:52 +0800 Subject: [PATCH 3/5] =?UTF-8?q?todo:=20=E5=88=87=E6=8D=A2=E4=BC=9A?= =?UTF-8?q?=E8=AF=9D=E7=9A=84=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/actions/ConversationActions.js | 3 ++- src/views/Conversations/Online/MessagesWrapper.jsx | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/actions/ConversationActions.js b/src/actions/ConversationActions.js index dc79094..d3b0602 100644 --- a/src/actions/ConversationActions.js +++ b/src/actions/ConversationActions.js @@ -76,12 +76,13 @@ export const fetchOrderConversationsList = async (params) => { export const MESSAGE_PAGE_SIZE = 50; /** * - * @param {object} params { opisn, whatsappid, conversationid, lasttime, pagesize } + * @param {object} params { coli_sn, opisn, whatsappid, conversationid, lasttime, pagesize } */ export const fetchMessages = async (params) => { const defaultParams = { // opisn: '', // whatsappid: '', + coli_sn: '', conversationid: '', lasttime: '', pagesize: MESSAGE_PAGE_SIZE, diff --git a/src/views/Conversations/Online/MessagesWrapper.jsx b/src/views/Conversations/Online/MessagesWrapper.jsx index 2710004..3e0293f 100644 --- a/src/views/Conversations/Online/MessagesWrapper.jsx +++ b/src/views/Conversations/Online/MessagesWrapper.jsx @@ -13,6 +13,7 @@ import emailReItem from './Components/emailRe.json'; import EmailEditorPopup from './Input/EmailEditorPopup'; import EmailDetail from './Components/EmailDetail'; import { useOrderStore, } from "@/stores/OrderStore"; +import { isEmpty } from '@/utils/commons'; const MessagesWrapper = ({ updateRead = true, forceGetMessages }) => { const userId = useAuthStore((state) => state.loginUser.userId); @@ -27,7 +28,7 @@ const MessagesWrapper = ({ updateRead = true, forceGetMessages }) => { const refreshTotalNotify = useConversationStore(useShallow((state) => state.refreshTotalNotify)); - const { orderDetail, } = useOrderStore(); + const [orderDetail] = useOrderStore(state => [state.orderDetail]); const isVisible = useVisibilityState(); @@ -41,7 +42,7 @@ const MessagesWrapper = ({ updateRead = true, forceGetMessages }) => { } setShouldScrollBottom(true); return () => {}; - }, [currentConversation.sn]); + }, [currentConversation.sn, orderDetail.coli_sn]); useEffect(() => { setLongList(activeMessages); @@ -68,6 +69,7 @@ const MessagesWrapper = ({ updateRead = true, forceGetMessages }) => { opisn: forceGetMessages ? currentConversation.opi_sn || '' : userId, whatsappid: item.whatsapp_phone_number, lasttime: '', + coli_sn: isEmpty(currentConversation.coli_sn) ? '' : (orderDetail.coli_sn || ''), // todo: 获取到上一个 }) const thisLastTime = data.length > 0 ? data[0].msgtime : ''; // orgmsgtime const loadNextPage = !(data.length === 0 || data.length < MESSAGE_PAGE_SIZE); @@ -85,6 +87,7 @@ const MessagesWrapper = ({ updateRead = true, forceGetMessages }) => { opisn: currentConversation.opi_sn, whatsappid: currentConversation.whatsapp_phone_number, lasttime: currentConversation?.lasttime || '', + coli_sn: isEmpty(currentConversation.coli_sn) ? '' : (orderDetail.coli_sn || ''), }) setLongListLoading(false); setLongList(prevValue => data.concat(prevValue)); From 7ec40fb66966135a9c4c6646e6ea83eccaefeccc Mon Sep 17 00:00:00 2001 From: Lei OT Date: Mon, 2 Dec 2024 11:40:42 +0800 Subject: [PATCH 4/5] =?UTF-8?q?feat:=20=E9=99=84=E4=BB=B6=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E5=89=8D=E9=A2=84=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Online/Input/EmailEditorPopup.jsx | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/views/Conversations/Online/Input/EmailEditorPopup.jsx b/src/views/Conversations/Online/Input/EmailEditorPopup.jsx index ae0963c..7250abb 100644 --- a/src/views/Conversations/Online/Input/EmailEditorPopup.jsx +++ b/src/views/Conversations/Online/Input/EmailEditorPopup.jsx @@ -296,6 +296,42 @@ const EmailEditorPopup = ({ open, setOpen, fromEmail, fromUser, fromOrder, toEma newFileList.splice(index, 1); setFileList(newFileList); }, + onPreview: (file) => { + return new Promise((resolve, reject) => { + const reader = new FileReader(); + reader.onloadend = (e) => { + var dataURL = e.target.result; + var win = window.open("", "_blank"); + if (file.type.startsWith('image/')) { + win.document.write(""); + } else if (file.type.startsWith('text/') || file.type === 'application/html' || file.type === 'application/xhtml+xml') { + var iframe = win.document.createElement('iframe'); + iframe.srcdoc = e.target.result; + iframe.style.width = '100%'; + iframe.style.height = '100%'; + iframe.style.border = 'none'; + win.document.body.appendChild(iframe); + } else if (file.type === 'application/pdf') { + win.document.write(""); + } else if (file.type.startsWith('audio/')) { + win.document.write(""); + } else if (file.type.startsWith('video/')) { + win.document.write(""); + } else { + win.document.write("

Preview not available for this file type

"); + } + // win.document.write(""); + resolve(reader.result) + }; + if (file.type.startsWith('text/') || file.type === 'application/html' || file.type === 'application/xhtml+xml') { + reader.readAsText(file); + } else { + reader.readAsDataURL(file); + } + // reader.readAsDataURL(file); + reader.onerror = (error) => reject(error); + }) + }, }; /** From 54c67d542828a1dca61228cb272696fbdf07126b Mon Sep 17 00:00:00 2001 From: Lei OT Date: Mon, 2 Dec 2024 13:56:55 +0800 Subject: [PATCH 5/5] =?UTF-8?q?feat:=20=E9=99=84=E4=BB=B6=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E5=89=8D=E9=A2=84=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Conversations/Online/Input/EmailEditorPopup.jsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/views/Conversations/Online/Input/EmailEditorPopup.jsx b/src/views/Conversations/Online/Input/EmailEditorPopup.jsx index 7250abb..03162b8 100644 --- a/src/views/Conversations/Online/Input/EmailEditorPopup.jsx +++ b/src/views/Conversations/Online/Input/EmailEditorPopup.jsx @@ -302,6 +302,7 @@ const EmailEditorPopup = ({ open, setOpen, fromEmail, fromUser, fromOrder, toEma reader.onloadend = (e) => { var dataURL = e.target.result; var win = window.open("", "_blank"); + win.document.body.style.margin = '0'; if (file.type.startsWith('image/')) { win.document.write(""); } else if (file.type.startsWith('text/') || file.type === 'application/html' || file.type === 'application/xhtml+xml') { @@ -311,14 +312,16 @@ const EmailEditorPopup = ({ open, setOpen, fromEmail, fromUser, fromOrder, toEma iframe.style.height = '100%'; iframe.style.border = 'none'; win.document.body.appendChild(iframe); + win.document.body.style.margin = '0'; } else if (file.type === 'application/pdf') { - win.document.write(""); + win.document.write(""); + win.document.body.style.margin = '0'; } else if (file.type.startsWith('audio/')) { win.document.write(""); } else if (file.type.startsWith('video/')) { win.document.write(""); } else { - win.document.write("

Preview not available for this file type

"); + win.document.write("

Preview not available for this file type

"); } // win.document.write(""); resolve(reader.result)