diff --git a/Touchkebao/src/pages/pc/ckbox/weChat/components/SidebarMenu/FriendsCicle/components/data.ts b/Touchkebao/src/pages/pc/ckbox/weChat/components/SidebarMenu/FriendsCicle/components/data.ts deleted file mode 100644 index a24cb362..00000000 --- a/Touchkebao/src/pages/pc/ckbox/weChat/components/SidebarMenu/FriendsCicle/components/data.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { FriendsCircleItem } from "../index.data"; -export interface FriendCardProps { - monent: FriendsCircleItem; - isNotMy?: boolean; - currentKf?: any; - wechatFriendId?: number; - formatTime: (time: number) => string; -} - -export interface MomentListProps { - MomentCommon: FriendsCircleItem[]; - MomentCommonLoading: boolean; - currentKf?: any; - wechatFriendId?: number; - formatTime: (time: number) => string; - loadMomentData: (loadMore: boolean) => void; -} -export interface likeListItem { - createTime: number; - nickName: string; - wechatId: string; -} diff --git a/Touchkebao/src/pages/pc/ckbox/weChat/components/SidebarMenu/FriendsCicle/components/friendCard.tsx b/Touchkebao/src/pages/pc/ckbox/weChat/components/SidebarMenu/FriendsCicle/components/friendCard.tsx index 09a6c6d8..99fd02b5 100644 --- a/Touchkebao/src/pages/pc/ckbox/weChat/components/SidebarMenu/FriendsCicle/components/friendCard.tsx +++ b/Touchkebao/src/pages/pc/ckbox/weChat/components/SidebarMenu/FriendsCicle/components/friendCard.tsx @@ -7,7 +7,13 @@ import { SendOutlined, DeleteOutlined, } from "@ant-design/icons"; -import { CommentItem, FriendsCircleItem } from "../index.data"; +import { + CommentItem, + likeListItem, + FriendCardProps, + MomentListProps, + FriendsCircleItem, +} from "@/pages/pc/ckbox/weChat/components/SidebarMenu/FriendsCicle/index.data"; import styles from "../index.module.scss"; import { likeMoment, @@ -16,7 +22,7 @@ import { cancelCommentMoment, } from "./api"; import { comfirm } from "@/utils/common"; -import { likeListItem, FriendCardProps, MomentListProps } from "./data"; + import { useWeChatStore } from "@/store/module/weChat/weChat"; // 单个朋友圈项目组件 export const FriendCard: React.FC = ({ @@ -31,7 +37,7 @@ export const FriendCard: React.FC = ({ const time = formatTime(monent.createTime); const likesCount = monent?.likeList?.length || 0; const commentsCount = monent?.commentList?.length || 0; - const { updateLikeMoment } = useWeChatStore(); + const { updateLikeMoment, updateComment } = useWeChatStore(); // 评论相关状态 const [showCommentInput, setShowCommentInput] = useState(false); @@ -89,6 +95,19 @@ export const FriendCard: React.FC = ({ sendWord: commentText, seq: Date.now(), }); + // 更新评论 + updateComment(monent.snsId, [ + ...monent.commentList, + { + commentArg: 0, + commentId1: Date.now(), + commentId2: Date.now(), + commentTime: Date.now(), + content: commentText, + nickName: currentKf?.nickname || "", + wechatId: currentKf?.wechatId || "", + }, + ]); // 清空输入框并隐藏 setCommentText(""); setShowCommentInput(false); @@ -106,6 +125,11 @@ export const FriendCard: React.FC = ({ commentId2: comment.commentId2, commentTime: comment.commentTime, }); + // 更新评论 + const commentList = monent.commentList.filter(v => { + return v.commentId2 !== comment.commentId2; + }); + updateComment(snsId, commentList); message.success("评论删除成功"); }); }; diff --git a/Touchkebao/src/pages/pc/ckbox/weChat/components/SidebarMenu/FriendsCicle/index.data.ts b/Touchkebao/src/pages/pc/ckbox/weChat/components/SidebarMenu/FriendsCicle/index.data.ts index ac081ac8..d61c2870 100644 --- a/Touchkebao/src/pages/pc/ckbox/weChat/components/SidebarMenu/FriendsCicle/index.data.ts +++ b/Touchkebao/src/pages/pc/ckbox/weChat/components/SidebarMenu/FriendsCicle/index.data.ts @@ -47,3 +47,25 @@ export interface ApiResponse { total: number; hasMore: boolean; } + +export interface FriendCardProps { + monent: FriendsCircleItem; + isNotMy?: boolean; + currentKf?: any; + wechatFriendId?: number; + formatTime: (time: number) => string; +} + +export interface MomentListProps { + MomentCommon: FriendsCircleItem[]; + MomentCommonLoading: boolean; + currentKf?: any; + wechatFriendId?: number; + formatTime: (time: number) => string; + loadMomentData: (loadMore: boolean) => void; +} +export interface likeListItem { + createTime: number; + nickName: string; + wechatId: string; +} diff --git a/Touchkebao/src/store/module/weChat/weChat.data.ts b/Touchkebao/src/store/module/weChat/weChat.data.ts index b0e25c76..4060245e 100644 --- a/Touchkebao/src/store/module/weChat/weChat.data.ts +++ b/Touchkebao/src/store/module/weChat/weChat.data.ts @@ -1,20 +1,9 @@ import { ChatRecord, ContractData, weChatGroup } from "@/pages/pc/ckbox/data"; -import { FriendsCircleItem } from "@/pages/pc/ckbox/weChat/components/SidebarMenu/FriendsCicle/index.data"; -export interface likeListItem { - createTime: number; - nickName: string; - wechatId: string; -} -// 评论数据类型 -export interface CommentItem { - commentArg: number; - commentId1: number; - commentId2: number; - commentTime: number; - content: string; - nickName: string; - wechatId: string; -} +import { + CommentItem, + likeListItem, + FriendsCircleItem, +} from "@/pages/pc/ckbox/weChat/components/SidebarMenu/FriendsCicle/index.data"; // 微信聊天相关的类型定义 export interface WeChatState { // 当前选中的联系人/群组 diff --git a/Touchkebao/src/store/module/weChat/weChat.ts b/Touchkebao/src/store/module/weChat/weChat.ts index 8b583bd4..b96a26e5 100644 --- a/Touchkebao/src/store/module/weChat/weChat.ts +++ b/Touchkebao/src/store/module/weChat/weChat.ts @@ -5,7 +5,11 @@ import { getChatroomMessages, getGroupMembers, } from "@/pages/pc/ckbox/api"; -import { WeChatState, likeListItem, CommentItem } from "./weChat.data"; +import { WeChatState } from "./weChat.data"; +import { + likeListItem, + CommentItem, +} from "@/pages/pc/ckbox/weChat/components/SidebarMenu/FriendsCicle/index.data"; import { clearUnreadCount, updateConfig } from "@/pages/pc/ckbox/api"; import { ContractData, weChatGroup } from "@/pages/pc/ckbox/data"; import { weChatGroupService, contractService } from "@/utils/db";