fix: map record titles to Chinese (covers historical English data)
All checks were successful
Deploy Admin Frontend / build-and-deploy (push) Successful in 12s

This commit is contained in:
wangdl 2026-06-19 13:23:44 +08:00
parent 972a80d4af
commit def5c953be
2 changed files with 12 additions and 4 deletions

View File

@ -37,6 +37,14 @@ export const recordTypeLabels: Record<string, string> = {
reading: '阅读', reading: '阅读',
session: '会话', session: '会话',
}; };
export const recordTitleLabels: Record<string, string> = {
'Reading started': '开始阅读',
'Reading ended': '结束阅读',
'Marked as read': '标记已读',
'开始阅读': '开始阅读',
'结束阅读': '结束阅读',
'标记已读': '标记已读',
};
export const sessionModeLabels: Record<string, string> = { export const sessionModeLabels: Record<string, string> = {
study: '学习', study: '学习',

View File

@ -4,7 +4,7 @@ import { Table, Input, Select, Space, Tag, Button, Tabs, Drawer, Descriptions, D
const { Text } = Typography; const { Text } = Typography;
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
import { learningAdminAPI } from '../../services/learningAdmin'; 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'; import dayjs from 'dayjs';
const { RangePicker } = DatePicker; const { RangePicker } = DatePicker;
@ -328,7 +328,7 @@ export function RecordPage() {
const columns = [ const columns = [
{ title: '用户', dataIndex: 'userId', key: 'userId', render: (_: any, r: any) => r.userName || r.userId, width: 90, ellipsis: true }, { 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: '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) => <Tag>{recordTypeLabels[t] || t}</Tag> }, { title: '类型', dataIndex: 'recordType', key: 'recordType', width: 100, render: (t: string) => <Tag>{recordTypeLabels[t] || t}</Tag> },
{ title: '时长', dataIndex: 'durationSeconds', key: 'duration', width: 80 }, { 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') : '-' }, { 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 && (
<Descriptions column={2} bordered size="small"> <Descriptions column={2} bordered size="small">
<Descriptions.Item label="用户ID">{detail.userId}</Descriptions.Item> <Descriptions.Item label="用户ID">{detail.userId}</Descriptions.Item>
<Descriptions.Item label="记录类型"><Tag>{detail.recordType}</Tag></Descriptions.Item> <Descriptions.Item label="记录类型"><Tag>{recordTypeLabels[detail.recordType] || detail.recordType}</Tag></Descriptions.Item>
<Descriptions.Item label="标题" span={2}>{detail.title || '-'}</Descriptions.Item> <Descriptions.Item label="标题" span={2}>{recordTitleLabels[detail.title] || detail.title || '-'}</Descriptions.Item>
<Descriptions.Item label="时长(秒)">{detail.durationSeconds ?? '-'}</Descriptions.Item> <Descriptions.Item label="时长(秒)">{detail.durationSeconds ?? '-'}</Descriptions.Item>
<Descriptions.Item label="关联资料ID">{detail.materialId || '-'}</Descriptions.Item> <Descriptions.Item label="关联资料ID">{detail.materialId || '-'}</Descriptions.Item>
<Descriptions.Item label="发生时间" span={2}>{detail.occurredAt ? dayjs(detail.occurredAt).format('YYYY-MM-DD HH:mm:ss') : '-'}</Descriptions.Item> <Descriptions.Item label="发生时间" span={2}>{detail.occurredAt ? dayjs(detail.occurredAt).format('YYYY-MM-DD HH:mm:ss') : '-'}</Descriptions.Item>