- 将原移动端页面重命名为 Mobile*,新增 22 个 Desktop* 视图与 DesktopShell 布局体系 - 路由入口改为 Wrapper 视图,通过 useViewport(≥1024px)自动切换移动/桌面端 - 新增投注单面板、盘口弹层、联赛侧栏、数据表格等桌面组件及独立样式令牌 - 扩展 betSlip store、串关筛选、冠军盘、Toast/悬浮信箱等交互与三语 i18n - 公告/消息 Hub 拆分移动与桌面实现;API 投注/钱包/充值记录支持 pageSize 分页
147 lines
2.6 KiB
Vue
147 lines
2.6 KiB
Vue
<script setup lang="ts">
|
|
import { computed, ref, watch } from 'vue';
|
|
import { teamFlagUrl } from '../utils/teamFlag';
|
|
|
|
const props = withDefaults(
|
|
defineProps<{
|
|
teamCode?: string;
|
|
teamName?: string;
|
|
logoUrl?: string | null;
|
|
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
}>(),
|
|
{ size: 'md' },
|
|
);
|
|
|
|
function isCustomLogo(url?: string | null) {
|
|
const value = url?.trim();
|
|
return Boolean(value && !value.includes('flagcdn.com'));
|
|
}
|
|
|
|
const useCustomLogo = computed(() => isCustomLogo(props.logoUrl));
|
|
const src = computed(() =>
|
|
teamFlagUrl(props.teamCode, props.teamName, props.logoUrl),
|
|
);
|
|
const failed = ref(false);
|
|
|
|
function onError() {
|
|
failed.value = true;
|
|
}
|
|
|
|
watch(
|
|
() => [props.teamCode, props.teamName, props.logoUrl] as const,
|
|
() => {
|
|
failed.value = false;
|
|
},
|
|
);
|
|
</script>
|
|
|
|
<template>
|
|
<img
|
|
v-if="src && !failed"
|
|
:src="src"
|
|
alt=""
|
|
class="team-emblem"
|
|
:class="[`team-emblem--${size}`, { 'team-emblem--logo': useCustomLogo }]"
|
|
loading="lazy"
|
|
@error="onError"
|
|
/>
|
|
<span
|
|
v-else
|
|
class="team-emblem team-emblem--placeholder"
|
|
:class="`team-emblem--${size}`"
|
|
aria-hidden="true"
|
|
>⚽</span>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.team-emblem {
|
|
flex-shrink: 0;
|
|
display: block;
|
|
}
|
|
|
|
/* 队徽(非国旗):圆角 + 投影 */
|
|
.team-emblem--logo {
|
|
border-radius: 4px;
|
|
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
|
|
}
|
|
|
|
.team-emblem--sm {
|
|
width: 24px;
|
|
height: 24px;
|
|
}
|
|
|
|
.team-emblem--md {
|
|
width: 36px;
|
|
height: 36px;
|
|
}
|
|
|
|
.team-emblem--lg {
|
|
width: 52px;
|
|
height: 52px;
|
|
}
|
|
|
|
.team-emblem--xl {
|
|
width: 72px;
|
|
height: 72px;
|
|
}
|
|
|
|
/* 国旗:横向比例 + 铺满 */
|
|
.team-emblem:not(.team-emblem--logo) {
|
|
object-fit: cover;
|
|
border-radius: 3px;
|
|
background: transparent;
|
|
}
|
|
|
|
.team-emblem--sm:not(.team-emblem--logo) {
|
|
width: 28px;
|
|
height: 20px;
|
|
}
|
|
|
|
.team-emblem--md:not(.team-emblem--logo) {
|
|
width: 40px;
|
|
height: 28px;
|
|
}
|
|
|
|
.team-emblem--lg:not(.team-emblem--logo) {
|
|
width: 54px;
|
|
height: 36px;
|
|
}
|
|
|
|
.team-emblem--xl:not(.team-emblem--logo) {
|
|
width: 80px;
|
|
height: 54px;
|
|
}
|
|
|
|
/* 队徽:正方形容器 + 完整显示 */
|
|
.team-emblem--logo {
|
|
object-fit: contain;
|
|
background: transparent;
|
|
}
|
|
|
|
.team-emblem--placeholder {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
background: transparent;
|
|
color: var(--text-muted);
|
|
opacity: 0.55;
|
|
box-shadow: none;
|
|
}
|
|
|
|
.team-emblem--sm.team-emblem--placeholder {
|
|
font-size: 12px;
|
|
}
|
|
|
|
.team-emblem--md.team-emblem--placeholder {
|
|
font-size: 16px;
|
|
}
|
|
|
|
.team-emblem--lg.team-emblem--placeholder {
|
|
font-size: 22px;
|
|
}
|
|
|
|
.team-emblem--xl.team-emblem--placeholder {
|
|
font-size: 30px;
|
|
}
|
|
</style>
|