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:
@@ -1,15 +1,15 @@
|
||||
<template>
|
||||
<view class="contract-detail-page tn-safe-area-inset-bottom">
|
||||
<tn-nav-bar :isBack="true" :bottomShadow="false" backgroundColor="transparent">
|
||||
<view class="tn-text-bold tn-text-xl tn-color-black">{{ t('navTitle') }}</view>
|
||||
<view class="tn-text-bold tn-text-xl tn-color-black">{{ $tr('合同详情') }}</view>
|
||||
</tn-nav-bar>
|
||||
|
||||
<view class="page-main" :style="{ paddingTop: vuex_custom_bar_height + 'px' }">
|
||||
<view class="overview-panel">
|
||||
<view class="overview-header">
|
||||
<view>
|
||||
<view class="overview-title">{{ t('overviewTitle') }}</view>
|
||||
<view class="overview-subtitle">{{ t('contractNoLabel') }}{{ contractNo || t('notAvailable') }}</view>
|
||||
<view class="overview-title">{{ $tr('合同影像') }}</view>
|
||||
<view class="overview-subtitle">{{ $tr('合同编号:') }}{{ contractNo || $tr('未获取') }}</view>
|
||||
</view>
|
||||
<view class="overview-badge">
|
||||
<text class="tn-icon-read"></text>
|
||||
@@ -19,26 +19,26 @@
|
||||
<view class="overview-tips">
|
||||
<view class="tip-chip">
|
||||
<text class="tn-icon-safe-fill"></text>
|
||||
<text>{{ t('signedChip') }}</text>
|
||||
<text>{{ $tr('已签合同') }}</text>
|
||||
</view>
|
||||
<view class="tip-chip">
|
||||
<text class="tn-icon-charts-ring"></text>
|
||||
<text>{{ t('zoomSupportedChip') }}</text>
|
||||
<text>{{ $tr('支持缩放') }}</text>
|
||||
</view>
|
||||
<view class="tip-chip" v-if="imageUrl">
|
||||
<text class="tn-icon-image-text-fill"></text>
|
||||
<text>{{ t('imageModeChip') }}</text>
|
||||
<text>{{ $tr('A4 影像模式') }}</text>
|
||||
</view>
|
||||
<view class="tip-chip" v-else-if="contractContent">
|
||||
<text class="tn-icon-text-new"></text>
|
||||
<text>{{ t('textModeChip') }}</text>
|
||||
<text>{{ $tr('正文预览模式') }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="loading" class="empty-panel">
|
||||
<view class="empty-title">{{ t('loadingTitle') }}</view>
|
||||
<view class="empty-desc">{{ t('loadingDesc') }}</view>
|
||||
<view class="empty-title">{{ $tr('合同加载中') }}</view>
|
||||
<view class="empty-desc">{{ $tr('正在获取合同影像与正文,请稍候。') }}</view>
|
||||
</view>
|
||||
|
||||
<view v-else-if="imageUrl || contractContent" class="preview-panel">
|
||||
@@ -72,8 +72,8 @@
|
||||
<view class="empty-icon">
|
||||
<text class="tn-icon-folder"></text>
|
||||
</view>
|
||||
<view class="empty-title">{{ t('emptyTitle') }}</view>
|
||||
<view class="empty-desc">{{ t('emptyDesc') }}</view>
|
||||
<view class="empty-title">{{ $tr('暂无合同内容') }}</view>
|
||||
<view class="empty-desc">{{ $tr('页面未带入影像地址,且通过合同编号也未获取到可预览的合同内容。') }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -100,36 +100,6 @@ function normalizeRichTextContent(content = '') {
|
||||
}
|
||||
|
||||
export default {
|
||||
i18n: {
|
||||
zh: {
|
||||
navTitle: '合同详情',
|
||||
overviewTitle: '合同影像',
|
||||
contractNoLabel: '合同编号:',
|
||||
notAvailable: '未获取',
|
||||
signedChip: '已签合同',
|
||||
zoomSupportedChip: '支持缩放',
|
||||
imageModeChip: 'A4 影像模式',
|
||||
textModeChip: '正文预览模式',
|
||||
loadingTitle: '合同加载中',
|
||||
loadingDesc: '正在获取合同影像与正文,请稍候。',
|
||||
emptyTitle: '暂无合同内容',
|
||||
emptyDesc: '页面未带入影像地址,且通过合同编号也未获取到可预览的合同内容。'
|
||||
},
|
||||
en: {
|
||||
navTitle: 'Contract Detail',
|
||||
overviewTitle: 'Contract Preview',
|
||||
contractNoLabel: 'Contract No.: ',
|
||||
notAvailable: 'N/A',
|
||||
signedChip: 'Signed Contract',
|
||||
zoomSupportedChip: 'Zoom Supported',
|
||||
imageModeChip: 'A4 Image Mode',
|
||||
textModeChip: 'Text Preview Mode',
|
||||
loadingTitle: 'Loading contract',
|
||||
loadingDesc: 'Fetching contract images and content. Please wait.',
|
||||
emptyTitle: 'No contract content',
|
||||
emptyDesc: 'No previewable contract content was provided by image URL or contract number.'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
contractNo: '',
|
||||
@@ -147,9 +117,6 @@ export default {
|
||||
this.fetchContractDetail()
|
||||
},
|
||||
methods: {
|
||||
t(key, params) {
|
||||
return this.$tm('pkgService.contract_detail.contract_detail', key, params)
|
||||
},
|
||||
fetchContractDetail() {
|
||||
if (!this.contractNo || (this.imageUrl && this.contractContent)) {
|
||||
return Promise.resolve()
|
||||
|
||||
Reference in New Issue
Block a user