重构内容管理模块,移除不再使用的管理组件和模态框,优化样式布局,新增发布和计划功能组件,提升用户体验和界面一致性。
This commit is contained in:
@@ -5,6 +5,7 @@ import { WebSocketMessage } from "./websocket";
|
||||
import { deepCopy } from "@/utils/common";
|
||||
import { Messages } from "./msg.data";
|
||||
import { db } from "@/utils/db";
|
||||
import { Modal } from "antd";
|
||||
// 消息处理器类型定义
|
||||
type MessageHandler = (message: WebSocketMessage) => void;
|
||||
const addMessage = useWeChatStore.getState().addMessage;
|
||||
@@ -82,14 +83,31 @@ const messageHandlers: Record<string, MessageHandler> = {
|
||||
console.log("通知消息", message);
|
||||
// 在这里添加具体的处理逻辑
|
||||
if (message.notify == "Auth failed") {
|
||||
// 被踢出时删除所有缓存数据
|
||||
localStorage.clear();
|
||||
// 删除
|
||||
await db.kfUsers.clear();
|
||||
await db.weChatGroup.clear();
|
||||
await db.contracts.clear();
|
||||
await db.newContractList.clear();
|
||||
window.location.href = "/login";
|
||||
// 避免重复弹窗
|
||||
if ((window as any).__CKB_AUTH_FAILED_SHOWN__) {
|
||||
return;
|
||||
}
|
||||
(window as any).__CKB_AUTH_FAILED_SHOWN__ = true;
|
||||
|
||||
Modal.warning({
|
||||
title: "登录失效",
|
||||
content: "认证已失效或账号在其他设备登录,请重新登录。",
|
||||
okText: "重新登录",
|
||||
onOk: async () => {
|
||||
try {
|
||||
// 被踢出时删除所有缓存数据
|
||||
localStorage.clear();
|
||||
await db.kfUsers.clear();
|
||||
await db.weChatGroup.clear();
|
||||
await db.contracts.clear();
|
||||
await db.newContractList.clear();
|
||||
} finally {
|
||||
(window as any).__CKB_AUTH_FAILED_SHOWN__ = false;
|
||||
window.location.href = "/login";
|
||||
}
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user