diff --git a/src/pages/Wall/index.tsx b/src/pages/Wall/index.tsx index b992c8d..e694801 100644 --- a/src/pages/Wall/index.tsx +++ b/src/pages/Wall/index.tsx @@ -70,6 +70,12 @@ const WallPage = () => { setIsModalOpen(true) }}>{text} }, + { + title: '邮箱', + dataIndex: 'email', + key: 'email', + render: (text: string) => text ? text : '暂无邮箱', + }, { title: '留言时间', dataIndex: 'createTime', diff --git a/src/pages/Work/index.tsx b/src/pages/Work/index.tsx index 8383c0e..4f10533 100644 --- a/src/pages/Work/index.tsx +++ b/src/pages/Work/index.tsx @@ -1,5 +1,5 @@ import { useEffect, useState } from "react"; -import { Card, Dropdown, message } from "antd"; +import { Button, Card, Dropdown, message, Modal } from "antd"; import { getLinkListAPI, delLinkDataAPI, auditWebDataAPI } from '@/api/Web'; import { getCommentListAPI, auditCommentDataAPI, delCommentDataAPI } from "@/api/Comment"; import { getWallListAPI, auditWallDataAPI, delWallDataAPI } from "@/api/Wall"; @@ -15,19 +15,55 @@ import RandomAvatar from "@/components/RandomAvatar"; import Empty from "@/components/Empty"; import { useWebStore } from '@/stores'; +import TextArea from "antd/es/input/TextArea"; type Menu = "comment" | "link" | "wall"; interface ListItemProps { item: any; type: Menu; - handleApproval: (id: number, type: Menu) => void; - handleRejection: (id: number, type: Menu) => void; + fetchData: (type: Menu) => void; } -const ListItem = ({ item, type, handleApproval, handleRejection }: ListItemProps) => { +const ListItem = ({ item, type, fetchData }: ListItemProps) => { const web = useWebStore(state => state.web) + // 审核数据 + const handleApproval = async () => { + if (type === "link") { + await auditWebDataAPI(item.id); + message.success('🎉 友链审核成功'); + } else if (type === "comment") { + await auditCommentDataAPI(item.id); + message.success('🎉 评论审核成功'); + } else if (type === "wall") { + await auditWallDataAPI(item.id); + message.success('🎉 留言审核成功'); + } + fetchData(type); + }; + + // 驳回原因 + const [dismissInfo, setDismissInfo] = useState("") + const [isModalOpen, setIsModalOpen] = useState(false); + const handleDismiss = async () => { + if (type === "link") { + await delLinkDataAPI(item.id); + message.success('🎉 友链驳回成功'); + } else if (type === "comment") { + await delCommentDataAPI(item.id); + message.success('🎉 评论驳回成功'); + } else if (type === "wall") { + await delWallDataAPI(item.id); + message.success('🎉 留言驳回成功'); + } + + console.log(dismissInfo); + + setIsModalOpen(false) + fetchData(type); + }; + return (