feat:国际化多语言适配

This commit is contained in:
2025-10-29 15:48:40 +08:00
parent 985d739324
commit 3d67dc928d
41 changed files with 2636 additions and 2801 deletions
+20 -20
View File
@@ -8,7 +8,7 @@
<!-- 场地信息卡片 -->
<view class="info-card">
<!-- 场地名称 -->
<view class="position-name">{{ positionInfo.name || '加载中...' }}</view>
<view class="position-name">{{ positionInfo.name || $t('common.loading') }}</view>
<!-- 地址信息 -->
<view class="info-item" v-if="positionInfo.location">
@@ -19,30 +19,30 @@
<!-- 营业时间 -->
<view class="info-item" v-if="positionInfo.workTime && positionInfo.workTime !== '0'">
<image src="/static/device-time.png" class="item-icon" mode="aspectFit"></image>
<text class="item-text">营业时间{{ positionInfo.workTime }}</text>
<text class="item-text">{{ $t('location.businessHours') }}{{ positionInfo.workTime }}</text>
</view>
<!-- 计费信息 -->
<view class="info-item">
<image src="/static/device-price.png" class="item-icon" mode="aspectFit"></image>
<text class="item-text">计费{{ pricingText }}</text>
<text class="item-text">{{ $t('device.pricing') }}{{ pricingText }}</text>
</view>
<!-- 按钮组 -->
<view class="button-group">
<view style="display: flex;flex-direction: row;gap: 10rpx;">
<view class="status-btn" v-if="isRentable">可租借</view>
<view class="status-btn" v-if="isReturnable">可归还</view>
<view class="status-btn" v-if="isRentable">{{ $t('location.rent') }}</view>
<view class="status-btn" v-if="isReturnable">{{ $t('location.return') }}</view>
</view>
<view class="nav-btn" @click.stop="navigateToPosition">导航去这</view>
<view class="nav-btn" @click.stop="navigateToPosition">{{ $t('location.navigateHere') }}</view>
</view>
</view>
<!-- 底部操作按钮 -->
<view class="footer-actions">
<button class="action-btn btn-outline" @click="reportError">设备报错</button>
<button class="action-btn btn-primary" @click="scanCode">扫码使用</button>
<button class="action-btn btn-outline" @click="reportError">{{ $t('device.reportError') }}</button>
<button class="action-btn btn-primary" @click="scanCode">{{ $t('device.scanToUse') }}</button>
</view>
</view>
</template>
@@ -93,7 +93,7 @@
const loadPositionDetail = async () => {
try {
uni.showLoading({
title: '加载中...'
title: $t('common.loading')
})
const res = await uni.request({
@@ -111,10 +111,10 @@
if (position) {
positionInfo.value = position
} else {
uni.showToast({
title: '场地不存在',
icon: 'none'
})
uni.showToast({
title: this.$t('location.notExist'),
icon: 'none'
})
}
} else if (res.statusCode === 401 || res.data?.code === 401 || res.data?.code === 40101) {
uni.reLaunch({
@@ -124,7 +124,7 @@
} catch (e) {
console.error('加载场地详情失败:', e)
uni.showToast({
title: '加载失败',
title: $t('common.loadFailed'),
icon: 'none'
})
} finally {
@@ -135,7 +135,7 @@
const navigateToPosition = () => {
if (!positionInfo.value.latitude || !positionInfo.value.longitude) {
uni.showToast({
title: '该场地坐标信息异常',
title: $t('location.coordinateError'),
icon: 'none'
})
return
@@ -150,7 +150,7 @@
longitude < -180 || longitude > 180 ||
(latitude === 0 && longitude === 0)) {
uni.showToast({
title: '该场地坐标信息异常',
title: $t('location.coordinateError'),
icon: 'none'
})
return
@@ -185,10 +185,10 @@
},
fail: (err) => {
console.error('扫码失败:', err)
uni.showToast({
title: '扫码失败',
icon: 'none'
})
uni.showToast({
title: this.$t('home.scanFailed'),
icon: 'none'
})
}
})
}