{
- linkList.filter(val => val.type === item._id).map(val => (
+ linkList.filter(val => val.type === item._id).filter((_, idx) => idx < 42).map(val => (
))
diff --git a/app/admin/(default)/dashboard/LinkTable.tsx b/app/admin/(default)/dashboard/LinkTable.tsx
index 2ecc9a2..6100f74 100644
--- a/app/admin/(default)/dashboard/LinkTable.tsx
+++ b/app/admin/(default)/dashboard/LinkTable.tsx
@@ -1,7 +1,7 @@
-import { Link } from "@/app/_lib/data/link"
+import { getLinkList, Link } from "@/app/_lib/data/link"
import { LinkType } from "@/app/_lib/data/linkType"
import { mRequest } from "@/app/_lib/request"
-import ImageUpload from "@/app/_ui/ImageUpload"
+import ImageUpload, { PICTURE_PREFIX } from "@/app/_ui/ImageUpload"
import { useAntdTable, useRequest } from "ahooks"
import {
Button,
@@ -20,7 +20,7 @@ import {
Table,
} from "antd"
import dayjs from "dayjs"
-import { useState } from "react"
+import { useEffect, useState } from "react"
@@ -30,17 +30,18 @@ export default function LinkTable(props: { id: string }) {
list: LinkType[]
}>('GET', '/api/linkType'))
const { tableProps, refresh } = useAntdTable(
- async ({ current, pageSize }) => {
- return mRequest<{
- total: number;
- list: Link[]
- }>(
- "GET",
- `/api/link?page=${current}&pageSize=${pageSize}&typeId=${props.id}`
- )
- },
+ ({ current, pageSize }) => {
+ console.log(current, pageSize);
+
+ return getLinkList({ page: current, pageSize, typeId: props.id })
+
+ }
)
+ useEffect(() => {
+ console.log(tableProps.dataSource);
+
+ }, [tableProps])
// const refresh = useCallback(async () => {
// setLoading(true)
// const res = await mRequest<{ list: Link[] }>(
@@ -71,8 +72,6 @@ export default function LinkTable(props: { id: string }) {
}
>
- {...tableProps}
- loading={loading}
rowKey="_id"
columns={[
{
@@ -83,7 +82,8 @@ export default function LinkTable(props: { id: string }) {
title: "图标",
dataIndex: "logoLink",
render: (_, row) => (
-
+
+
)
},
{
@@ -118,6 +118,8 @@ export default function LinkTable(props: { id: string }) {
),
},
]}
+ {...tableProps}
+
/>
void }) => {
+ const { token } = theme.useToken();
+ const [inputVisible, setInputVisible] = useState(false);
+ const [inputValue, setInputValue] = useState('');
+ const inputRef = useRef(null);
+
+ useEffect(() => {
+ if (inputVisible) {
+ inputRef.current?.focus();
+ }
+ }, [inputVisible]);
+ useEffect(() => {
+ console.log('value', value);
+
+ }, [value])
+ const handleClose = (removedTag: string) => {
+ const newTags = value.filter((tag) => tag !== removedTag);
+ setTags?.(newTags);
+ };
+
+ const showInput = () => {
+ setInputVisible(true);
+ };
+
+ const handleInputChange = (e: React.ChangeEvent) => {
+ setInputValue(e.target.value);
+ };
+
+ const handleInputConfirm = () => {
+ if (inputValue && value.findIndex(val => val === inputValue) === -1) {
+ // setTags([...tags, {
+ // label: inputValue,
+ // value: uuid(),
+ // }]);
+ setTags?.([...value, inputValue])
+ }
+
+ setInputVisible(false);
+ setInputValue('');
+ };
+
+ const forMap = (tag: string) => (
+
+ {
+ e.preventDefault();
+ handleClose(tag);
+ }}
+ >
+ {tag}
+
+
+ );
+
+ const tagChild = value.map(forMap);
+
+ const tagPlusStyle: React.CSSProperties = {
+ background: token.colorBgContainer,
+ borderStyle: 'dashed',
+ };
+
+ return (
+ <>
+
+ {tagChild}
+
+ {inputVisible ? (
+
+ ) : (
+
+ 新增分类
+
+ )}
+ >
+ );
+};
+
+export default SubCategoryList;
\ No newline at end of file
diff --git a/app/admin/(default)/dashboard/page.tsx b/app/admin/(default)/dashboard/page.tsx
index a19292f..e25f22d 100644
--- a/app/admin/(default)/dashboard/page.tsx
+++ b/app/admin/(default)/dashboard/page.tsx
@@ -5,10 +5,11 @@ import { useAntdTable } from "ahooks";
import { mRequest } from "@/app/_lib/request";
import { LinkTypeItem } from "@/app/_lib/types";
import LinkTable from "./LinkTable";
-import ImageUpload from "@/app/_ui/ImageUpload";
+import ImageUpload, { PICTURE_PREFIX } from "@/app/_ui/ImageUpload";
import { useForm } from "antd/es/form/Form";
import { LinkType } from "@/app/_lib/data/linkType";
import '@ant-design/v5-patch-for-react-19';
+import SubCategoryList from "./SubCategoryList";
export default function Page() {
const { tableProps, refresh } = useAntdTable(
@@ -69,7 +70,7 @@ export default function Page() {
dataIndex: "icon",
render: (_, item) => (
<>
-
+
>
)
},
@@ -166,14 +167,20 @@ export default function Page() {
name="priority"
label="优先级"
>
-
+
+
+
+ {/*
-
+ */}
-
+
{/* = 0.4'}
+ earcut@2.2.4:
+ resolution: {integrity: sha512-/pjZsA1b4RPHbeWZQn66SWS8nZZWLQQ23oE3Eam7aroEFGEvwKAsJfZ9ytiEMycfzXWpca4FA9QIOehf7PocBQ==}
+
ee-first@1.1.1:
resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==}
@@ -1827,6 +1839,9 @@ packages:
flatted@3.3.2:
resolution: {integrity: sha512-AiwGJM8YcNOaobumgtng+6NHuOqC3A7MixFeDafM3X9cIUM+xUXoS5Vfgf+OihAYe20fxqNM9yPBXJzRtZ/4eA==}
+ flubber@0.4.2:
+ resolution: {integrity: sha512-79RkJe3rA4nvRCVc2uXjj7U/BAUq84TS3KHn6c0Hr9K64vhj83ZNLUziNx4pJoBumSPhOl5VjH+Z0uhi+eE8Uw==}
+
for-each@0.3.3:
resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==}
@@ -2791,6 +2806,9 @@ packages:
pause-stream@0.0.11:
resolution: {integrity: sha512-e3FBlXLmN/D1S+zHzanP4E/4Z60oFAa3O051qt1pxa7DEJWKAyil6upYVXCWadEnuoqa4Pkc9oUx9zsxYeRv8A==}
+ performance-now@2.1.0:
+ resolution: {integrity: sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==}
+
picocolors@1.1.1:
resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==}
@@ -2851,6 +2869,9 @@ packages:
queue-microtask@1.2.3:
resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==}
+ raf@3.4.1:
+ resolution: {integrity: sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA==}
+
rc-cascader@3.33.0:
resolution: {integrity: sha512-JvZrMbKBXIbEDmpIORxqvedY/bck6hGbs3hxdWT8eS9wSQ1P7//lGxbyKjOSyQiVBbgzNWriSe6HoMcZO/+0rQ==}
peerDependencies:
@@ -3060,6 +3081,13 @@ packages:
react: '*'
react-dom: '*'
+ rc-tween-one@3.0.6:
+ resolution: {integrity: sha512-5zTSXyyv7bahDBQ/kJw/kNxxoBqTouttoelw8FOVOyWqmTMndizJEpvaj1N+yES5Xjss6Y2iVw+9vSJQZE8Z6g==}
+ engines: {node: '>=8.x'}
+ peerDependencies:
+ react: '>=16.9.0'
+ react-dom: '>=16.9.0'
+
rc-upload@4.8.1:
resolution: {integrity: sha512-toEAhwl4hjLAI1u8/CgKWt30BR06ulPa4iGQSMvSXoHzO88gPCslxqV/mnn4gJU7PDoltGIC9Eh+wkeudqgHyw==}
peerDependencies:
@@ -3422,6 +3450,9 @@ packages:
style-to-object@1.0.8:
resolution: {integrity: sha512-xT47I/Eo0rwJmaXC4oilDGDWLohVhR6o/xAQcPQN8q6QBuZVL8qMYL85kLmST5cPjAorwvqIA4qXTRQoYHaL6g==}
+ style-utils@0.3.8:
+ resolution: {integrity: sha512-RmGftIhY4tqtD1ERwKsVEDlt/M6UyxN/rcr95UmlooWmhtL0RwVUYJkpo1kSx3ppd9/JZzbknhy742zbMAawjQ==}
+
styled-jsx@5.1.6:
resolution: {integrity: sha512-qSVyDTeMotdvQYoHWLNGwRFJHC+i+ZvdBRYosOFgC+Wg1vx4frN2/RG/NA7SYqqvKNLf39P2LSRA2pu6n0XYZA==}
engines: {node: '>= 12.0.0'}
@@ -3446,6 +3477,15 @@ packages:
resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==}
engines: {node: '>= 0.4'}
+ svg-path-properties@0.2.2:
+ resolution: {integrity: sha512-GmrB+b6woz6CCdQe6w1GHs/1lt25l7SR5hmhF8jRdarpv/OgjLyuQygLu1makJapixeb1aQhP/Oa1iKi93o/aQ==}
+
+ svg-path-properties@1.3.0:
+ resolution: {integrity: sha512-R1+z37FrqyS3UXDhajNfvMxKI0smuVdedqOo4YbAQUfGqA86B9mGvr2IEXrwjjvGzCtdIKy/ad9N8m6YclaKAw==}
+
+ svgpath@2.6.0:
+ resolution: {integrity: sha512-OIWR6bKzXvdXYyO4DK/UWa1VA1JeKq8E+0ug2DG98Y/vOmMpfZNj+TIG988HjfYSqtcy/hFOtZq/n/j5GSESNg==}
+
swr@2.3.0:
resolution: {integrity: sha512-NyZ76wA4yElZWBHzSgEJc28a0u6QZvhb6w0azeL2k7+Q1gAzVK+IqQYXhVOC/mzi+HZIozrZvBVeSeOZNR2bqA==}
peerDependencies:
@@ -3486,6 +3526,10 @@ packages:
toggle-selection@1.0.6:
resolution: {integrity: sha512-BiZS+C1OS8g/q2RRbJmy59xpyghNBqrr6k5L/uKBGRsTfxmu3ffiRnd8mlGPUVayg8pvfi5urfnu8TU7DVOkLQ==}
+ topojson-client@3.1.0:
+ resolution: {integrity: sha512-605uxS6bcYxGXw9qi62XyrV6Q3xwbndjachmNxu8HWTtVPxZfEJN9fd/SZS1Q54Sn2y0TMyMxFj/cJINqGHrKw==}
+ hasBin: true
+
tr46@0.0.3:
resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==}
@@ -3511,6 +3555,12 @@ packages:
tslib@2.8.1:
resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==}
+ tween-functions@1.2.0:
+ resolution: {integrity: sha512-PZBtLYcCLtEcjL14Fzb1gSxPBeL7nWvGhO5ZFPGqziCcr8uvHp0NDmdjBchp6KHL+tExcg0m3NISmKxhU394dA==}
+
+ tween-one@1.2.7:
+ resolution: {integrity: sha512-F+Z9LO9GsYqf0j5bgNhAF98RDrAZ7QjQrujJ2lVYSHl4+dBPW/atHluL2bwclZf8Vo0Yo96f6pw2uq1OGzpC/Q==}
+
type-check@0.4.0:
resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==}
engines: {node: '>= 0.8.0'}
@@ -5762,6 +5812,10 @@ snapshots:
csstype@3.1.3: {}
+ d3-array@1.2.4: {}
+
+ d3-polygon@1.0.6: {}
+
damerau-levenshtein@1.0.8: {}
data-uri-to-buffer@6.0.2: {}
@@ -5852,6 +5906,8 @@ snapshots:
es-errors: 1.3.0
gopd: 1.2.0
+ earcut@2.2.4: {}
+
ee-first@1.1.1: {}
emoji-regex@8.0.0: {}
@@ -6241,6 +6297,15 @@ snapshots:
flatted@3.3.2: {}
+ flubber@0.4.2:
+ dependencies:
+ d3-array: 1.2.4
+ d3-polygon: 1.0.6
+ earcut: 2.2.4
+ svg-path-properties: 0.2.2
+ svgpath: 2.6.0
+ topojson-client: 3.1.0
+
for-each@0.3.3:
dependencies:
is-callable: 1.2.7
@@ -7508,6 +7573,8 @@ snapshots:
dependencies:
through: 2.3.8
+ performance-now@2.1.0: {}
+
picocolors@1.1.1: {}
picomatch@2.3.1: {}
@@ -7570,6 +7637,10 @@ snapshots:
queue-microtask@1.2.3: {}
+ raf@3.4.1:
+ dependencies:
+ performance-now: 2.1.0
+
rc-cascader@3.33.0(react-dom@19.0.0(react@19.0.0))(react@19.0.0):
dependencies:
'@babel/runtime': 7.26.0
@@ -7864,6 +7935,14 @@ snapshots:
react: 19.0.0
react-dom: 19.0.0(react@19.0.0)
+ rc-tween-one@3.0.6(react-dom@19.0.0(react@19.0.0))(react@19.0.0):
+ dependencies:
+ '@babel/runtime': 7.26.0
+ react: 19.0.0
+ react-dom: 19.0.0(react@19.0.0)
+ style-utils: 0.3.8
+ tween-one: 1.2.7
+
rc-upload@4.8.1(react-dom@19.0.0(react@19.0.0))(react@19.0.0):
dependencies:
'@babel/runtime': 7.26.0
@@ -8378,6 +8457,8 @@ snapshots:
dependencies:
inline-style-parser: 0.2.4
+ style-utils@0.3.8: {}
+
styled-jsx@5.1.6(react@19.0.0):
dependencies:
client-only: 0.0.1
@@ -8391,6 +8472,12 @@ snapshots:
supports-preserve-symlinks-flag@1.0.0: {}
+ svg-path-properties@0.2.2: {}
+
+ svg-path-properties@1.3.0: {}
+
+ svgpath@2.6.0: {}
+
swr@2.3.0(react@19.0.0):
dependencies:
dequal: 2.0.3
@@ -8430,6 +8517,10 @@ snapshots:
toggle-selection@1.0.6: {}
+ topojson-client@3.1.0:
+ dependencies:
+ commander: 2.20.3
+
tr46@0.0.3: {}
tr46@5.0.0:
@@ -8453,6 +8544,17 @@ snapshots:
tslib@2.8.1: {}
+ tween-functions@1.2.0: {}
+
+ tween-one@1.2.7:
+ dependencies:
+ '@babel/runtime': 7.26.0
+ flubber: 0.4.2
+ raf: 3.4.1
+ style-utils: 0.3.8
+ svg-path-properties: 1.3.0
+ tween-functions: 1.2.0
+
type-check@0.4.0:
dependencies:
prelude-ls: 1.2.1