From def5c953be7ef55689f1ecdff8004eb369d53866 Mon Sep 17 00:00:00 2001 From: wangdl Date: Fri, 19 Jun 2026 13:23:44 +0800 Subject: [PATCH] fix: map record titles to Chinese (covers historical English data) --- src/constants/labels.ts | 8 ++++++++ src/pages/learning/DataPages.tsx | 8 ++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/constants/labels.ts b/src/constants/labels.ts index 4408759..b2101c8 100644 --- a/src/constants/labels.ts +++ b/src/constants/labels.ts @@ -37,6 +37,14 @@ export const recordTypeLabels: Record = { reading: '阅读', session: '会话', }; +export const recordTitleLabels: Record = { + 'Reading started': '开始阅读', + 'Reading ended': '结束阅读', + 'Marked as read': '标记已读', + '开始阅读': '开始阅读', + '结束阅读': '结束阅读', + '标记已读': '标记已读', +}; export const sessionModeLabels: Record = { study: '学习', diff --git a/src/pages/learning/DataPages.tsx b/src/pages/learning/DataPages.tsx index 67f4c13..969a541 100644 --- a/src/pages/learning/DataPages.tsx +++ b/src/pages/learning/DataPages.tsx @@ -4,7 +4,7 @@ import { Table, Input, Select, Space, Tag, Button, Tabs, Drawer, Descriptions, D const { Text } = Typography; import { useQuery } from '@tanstack/react-query'; import { learningAdminAPI } from '../../services/learningAdmin'; -import { eventTypeLabels, eventStatusLabels, sessionStatusLabels, progressStatusLabels, targetTypeLabels, recordTypeLabels, sessionModeLabels } from '../../constants/labels'; +import { eventTypeLabels, eventStatusLabels, sessionStatusLabels, progressStatusLabels, targetTypeLabels, recordTypeLabels, recordTitleLabels, sessionModeLabels } from '../../constants/labels'; import dayjs from 'dayjs'; const { RangePicker } = DatePicker; @@ -328,7 +328,7 @@ export function RecordPage() { const columns = [ { title: '用户', dataIndex: 'userId', key: 'userId', render: (_: any, r: any) => r.userName || r.userId, width: 90, ellipsis: true }, { title: '资料', dataIndex: 'materialId', key: 'materialId', render: (_: any, r: any) => r.materialName || (r.materialId ? r.materialId.slice(0,12) : '-'), width: 100, ellipsis: true }, - { title: '标题', dataIndex: 'title', key: 'title', width: 180 }, + { title: '标题', dataIndex: 'title', key: 'title', width: 180, render: (t: string) => recordTitleLabels[t] || t }, { title: '类型', dataIndex: 'recordType', key: 'recordType', width: 100, render: (t: string) => {recordTypeLabels[t] || t} }, { title: '时长', dataIndex: 'durationSeconds', key: 'duration', width: 80 }, { title: '时间', dataIndex: 'occurredAt', key: 'occurredAt', width: 160, render: (t: string) => t ? dayjs(t).format('MM-DD HH:mm') : '-' }, @@ -349,8 +349,8 @@ export function RecordPage() { {detail && ( {detail.userId} - {detail.recordType} - {detail.title || '-'} + {recordTypeLabels[detail.recordType] || detail.recordType} + {recordTitleLabels[detail.title] || detail.title || '-'} {detail.durationSeconds ?? '-'} {detail.materialId || '-'} {detail.occurredAt ? dayjs(detail.occurredAt).format('YYYY-MM-DD HH:mm:ss') : '-'}