修复粤语音频重复提示

This commit is contained in:
lyf
2026-07-15 01:35:22 +08:00
parent be5b364bbf
commit 6c3da77693
2 changed files with 22 additions and 3 deletions

View File

@@ -106,9 +106,6 @@
</text>
</template>
<text v-if="currentDetailTextLoading" class="section-hint">{{ detailLoadingMessage }}</text>
<text v-else-if="audioAvailabilityMessage" class="section-hint audio-status-hint">
{{ audioAvailabilityMessage }}
</text>
</view>
</view>
</scroll-view>

View File

@@ -144,4 +144,26 @@ describe('讲解详情音频优先布局', () => {
language: 'en-US'
}), expect.objectContaining({ displayMode: 'mini' }))
})
it('音频不可用时只在音频控制区显示一次提示', async () => {
mocks.enterExplainDetail.mockResolvedValue({
...exhibit,
audioUrl: undefined,
audioDuration: undefined,
audioStatus: 'MISSING',
audioLanguage: 'yue-HK',
audioUnavailableReason: '当前语言暂无语音讲解。'
})
const wrapper = mount(ExhibitDetail, {
global: { stubs: { GuidePageFrame: GuidePageFrameStub } }
})
await mocks.onLoadHandler?.({ id: exhibit.id, lang: 'yue-HK', targetType: 'STOP', targetId: 'stop-1' })
await flushPromises()
expect(wrapper.find('.detail-audio-unavailable').text()).toBe('当前语言暂无语音讲解。')
expect(wrapper.find('.audio-status-hint').exists()).toBe(false)
expect(wrapper.findAll('.section-hint')).toHaveLength(0)
})
})