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/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/EmailEditorPopup.jsx b/src/views/Conversations/Online/Input/EmailEditorPopup.jsx
index ae0963c..03162b8 100644
--- a/src/views/Conversations/Online/Input/EmailEditorPopup.jsx
+++ b/src/views/Conversations/Online/Input/EmailEditorPopup.jsx
@@ -296,6 +296,45 @@ 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");
+ 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') {
+ 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);
+ win.document.body.style.margin = '0';
+ } else if (file.type === 'application/pdf') {
+ 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("");
+ 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);
+ })
+ },
};
/**
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);
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));
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: 正在开发……敬请期待
},