From a30bfcf087b340058c06544ddf08ba9408c9d536 Mon Sep 17 00:00:00 2001 From: wangdl Date: Fri, 19 Jun 2026 12:50:14 +0800 Subject: [PATCH] fix: add mode labels for learning sessions --- src/constants/labels.ts | 7 +++++++ src/pages/LearningData.tsx | 4 ++-- src/pages/learning/DataPages.tsx | 4 ++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/constants/labels.ts b/src/constants/labels.ts index 9a53a08..39108fc 100644 --- a/src/constants/labels.ts +++ b/src/constants/labels.ts @@ -38,6 +38,13 @@ export const recordTypeLabels: Record = { session: '会话', }; +export const sessionModeLabels: Record = { + study: '学习', + review: '复习', + reading: '阅读', + quiz: '测验', +}; + export const parseStatusLabels: Record = { pending: '待解析', processing: '解析中', diff --git a/src/pages/LearningData.tsx b/src/pages/LearningData.tsx index 1d064ef..9e19ad4 100644 --- a/src/pages/LearningData.tsx +++ b/src/pages/LearningData.tsx @@ -3,7 +3,7 @@ import { Table, Tabs, Tag, Space, Input, Typography } from 'antd' import { SearchOutlined } from '@ant-design/icons' import { useQuery } from '@tanstack/react-query' import { api } from '@/services/http-client' -import { sessionStatusLabels } from '@/constants/labels' +import { sessionStatusLabels, sessionModeLabels } from '@/constants/labels' const { Title } = Typography @@ -47,7 +47,7 @@ export default function LearningData() { { title: 'ID', dataIndex: 'id', width: 100, ellipsis: true }, { title: '用户', dataIndex: 'userId', width: 100, ellipsis: true, render: (_: any, r: any) => r.userName || r.userId }, { title: '知识库', dataIndex: 'knowledgeBaseId', width: 100, ellipsis: true, render: (_: any, r: any) => r.kbName || r.knowledgeBaseId }, - { title: '模式', dataIndex: 'mode', width: 80 }, + { title: '模式', dataIndex: 'mode', width: 80, render: (v: string) => sessionModeLabels[v] || v || '-' }, { title: '状态', dataIndex: 'status', width: 80, render: (s: string) => {sessionStatusLabels[s] || s} }, { title: '时长(分)', dataIndex: 'durationSeconds', width: 80, render: (s: number) => s ? Math.round(s / 60) : '-' }, { title: '开始时间', dataIndex: 'startedAt', width: 120, render: (d: string) => d ? new Date(d).toLocaleString() : '-' }, diff --git a/src/pages/learning/DataPages.tsx b/src/pages/learning/DataPages.tsx index befaf43..77f4952 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 } from '../../constants/labels'; +import { eventTypeLabels, eventStatusLabels, sessionStatusLabels, progressStatusLabels, targetTypeLabels, recordTypeLabels, sessionModeLabels } from '../../constants/labels'; import dayjs from 'dayjs'; const { RangePicker } = DatePicker; @@ -122,7 +122,7 @@ export function SessionPage() { { 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, width: 90, ellipsis: true }, { title: '类型', dataIndex: 'targetType', key: 'targetType', width: 80, render: (v?: string) => v ? {targetTypeLabels[v] || v} : '-' }, - { title: '模式', dataIndex: 'mode', key: 'mode', width: 70, render: (v?: string) => v || '-' }, + { title: '模式', dataIndex: 'mode', key: 'mode', width: 70, render: (v?: string) => sessionModeLabels[v] || v || '-' }, { title: 'KB', dataIndex: 'knowledgeBaseId', key: 'kbId', width: 80, ellipsis: true, render: (_: any, r: any) => r.kbName || r.knowledgeBaseId }, { title: '状态', dataIndex: 'status', key: 'status', width: 90, render: (s: string) => {sessionStatusLabels[s] || s} },