feat(admin): 从已有玩家升级代理、修复 i18n 与过期 .js 冲突
- 新建一级代理改为选择已有玩家;新建用户可选一级代理 - 操作日志/注单等扁平 key 翻译;清理 src 内误生成 .js,Vite 优先解析 .ts Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
42
apps/admin/src/components/AdminLocaleFlag.vue
Normal file
42
apps/admin/src/components/AdminLocaleFlag.vue
Normal file
@@ -0,0 +1,42 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import type { AdminLocale } from '../i18n/admin-messages';
|
||||
|
||||
const LOCALE_COUNTRY: Record<AdminLocale, string> = {
|
||||
'zh-CN': 'cn',
|
||||
'en-US': 'us',
|
||||
'ms-MY': 'my',
|
||||
};
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{ locale: AdminLocale | string; size?: number }>(),
|
||||
{ size: 18 },
|
||||
);
|
||||
|
||||
const countryCode = computed(() => {
|
||||
const code = props.locale as AdminLocale;
|
||||
return LOCALE_COUNTRY[code] ?? 'us';
|
||||
});
|
||||
|
||||
const src = computed(() => `/flags/${countryCode.value}.svg`);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<img
|
||||
:src="src"
|
||||
:width="size"
|
||||
:height="Math.round(size * 0.67)"
|
||||
class="admin-locale-flag-img"
|
||||
:alt="countryCode"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.admin-locale-flag-img {
|
||||
display: block;
|
||||
flex-shrink: 0;
|
||||
border-radius: 2px;
|
||||
object-fit: cover;
|
||||
box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user