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

@@ -2,29 +2,32 @@
import { computed } from 'vue';
import { RouterView, RouterLink, useRoute, useRouter } from 'vue-router';
import { useAuthStore } from '../stores/auth';
import { useAdminLocale } from '../composables/useAdminLocale';
import AdminLocaleSwitcher from '../components/AdminLocaleSwitcher.vue';
const route = useRoute();
const router = useRouter();
const auth = useAuthStore();
const { t } = useAdminLocale();
const adminMenus = [
{ path: '/', label: '控制台' },
{ path: '/users', label: '玩家管理' },
{ path: '/agents', label: '代理管理' },
{ path: '/matches', label: '赛事管理' },
{ path: '/bets', label: '注单管理' },
{ path: '/cashback', label: '返水管理' },
{ path: '/audit', label: '操作日志' },
];
const adminMenus = computed(() => [
{ path: '/', label: t('nav.dashboard') },
{ path: '/users', label: t('nav.users') },
{ path: '/agents', label: t('nav.agents') },
{ path: '/matches', label: t('nav.matches') },
{ path: '/bets', label: t('nav.bets') },
{ path: '/cashback', label: t('nav.cashback') },
{ path: '/audit', label: t('nav.audit') },
]);
const agentMenus = [
{ path: '/', label: '概览' },
{ path: '/my-players', label: '直属玩家' },
{ path: '/sub-agents', label: '下级代理' },
{ path: '/my-bets', label: '注单查询' },
];
const agentMenus = computed(() => [
{ path: '/', label: t('nav.dashboard') },
{ path: '/my-players', label: t('nav.players') },
{ path: '/sub-agents', label: t('nav.subAgents') },
{ path: '/my-bets', label: t('nav.myBets') },
]);
const menus = computed(() => (auth.isAdmin.value ? adminMenus : agentMenus));
const menus = computed(() => (auth.isAdmin.value ? adminMenus.value : agentMenus.value));
const currentLabel = computed(() =>
menus.value.find(m => m.path === route.path)?.label ?? ''
@@ -72,11 +75,12 @@ function logout() {
<div class="avatar">{{ userInitial }}</div>
<div class="user-info">
<span class="user-name">{{ auth.user?.username }}</span>
<span class="user-role">{{ auth.isAdmin ? '系统管理员' : '代理账号' }}</span>
<span class="user-role">{{ auth.isAdmin ? t('role.admin') : t('role.agent') }}</span>
</div>
</div>
<div class="portal-tag">{{ auth.portalLabel }}</div>
<button class="btn-logout" @click="logout">退出</button>
<AdminLocaleSwitcher />
<div class="portal-tag">{{ auth.isAdmin ? t('portal.admin') : t('portal.agent') }}</div>
<button class="btn-logout" @click="logout">{{ t('logout') }}</button>
</div>
</header>
<main class="page-main">