移除讲解列表状态标签
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
lyf
2026-07-14 11:17:43 +08:00
parent 7caa671fe9
commit ec4c3e36cd
2 changed files with 80 additions and 5 deletions

View File

@@ -92,9 +92,6 @@
<view class="hall-main">
<text class="hall-name">{{ unit.name }}</text>
<view class="hall-meta-row">
<view class="floor-badge">
<text class="floor-badge-text">业务单元</text>
</view>
<text class="hall-meta-text">{{ unit.guideStopCount }} 个讲解点</text>
</view>
</view>
@@ -128,9 +125,9 @@
</view>
</view>
<text v-if="stop.description" class="stop-desc">{{ stop.description }}</text>
<view class="hall-meta-row">
<view v-if="stop.audioStatus !== 'READY'" class="hall-meta-row">
<view class="floor-badge">
<text class="floor-badge-text">{{ stop.audioStatus === 'READY' ? '可讲解' : '图文' }}</text>
<text class="floor-badge-text">图文</text>
</view>
</view>
</view>

View File

@@ -0,0 +1,78 @@
// @vitest-environment happy-dom
import { mount } from '@vue/test-utils'
import { describe, expect, it, vi } from 'vitest'
import ExplainHallSelect from '@/components/explain/ExplainHallSelect.vue'
vi.mock('@/utils/hostEnvironment', () => ({
isEmbeddedInWechatMiniProgram: () => false
}))
describe('讲解展厅选择列表', () => {
it('业务单元卡片不显示业务单元标签,并保留讲解点数量和点击事件', async () => {
const wrapper = mount(ExplainHallSelect, {
props: {
stage: 'unit',
businessUnits: [
{
id: 'unit-evolution',
name: '生命演化',
hallId: 'hall-evolution',
guideStopCount: 6
},
{
id: 'unit-dinosaur',
name: '恐龙世界',
hallId: 'hall-dinosaur',
guideStopCount: 4
}
]
}
})
const cards = wrapper.findAll('.unit-card')
expect(cards).toHaveLength(2)
expect(wrapper.text()).toContain('生命演化')
expect(wrapper.text()).toContain('恐龙世界')
expect(wrapper.text()).toContain('6 个讲解点')
expect(wrapper.text()).toContain('4 个讲解点')
expect(cards.map((card) => card.text()).join('')).not.toContain('业务单元')
expect(cards[0]?.find('.floor-badge').exists()).toBe(false)
await cards[0]?.trigger('tap')
expect(wrapper.emitted('businessUnitClick')).toEqual([['unit-evolution']])
})
it('READY 讲解点不显示可讲解标签,非 READY 讲解点保留图文标签和点击事件', async () => {
const readyStop = {
id: 'stop-ready',
name: '生命起源',
hallId: 'hall-evolution',
audioStatus: 'READY'
}
const textStop = {
id: 'stop-text',
name: '化石记录',
hallId: 'hall-evolution',
audioStatus: 'MISSING'
}
const wrapper = mount(ExplainHallSelect, {
props: {
stage: 'stop',
guideStops: [readyStop, textStop]
}
})
const cards = wrapper.findAll('.stop-card')
expect(cards).toHaveLength(2)
expect(wrapper.text()).toContain('生命起源')
expect(wrapper.text()).toContain('化石记录')
expect(wrapper.text()).not.toContain('可讲解')
expect(cards[0]?.find('.hall-meta-row').exists()).toBe(false)
expect(cards[1]?.find('.floor-badge').text()).toBe('图文')
await cards[0]?.trigger('tap')
await cards[1]?.trigger('tap')
expect(wrapper.emitted('guideStopClick')).toEqual([[readyStop], [textStop]])
})
})