refactor(朋友圈): 重构朋友圈数据管理为统一结构
移除原有的分类型朋友圈状态和方法,合并为统一的MomentCommon状态 更新相关组件以使用新的状态管理方式
This commit is contained in:
@@ -24,9 +24,12 @@ export const useWeChatStore = create<WeChatState>()(
|
||||
messagesLoading: false,
|
||||
isLoadingData: false,
|
||||
currentGroupMembers: [],
|
||||
MomentOfKf: [], //客服自己的朋友圈
|
||||
MomentOfSquare: [], //朋友圈广场
|
||||
MomentOfFriend: [], //好友的朋友圈
|
||||
MomentCommon: [],
|
||||
MomentCommonLoading: false,
|
||||
// MomentCommon 相关方法
|
||||
updateMomentCommonLoading: (loading: boolean) => {
|
||||
set({ MomentCommonLoading: loading });
|
||||
},
|
||||
//============方法列表============
|
||||
|
||||
//清空当前联系人
|
||||
@@ -274,43 +277,19 @@ export const useWeChatStore = create<WeChatState>()(
|
||||
});
|
||||
},
|
||||
|
||||
// 朋友圈相关方法
|
||||
setMomentOfKf: moments => {
|
||||
set({ MomentOfKf: moments });
|
||||
// MomentCommon 相关方法
|
||||
clearMomentCommon: () => {
|
||||
set({ MomentCommon: [] });
|
||||
},
|
||||
|
||||
setMomentOfSquare: moments => {
|
||||
set({ MomentOfSquare: moments });
|
||||
},
|
||||
|
||||
setMomentOfFriend: moments => {
|
||||
set({ MomentOfFriend: moments });
|
||||
},
|
||||
|
||||
addMomentOfKf: moments => {
|
||||
addMomentCommon: moment => {
|
||||
set(state => ({
|
||||
MomentOfKf: [...state.MomentOfKf, ...moments],
|
||||
MomentCommon: [...state.MomentCommon, moment],
|
||||
}));
|
||||
},
|
||||
|
||||
addMomentOfSquare: moments => {
|
||||
set(state => ({
|
||||
MomentOfSquare: [...state.MomentOfSquare, ...moments],
|
||||
}));
|
||||
},
|
||||
|
||||
addMomentOfFriend: moments => {
|
||||
set(state => ({
|
||||
MomentOfFriend: [...state.MomentOfFriend, ...moments],
|
||||
}));
|
||||
},
|
||||
|
||||
clearAllMoments: () => {
|
||||
set({
|
||||
MomentOfKf: [],
|
||||
MomentOfSquare: [],
|
||||
MomentOfFriend: [],
|
||||
});
|
||||
updateMomentCommon: moments => {
|
||||
set({ MomentCommon: moments });
|
||||
},
|
||||
}),
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user