feat(wechat): 添加朋友圈功能支持
- 在微信状态管理中新增朋友圈相关状态和方法 - 实现朋友圈数据获取、展示和交互功能 - 添加朋友圈API接口和WebSocket消息处理 - 优化朋友圈UI展示和样式
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import { ChatRecord, ContractData, weChatGroup } from "@/pages/pc/ckbox/data";
|
||||
import { FriendsCircleItem } from "@/pages/pc/ckbox/weChat/components/SidebarMenu/FriendsCicle/index.data";
|
||||
|
||||
// 微信聊天相关的类型定义
|
||||
export interface WeChatState {
|
||||
// 当前选中的联系人/群组
|
||||
@@ -13,6 +15,11 @@ export interface WeChatState {
|
||||
isLoadingData: boolean;
|
||||
currentGroupMembers: any[];
|
||||
|
||||
// 朋友圈数据
|
||||
MomentOfKf: FriendsCircleItem[]; // 客服自己的朋友圈
|
||||
MomentOfSquare: FriendsCircleItem[]; // 朋友圈广场
|
||||
MomentOfFriend: FriendsCircleItem[]; // 好友的朋友圈
|
||||
|
||||
// Actions
|
||||
setCurrentContact: (
|
||||
contract: ContractData | weChatGroup,
|
||||
@@ -30,4 +37,13 @@ export interface WeChatState {
|
||||
setVideoUrl: (messageId: number, videoUrl: string) => void;
|
||||
addMessage: (message: ChatRecord) => void;
|
||||
receivedMsg: (message: ChatRecord) => void;
|
||||
|
||||
// 朋友圈相关方法
|
||||
setMomentOfKf: (moments: FriendsCircleItem[]) => void;
|
||||
setMomentOfSquare: (moments: FriendsCircleItem[]) => void;
|
||||
setMomentOfFriend: (moments: FriendsCircleItem[]) => void;
|
||||
addMomentOfKf: (moments: FriendsCircleItem[]) => void;
|
||||
addMomentOfSquare: (moments: FriendsCircleItem[]) => void;
|
||||
addMomentOfFriend: (moments: FriendsCircleItem[]) => void;
|
||||
clearAllMoments: () => void;
|
||||
}
|
||||
|
||||
@@ -273,6 +273,45 @@ export const useWeChatStore = create<WeChatState>()(
|
||||
messagesLoading: false,
|
||||
});
|
||||
},
|
||||
|
||||
// 朋友圈相关方法
|
||||
setMomentOfKf: moments => {
|
||||
set({ MomentOfKf: moments });
|
||||
},
|
||||
|
||||
setMomentOfSquare: moments => {
|
||||
set({ MomentOfSquare: moments });
|
||||
},
|
||||
|
||||
setMomentOfFriend: moments => {
|
||||
set({ MomentOfFriend: moments });
|
||||
},
|
||||
|
||||
addMomentOfKf: moments => {
|
||||
set(state => ({
|
||||
MomentOfKf: [...state.MomentOfKf, ...moments],
|
||||
}));
|
||||
},
|
||||
|
||||
addMomentOfSquare: moments => {
|
||||
set(state => ({
|
||||
MomentOfSquare: [...state.MomentOfSquare, ...moments],
|
||||
}));
|
||||
},
|
||||
|
||||
addMomentOfFriend: moments => {
|
||||
set(state => ({
|
||||
MomentOfFriend: [...state.MomentOfFriend, ...moments],
|
||||
}));
|
||||
},
|
||||
|
||||
clearAllMoments: () => {
|
||||
set({
|
||||
MomentOfKf: [],
|
||||
MomentOfSquare: [],
|
||||
MomentOfFriend: [],
|
||||
});
|
||||
},
|
||||
}),
|
||||
{
|
||||
name: "wechat-storage",
|
||||
|
||||
Reference in New Issue
Block a user