windows/components/StreamerBadge.vue

343 lines
9.1 KiB
Vue

<template>
<div :class="['streamer-badge', badgeClass, sizeClass]" :title="badgeConfig.tooltip">
<span v-if="badgeConfig.icon" class="badge-icon">{{ badgeConfig.icon }}</span>
<span v-if="badgeConfig.text" class="badge-text">{{ badgeConfig.text }}</span>
</div>
</template>
<script setup lang="ts">
import { computed } from 'vue';
interface Props {
code: string;
size?: 'small' | 'medium' | 'large';
}
const props = defineProps<Props>();
const badgeConfigs: { [key: string]: { text: string; icon?: string; class: string; tooltip: string; } } = {
// 等級徽章
'rank-diamond': { text: '鑽石', icon: '💎', class: 'badge-rank-diamond', tooltip: '鑽石級玩家' },
'rank-gold': { text: '黃金', icon: '🏆', class: 'badge-rank-gold', tooltip: '黃金級玩家' },
'rank-silver': { text: '白銀', icon: '🥈', class: 'badge-rank-silver', tooltip: '白銀級玩家' },
'rank-bronze': { text: '青銅', icon: '🥉', class: 'badge-rank-bronze', tooltip: '青銅級玩家' },
'rank-master': { text: '大師', icon: '🎖️', class: 'badge-rank-master', tooltip: '大師級玩家' },
// 專業徽章
'pro-gaming': { text: '電競', icon: '🎮', class: 'badge-pro-gaming', tooltip: '專業電競陪玩' },
'pro-music': { text: '音樂', icon: '🎵', class: 'badge-pro-music', tooltip: '音樂專家' },
'pro-anime': { text: '二次元', icon: '🌸', class: 'badge-pro-anime', tooltip: '二次元專家' },
'pro-party': { text: '派對', icon: '🎉', class: 'badge-pro-party', tooltip: '派對達人' },
'pro-strategy': { text: '策略', icon: '♟️', class: 'badge-pro-strategy', tooltip: '策略大師' },
'pro-survival': { text: '生存', icon: '🏹', class: 'badge-pro-survival', tooltip: '生存專家' },
// 特色徽章
'feature-live': { text: '直播中', icon: '🔴', class: 'badge-feature-live', tooltip: '正在直播' },
'feature-verified': { text: '認證', icon: '✅', class: 'badge-feature-verified', tooltip: '認證主播' },
'feature-new': { text: '新人', icon: '⭐', class: 'badge-feature-new', tooltip: '新進主播' },
'feature-popular': { text: '熱門', icon: '🔥', class: 'badge-feature-popular', tooltip: '熱門主播' },
'feature-vip': { text: 'VIP', icon: '👑', class: 'badge-feature-vip', tooltip: 'VIP主播' },
// 特殊徽章
'special-anime': { text: '動漫', icon: '🎌', class: 'badge-special-anime', tooltip: '動漫專家' },
'special-party': { text: '派對', icon: '🎊', class: 'badge-special-party', tooltip: '派對女王' },
'special-survival': { text: '生存', icon: '🛡️', class: 'badge-special-survival', tooltip: '生存專家' },
// 成就徽章
'achievement-expert': { text: '專家', icon: '🎯', class: 'badge-achievement-expert', tooltip: '領域專家' },
'achievement-mentor': { text: '導師', icon: '👨‍🏫', class: 'badge-achievement-mentor', tooltip: '新手導師' }
};
const badgeConfig = computed(() => badgeConfigs[props.code] || { text: props.code, class: 'badge-default', tooltip: props.code });
const badgeClass = computed(() => badgeConfig.value.class);
const sizeClass = computed(() => `badge-size-${props.size || 'medium'}`);
</script>
<style scoped>
.streamer-badge {
display: inline-flex;
align-items: center;
gap: 4px;
padding: 4px 8px;
border-radius: 12px;
font-size: 10px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.5px;
backdrop-filter: blur(8px);
border: 1px solid rgba(255, 255, 255, 0.2);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
transition: all 0.3s ease;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 80px;
}
.streamer-badge:hover {
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.badge-icon {
font-size: 10px;
line-height: 1;
}
.badge-text {
font-size: 9px;
line-height: 1;
font-weight: 700;
}
/* 尺寸變體 */
.badge-size-small {
padding: 2px 6px;
font-size: 8px;
border-radius: 8px;
max-width: 60px;
}
.badge-size-small .badge-icon {
font-size: 8px;
}
.badge-size-small .badge-text {
font-size: 7px;
}
.badge-size-medium {
padding: 4px 8px;
font-size: 10px;
border-radius: 12px;
max-width: 80px;
}
.badge-size-large {
padding: 6px 12px;
font-size: 12px;
border-radius: 16px;
max-width: 100px;
}
.badge-size-large .badge-icon {
font-size: 12px;
}
.badge-size-large .badge-text {
font-size: 11px;
}
/* 等級徽章 */
.badge-rank-diamond {
background: linear-gradient(135deg, #b9f2ff 0%, #00d4ff 100%);
color: #0066cc;
border-color: rgba(0, 102, 204, 0.3);
}
.badge-rank-gold {
background: linear-gradient(135deg, #ffd700 0%, #ffb347 100%);
color: #b8860b;
border-color: rgba(184, 134, 11, 0.3);
}
.badge-rank-silver {
background: linear-gradient(135deg, #c0c0c0 0%, #a8a8a8 100%);
color: #696969;
border-color: rgba(105, 105, 105, 0.3);
}
.badge-rank-bronze {
background: linear-gradient(135deg, #cd7f32 0%, #b87333 100%);
color: #8b4513;
border-color: rgba(139, 69, 19, 0.3);
}
.badge-rank-master {
background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
color: #8b4513;
border-color: rgba(139, 69, 19, 0.3);
animation: shimmer 3s ease-in-out infinite;
}
/* 專業徽章 */
.badge-pro-gaming {
background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
color: white;
border-color: rgba(255, 255, 255, 0.3);
}
.badge-pro-music {
background: linear-gradient(135deg, #a8e6cf 0%, #7fcdcd 100%);
color: #2c5530;
border-color: rgba(44, 85, 48, 0.3);
}
.badge-pro-anime {
background: linear-gradient(135deg, #ffb3ba 0%, #ffdfba 100%);
color: #d63384;
border-color: rgba(214, 51, 132, 0.3);
}
.badge-pro-party {
background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
color: #e91e63;
border-color: rgba(233, 30, 99, 0.3);
}
.badge-pro-strategy {
background: linear-gradient(135deg, #a8c8ec 0%, #5d9cec 100%);
color: #2c3e50;
border-color: rgba(44, 62, 80, 0.3);
}
.badge-pro-survival {
background: linear-gradient(135deg, #d4a574 0%, #8b7355 100%);
color: white;
border-color: rgba(255, 255, 255, 0.3);
}
/* 特殊徽章 */
.badge-special-anime {
background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
color: #e91e63;
border-color: rgba(233, 30, 99, 0.3);
}
.badge-special-party {
background: linear-gradient(135deg, #ff6b9d 0%, #c44569 100%);
color: white;
border-color: rgba(255, 255, 255, 0.3);
animation: pulse 2s infinite;
}
.badge-special-survival {
background: linear-gradient(135deg, #8b7355 0%, #6b5b73 100%);
color: white;
border-color: rgba(255, 255, 255, 0.3);
}
/* 特色徽章 */
.badge-feature-live {
background: linear-gradient(135deg, #ff4757 0%, #c44569 100%);
color: white;
border-color: rgba(255, 255, 255, 0.3);
animation: pulse 2s infinite;
}
.badge-feature-verified {
background: linear-gradient(135deg, #2ed573 0%, #1e90ff 100%);
color: white;
border-color: rgba(255, 255, 255, 0.3);
}
.badge-feature-new {
background: linear-gradient(135deg, #ffa502 0%, #ff6348 100%);
color: white;
border-color: rgba(255, 255, 255, 0.3);
}
.badge-feature-popular {
background: linear-gradient(135deg, #ff3838 0%, #ff6b35 100%);
color: white;
border-color: rgba(255, 255, 255, 0.3);
animation: glow 2s ease-in-out infinite alternate;
}
.badge-feature-vip {
background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
color: #8b4513;
border-color: rgba(139, 69, 19, 0.3);
animation: shimmer 3s ease-in-out infinite;
}
/* 成就徽章 */
.badge-achievement-expert {
background: linear-gradient(135deg, #2ed573 0%, #1e90ff 100%);
color: white;
border-color: rgba(255, 255, 255, 0.3);
animation: glow 2s ease-in-out infinite alternate;
}
.badge-achievement-mentor {
background: linear-gradient(135deg, #ffa502 0%, #ff6348 100%);
color: white;
border-color: rgba(255, 255, 255, 0.3);
}
/* 預設徽章 */
.badge-default {
background: linear-gradient(135deg, #ddd 0%, #bbb 100%);
color: #666;
border-color: rgba(102, 102, 102, 0.3);
}
/* 動畫效果 */
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.7; }
}
@keyframes glow {
from { box-shadow: 0 2px 8px rgba(255, 56, 56, 0.3); }
to { box-shadow: 0 4px 16px rgba(255, 56, 56, 0.6); }
}
@keyframes shimmer {
0% { background-position: -200% 0; }
100% { background-position: 200% 0; }
}
.badge-feature-vip {
background-size: 200% 100%;
animation: shimmer 3s ease-in-out infinite;
}
/* 響應式設計 */
@media (max-width: 768px) {
.streamer-badge {
padding: 3px 6px;
font-size: 9px;
border-radius: 10px;
max-width: 70px;
}
.badge-size-small {
padding: 2px 4px;
font-size: 7px;
border-radius: 6px;
max-width: 50px;
}
.badge-size-large {
padding: 4px 8px;
font-size: 10px;
border-radius: 12px;
max-width: 80px;
}
}
@media (max-width: 480px) {
.streamer-badge {
padding: 2px 5px;
font-size: 8px;
border-radius: 8px;
max-width: 60px;
}
.badge-size-small {
padding: 1px 3px;
font-size: 6px;
border-radius: 4px;
max-width: 40px;
}
.badge-size-large {
padding: 3px 6px;
font-size: 9px;
border-radius: 10px;
max-width: 70px;
}
}
</style>