From 47d5db3eb07e7592a706499c4ddb1847c7d9f871 Mon Sep 17 00:00:00 2001 From: Li1304553726 <1304553726@qq.com> Date: Thu, 27 Feb 2025 10:23:04 +0800 Subject: [PATCH] add. --- .../src/app/main/path/components/DeptInfo.tsx | 22 +++++++ .../src/app/main/path/components/PathCard.tsx | 63 +++---------------- .../src/app/main/path/components/TermInfo.tsx | 41 ++++++++++++ 3 files changed, 70 insertions(+), 56 deletions(-) create mode 100644 apps/web/src/app/main/path/components/DeptInfo.tsx create mode 100644 apps/web/src/app/main/path/components/TermInfo.tsx diff --git a/apps/web/src/app/main/path/components/DeptInfo.tsx b/apps/web/src/app/main/path/components/DeptInfo.tsx new file mode 100644 index 0000000..2cec836 --- /dev/null +++ b/apps/web/src/app/main/path/components/DeptInfo.tsx @@ -0,0 +1,22 @@ +import { TeamOutlined } from "@ant-design/icons"; +import { Typography } from "antd"; + +const { Title, Text } = Typography; +const DeptInfo = ({ path }) => { + return ( +
+ + {path?.depts && path?.depts?.length > 0 ? ( + + {path?.depts?.length > 1 ? `${path.depts[0].name}等` : path?.depts?.[0]?.name} + + ) : ( + + 未设置单位 + + )} +
+ ); +}; + +export default DeptInfo; \ No newline at end of file diff --git a/apps/web/src/app/main/path/components/PathCard.tsx b/apps/web/src/app/main/path/components/PathCard.tsx index dfdc79b..32f5d43 100755 --- a/apps/web/src/app/main/path/components/PathCard.tsx +++ b/apps/web/src/app/main/path/components/PathCard.tsx @@ -1,11 +1,11 @@ -import { Card, Rate, Tag, Typography, Button } from "antd"; +import { Card, Tag, Typography, Button } from "antd"; import { - EyeOutlined, - PlayCircleOutlined, - TeamOutlined, + EyeOutlined } from "@ant-design/icons"; import { PostDto, TaxonomySlug } from "@nice/common"; import { useNavigate } from "react-router-dom"; +import DeptInfo from "./DeptInfo"; +import TermInfo from "./TermInfo"; interface pathCardProps { path: PostDto; } @@ -21,8 +21,7 @@ export default function PathCard({ path }: pathCardProps) { onClick={() => handleClick(path)} key={path.id} hoverable - className=" group overflow-hidden rounded-xl border border-gray-200 bg-white - shadow-xl hover:shadow-2xl transition-all duration-300 transform hover:-translate-y-2" + className=" group overflow-hidden rounded-xl border border-gray-200 bg-white shadow-xl hover:shadow-2xl transition-all duration-300 transform hover:-translate-y-2" cover={
}>
- {path?.terms && path?.terms?.length > 0 ? ( -
- {path?.terms?.map((term) => { - return ( - - {term.name} - - ); - })} -
- ) : ( -
- - {"未设置分类"} - -
- )} - + @@ -74,24 +42,7 @@ export default function PathCard({ path }: pathCardProps) {
- { -
- - {path?.depts && path?.depts?.length > 0 ? ( - - {path?.depts?.length > 1 - ? `${path.depts[0].name}等` - : path?.depts?.[0]?.name} - {/* {path?.depts?.map((dept) => {return dept.name.length > 1 ?`${dept.name.slice}等`: dept.name})} */} - {/* {path?.depts?.map((dept)=>{return dept.name})} */} - - ) : ( - - 未设置单位 - - )} -
- } + {path?.meta?.views diff --git a/apps/web/src/app/main/path/components/TermInfo.tsx b/apps/web/src/app/main/path/components/TermInfo.tsx new file mode 100644 index 0000000..421909b --- /dev/null +++ b/apps/web/src/app/main/path/components/TermInfo.tsx @@ -0,0 +1,41 @@ +import { Tag } from "antd"; +import { TaxonomySlug } from "@nice/common"; + +const TermInfo = ({ path }) => { + console.log('xx',path?.terms); + + return <> + {path?.terms && path?.terms?.length > 0 ? ( +
+ {path?.terms?.map((term:any) => { + return ( + + {term.name} + + ); + })} +
+ ) : ( +
+ + {"未设置分类"} + +
+ )} + +}; + +export default TermInfo; \ No newline at end of file