图片列表优化

This commit is contained in:
禺狨 2023-03-10 18:13:44 +08:00
parent 80388e6d54
commit ffbf24a2b5
2 changed files with 9 additions and 13 deletions

View File

@ -29,6 +29,6 @@
.imageItem{ .imageItem{
position: relative; position: relative;
width: 120px; width: 150px;
height: 80px; height: 150px;
} }

View File

@ -32,7 +32,7 @@ export const ResourceImagesPage = () => {
const [imageList, setImageList] = useState<ImageItem[]>([]); const [imageList, setImageList] = useState<ImageItem[]>([]);
const [refresh, setRefresh] = useState(false); const [refresh, setRefresh] = useState(false);
const [page, setPage] = useState(1); const [page, setPage] = useState(1);
const [size, setSize] = useState(12); const [size, setSize] = useState(32);
const [total, setTotal] = useState(0); const [total, setTotal] = useState(0);
const [category_ids, setCategoryIds] = useState<any>([]); const [category_ids, setCategoryIds] = useState<any>([]);
@ -92,12 +92,7 @@ export const ResourceImagesPage = () => {
></UploadImageSub> ></UploadImageSub>
</Col> </Col>
</Row> </Row>
<Row <Row gutter={[24, 24]}>
gutter={[
{ xs: 8, sm: 16, md: 24, lg: 32 },
{ xs: 4, sm: 8, md: 12, lg: 16 },
]}
>
{imageList.length === 0 && ( {imageList.length === 0 && (
<Col span={24}> <Col span={24}>
<Empty description="暂无图片" /> <Empty description="暂无图片" />
@ -105,12 +100,12 @@ export const ResourceImagesPage = () => {
)} )}
{imageList.map((item) => ( {imageList.map((item) => (
<Col key={item.id} span={6}> <Col key={item.id} span={3}>
<div className={styles.imageItem}> <div className={styles.imageItem}>
<Image <Image
preview={false} preview={true}
width={120} width={150}
height={80} height={150}
src={item.url} src={item.url}
/> />
<Popconfirm <Popconfirm
@ -141,6 +136,7 @@ export const ResourceImagesPage = () => {
}} }}
defaultCurrent={page} defaultCurrent={page}
total={total} total={total}
pageSize={size}
/> />
</Col> </Col>
)} )}