优化多语言翻译

This commit is contained in:
2026-03-20 10:29:31 +08:00
parent b689a40595
commit 6ff65afcb5
19 changed files with 768 additions and 279 deletions

View File

@@ -1,32 +1,30 @@
<template>
<el-dialog
v-model="visible"
title="奖励对照表dice_reward权重配比"
:title="$t('page.weightEdit.title')"
width="900px"
align-center
:close-on-click-modal="false"
@close="handleClose"
>
<div class="global-tip">
编辑的是<strong>奖励对照表dice_reward / DiceReward 模型</strong
>的权重<strong>结束索引end_index</strong>区分
<strong>顺时针</strong><strong>逆时针</strong>两套权重抽奖时按当前方向取对应权重
{{ $t('page.weightEdit.globalTip') }}
</div>
<div v-loading="loading" class="dialog-body">
<el-tabs v-model="activeTier" type="card">
<el-tab-pane v-for="t in tierKeys" :key="t" :label="t" :name="t">
<div v-if="getTierItems(t).length === 0" class="empty-tip">该档位暂无配置数据</div>
<div v-if="getTierItems(t).length === 0" class="empty-tip">{{ $t('page.weightShared.emptyTier') }}</div>
<template v-else>
<div class="chart-wrap" v-if="t !== 'T4' && t !== 'T5'">
<div class="chart-row">
<ArtBarChart
x-axis-name="结束索引"
:x-axis-name="$t('page.weightShared.xAxisEndIndex')"
:x-axis-data="getTierChartLabels(t)"
:data="getTierChartData(t, 'clockwise')"
height="180px"
/>
<ArtBarChart
x-axis-name="结束索引"
:x-axis-name="$t('page.weightShared.xAxisEndIndex')"
:x-axis-data="getTierChartLabels(t)"
:data="getTierChartData(t, 'counterclockwise')"
height="180px"
@@ -34,42 +32,50 @@
</div>
</div>
<div class="weight-sum" v-if="t !== 'T4' && t !== 'T5'">
当前档位权重合计顺时针<strong>{{ getTierSum(t, 'clockwise') }}</strong>
逆时针<strong>{{ getTierSum(t, 'counterclockwise') }}</strong>
各条 1-10000和不限制
{{
$t('page.weightShared.sumLineDual', {
cw: getTierSum(t, 'clockwise'),
ccw: getTierSum(t, 'counterclockwise')
})
}}
</div>
<div class="weight-sum weight-sum-t4t5" v-else>T4T5 仅单一结果无需配置权重</div>
<div class="weight-sum weight-sum-t4t5" v-else>{{ $t('page.weightShared.t4t5NoteSingle') }}</div>
<el-table :data="getTierItems(t)" border size="small" class="weight-table">
<el-table-column
label="结束索引(id)"
:label="$t('page.weightShared.colEndIndexId')"
prop="id"
width="90"
align="center"
show-overflow-tooltip
/>
<el-table-column label="色子点数" prop="grid_number" width="80" align="center" />
<el-table-column
label="实际中奖金额"
:label="$t('page.weightShared.colDicePoints')"
prop="grid_number"
width="80"
align="center"
/>
<el-table-column
:label="$t('page.weightShared.colRealEv')"
prop="real_ev"
width="90"
align="center"
show-overflow-tooltip
/>
<el-table-column
label="显示文本"
:label="$t('page.weightShared.colUiText')"
prop="ui_text"
min-width="70"
align="center"
show-overflow-tooltip
/>
<el-table-column
label="备注"
:label="$t('page.weightShared.colRemark')"
prop="remark"
min-width="70"
align="center"
show-overflow-tooltip
/>
<el-table-column label="顺时针权重(direction=0)" min-width="160" align="center">
<el-table-column :label="$t('page.weightShared.colWeightCwDir')" min-width="160" align="center">
<template #default="{ row }">
<div class="weight-cell-vertical">
<div class="weight-slider-wrap">
@@ -146,7 +152,7 @@
</div>
</template>
</el-table-column>
<el-table-column label="逆时针权重(direction=1)" min-width="160" align="center">
<el-table-column :label="$t('page.weightShared.colWeightCcwDir')" min-width="160" align="center">
<template #default="{ row }">
<div class="weight-cell-vertical">
<div class="weight-slider-wrap">
@@ -232,8 +238,10 @@
</el-tabs>
</div>
<template #footer>
<el-button @click="handleClose">取消</el-button>
<el-button type="primary" :loading="submitting" @click="handleSubmit">提交</el-button>
<el-button @click="handleClose">{{ $t('page.weightShared.btnCancel') }}</el-button>
<el-button type="primary" :loading="submitting" @click="handleSubmit">{{
$t('page.weightShared.btnSubmit')
}}</el-button>
</template>
</el-dialog>
</template>
@@ -242,6 +250,9 @@
import api from '../../../api/reward/index'
import ArtBarChart from '@/components/core/charts/art-bar-chart/index.vue'
import { ElMessage } from 'element-plus'
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
const TIER_KEYS = ['T1', 'T2', 'T3', 'T4', 'T5'] as const
/** 供模板 v-for 使用 */
@@ -430,7 +441,7 @@
grouped.value = parsePayload(res)
})
.catch(() => {
ElMessage.error('获取权重数据失败')
ElMessage.error(t('page.weightShared.fetchFail'))
})
.finally(() => {
loading.value = false
@@ -456,19 +467,19 @@
function handleSubmit() {
const items = collectItems()
if (items.length === 0) {
ElMessage.info('没有可提交的配置')
ElMessage.info(t('page.weightShared.nothingToSubmit'))
return
}
submitting.value = true
api
.batchUpdateWeights(items)
.then(() => {
ElMessage.success('保存成功')
ElMessage.success(t('page.weightShared.saveSuccess'))
emit('success')
handleClose()
})
.catch((e: { message?: string }) => {
ElMessage.error(e?.message ?? '保存失败')
ElMessage.error(e?.message ?? t('page.weightShared.submitFail'))
})
.finally(() => {
submitting.value = false