feat(player,admin): 钱包卡片与登录页 UI 优化

- 玩家端我的页:钱包背景图、银行卡式排版、自定义语言下拉与投注规则折叠

- 管理端登录:左右布局、金边半透明卡片、自定义语言选择

- 修复 API promotePlayerToTier1Agent 返回类型导致编译失败
This commit is contained in:
2026-06-03 16:59:53 +08:00
parent 95abbcb470
commit 9b63d67e7c
8 changed files with 546 additions and 141 deletions

View File

@@ -1,41 +1,177 @@
<script setup lang="ts">
import { ref, computed, onMounted, onUnmounted } from 'vue';
import { useAdminLocale, type AdminLocale } from '../composables/useAdminLocale';
import AdminLocaleFlag from './AdminLocaleFlag.vue';
withDefaults(
defineProps<{
/** gold与玩家端登录一致admin管理后台顶栏绿色主题 */
variant?: 'gold' | 'admin';
}>(),
{ variant: 'admin' },
);
const { locale, locales, setLocale, t } = useAdminLocale();
function onChange(e: Event) {
setLocale((e.target as HTMLSelectElement).value as AdminLocale);
const open = ref(false);
const root = ref<HTMLElement | null>(null);
const currentLabel = computed(
() => locales.find((l) => l.code === locale.value)?.label ?? locale.value,
);
function pick(code: AdminLocale) {
open.value = false;
setLocale(code);
}
function toggle() {
open.value = !open.value;
}
function onDocClick(e: MouseEvent) {
if (!root.value?.contains(e.target as Node)) open.value = false;
}
onMounted(() => document.addEventListener('click', onDocClick));
onUnmounted(() => document.removeEventListener('click', onDocClick));
</script>
<template>
<label class="admin-locale" :title="t('lang')">
<AdminLocaleFlag :locale="locale" :size="20" />
<select :value="locale" class="admin-locale-select" :aria-label="t('lang')" @change="onChange">
<option v-for="l in locales" :key="l.code" :value="l.code">
{{ l.label }}
</option>
</select>
</label>
<div ref="root" class="admin-locale" :class="[variant, { open }]">
<button
type="button"
class="admin-locale-trigger"
:aria-expanded="open"
aria-haspopup="listbox"
:title="t('lang')"
@click.stop="toggle"
>
<AdminLocaleFlag :locale="locale" :size="20" />
<span class="admin-locale-label">{{ currentLabel }}</span>
<span class="locale-chevron" aria-hidden="true"></span>
</button>
<ul v-show="open" class="admin-locale-menu" role="listbox" :aria-label="t('lang')">
<li
v-for="l in locales"
:key="l.code"
role="option"
:aria-selected="locale === l.code"
class="admin-locale-option"
:class="{ active: locale === l.code }"
@click="pick(l.code)"
>
<AdminLocaleFlag :locale="l.code" :size="18" />
<span>{{ l.label }}</span>
</li>
</ul>
</div>
</template>
<style scoped>
.admin-locale {
position: relative;
display: inline-flex;
}
.admin-locale-trigger {
display: inline-flex;
align-items: center;
gap: 8px;
}
.admin-locale-select {
background: #0d0d0d;
color: var(--green-text);
border: 1px solid var(--green-border);
min-width: 120px;
padding: 5px 10px 5px 8px;
border-radius: 6px;
padding: 5px 24px 5px 8px;
font-size: 12px;
font-weight: 600;
min-width: 120px;
font-family: inherit;
cursor: pointer;
line-height: 1.2;
}
.admin-locale-label {
flex: 1;
text-align: left;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.locale-chevron {
font-size: 10px;
opacity: 0.7;
transition: transform 0.15s ease;
}
.admin-locale.open .locale-chevron {
transform: rotate(180deg);
}
.admin-locale-menu {
position: absolute;
top: calc(100% + 4px);
right: 0;
z-index: 50;
min-width: 100%;
margin: 0;
padding: 4px;
list-style: none;
border-radius: 8px;
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
}
.admin-locale-option {
display: flex;
align-items: center;
gap: 8px;
padding: 8px 10px;
border-radius: 6px;
font-size: 12px;
font-weight: 600;
cursor: pointer;
white-space: nowrap;
}
/* 管理顶栏 */
.admin-locale.admin .admin-locale-trigger {
background: #0d0d0d;
color: var(--green-text);
border: 1px solid var(--green-border);
}
.admin-locale.admin .admin-locale-menu {
background: #0f1411;
border: 1px solid var(--green-border);
}
.admin-locale.admin .admin-locale-option {
color: #8ab89a;
}
.admin-locale.admin .admin-locale-option:hover,
.admin-locale.admin .admin-locale-option.active {
background: var(--green-surface);
color: var(--green-text);
}
/* 登录页:与玩家端金色主题一致 */
.admin-locale.gold .admin-locale-trigger {
background: #0d0d0d;
color: #f0d875;
border: 1px solid rgba(212, 175, 55, 0.28);
}
.admin-locale.gold .admin-locale-menu {
background: #141414;
border: 1px solid rgba(212, 175, 55, 0.28);
}
.admin-locale.gold .admin-locale-option {
color: #8e8e93;
}
.admin-locale.gold .admin-locale-option:hover,
.admin-locale.gold .admin-locale-option.active {
background: rgba(212, 175, 55, 0.1);
color: #f0d875;
}
</style>