diff --git a/src/pages/Article/index.tsx b/src/pages/Article/index.tsx
index ebf356a..40aebca 100644
--- a/src/pages/Article/index.tsx
+++ b/src/pages/Article/index.tsx
@@ -9,8 +9,7 @@ import { getTagListAPI } from '@/api/Tag'
import { delArticleDataAPI, getArticleListAPI } from '@/api/Article';
import type { Tag as ArticleTag } from '@/types/app/tag';
import type { Cate } from '@/types/app/cate';
-import type { Article } from '@/types/app/article';
-import { FilterArticle, FilterForm } from './type'
+import type { Article, FilterArticle, FilterForm } from '@/types/app/article';
import dayjs from 'dayjs';
@@ -127,10 +126,10 @@ const ArticlePage = () => {
const onSubmit = async (values: FilterForm) => {
const query: FilterArticle = {
key: values.title,
- startDate: values.createTime ? values.createTime[0].valueOf() + '' : undefined,
- endDate: values.createTime ? values.createTime[1].valueOf() + '' : undefined,
cateIds: values.cateIds,
tagId: values.tagId,
+ startDate: values?.createTime[0].valueOf() + '',
+ endDate: values?.createTime[1].valueOf() + '',
}
const { data } = await getArticleListAPI({ query });
@@ -142,7 +141,7 @@ const ArticlePage = () => {
const getCateList = async () => {
const { data } = await getCateListAPI()
- setCateList(data as Cate[])
+ setCateList(data.filter(item => item.type === "cate") as Cate[])
}
const getTagList = async () => {
diff --git a/src/pages/Article/type.d.ts b/src/pages/Article/type.d.ts
deleted file mode 100644
index a2352a3..0000000
--- a/src/pages/Article/type.d.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-export interface FilterForm {
- title: string,
- cateIds?: number[],
- tagId?: number,
- createTime: Date[]
-}
-
-export interface FilterArticle extends FilterData {
- cateIds?: number[],
- tagId?: number,
-}
\ No newline at end of file
diff --git a/src/pages/Comment/index.tsx b/src/pages/Comment/index.tsx
index eb9da6c..4104bc7 100644
--- a/src/pages/Comment/index.tsx
+++ b/src/pages/Comment/index.tsx
@@ -1,11 +1,11 @@
import { useState, useEffect } from 'react';
-import { Card, message, Table, Popconfirm, Button, Tag, Modal, Form, Input, DatePicker } from 'antd';
+import { Card, message, Table, Popconfirm, Button, Modal, Form, Input, DatePicker } from 'antd';
import { getCommentListAPI } from '@/api/Comment';
import { delCommentDataAPI } from '@/api/Comment';
import { ColumnsType } from 'antd/es/table';
import { titleSty } from '@/styles/sty';
import Title from '@/components/Title';
-import { Comment } from '@/types/app/comment'
+import { Comment, FilterForm } from '@/types/app/comment'
import dayjs from 'dayjs';
const CommentPage = () => {
@@ -18,8 +18,6 @@ const CommentPage = () => {
const getCommentList = async () => {
const { data } = await getCommentListAPI();
- // 根据时间排序:最新时间在前
- // const sortedData = (data as Comment[]).sort((a, b) => +b.createTime - +a.createTime);
setList(data)
setLoading(false)
}
@@ -43,15 +41,6 @@ const CommentPage = () => {
key: 'id',
align: "center"
},
- // {
- // title: '状态',
- // dataIndex: 'auditStatus',
- // key: 'auditStatus',
- // fixed: 'left',
- // render: (status: number) => status ?
- // 通过
- // : 待审核
- // },
{
title: '名称',
dataIndex: 'name',
@@ -116,14 +105,13 @@ const CommentPage = () => {
const onSubmit = async (values: FilterForm) => {
const query: FilterData = {
- 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,
+ key: values?.title,
+ content: values?.content,
+ startDate: values?.createTime[0].valueOf() + '',
+ endDate: values?.createTime[1].valueOf() + '',
}
const { data } = await getCommentListAPI({ query });
- console.log(data);
setList(data)
}
diff --git a/src/pages/Create/components/PublishForm/index.tsx b/src/pages/Create/components/PublishForm/index.tsx
index 1c2318a..68227e4 100644
--- a/src/pages/Create/components/PublishForm/index.tsx
+++ b/src/pages/Create/components/PublishForm/index.tsx
@@ -79,9 +79,6 @@ const PublishForm = ({ data, closeModel }: { data: Article, closeModel: () => vo
};
const onSubmit: FormProps['onFinish'] = async (values) => {
- console.log(values, 777);
-
-
values.createTime = values.createTime.valueOf()
values.cateIds = [...new Set(values.cateIds?.flat())]
@@ -135,7 +132,6 @@ const PublishForm = ({ data, closeModel }: { data: Article, closeModel: () => vo
multiple
fieldNames={{ label: "name", value: "id" }}
placeholder="请选择文章分类"
- onChange={(value) => { console.log(value) }}
className="w-full"
/>
diff --git a/src/pages/Footprint/index.tsx b/src/pages/Footprint/index.tsx
index 47191cc..5ff740d 100644
--- a/src/pages/Footprint/index.tsx
+++ b/src/pages/Footprint/index.tsx
@@ -3,7 +3,7 @@ import { Table, Button, Tag, notification, Card, Popconfirm, Form, Input, DatePi
import { titleSty } from '@/styles/sty';
import Title from '@/components/Title';
import { delFootprintDataAPI, getFootprintListAPI, addFootprintDataAPI, editFootprintDataAPI, getFootprintDataAPI } from '@/api/Footprint';
-import type { Footprint, FilterFootprint, FilterForm } from '@/types/app/footprint';
+import type { Footprint, FilterForm } from '@/types/app/footprint';
import dayjs from 'dayjs';
const FootprintPage = () => {
@@ -129,7 +129,7 @@ const FootprintPage = () => {
const onSubmit = async () => {
form.validateFields().then(async (values: Footprint) => {
values.createTime = values.createTime.valueOf()
- values.images = values.images?(values.images as string).split("\n"):[]
+ values.images = values.images ? (values.images as string).split("\n") : []
if (isMethod === "edit") {
await editFootprintDataAPI({ ...footprint, ...values });
@@ -147,10 +147,10 @@ const FootprintPage = () => {
const closeModel = () => reset();
const onFilterSubmit = async (values: FilterForm) => {
- const query: FilterFootprint = {
- key: values.address ? values.address : null,
- startDate: values.createTime ? values.createTime[0].valueOf() + '' : null,
- endDate: values.createTime ? values.createTime[1].valueOf() + '' : null,
+ const query: FilterData = {
+ key: values.address,
+ startDate: values?.createTime[0].valueOf() + '',
+ endDate: values?.createTime[1].valueOf() + '',
}
const { data } = await getFootprintListAPI({ query });
diff --git a/src/pages/Footprint/type.d.ts b/src/pages/Footprint/type.d.ts
deleted file mode 100644
index 8d7fb5b..0000000
--- a/src/pages/Footprint/type.d.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-export interface FilterForm {
- content?: string;
- cateId?: number;
- createTime?: [moment.Moment, moment.Moment];
-}
\ No newline at end of file
diff --git a/src/types/app/article.d.ts b/src/types/app/article.d.ts
index 227f36a..ec6be95 100644
--- a/src/types/app/article.d.ts
+++ b/src/types/app/article.d.ts
@@ -14,4 +14,16 @@ export interface Article {
view?: number
count?: number,
createTime?: string,
+}
+
+export interface FilterForm {
+ title?: string,
+ cateIds?: number[],
+ tagId?: number,
+ createTime: Date[]
+}
+
+export interface FilterArticle extends FilterData {
+ cateIds?: number[],
+ tagId?: number,
}
\ No newline at end of file
diff --git a/src/types/app/comment.d.ts b/src/types/app/comment.d.ts
index 12df27b..6e3ca29 100644
--- a/src/types/app/comment.d.ts
+++ b/src/types/app/comment.d.ts
@@ -17,4 +17,10 @@ export interface Info {
loading: boolean,
list: Comment[],
paginate: Page
+}
+
+export interface FilterForm {
+ title?: string,
+ content?: string,
+ createTime: Date[]
}
\ No newline at end of file
diff --git a/src/types/app/footprint.d.ts b/src/types/app/footprint.d.ts
index e684c8d..e3c0d7e 100644
--- a/src/types/app/footprint.d.ts
+++ b/src/types/app/footprint.d.ts
@@ -8,13 +8,7 @@ export interface Footprint {
createTime?: string | Dayjs;
}
-export interface FilterFootprint {
- key?: string | null;
- startDate?: string | null;
- endDate?: string | null;
-}
-
export interface FilterForm {
address?: string;
- createTime?: [moment.Moment, moment.Moment];
+ createTime: Date[]
}
\ No newline at end of file