修复讲解页标题与嵌入导航
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
lyf
2026-07-24 23:09:40 +08:00
parent f0d27441d6
commit 4bcd1af1f4
5 changed files with 6 additions and 6 deletions

View File

@@ -223,7 +223,7 @@ const shouldUseHostNavigation = computed(() => isEmbeddedInWechatMiniProgram())
const showInternalHeader = computed(() => props.forceInternalHeader || !shouldUseHostNavigation.value) const showInternalHeader = computed(() => props.forceInternalHeader || !shouldUseHostNavigation.value)
const headerTitle = computed(() => { const headerTitle = computed(() => {
if (props.stage === 'stop') return props.selectedHallName || '讲解对象' if (props.stage === 'stop') return props.selectedHallName || '讲解对象'
return '展厅讲解' return '免费讲解'
}) })
const loadingTitle = computed(() => { const loadingTitle = computed(() => {
if (props.stage === 'stop') return '正在加载讲解对象' if (props.stage === 'stop') return '正在加载讲解对象'

View File

@@ -25,7 +25,7 @@
{ {
"path": "pages/explain/list", "path": "pages/explain/list",
"style": { "style": {
"navigationBarTitleText": "全部讲解", "navigationBarTitleText": "免费讲解",
"navigationBarBackgroundColor": "#FFFFFF", "navigationBarBackgroundColor": "#FFFFFF",
"navigationStyle": "custom" "navigationStyle": "custom"
} }

View File

@@ -10,7 +10,7 @@
<ExplainHallSelect <ExplainHallSelect
:halls="explainHallItems" :halls="explainHallItems"
stage="hall" stage="hall"
force-internal-header :force-internal-header="!shouldUseHostNavigation"
:loading="explainLoading" :loading="explainLoading"
:error="explainError" :error="explainError"
@hall-click="handleExplainHallClick" @hall-click="handleExplainHallClick"

View File

@@ -83,7 +83,7 @@ describe('讲解展厅选择列表', () => {
}) })
const card = wrapper.get('.hall-overview-card') const card = wrapper.get('.hall-overview-card')
expect(wrapper.get('.header-title').text()).toBe('展厅讲解') expect(wrapper.get('.header-title').text()).toBe('免费讲解')
expect(card.attributes('style')).toContain('--hall-card-color: #d9b06c') expect(card.attributes('style')).toContain('--hall-card-color: #d9b06c')
expect(card.text()).toContain('恐龙厅') expect(card.text()).toContain('恐龙厅')
expect(card.text()).not.toContain('Dinosaur Hall') expect(card.text()).not.toContain('Dinosaur Hall')

View File

@@ -106,13 +106,13 @@ describe('讲解展厅列表返回', () => {
wrapper.unmount() wrapper.unmount()
}) })
it('独立页在微信嵌入态强制提供 H5 返回,并保留宿主识别参数', async () => { it('微信嵌入态由宿主导航提供标题与返回,不渲染重复的 H5 页头', async () => {
hostEnvironmentMocks.embeddedInWechatMiniProgram = true hostEnvironmentMocks.embeddedInWechatMiniProgram = true
window.location.hash = '#/pages/explain/list?embedded=wechat-mini-program&weapp=1' window.location.hash = '#/pages/explain/list?embedded=wechat-mini-program&weapp=1'
window.history.replaceState({}, '', window.location.href) window.history.replaceState({}, '', window.location.href)
const wrapper = mountExplainList() const wrapper = mountExplainList()
expect(wrapper.getComponent(ExplainHallSelectStub).props('forceInternalHeader')).toBe(true) expect(wrapper.getComponent(ExplainHallSelectStub).props('forceInternalHeader')).toBe(false)
await wrapper.get('[data-testid="explain-list-back"]').trigger('click') await wrapper.get('[data-testid="explain-list-back"]').trigger('click')
expect(uni.navigateBack).not.toHaveBeenCalled() expect(uni.navigateBack).not.toHaveBeenCalled()