From d113fc5de14849fa1e1991c2ddd1074abdb2b1c3 Mon Sep 17 00:00:00 2001 From: besscroft Date: Tue, 9 Apr 2024 22:09:19 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=A0=87=E7=AD=BE=E5=92=8C=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/list/page.tsx | 130 ++++++++++++++++++++++++++++++++---- app/admin/tag/page.tsx | 117 ++++++++++++++++++++++++++++---- app/admin/upload/page.tsx | 25 +++++-- components/AListTabs.tsx | 2 +- components/UploadSelect.tsx | 56 ++++++++++++++++ 5 files changed, 296 insertions(+), 34 deletions(-) create mode 100644 components/UploadSelect.tsx diff --git a/app/admin/list/page.tsx b/app/admin/list/page.tsx index 1e61847..cf6971b 100644 --- a/app/admin/list/page.tsx +++ b/app/admin/list/page.tsx @@ -1,22 +1,126 @@ -import { Card, CardBody } from '@nextui-org/card' +'use client' + +import React from 'react' +import { Card, CardHeader } from '@nextui-org/card' +import { Button, Dropdown, DropdownItem, DropdownMenu, DropdownTrigger } from '@nextui-org/react' +import { Table } from 'antd' +import type { TableProps } from 'antd' +import useSWR from 'swr' +import { fetcher } from '~/utils/fetcher' +import { toast } from 'sonner' +import { DeleteDocumentBulkIcon, EditDocumentBulkIcon, SendFilledIcon, LinkIcon } from '@nextui-org/shared-icons' + +interface DataType { + id: number; + tag: string; + url: string; + exif: any; + rating: number; + detail: string; + show: number; + sort: number; +} + +const iconClasses = 'text-xl text-default-500 pointer-events-none flex-shrink-0' + +const columns: TableProps['columns'] = [ + { + title: '标签', + dataIndex: 'tag', + }, + { + title: '评分', + dataIndex: 'rating', + }, + { + title: '说明', + dataIndex: 'detail', + }, + { + title: '显示', + dataIndex: 'show', + }, + { + title: '排序', + dataIndex: 'sort', + }, + { + title: '操作', + key: 'action', + render: (_, record) => ( + + + + + + } + onClick={() => toast.warning('还没写!')} + > + 编辑 + + } + onClick={() => toast.warning('还没写!')} + > + 同步 + + } + onClick={() => toast.warning('还没写!')} + > + 删除 + + + + ), + }, +]; export default async function List() { + const { data, error, isLoading, isValidating, mutate } = useSWR('/api/get-images', fetcher) + + if (error) { + toast.error('数据获取失败!') + } + return (
- -

- 图片维护 -

-
-
- - -

- 图片维护页面 -

-
+ +
+
+

标签管理

+
+
+ +
+ ) } \ No newline at end of file diff --git a/app/admin/tag/page.tsx b/app/admin/tag/page.tsx index 695c44a..b03b9ed 100644 --- a/app/admin/tag/page.tsx +++ b/app/admin/tag/page.tsx @@ -1,22 +1,111 @@ -import { Card, CardBody } from '@nextui-org/card' +'use client' + +import React from 'react' +import { Card, CardHeader } from '@nextui-org/card' +import { Button, Dropdown, DropdownItem, DropdownMenu, DropdownTrigger } from '@nextui-org/react' +import { Table } from 'antd' +import type { TableProps } from 'antd' +import useSWR from 'swr' +import { fetcher } from '~/utils/fetcher' +import { toast } from 'sonner' +import { DeleteDocumentBulkIcon, EditDocumentBulkIcon, SendFilledIcon } from '@nextui-org/shared-icons' + +interface DataType { + id: number; + name: string; + tag_value: string; + detail: string; + show: number; +} + +const iconClasses = 'text-xl text-default-500 pointer-events-none flex-shrink-0' + +const columns: TableProps['columns'] = [ + { + title: '标签名称', + dataIndex: 'name', + }, + { + title: '标签值', + dataIndex: 'tag_value', + }, + { + title: '说明', + dataIndex: 'detail', + }, + { + title: '显示', + dataIndex: 'show', + }, + { + title: '操作', + key: 'action', + render: (_, record) => ( + + + + + + } + onClick={() => toast.warning('还没写!')} + > + 编辑 + + } + onClick={() => toast.warning('还没写!')} + > + 删除 + + + + ), + }, +]; + +export default function List(callback: any, deps: React.DependencyList) { + const { data, error, isLoading, isValidating, mutate } = useSWR('/api/get-tags', fetcher) + + if (error) { + toast.error('数据获取失败!') + } -export default async function List() { return (
- -

- 标签管理 -

-
-
- - -

- 标签管理页面 -

-
+ +
+
+

标签管理

+
+
+ +
+
) } \ No newline at end of file diff --git a/app/admin/upload/page.tsx b/app/admin/upload/page.tsx index cd7add0..f031681 100644 --- a/app/admin/upload/page.tsx +++ b/app/admin/upload/page.tsx @@ -1,18 +1,31 @@ -import { Card, CardBody } from '@nextui-org/card' +import { Card, CardBody, CardHeader } from '@nextui-org/card' import FileUpload from '~/components/FileUpload' +import { Button } from '@nextui-org/react' +import UploadSelect from '~/components/UploadSelect' export default async function Upload() { + return (
- -

- 上传 -

-
+ +
+
+

上传

+
+
+ +
+ diff --git a/components/AListTabs.tsx b/components/AListTabs.tsx index 6bb467b..0adefda 100644 --- a/components/AListTabs.tsx +++ b/components/AListTabs.tsx @@ -43,7 +43,7 @@ export default function AListTabs() { data.map((item: any) => ( {item.config_key} - {item.config_value || 'N&A'} + {item.config_value || 'N&A'} )) } diff --git a/components/UploadSelect.tsx b/components/UploadSelect.tsx new file mode 100644 index 0000000..af92018 --- /dev/null +++ b/components/UploadSelect.tsx @@ -0,0 +1,56 @@ +'use client' + +import { Button, Select, SelectItem } from '@nextui-org/react' +import {CardHeader} from "@nextui-org/card"; + +export default async function UploadSelect() { + const animals = [ + {label: "Cat", value: "cat", description: "The second most popular pet in the world"}, + {label: "Dog", value: "dog", description: "The most popular pet in the world"}, + {label: "Elephant", value: "elephant", description: "The largest land animal"}, + ]; + + const storages = [ + { + label: 'S3', + value: 's3', + }, + { + label: 'AList', + value: 'alist', + } + ] + + return ( + + + + + ) +}