feat(i18n): 管理端与玩家端三语支持(中/英/马来语)

- 管理后台 adminT 文案库、结算与代理端页面、表单校验
- 玩家端 vue-i18n 补全首页/公告/串关与 ms 文案
- Element Plus ms 语言包与共享 locale 工具
This commit is contained in:
2026-06-03 15:05:36 +08:00
parent 80adc0e928
commit cbfa18d1d3
63 changed files with 3081 additions and 1038 deletions

View File

@@ -1,9 +1,12 @@
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { useAdminLocale } from '../../composables/useAdminLocale';
import api from '../../api';
import { ElMessage } from 'element-plus';
import { formatAmount, formatAmountFull } from '../../utils/format-amount';
const { t } = useAdminLocale();
const agents = ref<unknown[]>([]);
const form = ref({ username: '', password: 'Agent@123', creditLimit: 10000 });
@@ -16,57 +19,57 @@ async function load() {
async function create() {
await api.post('/agent/agents', form.value);
ElMessage.success('下级代理已创建');
ElMessage.success(t('msg.agent_sub_created'));
load();
}
</script>
<template>
<div class="admin-list-page">
<div class="page-header">
<h2 class="page-title">下级代理</h2>
<span class="page-desc">仅一级代理可见</span>
</div>
<el-card class="tool-card" shadow="never">
<el-form inline>
<el-form-item label="用户名">
<el-input v-model="form.username" placeholder="代理用户名" style="width: 150px" />
</el-form-item>
<el-form-item label="授信额度">
<el-input-number v-model="form.creditLimit" :min="0" :step="1000" style="width: 150px" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="create">+ 创建二级代理</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card class="data-card" shadow="never">
<div class="table-wrap">
<el-table :data="agents" stripe>
<el-table-column label="用户名" min-width="140">
<template #default="{ row }">
{{ (row as { user?: { username: string } }).user?.username }}
</template>
</el-table-column>
<el-table-column label="授信额度" min-width="100" align="right">
<template #default="{ row }">
<el-tooltip :content="formatAmountFull((row as { creditLimit: string }).creditLimit)" placement="top">
<span>{{ formatAmount((row as { creditLimit: string }).creditLimit) }}</span>
</el-tooltip>
</template>
</el-table-column>
<el-table-column label="已用额度" min-width="100" align="right">
<template #default="{ row }">
<el-tooltip :content="formatAmountFull((row as { usedCredit: string }).usedCredit)" placement="top">
<span>{{ formatAmount((row as { usedCredit: string }).usedCredit) }}</span>
</el-tooltip>
</template>
</el-table-column>
</el-table>
<div class="page-header">
<h2 class="page-title">{{ t('page.agent_sub.title') }}</h2>
<span class="page-desc">{{ t('page.agent_sub.desc') }}</span>
</div>
</el-card>
<el-card class="tool-card" shadow="never">
<el-form inline>
<el-form-item :label="t('user.col.username')">
<el-input v-model="form.username" :placeholder="t('agent_portal.agent_username_ph')" style="width: 150px" />
</el-form-item>
<el-form-item :label="t('agent.field.credit_limit')">
<el-input-number v-model="form.creditLimit" :min="0" :step="1000" style="width: 150px" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="create">{{ t('agent_portal.create_tier2_btn') }}</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card class="data-card" shadow="never">
<div class="table-wrap">
<el-table :data="agents" stripe>
<el-table-column :label="t('user.col.username')" min-width="140">
<template #default="{ row }">
{{ (row as { user?: { username: string } }).user?.username }}
</template>
</el-table-column>
<el-table-column :label="t('agent.field.credit_limit')" min-width="100" align="right">
<template #default="{ row }">
<el-tooltip :content="formatAmountFull((row as { creditLimit: string }).creditLimit)" placement="top">
<span>{{ formatAmount((row as { creditLimit: string }).creditLimit) }}</span>
</el-tooltip>
</template>
</el-table-column>
<el-table-column :label="t('agent.field.used_credit')" min-width="100" align="right">
<template #default="{ row }">
<el-tooltip :content="formatAmountFull((row as { usedCredit: string }).usedCredit)" placement="top">
<span>{{ formatAmount((row as { usedCredit: string }).usedCredit) }}</span>
</el-tooltip>
</template>
</el-table-column>
</el-table>
</div>
</el-card>
</div>
</template>