取消系统通知的ID, 否则收起之后弹不出来; 读取到消息之后, 未读清零

dev/mobile
Lei OT 2 years ago
parent f4606fe558
commit 3f24eb5669

@ -498,7 +498,7 @@ export const handleNotification = (title, _options) => {
var notification;
const options = {
requireInteraction: true, // 设置手动关闭
tag: 'global-sales-notification', // 通知ID同类通知建议设置相同ID避免通知过多遮挡桌面
// tag: 'global-sales-notification', // 通知ID同类通知建议设置相同ID避免通知过多遮挡桌面
// icon: '/favicon.ico', // 通知图标
..._options,
};

@ -69,26 +69,30 @@ const Conversations = () => {
receivedMessageList(item.sn, data);
};
const switchConversation = async (item) => {
fetchCleanUnreadMsgCount({ opisn: item.opi_sn, whatsappid: item.whatsapp_phone_number });
setCurrentConversation(item);
const messagesList = activeConversations[`${item.sn}`] || [];
if (messagesList.length < 20) {
getMessages(item);
}
if (String(item.sn) === String(currentConversation.sn)) {
return false;
}
setCurrentConversation(item);
};
const onSwitchConversation = async (item) => {
if (!isEmpty(item.coli_sn)) {
switchConversation(item);
if (isEmpty(item.coli_sn)) {
navigate(`/order/chat`, { replace: true });
} else {
setSwitchToC(item);
setShouldFetchCList(false);
navigate(`/order/chat/${item.coli_sn}`, { replace: true });
} else {
navigate(`/order/chat`, { replace: true });
}
switchConversation(item);
// if (!isEmpty(item.coli_sn)) {
// setSwitchToC(item);
// setShouldFetchCList(false);
// navigate(`/order/chat/${item.coli_sn}`, { replace: true });
// } else {
// navigate(`/order/chat`, { replace: true });
// }
// switchConversation(item);
};
const handleConversationItemClose = async (item) => {

@ -1,12 +1,23 @@
import { useRef, useState } from 'react';
import { useRef, useState, useEffect } from 'react';
import useConversationStore from '@/stores/ConversationStore';
import { useShallow } from 'zustand/react/shallow';
import { Image, } from 'antd';
import MessagesList from './MessagesList';
import { fetchCleanUnreadMsgCount } from '@/actions/ConversationActions';
const MessagesWrapper = () => {
const currentConversation = useConversationStore(useShallow((state) => state.currentConversation));
const activeMessages = useConversationStore(useShallow((state) => (state.currentConversation.sn && state.activeConversations[state.currentConversation.sn] ? state.activeConversations[state.currentConversation.sn]: [])));
useEffect(() => {
if (currentConversation.opi_sn && currentConversation.whatsapp_phone_number && activeMessages.length > 0) {
fetchCleanUnreadMsgCount({ opisn: currentConversation.opi_sn, whatsappid: currentConversation.whatsapp_phone_number });
}
return () => {};
}, [activeMessages]);
const reference = useRef(null);
const [previewVisible, setPreviewVisible] = useState(false);

Loading…
Cancel
Save