From c915bb2d18200c31de5c2246e2d08e45e4f86bf9 Mon Sep 17 00:00:00 2001 From: non_hana <1209220829@qq.com> Date: Fri, 12 Jul 2024 17:35:52 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E9=A1=B5ui?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../work-detail/view-list/index.tsx | 6 ++ .../work-detail/work-info/index.tsx | 92 +++++++++++-------- src/pages/work-detail/index.tsx | 3 +- src/utils/types.ts | 4 +- 4 files changed, 65 insertions(+), 40 deletions(-) diff --git a/src/components/work-detail/view-list/index.tsx b/src/components/work-detail/view-list/index.tsx index bf50452..b71eff1 100644 --- a/src/components/work-detail/view-list/index.tsx +++ b/src/components/work-detail/view-list/index.tsx @@ -387,6 +387,10 @@ const ViewList: FC = ({
= ({
= ({
= ({ status }) => { + switch (status) { + case 0: + return ( + + 原创作品 + + + ) + case 1: + return ( + + 转载作品 + + + ) + case 2: + return ( + + 合集作品 + + + ) + } +} + const WorkInfo: FC = ({ workId, workInfo, @@ -296,7 +323,8 @@ const WorkInfo: FC = ({ )} {/* 操作栏 */} {isLogin && ( -
+
+
= ({
)} {/* 作品信息 */} -
-
- {workInfo.name} +
+
+ {workInfo.name}
-
+
{workIntro}
-
- - {workInfo.reprintType === 0 - ? '原创作品' - : workInfo.reprintType === 1 - ? '转载作品' - : '合集作品'} - + {workInfo.labels.map((label) => ( - - #{label.label} - + ))} -
-
-
- - {workInfo.likeNum} -
-
- - {workInfo.viewNum} + +
+
+
+ + {workInfo.likeNum} +
+
+ + {workInfo.viewNum} +
+
+ + {workInfo.collectNum} +
-
- - {workInfo.collectNum} +
+ 发布日期:{workInfo.createdDate} + 更新日期:{workInfo.updatedDate}
-
- 发布日期:{workInfo.createdDate} - 更新日期:{workInfo.updatedDate} -
{/* 用户信息 */} -
-
+
+
= ({
{ const { authorId, ...rest } = data const authorInfo = (await getUserSimpleAPI({ id: authorId })).data - const labels = data.labels.map((label) => ({ value: label.id, label: label.name })) - setWorkInfo({ ...rest, authorInfo, labels }) + setWorkInfo({ ...rest, authorInfo }) } catch (error) { console.log('出现错误了喵!!', error) return diff --git a/src/utils/types.ts b/src/utils/types.ts index e869ac9..8fec3a8 100644 --- a/src/utils/types.ts +++ b/src/utils/types.ts @@ -1,4 +1,4 @@ -import { ImageItem } from '@/apis/types' +import { ImageItem, LabelItem } from '@/apis/types' export type Option = { label: string; value: string } @@ -63,7 +63,7 @@ export interface WorkDetailInfo { images: ImageItem[] name: string intro: string - labels: Option[] + labels: LabelItem[] isLiked: boolean isCollected: boolean favoriteIds?: string[]