fix: 恢复识别结果媒体分类展示

This commit is contained in:
jxxghp
2026-08-05 06:56:52 +08:00
parent b1f3d3eacb
commit 1129d63fcc
5 changed files with 33 additions and 1 deletions

View File

@@ -1653,6 +1653,9 @@ export default {
title: 'Meta Info',
caption: 'Parsed name, episodes, and resource terms',
},
classification: {
title: 'Media Classification',
},
source: {
title: 'Recognition Source',
caption: 'The media source matched by this recognition',

View File

@@ -1642,6 +1642,9 @@ export default {
title: '元信息',
caption: '解析出的名称、季集和资源信息',
},
classification: {
title: '媒体分类',
},
source: {
title: '识别数据源',
caption: '本次识别匹配到的媒体数据源',

View File

@@ -1641,6 +1641,9 @@ export default {
title: '元資訊',
caption: '解析出的名稱、季集和資源資訊',
},
classification: {
title: '媒體分類',
},
source: {
title: '識別資料源',
caption: '本次識別匹配到的媒體資料源',

View File

@@ -143,10 +143,13 @@ const mediaInfo = computed(() => nameTestResult.value?.media_info)
const isRecognized = computed(() => Boolean(metaInfo.value?.name))
const resultTitle = computed(() => mediaInfo.value?.title || metaInfo.value?.name || t('nameTest.unrecognized'))
const resultSubtitle = computed(() => {
const parts = [mediaInfo.value?.year || metaInfo.value?.year, mediaInfo.value?.type || metaInfo.value?.type]
const parts = [mediaInfo.value?.year || metaInfo.value?.year]
if (metaInfo.value?.season_episode) parts.push(metaInfo.value.season_episode)
return parts.filter(Boolean).join(' · ') || t('nameTest.waitingResult')
})
const mediaClassification = computed(() => {
return [mediaInfo.value?.type || metaInfo.value?.type, mediaInfo.value?.category].filter(Boolean).join(' · ') || '-'
})
const resourceChips = computed(() => {
return [
metaInfo.value?.web_source,
@@ -229,6 +232,11 @@ const pipelineSteps = computed<PipelineStep[]>(() => [
.filter(Boolean)
.join(' · ') || '-',
},
{
icon: 'mdi-shape-outline',
title: t('nameTest.steps.classification.title'),
value: mediaClassification.value,
},
{
icon: 'mdi-database-search-outline',
source: recognizedMediaSource.value,

View File

@@ -35,6 +35,7 @@ vi.mock('vue-toastification', () => ({
}))
interface RecognizedMedia {
category?: string
media_id: string
source: string
title: string
@@ -114,6 +115,20 @@ describe('NameTestView media identity', () => {
expect(sourceDisplay.querySelector('.media-source-logo')).toBeInTheDocument()
})
it('shows the recognized media type and category below metadata', async () => {
await renderRecognizedMedia({
category: '动漫',
media_id: '485',
source: 'bangumi',
title: '测试动画',
type: '电视剧',
year: '2026',
})
const classificationStep = screen.getByText('媒体分类').closest('.pipeline-step')
expect(classificationStep).toHaveTextContent('媒体分类电视剧 · 动漫')
})
it('closes the recognition dialog before navigating to the media detail', async () => {
const eventOrder: string[] = []
const onClose = vi.fn(() => eventOrder.push('close'))