'use client' import { BigLoading, PageContainer } from '@/components' import { useTitle, useUrlQuery } from '@/hooks' import { useGetCategoriesQuery } from '@/store/services' import Link from 'next/link' export default function CategoriesPage() { useTitle('分类管理') const query = useUrlQuery() const parentId = query.parent_id const parentLvl = query.parent_lvl //? Get Categories Data const { childCategories, isLoading } = useGetCategoriesQuery(undefined, { selectFromResult: ({ data, isLoading }) => { return { childCategories: data?.data?.categories?.filter(category => category.parent === parentId), isLoading, } }, }) //? Render(s) if (isLoading) return (
) return (
{childCategories && childCategories[0]?.level !== 0 ? ( 添加新文件夹 ) : (
)} 图表展示
{childCategories && childCategories.length > 0 ? ( childCategories?.map(category => ( )) ) : ( )}
分类名称 操作
{category.name} {category.level !== 3 && ( 子类 )} 编辑 {category.level === 2 && ( 规格和特点 )} {category.level < 2 && ( <> 滑块 横幅 )}

还没有分类

) }