|
|
@ -31,15 +31,15 @@ function DesktopApp() {
|
|
|
|
}, [href])
|
|
|
|
}, [href])
|
|
|
|
|
|
|
|
|
|
|
|
const totalNotify = useConversationStore((state) => state.totalNotify);
|
|
|
|
const totalNotify = useConversationStore((state) => state.totalNotify);
|
|
|
|
useEffect(() => {
|
|
|
|
// useEffect(() => {
|
|
|
|
if (loginUser.userId > 0) {
|
|
|
|
// if (loginUser.userId > 0) {
|
|
|
|
useConversationStore.getState().connectWebsocket(loginUser.userId);
|
|
|
|
// useConversationStore.getState().connectWebsocket(loginUser.userId);
|
|
|
|
useConversationStore.getState().fetchInitialData(loginUser.userId); // userIdStr
|
|
|
|
// useConversationStore.getState().fetchInitialData(loginUser.userId); // userIdStr
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
return () => {
|
|
|
|
// return () => {
|
|
|
|
useConversationStore.getState().disconnectWebsocket();
|
|
|
|
// useConversationStore.getState().disconnectWebsocket();
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}, [])
|
|
|
|
// }, [])
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
useEffect(() => {
|
|
|
|
Notification.requestPermission();
|
|
|
|
Notification.requestPermission();
|
|
|
@ -63,19 +63,19 @@ function DesktopApp() {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 标签页标题闪烁
|
|
|
|
* 标签页标题闪烁
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
const [isTitleVisible, setIsTitleVisible] = useState(true);
|
|
|
|
// const [isTitleVisible, setIsTitleVisible] = useState(true);
|
|
|
|
useEffect(() => {
|
|
|
|
// useEffect(() => {
|
|
|
|
let interval;
|
|
|
|
// let interval;
|
|
|
|
if (totalNotify > 0) {
|
|
|
|
// if (totalNotify > 0) {
|
|
|
|
interval = setInterval(() => {
|
|
|
|
// interval = setInterval(() => {
|
|
|
|
document.title = isTitleVisible ? `🔔🔥💬【${totalNotify}条新消息】` : '______________';
|
|
|
|
// document.title = isTitleVisible ? `🔔🔥💬【${totalNotify}条新消息】` : '______________';
|
|
|
|
setIsTitleVisible(!isTitleVisible);
|
|
|
|
// setIsTitleVisible(!isTitleVisible);
|
|
|
|
}, 500);
|
|
|
|
// }, 500);
|
|
|
|
} else {
|
|
|
|
// } else {
|
|
|
|
document.title = '聊天式销售平台';
|
|
|
|
// document.title = '聊天式销售平台';
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
return () => clearInterval(interval);
|
|
|
|
// return () => clearInterval(interval);
|
|
|
|
}, [totalNotify, isTitleVisible]);
|
|
|
|
// }, [totalNotify, isTitleVisible]);
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<Layout>
|
|
|
|
<Layout>
|
|
|
|