优化讲解详情正文按钮显示
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
lyf
2026-07-07 18:15:45 +08:00
parent 349f9b03e5
commit 64ad7acfa8

View File

@@ -78,7 +78,7 @@
:class="{ disabled: detailTextLoading }"
@tap="handleLoadDetailText"
>
<text class="text-load-btn-text">{{ detailTextLoading ? '正在加载' : '查看图文讲解' }}</text>
<text class="text-load-btn-text">{{ detailTextLoading ? '正在加载' : detailTextLoadActionText }}</text>
</view>
<text v-if="detailTextUnavailableMessage" class="section-hint">{{ detailTextUnavailableMessage }}</text>
</view>
@@ -239,14 +239,36 @@ const visibleLanguageOptions = computed(() => (
languageOptions.filter((option) => supportedDetailLanguages.value.has(option.value))
))
const isLanguageSwitchVisible = computed(() => visibleLanguageOptions.value.length > 1)
const isTextLoadActionVisible = computed(() => (
const hasTextLoadTarget = computed(() => Boolean(
exhibit.value.audio.playTargetId || exhibit.value.id
))
const normalizedDetailSummary = computed(() => exhibit.value.summary.trim())
const hasMeaningfulDetailSummary = computed(() => (
normalizedDetailSummary.value
&& normalizedDetailSummary.value !== defaultDetail.summary
))
const isDetailSummaryLikelyComplete = computed(() => (
hasMeaningfulDetailSummary.value
&& normalizedDetailSummary.value.length >= 120
))
const hasDeferredDetailText = computed(() => (
exhibit.value.audio.hasText === true
&& !detailTextLoaded.value
&& !detailTextUnavailableMessage.value
&& hasTextLoadTarget.value
&& !isDetailSummaryLikelyComplete.value
))
const isTextLoadActionVisible = computed(() => hasDeferredDetailText.value)
const detailTextLoadActionText = computed(() => (
hasMeaningfulDetailSummary.value
? '查看完整讲解词'
: '加载讲解正文'
))
const detailBodyText = computed(() => (
detailTextLoaded.value
? exhibit.value.body || exhibit.value.summary
: hasDeferredDetailText.value && !hasMeaningfulDetailSummary.value
? '已找到当前语言讲解词,可加载查看完整正文。'
: exhibit.value.summary
))