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-sign-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-edit-write-fill"></text>
|
||||
@@ -18,13 +18,13 @@
|
||||
</view>
|
||||
<view class="overview-meta">
|
||||
<text class="tn-icon-safe-fill"></text>
|
||||
<text>{{ t('overviewMeta') }}</text>
|
||||
<text>{{ $tr('阅读合同正文后完成签名提交,签约结果会同步到我的合同。') }}</text>
|
||||
</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="contractContent" class="preview-panel">
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
<view class="preview-tip" @click="openFullscreenPreview">
|
||||
<text class="tn-icon-fullscreen"></text>
|
||||
<text>{{ t('fullscreenPreview') }}</text>
|
||||
<text>{{ $tr('点击全屏查看') }}</text>
|
||||
</view>
|
||||
|
||||
<view class="zoom-controls" @click.stop>
|
||||
@@ -56,17 +56,17 @@
|
||||
<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 v-if="contractContent" class="footer-bar">
|
||||
<view class="footer-tip">
|
||||
<text class="tn-icon-safe-fill"></text>
|
||||
<text>{{ t('footerTip') }}</text>
|
||||
<text>{{ $tr('签名前请确认您已完整阅读合同内容') }}</text>
|
||||
</view>
|
||||
<view class="action-btn" @click="openSignBoard">
|
||||
{{ isSubmitting ? t('submitting') : t('signAction') }}
|
||||
{{ isSubmitting ? $tr('提交中...') : $tr('我已阅读并同意,去签名') }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -83,9 +83,9 @@
|
||||
<view class="fullscreen-header">
|
||||
<view class="fullscreen-back" @click="closeFullscreenPreview">
|
||||
<text class="tn-icon-left"></text>
|
||||
<text>{{ t('back') }}</text>
|
||||
<text>{{ $tr('返回') }}</text>
|
||||
</view>
|
||||
<view class="fullscreen-title">{{ t('fullscreenTitle') }}</view>
|
||||
<view class="fullscreen-title">{{ $tr('合同全文') }}</view>
|
||||
<view class="fullscreen-placeholder"></view>
|
||||
</view>
|
||||
<scroll-view scroll-y scroll-x class="fullscreen-scroll" :enable-flex="true">
|
||||
@@ -138,54 +138,6 @@ function resolveUploadedFileUrl(uploadResult) {
|
||||
}
|
||||
|
||||
export default {
|
||||
i18n: {
|
||||
zh: {
|
||||
navTitle: '合同签约',
|
||||
overviewTitle: '签约前确认',
|
||||
contractNoLabel: '合同编号:',
|
||||
notAvailable: '未获取',
|
||||
overviewMeta: '阅读合同正文后完成签名提交,签约结果会同步到我的合同。',
|
||||
loadingTitle: '合同加载中',
|
||||
loadingDesc: '正在获取合同正文,请稍候。',
|
||||
fullscreenPreview: '点击全屏查看',
|
||||
emptyTitle: '暂无合同正文',
|
||||
emptyDesc: '当前合同暂未返回可签约正文,请稍后再试。',
|
||||
footerTip: '签名前请确认您已完整阅读合同内容',
|
||||
submitting: '提交中...',
|
||||
signAction: '我已阅读并同意,去签名',
|
||||
back: '返回',
|
||||
fullscreenTitle: '合同全文',
|
||||
signerMissing: '未获取到签名人姓名',
|
||||
contractNoMissing: '缺少合同编号',
|
||||
signingLoading: '签约提交中...',
|
||||
uploadFailed: '签名上传失败',
|
||||
signSuccess: '签约成功',
|
||||
signFailed: '签约失败'
|
||||
},
|
||||
en: {
|
||||
navTitle: 'Contract Signing',
|
||||
overviewTitle: 'Before Signing',
|
||||
contractNoLabel: 'Contract No.: ',
|
||||
notAvailable: 'N/A',
|
||||
overviewMeta: 'Read the contract content before submitting your signature. The result will sync to My Contracts.',
|
||||
loadingTitle: 'Loading contract',
|
||||
loadingDesc: 'Fetching contract content. Please wait.',
|
||||
fullscreenPreview: 'Open Fullscreen',
|
||||
emptyTitle: 'No contract content',
|
||||
emptyDesc: 'No signable contract content is available at the moment. Please try again later.',
|
||||
footerTip: 'Please confirm that you have fully read the contract before signing',
|
||||
submitting: 'Submitting...',
|
||||
signAction: 'I have read and agree. Sign now',
|
||||
back: 'Back',
|
||||
fullscreenTitle: 'Full Contract',
|
||||
signerMissing: 'Missing signer name',
|
||||
contractNoMissing: 'Missing contract number',
|
||||
signingLoading: 'Submitting contract...',
|
||||
uploadFailed: 'Failed to upload signature',
|
||||
signSuccess: 'Contract signed successfully',
|
||||
signFailed: 'Failed to sign contract'
|
||||
}
|
||||
},
|
||||
components: {
|
||||
ContractSignDialog
|
||||
},
|
||||
@@ -209,9 +161,6 @@ export default {
|
||||
this.fetchContractContent()
|
||||
},
|
||||
methods: {
|
||||
t(key, params) {
|
||||
return this.$tm('pkgService.contract_sign.contract_sign', key, params)
|
||||
},
|
||||
fetchContractContent() {
|
||||
if (!this.contractNo) {
|
||||
return Promise.resolve()
|
||||
@@ -238,14 +187,14 @@ export default {
|
||||
}
|
||||
if (!this.signerName) {
|
||||
uni.showToast({
|
||||
title: this.t('signerMissing'),
|
||||
title: this.$tr('未获取到签名人姓名'),
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
if (!this.contractNo) {
|
||||
uni.showToast({
|
||||
title: this.t('contractNoMissing'),
|
||||
title: this.$tr('缺少合同编号'),
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
@@ -307,7 +256,7 @@ export default {
|
||||
|
||||
this.isSubmitting = true
|
||||
uni.showLoading({
|
||||
title: this.t('signingLoading'),
|
||||
title: this.$tr('签约提交中...'),
|
||||
mask: true
|
||||
})
|
||||
|
||||
@@ -322,7 +271,7 @@ export default {
|
||||
.then((uploadResult) => {
|
||||
const signImageUrl = resolveUploadedFileUrl(uploadResult)
|
||||
if (!signImageUrl) {
|
||||
return Promise.reject(new Error((uploadResult && uploadResult.msg) || this.t('uploadFailed')))
|
||||
return Promise.reject(new Error((uploadResult && uploadResult.msg) || this.$tr('签名上传失败')))
|
||||
}
|
||||
|
||||
return contractSign({
|
||||
@@ -349,7 +298,7 @@ export default {
|
||||
.then(() => {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: this.t('signSuccess'),
|
||||
title: this.$tr('签约成功'),
|
||||
icon: 'success'
|
||||
})
|
||||
setTimeout(() => {
|
||||
@@ -362,7 +311,7 @@ export default {
|
||||
console.error('contract sign failed', error)
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: (error && (error.message || error.msg)) || this.t('signFailed'),
|
||||
title: (error && (error.message || error.msg)) || this.$tr('签约失败'),
|
||||
icon: 'none'
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user