diff --git a/src/pages/Comment/index.tsx b/src/pages/Comment/index.tsx index 9993227..c53d87e 100644 --- a/src/pages/Comment/index.tsx +++ b/src/pages/Comment/index.tsx @@ -1,7 +1,7 @@ import { useState, useEffect } from 'react'; import { Card, message, Table, Popconfirm, Button, Tag, Modal, Form, Input, DatePicker } from 'antd'; import { getCommentListAPI } from '@/api/Comment'; -import { auditCommentDataAPI, delCommentDataAPI } from '@/api/Comment'; +import { delCommentDataAPI } from '@/api/Comment'; import { ColumnsType } from 'antd/es/table'; import { titleSty } from '@/styles/sty'; import Title from '@/components/Title'; @@ -24,14 +24,6 @@ const CommentPage = () => { setLoading(false) } - const auditCommentData = async () => { - setLoading(true) - await auditCommentDataAPI(comment?.id!); - getCommentList(); - setIsModalOpen(false) - message.success('🎉 审核评论成功'); - }; - const delCommentData = async (id: number) => { setLoading(true) await delCommentDataAPI(id); @@ -106,17 +98,10 @@ const CommentPage = () => { align: 'center', render: (text: string, record: Comment) => (
- { - !record.auditStatus - ? - : - } + delCommentData(record.id)}> @@ -130,12 +115,15 @@ const CommentPage = () => { const onSubmit = async (values: FilterForm) => { const query: FilterData = { - key: values.title ? values.title : null, - startDate: values.createTime ? values.createTime[0].valueOf() + '' : null, - endDate: values.createTime ? values.createTime[1].valueOf() + '' : null, + key: values.title ? values.title : undefined, + content: values.content ? values.content : undefined, + startDate: values.createTime ? values.createTime[0].valueOf() + '' : undefined, + endDate: values.createTime ? values.createTime[1].valueOf() + '' : undefined, } const { data } = await getCommentListAPI({ query }); + console.log(data); + setList(data) } return ( @@ -145,7 +133,11 @@ const CommentPage = () => {
- + + + + + @@ -178,15 +170,9 @@ const CommentPage = () => {
所属文章: {comment?.articleTitle}
评论时间: {dayjs(comment?.createTime).format("YYYY-MM-DD HH:mm:ss")}
评论用户: {comment?.name}
-
邮箱: {comment?.email}
+
邮箱: {comment?.email ? comment?.email : "暂无邮箱"}
网站: {comment?.url ? {comment?.url} : '无网站'}
内容: {comment?.content}
-
状态: {comment?.auditStatus - ? 通过 - : 待审核} -
- - {!comment?.auditStatus ? : null}
diff --git a/src/pages/Footprint/type.d.ts b/src/pages/Footprint/type.d.ts index ee8f51b..b9e3af4 100644 --- a/src/pages/Footprint/type.d.ts +++ b/src/pages/Footprint/type.d.ts @@ -1,4 +1,5 @@ interface FilterForm { title?: string; + content?: string; createTime?: [moment.Moment, moment.Moment]; } \ No newline at end of file diff --git a/src/types/response.d.ts b/src/types/response.d.ts index 7c3cbd4..df34500 100644 --- a/src/types/response.d.ts +++ b/src/types/response.d.ts @@ -20,9 +20,10 @@ interface Page { } interface FilterData { - key?: string | null, - startDate?: string | null, - endDate?: string | null + key?: string, + content?: string, + startDate?: string, + endDate?: string } interface QueryData {