From 2d5445105211f5ffe383ba814afa44a4944ba96c Mon Sep 17 00:00:00 2001 From: callmeyan Date: Sun, 22 Dec 2024 03:44:43 +0800 Subject: [PATCH] =?UTF-8?q?:lipstick:=20update=20=E6=96=B0=E9=97=BB?= =?UTF-8?q?=E7=BC=96=E8=BE=91ui?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/news/components/style.module.scss | 9 ++ src/pages/news/edit.tsx | 130 +++++++++++++------- 2 files changed, 97 insertions(+), 42 deletions(-) diff --git a/src/pages/news/components/style.module.scss b/src/pages/news/components/style.module.scss index 53f181f..708fc0b 100644 --- a/src/pages/news/components/style.module.scss +++ b/src/pages/news/components/style.module.scss @@ -28,4 +28,13 @@ @apply flex flex-wrap gap-2 mt-2; } } +} +.newListTable{ + :global{ + .header{} + .body{} + .row{ + @apply bg-white mt-2 p-4 rounded; + } + } } \ No newline at end of file diff --git a/src/pages/news/edit.tsx b/src/pages/news/edit.tsx index e18f6c4..0bf5626 100644 --- a/src/pages/news/edit.tsx +++ b/src/pages/news/edit.tsx @@ -1,4 +1,4 @@ -import {Button, Pagination, Table, TableColumnsType, TableProps, Typography} from "antd"; +import {Button, Checkbox, Pagination, Space, Table, TableColumnsType, TableProps, Typography} from "antd"; import {Card} from "@/components/card"; import React, {useState} from "react"; @@ -10,6 +10,9 @@ import EditSearchForm from "@/pages/news/components/edit-search-form.tsx"; import ButtonPush2Video from "@/pages/news/components/button-push2video.tsx"; import {Key} from "antd/es/table/interface"; +import styles from './components/style.module.scss' +import InfiniteScroller from "@/components/scoller/infinite-scroller.tsx"; + export default function NewEdit() { const [editId, setEditId] = useState(-1) @@ -17,20 +20,17 @@ export default function NewEdit() { const [params, setParams] = useState({ pagination: {page: 1, limit: 10} }) - const {data, refresh} = useRequest(() => getList(params), {refreshDeps: [params]}) + const {data, refresh, loading} = useRequest(() => getList(params), {refreshDeps: [params]}) - const columns: TableColumnsType = [ + // : TableColumnsType + const columns = [ { title: '标题', - minWidth: 300, dataIndex: 'title', - }, - { - title: '内容', - dataIndex: 'summary', - render: (value) => ({value}) + render: (_, record) => (
+
{_}
+
{record.summary}
+
) }, { title: '来源', @@ -49,48 +49,94 @@ export default function NewEdit() { title: '操作', width: 80, align: 'center', - render: (_, record) => (), + render: (_, record) => ( + + + + ), }, ]; - const rowSelection: TableProps['rowSelection'] = { - onChange: (selectedRowKeys: Key[]) => { - setSelectedRowKeys(selectedRowKeys as Id[]) - }, - }; return (
- +
- - rowSelection={{type: 'checkbox', ...rowSelection}} - columns={columns} - dataSource={data?.list || []} - rowKey={'id'} - bordered - pagination={false} - /> - {data?.pagination && data?.pagination.total > 0 &&
- setParams(prev => ({ +
+
+
标题
+
来源
+
时间
+
操作
+
+ { + setParams(prev => ({ ...prev, pagination: {page, limit: 10} - }))} - /> - -
} + })) + }} loading={loading} pagination={data?.pagination}> +
+ {data?.list?.map((item, i) => { + return
+
+
{item.title}
+
{item.summary}
+
+
+
{item.media_name}
+
+
+
{formatTime(item.publish_time, 'YYYY-MM-DD HH:mm')}
+
+
+ + + + + +
+
+ })} +
+ +
+ {/**/} + {/* columns={columns}*/} + {/* dataSource={data?.list || []}*/} + {/* rowKey={'id'}*/} + {/* bordered={false}*/} + {/* pagination={false}*/} + {/* rowHoverable={false}*/} + {/* className={styles.newListTable}*/} + {/*/>*/} + {data?.pagination && data?.pagination.total > 0 && +
+ setParams(prev => ({ + ...prev, + pagination: {page, limit: 10} + }))} + /> + +
}
- +
) } \ No newline at end of file