refactor: 国际化文本迁移至全局 locales/messages.js
将组件级 i18n 对象重构为统一由全局 locales/messages.js 管理,确保中英文语言切换时正确显示对应文本。 - 新增 utils/i18n.js 国际化工具函数 - 更新 store/$t.mixin.js 翻译混入逻辑 - 迁移 pkgService、pkgBooking、pkgAccount、pkgExplore、pages 等共 58 个组件的中英文文本至全局消息表
This commit is contained in:
@@ -12,23 +12,23 @@
|
||||
|
||||
<view class="vr-stage">
|
||||
<image v-if="poster" :src="poster" mode="aspectFill" class="vr-poster"></image>
|
||||
<view v-else class="vr-empty tn-flex tn-flex-col-center tn-flex-row-center">{{ t('emptyPreview') }}</view>
|
||||
<view v-else class="vr-empty tn-flex tn-flex-col-center tn-flex-row-center">{{ $tr('暂无VR预览画面') }}</view>
|
||||
<view class="vr-mask"></view>
|
||||
|
||||
<view class="vr-mode-chip">{{ t('modeChip') }}</view>
|
||||
<view class="vr-mode-chip">{{ $tr('VR预览模式') }}</view>
|
||||
|
||||
<view class="vr-center-indicator" @click="openPosterPreview">
|
||||
<view class="indicator-ring"></view>
|
||||
<view class="indicator-core">
|
||||
<text class="tn-icon-vr indicator-icon"></text>
|
||||
</view>
|
||||
<text class="indicator-text">{{ poster ? t('viewFullscreen') : t('waitingAsset') }}</text>
|
||||
<text class="indicator-text">{{ poster ? $tr('查看全屏预览') : $tr('等待素材接入') }}</text>
|
||||
</view>
|
||||
|
||||
<view class="vr-bottom-bar tn-safe-area-inset-bottom">
|
||||
<view class="vr-title-area">
|
||||
<view class="vr-title">{{ resolvedPageTitle }}</view>
|
||||
<view class="vr-subtitle">{{ poster ? t('posterSubtitle') : t('placeholderSubtitle') }}</view>
|
||||
<view class="vr-subtitle">{{ poster ? $tr('当前展示 VR 预览海报,可点击查看大图。') : $tr('当前房型已保留 VR 入口,后续可继续接入更完整的沉浸式资源。') }}</view>
|
||||
</view>
|
||||
|
||||
<view class="vr-action-circle" @click="openPosterPreview">
|
||||
@@ -41,28 +41,6 @@
|
||||
|
||||
<script>
|
||||
export default {
|
||||
i18n: {
|
||||
zh: {
|
||||
defaultTitle: 'VR看房',
|
||||
emptyPreview: '暂无VR预览画面',
|
||||
modeChip: 'VR预览模式',
|
||||
viewFullscreen: '查看全屏预览',
|
||||
waitingAsset: '等待素材接入',
|
||||
posterSubtitle: '当前展示 VR 预览海报,可点击查看大图。',
|
||||
placeholderSubtitle: '当前房型已保留 VR 入口,后续可继续接入更完整的沉浸式资源。',
|
||||
noAsset: '暂无VR预览素材'
|
||||
},
|
||||
en: {
|
||||
defaultTitle: 'VR Viewing',
|
||||
emptyPreview: 'No VR preview available',
|
||||
modeChip: 'VR Preview',
|
||||
viewFullscreen: 'View Fullscreen',
|
||||
waitingAsset: 'Waiting for assets',
|
||||
posterSubtitle: 'The current VR preview poster is displayed. Tap to view the full image.',
|
||||
placeholderSubtitle: 'This room type keeps its VR entry reserved for richer immersive assets later.',
|
||||
noAsset: 'No VR preview asset available'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
pageTitleZh: '',
|
||||
@@ -74,9 +52,9 @@ export default {
|
||||
computed: {
|
||||
resolvedPageTitle() {
|
||||
if (this.$getLanguage() === 'en') {
|
||||
return this.pageTitleEn || this.pageTitleZh || this.rawPageTitle || this.t('defaultTitle')
|
||||
return this.pageTitleEn || this.pageTitleZh || this.rawPageTitle || this.$tr('VR看房')
|
||||
}
|
||||
return this.pageTitleZh || this.pageTitleEn || this.rawPageTitle || this.t('defaultTitle')
|
||||
return this.pageTitleZh || this.pageTitleEn || this.rawPageTitle || this.$tr('VR看房')
|
||||
},
|
||||
navBarBackStyle() {
|
||||
return {
|
||||
@@ -112,13 +90,10 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
t(key, params) {
|
||||
return this.$tm('pkgExplore.vr_preview.vr_preview', key, params)
|
||||
},
|
||||
openPosterPreview() {
|
||||
if (!this.poster) {
|
||||
uni.showToast({
|
||||
title: this.t('noAsset'),
|
||||
title: this.$tr('暂无VR预览素材'),
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user