Ver código fonte

fix: 修复人才详情视频标题显示问题

- 后端添加文件名字段到视频数据返回
- 前端使用文件名作为视频标题,而非视频类型

Co-Authored-By: Claude <noreply@anthropic.com>
yourname 1 semana atrás
pai
commit
6f9fc0967f

+ 1 - 0
allin-packages/disability-module/src/routes/person-extension.types.ts

@@ -73,6 +73,7 @@ export type PersonVideoItem = {
   视频类型: string;
   文件ID: string;
   文件URL: string | null;
+  文件名: string | null;
   上传时间: string | null;
   文件类型: string | null;
   关联订单ID: number | null;

+ 4 - 0
allin-packages/disability-module/src/schemas/person-extension.schema.ts

@@ -138,6 +138,10 @@ export const PersonVideoItemSchema = z.object({
     description: '文件URL',
     example: 'https://example.com/files/123456'
   }),
+  文件名: z.string().nullable().openapi({
+    description: '文件名',
+    example: 'video_20240115.mp4'
+  }),
   上传时间: z.coerce.date().nullable().openapi({
     description: '上传时间',
     example: '2024-01-15T10:30:00.000Z'

+ 1 - 0
allin-packages/disability-module/src/services/disabled-person.service.ts

@@ -479,6 +479,7 @@ export class DisabledPersonService extends GenericCrudService<DisabledPerson> {
         视频类型: video.assetType,
         文件ID: video.fileId ? video.fileId.toString() : '',
         文件URL: video.file ? await video.file.fullUrl : null,
+        文件名: video.file?.name || null,
         上传时间: video.file?.uploadTime, // z.coerce.date().nullable()会自动转换
         文件类型: video.file?.type,
         关联订单ID: video.orderId

+ 9 - 2
mini-ui-packages/yongren-talent-management-ui/src/pages/TalentDetail/TalentDetail.tsx

@@ -221,15 +221,22 @@ const TalentDetail: React.FC<TalentDetailProps> = () => {
       const data = await response.json()
       // 企业专用视频API返回结构:{ 视频列表: [...] }
       const videoList = data?.视频列表 || []
+      // 视频类型映射:英文 -> 中文
+      const videoCategoryMap: Record<string, '个税视频' | '工资视频' | '工作视频' | '其他'> = {
+        'tax_video': '个税视频',
+        'salary_video': '工资视频',
+        'work_video': '工作视频',
+        'checkin_video': '其他'
+      }
       // 转换为VideoData数组
       return videoList.map((item: PersonVideoItem) => ({
         id: item.文件ID || '',
-        title: item.视频类型 || '未命名视频',
+        title: item.文件名 || item.视频类型 || '未命名视频',
         url: item.文件URL || undefined,
         type: item.文件类型 || undefined,
         uploadTime: item.上传时间 || undefined,
         size: undefined, // 文件大小字段不存在
-        category: (item.视频类型 as '个税视频' | '工资视频' | '工作视频' | '其他') || '其他'
+        category: videoCategoryMap[item.视频类型] || '其他'
       }))
     },
     enabled: isLoggedIn && talentId > 0