fix: add mode labels for learning sessions
Some checks failed
Deploy Admin Frontend / build-and-deploy (push) Failing after 10s
Some checks failed
Deploy Admin Frontend / build-and-deploy (push) Failing after 10s
This commit is contained in:
parent
129a9b9abc
commit
a30bfcf087
@ -38,6 +38,13 @@ export const recordTypeLabels: Record<string, string> = {
|
|||||||
session: '会话',
|
session: '会话',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const sessionModeLabels: Record<string, string> = {
|
||||||
|
study: '学习',
|
||||||
|
review: '复习',
|
||||||
|
reading: '阅读',
|
||||||
|
quiz: '测验',
|
||||||
|
};
|
||||||
|
|
||||||
export const parseStatusLabels: Record<string, string> = {
|
export const parseStatusLabels: Record<string, string> = {
|
||||||
pending: '待解析',
|
pending: '待解析',
|
||||||
processing: '解析中',
|
processing: '解析中',
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { Table, Tabs, Tag, Space, Input, Typography } from 'antd'
|
|||||||
import { SearchOutlined } from '@ant-design/icons'
|
import { SearchOutlined } from '@ant-design/icons'
|
||||||
import { useQuery } from '@tanstack/react-query'
|
import { useQuery } from '@tanstack/react-query'
|
||||||
import { api } from '@/services/http-client'
|
import { api } from '@/services/http-client'
|
||||||
import { sessionStatusLabels } from '@/constants/labels'
|
import { sessionStatusLabels, sessionModeLabels } from '@/constants/labels'
|
||||||
|
|
||||||
const { Title } = Typography
|
const { Title } = Typography
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ export default function LearningData() {
|
|||||||
{ title: 'ID', dataIndex: 'id', width: 100, ellipsis: true },
|
{ 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: '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: '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) => <Tag color={statusColors[s] || 'default'}>{sessionStatusLabels[s] || s}</Tag> },
|
{ title: '状态', dataIndex: 'status', width: 80, render: (s: string) => <Tag color={statusColors[s] || 'default'}>{sessionStatusLabels[s] || s}</Tag> },
|
||||||
{ title: '时长(分)', dataIndex: 'durationSeconds', width: 80, render: (s: number) => s ? Math.round(s / 60) : '-' },
|
{ 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() : '-' },
|
{ title: '开始时间', dataIndex: 'startedAt', width: 120, render: (d: string) => d ? new Date(d).toLocaleString() : '-' },
|
||||||
|
|||||||
@ -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 } from '../../constants/labels';
|
import { eventTypeLabels, eventStatusLabels, sessionStatusLabels, progressStatusLabels, targetTypeLabels, recordTypeLabels, sessionModeLabels } from '../../constants/labels';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
const { RangePicker } = DatePicker;
|
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: '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: '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 ? <Tag>{targetTypeLabels[v] || v}</Tag> : '-' },
|
{ title: '类型', dataIndex: 'targetType', key: 'targetType', width: 80, render: (v?: string) => v ? <Tag>{targetTypeLabels[v] || v}</Tag> : '-' },
|
||||||
{ 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: 'KB', dataIndex: 'knowledgeBaseId', key: 'kbId', width: 80, ellipsis: true, render: (_: any, r: any) => r.kbName || r.knowledgeBaseId },
|
||||||
{ title: '状态', dataIndex: 'status', key: 'status', width: 90,
|
{ title: '状态', dataIndex: 'status', key: 'status', width: 90,
|
||||||
render: (s: string) => <Tag color={s === 'active' ? 'green' : s === 'interrupted' ? 'red' : s === 'completed' ? 'blue' : 'orange'}>{sessionStatusLabels[s] || s}</Tag> },
|
render: (s: string) => <Tag color={s === 'active' ? 'green' : s === 'interrupted' ? 'red' : s === 'completed' ? 'blue' : 'orange'}>{sessionStatusLabels[s] || s}</Tag> },
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user