feat: redesign Big Screen voting view with philatelic postcard UI
- Add PostcardItem.vue component with Chinese postal aesthetics - Add PostcardGrid.vue container with 4x2 CSS Grid layout - Add Postmark.vue component for real-time vote stamp visualization - Update LiveVotingView.vue with cream paper theme (#FDFBF7) - Add Year of the Horse 2026 stamp image - Add responsive breakpoints for different screen sizes - Enhance admin service with program voting control - Add vote stamp accumulation for big screen display Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
466
packages/client-screen/src/components/PostcardDisplay.vue
Normal file
466
packages/client-screen/src/components/PostcardDisplay.vue
Normal file
@@ -0,0 +1,466 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import type { VotingProgram, VoteStamp } from '@gala/shared/types';
|
||||
import Postmark from './Postmark.vue';
|
||||
|
||||
// 票据类型名称映射
|
||||
const TICKET_TYPE_NAMES: Record<string, string> = {
|
||||
creative: '最佳创意',
|
||||
visual: '最佳视觉',
|
||||
atmosphere: '最佳氛围',
|
||||
performance: '最佳表演',
|
||||
teamwork: '最佳团队',
|
||||
popularity: '最受欢迎',
|
||||
potential: '最具潜力',
|
||||
};
|
||||
|
||||
interface Props {
|
||||
program: VotingProgram;
|
||||
isFocused: boolean;
|
||||
showStamps?: boolean;
|
||||
compact?: boolean; // 紧凑模式用于网格布局
|
||||
rotateX?: number; // 3D 旋转 X
|
||||
rotateY?: number; // 3D 旋转 Y
|
||||
rotateZ?: number; // 3D 旋转 Z
|
||||
z?: number; // 3D 位移 Z
|
||||
index?: number; // 传入索引用于生成邮编
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
showStamps: true,
|
||||
compact: false,
|
||||
rotateX: 0,
|
||||
rotateY: 0,
|
||||
rotateZ: 0,
|
||||
z: 0,
|
||||
index: 0,
|
||||
});
|
||||
|
||||
// 计算邮政编码 (模拟 202601, 202602...)
|
||||
const postcodeDigits = computed(() => {
|
||||
const code = (202601 + props.index).toString();
|
||||
return code.split('');
|
||||
});
|
||||
|
||||
// 在紧凑模式下不进行缩放和模糊
|
||||
const scale = computed(() => props.compact ? 1 : (props.isFocused ? 1 : 0.65));
|
||||
const blur = computed(() => props.compact ? 0 : (props.isFocused ? 0 : 4));
|
||||
const opacity = computed(() => props.compact ? 1 : (props.isFocused ? 1 : 0.6));
|
||||
|
||||
// 3D 变换样式
|
||||
const transformStyle = computed(() => {
|
||||
if (props.compact) {
|
||||
return `rotateX(${props.rotateX}deg) rotateY(${props.rotateY}deg) rotateZ(${props.rotateZ}deg) translateZ(${props.z}px)`;
|
||||
}
|
||||
return `scale(${scale.value})`;
|
||||
});
|
||||
|
||||
// 格式化印章位置样式
|
||||
function getStampStyle(stamp: VoteStamp) {
|
||||
return {
|
||||
left: `${stamp.x}%`,
|
||||
top: `${stamp.y}%`,
|
||||
transform: `translate(-50%, -50%) rotate(${stamp.rotation}deg)`,
|
||||
};
|
||||
}
|
||||
|
||||
// 根据 ticketType 获取颜色
|
||||
function getStampColor(ticketType: string): string {
|
||||
const colors: Record<string, string> = {
|
||||
'best_performance': '#e8313f',
|
||||
'best_creativity': '#f97316',
|
||||
'best_visual': '#10b981',
|
||||
'best_humor': '#eab308',
|
||||
'most_touching': '#ec4899',
|
||||
'best_teamwork': '#3b82f6',
|
||||
'audience_favorite': '#d4af37',
|
||||
};
|
||||
return colors[ticketType] || '#e8313f';
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
class="postcard-display"
|
||||
:class="{ 'is-focused': isFocused, 'is-blurred': !isFocused }"
|
||||
:style="{
|
||||
'--blur': `${blur}px`,
|
||||
'--opacity': opacity,
|
||||
'transform': transformStyle,
|
||||
}"
|
||||
>
|
||||
<!-- 明信片主体 -->
|
||||
<div class="postcard-body">
|
||||
<!-- 邮票 (右上角) -->
|
||||
<div class="postage-stamp">
|
||||
<img src="/Users/yuanjiantsui/.gemini/antigravity/brain/0695d84c-9b47-48d6-aefb-6d219a9324c4/year_of_horse_stamp_1768535779377.png" alt="Stamp" />
|
||||
</div>
|
||||
|
||||
<!-- 邮编框 (左上角) -->
|
||||
<div class="postcode-container">
|
||||
<div v-for="(digit, i) in postcodeDigits" :key="i" class="postcode-box">
|
||||
{{ digit }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 主内容区域 -->
|
||||
<div class="main-layout">
|
||||
<!-- 左侧:节目名与祝福语 -->
|
||||
<div class="left-section">
|
||||
<div class="program-name-container">
|
||||
<h2 class="program-title">{{ program.name }}</h2>
|
||||
</div>
|
||||
|
||||
<div class="blessings-outer">
|
||||
<div class="blessings-box">
|
||||
<span class="blessings-text handwritten">With all our passion 倾情呈现</span>
|
||||
</div>
|
||||
<span class="blessings-label">祝福语</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 右侧:地址栏 -->
|
||||
<div class="right-section address-layout">
|
||||
<div class="address-line">
|
||||
<span class="address-prefix">TO:</span>
|
||||
<span class="address-content handwritten">全体同事</span>
|
||||
<div class="line"></div>
|
||||
</div>
|
||||
<div class="address-line">
|
||||
<span class="address-prefix">FROM:</span>
|
||||
<span class="address-content handwritten">{{ program.teamName }}</span>
|
||||
<div class="line"></div>
|
||||
</div>
|
||||
<div class="address-line name-line">
|
||||
<span class="address-content handwritten">The Gala Family</span>
|
||||
<div class="line"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 印刷单位 (左下角) -->
|
||||
<div class="manufacturer-mark">
|
||||
四川省邮电印制有限责任公司
|
||||
</div>
|
||||
|
||||
<!-- 票数统计 (可选,作为年会互动元素保留) -->
|
||||
<div class="vote-tag">
|
||||
<span class="vote-number">{{ program.votes }}</span>
|
||||
<span class="vote-unit">票</span>
|
||||
</div>
|
||||
|
||||
<!-- 盖章区域 (置于最顶层以修复 Bug) -->
|
||||
<div v-if="showStamps" class="stamps-overlay">
|
||||
<div
|
||||
v-for="stamp in program.stamps.slice(-20)"
|
||||
:key="stamp.id"
|
||||
class="stamp-mark"
|
||||
:style="getStampStyle(stamp)"
|
||||
>
|
||||
<Postmark
|
||||
:award-name="TICKET_TYPE_NAMES[stamp.ticketType] || stamp.ticketType"
|
||||
:user-name="stamp.userName"
|
||||
color="red"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 聚焦时的发光边框 -->
|
||||
<div v-if="isFocused" class="focus-glow"></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@use 'sass:color';
|
||||
|
||||
// 核心变量
|
||||
$paper-cream: #f9f6ef;
|
||||
$ink-blue: #1b3a7a;
|
||||
$ink-charcoal: #2c3e50;
|
||||
$stamp-red: #c0392b;
|
||||
$color-gold: #d4af37;
|
||||
|
||||
.postcard-display {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
max-width: 600px;
|
||||
max-height: 380px;
|
||||
position: relative;
|
||||
transition: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
|
||||
filter: blur(var(--blur));
|
||||
opacity: var(--opacity);
|
||||
transform-style: preserve-3d;
|
||||
|
||||
&.is-focused {
|
||||
z-index: 10;
|
||||
}
|
||||
}
|
||||
|
||||
.postcard-body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
background: $paper-cream;
|
||||
border-radius: 4px;
|
||||
box-shadow:
|
||||
0 10px 30px rgba(0, 0, 0, 0.2),
|
||||
0 1px 2px rgba(0,0,0,0.1);
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 40px;
|
||||
box-sizing: border-box;
|
||||
|
||||
// 更加真实的纸张纹理
|
||||
background-image:
|
||||
linear-gradient(rgba(255,255,255,0.5), rgba(255,255,255,0.5)),
|
||||
url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.08'/%3E%3C/svg%3E");
|
||||
}
|
||||
|
||||
// 邮编框
|
||||
.postcode-container {
|
||||
position: absolute;
|
||||
top: 25px;
|
||||
left: 25px;
|
||||
display: flex;
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
.postcode-box {
|
||||
width: 28px;
|
||||
height: 36px;
|
||||
border: 1px solid $stamp-red;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
color: $stamp-red;
|
||||
font-family: 'Courier New', Courier, monospace;
|
||||
}
|
||||
|
||||
// 邮票
|
||||
.postage-stamp {
|
||||
position: absolute;
|
||||
top: 15px;
|
||||
right: 15px;
|
||||
width: 85px;
|
||||
height: 100px;
|
||||
z-index: 5; // 普通层级
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: contain;
|
||||
filter: drop-shadow(2px 2px 5px rgba(0,0,0,0.2));
|
||||
}
|
||||
}
|
||||
|
||||
// 主布局
|
||||
.main-layout {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
margin-top: 40px;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.left-section {
|
||||
flex: 1.2;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
||||
.program-name-container {
|
||||
margin-bottom: 30px;
|
||||
border-bottom: 1px solid rgba(0,0,0,0.05);
|
||||
}
|
||||
|
||||
.program-title {
|
||||
font-size: 38px;
|
||||
margin: 0;
|
||||
color: $ink-charcoal;
|
||||
font-family: 'Noto Serif SC', serif;
|
||||
font-weight: 900;
|
||||
letter-spacing: 2px;
|
||||
}
|
||||
|
||||
.blessings-outer {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
max-width: 260px;
|
||||
}
|
||||
|
||||
.blessings-box {
|
||||
border: 1px solid #999;
|
||||
height: 100px;
|
||||
width: 100%;
|
||||
padding: 15px;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.blessings-label {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
font-size: 24px;
|
||||
color: rgba(0,0,0,0.05);
|
||||
font-family: 'Noto Serif SC', serif;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.right-section {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
gap: 25px;
|
||||
padding-top: 20px;
|
||||
}
|
||||
|
||||
.address-line {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
gap: 10px;
|
||||
height: 40px;
|
||||
|
||||
.address-prefix {
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
color: #555;
|
||||
min-width: 50px;
|
||||
}
|
||||
|
||||
.address-content {
|
||||
font-size: 22px;
|
||||
color: $ink-blue;
|
||||
padding-bottom: 2px;
|
||||
}
|
||||
|
||||
.line {
|
||||
position: absolute;
|
||||
bottom: 5px;
|
||||
left: 55px;
|
||||
right: 0;
|
||||
height: 1px;
|
||||
background: #bbb;
|
||||
}
|
||||
|
||||
&.name-line {
|
||||
.address-content {
|
||||
padding-left: 55px;
|
||||
}
|
||||
.line {
|
||||
left: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 手写体
|
||||
.handwritten {
|
||||
font-family: 'Ma Shan Zheng', 'Kaiti', cursive;
|
||||
}
|
||||
|
||||
// 印刷厂标记
|
||||
.manufacturer-mark {
|
||||
position: absolute;
|
||||
bottom: 20px;
|
||||
left: 30px;
|
||||
font-size: 12px;
|
||||
color: #888;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
// 投票标签
|
||||
.vote-tag {
|
||||
position: absolute;
|
||||
bottom: 20px;
|
||||
right: 30px;
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 4px;
|
||||
background: rgba($color-gold, 0.1);
|
||||
padding: 5px 15px;
|
||||
border-radius: 20px;
|
||||
border: 1px solid rgba($color-gold, 0.3);
|
||||
|
||||
.vote-number {
|
||||
font-size: 28px;
|
||||
font-weight: 900;
|
||||
color: darken($color-gold, 15%);
|
||||
}
|
||||
|
||||
.vote-unit {
|
||||
font-size: 12px;
|
||||
color: $color-gold;
|
||||
}
|
||||
}
|
||||
|
||||
// 盖章区域 (置于最顶层)
|
||||
.stamps-overlay {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
pointer-events: none;
|
||||
z-index: 100; // 确保在邮票和所有其他内容上方
|
||||
}
|
||||
|
||||
.stamp-mark {
|
||||
position: absolute;
|
||||
animation: stamp-appear 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
|
||||
}
|
||||
|
||||
.stamp-circle {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border-radius: 50%;
|
||||
border: 3px solid var(--stamp-color);
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
mix-blend-mode: multiply;
|
||||
box-shadow: inset 0 0 10px var(--stamp-color);
|
||||
|
||||
.stamp-user {
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
color: var(--stamp-color);
|
||||
text-shadow: 0 0 1px white;
|
||||
}
|
||||
}
|
||||
|
||||
.focus-glow {
|
||||
position: absolute;
|
||||
inset: -4px;
|
||||
border: 3px solid $color-gold;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 0 40px rgba($color-gold, 0.6);
|
||||
pointer-events: none;
|
||||
animation: glow-pulse 2s ease-in-out infinite;
|
||||
z-index: 5;
|
||||
}
|
||||
|
||||
@keyframes stamp-appear {
|
||||
from {
|
||||
transform: translate(-50%, -50%) scale(2);
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
transform: translate(-50%, -50%) scale(1);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes glow-pulse {
|
||||
0%, 100% { opacity: 0.6; }
|
||||
50% { opacity: 1; }
|
||||
}
|
||||
</style>
|
||||
|
||||
154
packages/client-screen/src/components/PostcardGrid.vue
Normal file
154
packages/client-screen/src/components/PostcardGrid.vue
Normal file
@@ -0,0 +1,154 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, onMounted, onUnmounted } from 'vue';
|
||||
import PostcardItem from './PostcardItem.vue';
|
||||
import type { VotingProgram } from '@gala/shared/types';
|
||||
|
||||
interface Props {
|
||||
programs: VotingProgram[];
|
||||
columns?: number;
|
||||
rows?: number;
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
columns: 4,
|
||||
rows: 2,
|
||||
});
|
||||
|
||||
// Calculate visible programs based on grid size
|
||||
const maxVisible = computed(() => props.columns * props.rows);
|
||||
|
||||
const visiblePrograms = computed(() => {
|
||||
return props.programs.slice(0, maxVisible.value);
|
||||
});
|
||||
|
||||
// Refs for postcard items (for stamp animation targeting)
|
||||
const postcardRefs = ref<Map<string, InstanceType<typeof PostcardItem>>>(new Map());
|
||||
|
||||
function setPostcardRef(id: string, el: any) {
|
||||
if (el) {
|
||||
postcardRefs.value.set(id, el);
|
||||
} else {
|
||||
postcardRefs.value.delete(id);
|
||||
}
|
||||
}
|
||||
|
||||
// Get stamp target element for a specific program
|
||||
function getStampTarget(programId: string): HTMLElement | null {
|
||||
const postcard = postcardRefs.value.get(programId);
|
||||
return postcard?.stampTargetRef || null;
|
||||
}
|
||||
|
||||
// Expose for parent component (animation system)
|
||||
defineExpose({
|
||||
getStampTarget,
|
||||
postcardRefs,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
class="postcard-grid"
|
||||
:style="{
|
||||
'--columns': columns,
|
||||
'--rows': rows,
|
||||
}"
|
||||
>
|
||||
<PostcardItem
|
||||
v-for="program in visiblePrograms"
|
||||
:key="program.id"
|
||||
:ref="(el) => setPostcardRef(program.id, el)"
|
||||
:id="program.id"
|
||||
:name="program.name"
|
||||
:team-name="program.teamName"
|
||||
:order="program.order"
|
||||
:votes="program.votes"
|
||||
:stamps="program.stamps"
|
||||
class="grid-item"
|
||||
/>
|
||||
|
||||
<!-- Empty slots for incomplete grid -->
|
||||
<div
|
||||
v-for="n in Math.max(0, maxVisible - visiblePrograms.length)"
|
||||
:key="`empty-${n}`"
|
||||
class="grid-item empty-slot"
|
||||
>
|
||||
<div class="empty-placeholder">
|
||||
<span class="empty-icon">📮</span>
|
||||
<span class="empty-text">待添加节目</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.postcard-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(var(--columns, 4), 1fr);
|
||||
grid-template-rows: repeat(var(--rows, 2), 1fr);
|
||||
gap: 24px;
|
||||
padding: 32px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
background: #FDFBF7;
|
||||
|
||||
// Subtle paper texture for the entire grid background
|
||||
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
|
||||
background-blend-mode: overlay;
|
||||
|
||||
// Responsive breakpoints
|
||||
@media (max-width: 1200px) {
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 20px;
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
grid-template-rows: auto;
|
||||
gap: 16px;
|
||||
padding: 16px;
|
||||
overflow-y: auto;
|
||||
height: auto;
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
@media (max-width: 500px) {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 12px;
|
||||
padding: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
.grid-item {
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.empty-slot {
|
||||
background: rgba(0, 0, 0, 0.02);
|
||||
border: 2px dashed #ddd;
|
||||
border-radius: 4px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.empty-placeholder {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
color: #bbb;
|
||||
|
||||
.empty-icon {
|
||||
font-size: 32px;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
font-size: 14px;
|
||||
font-family: 'SimSun', 'Songti SC', serif;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
354
packages/client-screen/src/components/PostcardItem.vue
Normal file
354
packages/client-screen/src/components/PostcardItem.vue
Normal file
@@ -0,0 +1,354 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
import type { VoteStamp } from '@gala/shared/types';
|
||||
import stampImage from '../assets/images/stamp-horse-2026.png';
|
||||
import Postmark from './Postmark.vue';
|
||||
|
||||
// 票据类型名称映射
|
||||
const TICKET_TYPE_NAMES: Record<string, string> = {
|
||||
creative: '最佳创意',
|
||||
visual: '最佳视觉',
|
||||
atmosphere: '最佳氛围',
|
||||
performance: '最佳表演',
|
||||
teamwork: '最佳团队',
|
||||
popularity: '最受欢迎',
|
||||
potential: '最具潜力',
|
||||
};
|
||||
|
||||
interface Props {
|
||||
id: string;
|
||||
name: string;
|
||||
teamName: string;
|
||||
order: number;
|
||||
votes: number;
|
||||
stamps?: VoteStamp[];
|
||||
slogan?: string;
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
slogan: 'With all our passion',
|
||||
stamps: () => [],
|
||||
});
|
||||
|
||||
// Generate zip code display: 2|0|2|6|0|[order]
|
||||
const zipCodes = computed(() => {
|
||||
const orderStr = String(props.order).padStart(1, '0');
|
||||
return ['2', '0', '2', '6', '0', orderStr];
|
||||
});
|
||||
|
||||
// Limit displayed stamps to avoid overcrowding
|
||||
const displayedStamps = computed(() => {
|
||||
return props.stamps?.slice(-12) || []; // Show last 12 stamps max
|
||||
});
|
||||
|
||||
// Random position for new stamps (avoiding center content area)
|
||||
function getStampStyle(stamp: VoteStamp) {
|
||||
const isNew = Date.now() - stamp.timestamp < 1000;
|
||||
|
||||
// For fly-in animation
|
||||
const flyX = (Math.random() - 0.5) * 1000; // -500 to 500
|
||||
const flyY = (Math.random() - 0.5) * 1000;
|
||||
const flyRotate = (Math.random() - 0.5) * 180;
|
||||
|
||||
return {
|
||||
left: `${stamp.x}%`,
|
||||
top: `${stamp.y}%`,
|
||||
transform: isNew ? undefined : `translate(-50%, -50%) rotate(${stamp.rotation}deg)`,
|
||||
'--fly-x': `${flyX}px`,
|
||||
'--fly-y': `${flyY}px`,
|
||||
'--fly-rotate': `${flyRotate}deg`,
|
||||
};
|
||||
}
|
||||
|
||||
// Stamp target ref for particle animation
|
||||
const stampTargetRef = ref<HTMLElement | null>(null);
|
||||
|
||||
// Award name mapping for stamps
|
||||
const awardNames: Record<string, string> = {
|
||||
creative: '最佳创意奖',
|
||||
visual: '最佳视觉奖',
|
||||
atmosphere: '最佳气氛奖',
|
||||
performance: '最佳表演奖',
|
||||
teamwork: '最佳团队奖',
|
||||
popularity: '最受欢迎奖',
|
||||
potential: '最具潜力奖',
|
||||
};
|
||||
|
||||
function getAwardName(type: string) {
|
||||
return awardNames[type] || '优秀节目奖';
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
stampTargetRef,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="postcard">
|
||||
<!-- Accumulated Stamps Layer (on top) -->
|
||||
<div class="stamps-layer">
|
||||
<div
|
||||
v-for="stamp in displayedStamps"
|
||||
:key="stamp.id"
|
||||
class="postmark-wrapper"
|
||||
:class="{ 'is-new': Date.now() - stamp.timestamp < 1000 }"
|
||||
:style="getStampStyle(stamp)"
|
||||
>
|
||||
<Postmark
|
||||
:award-name="getAwardName(stamp.ticketType)"
|
||||
:user-name="stamp.userName"
|
||||
color="red"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Top Row: Zip codes left, Stamp right -->
|
||||
<div class="top-row">
|
||||
<div class="zip-codes">
|
||||
<div v-for="(code, idx) in zipCodes" :key="idx" class="zip-box">
|
||||
{{ code }}
|
||||
</div>
|
||||
</div>
|
||||
<div ref="stampTargetRef" class="stamp-box">
|
||||
<img :src="stampImage" alt="2026马年邮票" class="stamp-image" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Content Row: Left content, Right address -->
|
||||
<div class="content-row">
|
||||
<!-- Left Side: Title + Slogan -->
|
||||
<div class="content-left">
|
||||
<h2 class="program-name">{{ name }}</h2>
|
||||
<div class="slogan-box">
|
||||
<span class="slogan-text">{{ slogan }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Right Side: Address lines -->
|
||||
<div class="content-right">
|
||||
<div class="address-zone">
|
||||
<div class="address-line">
|
||||
<span class="label">寄:</span>
|
||||
<span class="value">{{ teamName }}</span>
|
||||
</div>
|
||||
<div class="address-line">
|
||||
<span class="label">收:</span>
|
||||
<span class="value">2026全体家人</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Footer -->
|
||||
<div class="footer-zone">
|
||||
<span class="vote-count">{{ votes }} 票</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// Postcard base - Chinese postcard style (wider)
|
||||
.postcard {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
aspect-ratio: 1.5 / 1;
|
||||
background: #FDFBF7;
|
||||
border: 1px solid #2c2c2c;
|
||||
box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.1);
|
||||
padding: 16px 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
|
||||
// Paper texture
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%' height='100%' filter='url(%23noise)'/%3E%3C/svg%3E");
|
||||
opacity: 0.03;
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
|
||||
// Stamps layer (accumulated postmarks)
|
||||
.stamps-layer {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
pointer-events: none;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.postmark-wrapper {
|
||||
position: absolute;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
|
||||
&.is-new {
|
||||
animation: stamp-fly-in 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes stamp-fly-in {
|
||||
0% {
|
||||
transform: translate(-50%, -50%) translate(var(--fly-x, -200px), var(--fly-y, -200px)) scale(3) rotate(var(--fly-rotate, -45deg));
|
||||
opacity: 0;
|
||||
}
|
||||
70% {
|
||||
transform: translate(-50%, -50%) scale(0.9);
|
||||
opacity: 1;
|
||||
}
|
||||
100% {
|
||||
transform: translate(-50%, -50%) scale(1);
|
||||
opacity: 0.9;
|
||||
}
|
||||
}
|
||||
|
||||
// Top Row: Zip codes + Stamp
|
||||
.top-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.zip-codes {
|
||||
display: flex;
|
||||
gap: 3px;
|
||||
}
|
||||
|
||||
.zip-box {
|
||||
width: 22px;
|
||||
height: 26px;
|
||||
border: 1.5px solid #c41e3a;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-family: 'Courier New', monospace;
|
||||
font-size: 13px;
|
||||
font-weight: bold;
|
||||
color: #2c2c2c;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.stamp-box {
|
||||
width: 90px;
|
||||
height: 90px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: transparent;
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.stamp-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
// Content Row
|
||||
.content-row {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
// Left Side: Title + Slogan
|
||||
.content-left {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-start;
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
||||
.program-name {
|
||||
font-family: 'SimSun', 'Songti SC', 'STSong', serif;
|
||||
font-size: 28px;
|
||||
font-weight: bold;
|
||||
color: #c41e3a;
|
||||
margin: 0 0 12px 0;
|
||||
letter-spacing: 6px;
|
||||
}
|
||||
|
||||
.slogan-box {
|
||||
display: inline-block;
|
||||
border: 1px solid #ccc;
|
||||
padding: 6px 14px;
|
||||
align-self: flex-start;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.slogan-text {
|
||||
font-family: 'Georgia', 'Times New Roman', serif;
|
||||
font-size: 12px;
|
||||
font-style: italic;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
// Right Side: Address
|
||||
.content-right {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-end;
|
||||
align-items: flex-start;
|
||||
min-width: 120px;
|
||||
}
|
||||
|
||||
.address-zone {
|
||||
text-align: left;
|
||||
border-top: 1px solid #999;
|
||||
padding-top: 8px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.address-line {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 6px;
|
||||
margin-bottom: 6px;
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.label {
|
||||
font-family: 'SimSun', 'Songti SC', serif;
|
||||
font-size: 11px;
|
||||
color: #666;
|
||||
min-width: 24px;
|
||||
}
|
||||
|
||||
.value {
|
||||
font-family: 'Kaiti', 'STKaiti', serif;
|
||||
font-size: 13px;
|
||||
color: #2c2c2c;
|
||||
}
|
||||
}
|
||||
|
||||
// Footer Zone
|
||||
.footer-zone {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
margin-top: auto;
|
||||
padding-top: 8px;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
|
||||
.vote-count {
|
||||
font-family: 'SimSun', 'Songti SC', serif;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
color: #c41e3a;
|
||||
padding: 4px 12px;
|
||||
background: rgba(196, 30, 58, 0.08);
|
||||
border: 1px solid rgba(196, 30, 58, 0.2);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
139
packages/client-screen/src/components/Postmark.vue
Normal file
139
packages/client-screen/src/components/Postmark.vue
Normal file
@@ -0,0 +1,139 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
|
||||
interface Props {
|
||||
awardName: string;
|
||||
awardIcon?: string;
|
||||
userName?: string;
|
||||
color?: 'red' | 'gold';
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
awardIcon: '🏅',
|
||||
userName: '',
|
||||
color: 'red',
|
||||
});
|
||||
|
||||
// Random imperfections for realism
|
||||
const rotation = ref(0);
|
||||
const inkOpacity = ref(0.9);
|
||||
|
||||
onMounted(() => {
|
||||
// Random rotation between -15 and +15 degrees
|
||||
rotation.value = (Math.random() - 0.5) * 30;
|
||||
// Random opacity between 0.85 and 0.95
|
||||
inkOpacity.value = 0.85 + Math.random() * 0.1;
|
||||
});
|
||||
|
||||
const inkColor = computed(() => {
|
||||
return props.color === 'gold' ? '#D4A84B' : '#C21F30';
|
||||
});
|
||||
|
||||
const currentDate = computed(() => {
|
||||
const now = new Date();
|
||||
return `${now.getFullYear()}.${String(now.getMonth() + 1).padStart(2, '0')}.${String(now.getDate()).padStart(2, '0')}`;
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
class="postmark"
|
||||
:class="[`postmark--${color}`]"
|
||||
:style="{
|
||||
transform: `rotate(${rotation}deg)`,
|
||||
opacity: inkOpacity,
|
||||
}"
|
||||
>
|
||||
<!-- Simplified SVG with award name on top and nickname on bottom -->
|
||||
<svg
|
||||
viewBox="0 0 100 100"
|
||||
class="postmark-svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<!-- Double Ring Design (Mobile characteristic) -->
|
||||
<circle cx="50" cy="50" r="48" fill="none" :stroke="inkColor" stroke-width="2" />
|
||||
<circle cx="50" cy="50" r="42" fill="none" :stroke="inkColor" stroke-width="1" />
|
||||
|
||||
<!-- Text paths consistent with Big Screen -->
|
||||
<defs>
|
||||
<path id="path-top" d="M 20,50 A 30,30 0 1,1 80,50" />
|
||||
<path id="path-bottom" d="M 80,50 A 30,30 0 0,1 20,50" />
|
||||
</defs>
|
||||
|
||||
<!-- Top Text: Award Name -->
|
||||
<text class="postmark-text top" :fill="inkColor">
|
||||
<textPath xlink:href="#path-top" startOffset="50%" text-anchor="middle">
|
||||
{{ awardName }}
|
||||
</textPath>
|
||||
</text>
|
||||
|
||||
<!-- Middle Text: Date -->
|
||||
<text x="50" y="50" class="postmark-text date" text-anchor="middle" dominant-baseline="central" :fill="inkColor">
|
||||
{{ currentDate }}
|
||||
</text>
|
||||
|
||||
<!-- Bottom Text: Nickname -->
|
||||
<text class="postmark-text bottom" :fill="inkColor">
|
||||
<textPath xlink:href="#path-bottom" startOffset="50%" text-anchor="middle">
|
||||
{{ userName || '访客' }}
|
||||
</textPath>
|
||||
</text>
|
||||
</svg>
|
||||
|
||||
<!-- Grunge Texture Overlay -->
|
||||
<div class="grunge-overlay"></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@use '../assets/styles/variables.scss' as *;
|
||||
|
||||
.postmark {
|
||||
position: relative;
|
||||
width: 70px;
|
||||
height: 70px;
|
||||
// Multiply blend mode for realism
|
||||
mix-blend-mode: multiply;
|
||||
animation: stamp-reveal 0.3s ease-out forwards;
|
||||
transform-origin: center center;
|
||||
}
|
||||
|
||||
.postmark-svg {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.postmark-text {
|
||||
font-family: 'Kaiti', 'STKaiti', serif;
|
||||
font-weight: bold;
|
||||
|
||||
&.top { font-size: 11px; }
|
||||
&.date { font-size: 10px; letter-spacing: 0.5px; }
|
||||
&.bottom { font-size: 10px; }
|
||||
}
|
||||
|
||||
.grunge-overlay {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.08'/%3E%3C/svg%3E");
|
||||
mix-blend-mode: overlay;
|
||||
pointer-events: none;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
@keyframes stamp-reveal {
|
||||
0% {
|
||||
opacity: 0;
|
||||
transform: scale(1.2) rotate(var(--rotation, 0deg));
|
||||
}
|
||||
50% {
|
||||
opacity: 1;
|
||||
transform: scale(0.95) rotate(var(--rotation, 0deg));
|
||||
}
|
||||
100% {
|
||||
opacity: var(--ink-opacity, 0.9);
|
||||
transform: scale(1) rotate(var(--rotation, 0deg));
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user