修复投票计数与状态同步,完善票据与戳显示

修复投票系统:禁止重复投票、恢复状态、同步大屏

完善投票流程与展示:计数准确、状态可恢复、样式统一
This commit is contained in:
empty
2026-01-28 21:37:05 +08:00
parent 66ca67c137
commit d090c80e50
27 changed files with 1541 additions and 1023 deletions

View File

@@ -60,6 +60,8 @@ defineExpose({
:id="program.id"
:name="program.name"
:team-name="program.teamName"
:performer="(program as any).performer"
:remark="(program as any).remark"
:order="program.order"
:votes="program.votes"
:stamps="program.stamps"
@@ -85,29 +87,26 @@ defineExpose({
display: grid;
grid-template-columns: repeat(var(--columns, 4), 1fr);
grid-template-rows: repeat(var(--rows, 2), 1fr);
gap: 24px;
padding: 32px;
gap: 40px;
padding: 40px 80px 80px;
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;
background: transparent;
overflow: visible; // Allow shadows and rotation to bleed out if needed
// Responsive breakpoints
@media (max-width: 1200px) {
grid-template-columns: repeat(3, 1fr);
gap: 20px;
padding: 24px;
gap: 30px;
padding: 30px;
}
@media (max-width: 900px) {
grid-template-columns: repeat(2, 1fr);
grid-template-rows: auto;
gap: 16px;
padding: 16px;
gap: 20px;
padding: 20px;
overflow-y: auto;
height: auto;
min-height: 100%;
@@ -115,8 +114,8 @@ defineExpose({
@media (max-width: 500px) {
grid-template-columns: 1fr;
gap: 12px;
padding: 12px;
gap: 16px;
padding: 16px;
}
}
@@ -126,29 +125,37 @@ defineExpose({
}
.empty-slot {
background: rgba(0, 0, 0, 0.02);
border: 2px dashed #ddd;
border-radius: 4px;
background: rgba(255, 255, 255, 0.03);
border: 2px dashed rgba(255, 255, 255, 0.1);
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.3s ease;
&:hover {
background: rgba(255, 255, 255, 0.05);
border-color: rgba(255, 255, 255, 0.2);
}
}
.empty-placeholder {
display: flex;
flex-direction: column;
align-items: center;
gap: 8px;
color: #bbb;
gap: 12px;
color: rgba(255, 255, 255, 0.25);
.empty-icon {
font-size: 32px;
opacity: 0.5;
font-size: 48px;
opacity: 0.6;
filter: grayscale(1) brightness(0.8);
}
.empty-text {
font-size: 14px;
font-family: 'SimSun', 'Songti SC', serif;
font-size: 16px;
font-family: 'Kaiti', 'STKaiti', serif;
letter-spacing: 2px;
}
}
</style>

View File

@@ -19,17 +19,26 @@ export interface Props {
id: string;
name: string;
teamName: string;
performer?: string; // 表演者
remark?: string; // 节目备注
order: number;
votes: number;
stamps?: VoteStamp[];
slogan?: string;
}
const props = withDefaults(defineProps<Props>(), {
slogan: 'With all our passion',
remark: 'With all our passion',
stamps: () => [],
});
// 寄处显示:部门·表演者
const senderDisplay = computed(() => {
if (props.performer) {
return `${props.teamName}·${props.performer}`;
}
return props.teamName;
});
// Generate zip code display: 2|0|2|6|0|[order]
const zipCodes = computed(() => {
const orderStr = String(props.order).padStart(1, '0');
@@ -114,13 +123,13 @@ defineExpose({
</div>
</div>
<!-- Content Row: Left content, Right address -->
<!-- Content Row: Left slogan, 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>
<span class="slogan-text">{{ remark }}</span>
</div>
</div>
@@ -129,7 +138,7 @@ defineExpose({
<div class="address-zone">
<div class="address-line">
<span class="label"></span>
<span class="value">{{ teamName }}</span>
<span class="value">{{ senderDisplay }}</span>
</div>
<div class="address-line">
<span class="label"></span>
@@ -152,21 +161,35 @@ defineExpose({
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;
background: #fdfcf0; // Parchment color
border: 1px solid rgba(0, 0, 0, 0.1);
box-shadow:
0 10px 25px rgba(0, 0, 0, 0.25),
0 2px 5px rgba(0, 0, 0, 0.1);
padding: 20px 24px;
display: flex;
flex-direction: column;
overflow: hidden;
overflow: visible; // Allows full shadows and stamps to bleed correctly
transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
// Organic scattered look
&:nth-child(odd) { transform: rotate(-1.2deg); }
&:nth-child(even) { transform: rotate(0.8deg); }
&:nth-child(3n) { transform: rotate(-0.5deg); }
&:hover {
transform: rotate(0deg) translateY(-5px) scale(1.02);
z-index: 10;
box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
}
// 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;
background-image: url("https://www.transparenttextures.com/patterns/pinstriped-suit.png");
opacity: 0.05;
pointer-events: none;
}
}
@@ -181,8 +204,9 @@ defineExpose({
.postmark-wrapper {
position: absolute;
width: 80px;
height: 80px;
width: 110px;
height: 110px;
filter: drop-shadow(0 2px 4px rgba(185, 28, 28, 0.2));
&.is-new {
animation: stamp-fly-in 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
@@ -196,11 +220,12 @@ defineExpose({
}
70% {
transform: translate(-50%, -50%) scale(0.9);
filter: drop-shadow(0 10px 20px rgba(185, 28, 28, 0.5));
opacity: 1;
}
100% {
transform: translate(-50%, -50%) scale(1);
opacity: 0.9;
opacity: 0.95;
}
}
@@ -211,36 +236,37 @@ defineExpose({
align-items: flex-start;
position: relative;
z-index: 2;
margin-bottom: 12px;
margin-bottom: 16px;
}
.zip-codes {
display: flex;
gap: 3px;
gap: 4px;
}
.zip-box {
width: 22px;
height: 26px;
border: 1.5px solid #c41e3a;
width: 26px;
height: 32px;
border: 1.5px solid #b91c1c;
display: flex;
align-items: center;
justify-content: center;
font-family: 'Courier New', monospace;
font-size: 13px;
font-weight: bold;
color: #2c2c2c;
font-size: 16px;
font-weight: 800;
color: #1a1a1a;
background: #fff;
box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}
.stamp-box {
width: 90px;
height: 90px;
display: flex;
align-items: center;
justify-content: center;
background: transparent;
border: 1px solid #ddd;
width: 100px;
height: 100px;
padding: 4px;
background: white;
border: 1px solid #e5e7eb;
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
transform: rotate(2deg);
}
.stamp-image {
@@ -253,67 +279,75 @@ defineExpose({
.content-row {
flex: 1;
display: flex;
flex-direction: row;
justify-content: space-between;
gap: 20px;
position: relative;
z-index: 2;
min-height: 0; // Prevent overflow
}
// Left Side: Title + Slogan
.content-left {
flex: 1;
flex: 1.2;
display: flex;
flex-direction: column;
justify-content: flex-start;
padding-right: 20px;
gap: 12px;
min-width: 0; // Allow shrinking for text wrap
}
.program-name {
font-family: 'SimSun', 'Songti SC', 'STSong', serif;
font-size: 28px;
font-weight: bold;
color: #c41e3a;
margin: 0 0 12px 0;
font-size: 32px;
font-weight: 900;
color: #b91c1c;
margin: 0;
letter-spacing: 6px;
text-shadow: 0.5px 0.5px 1px rgba(0,0,0,0.1);
word-break: break-all;
}
.slogan-box {
display: inline-block;
border: 1px solid #ccc;
padding: 6px 14px;
padding: 8px 14px;
align-self: flex-start;
background: #fff;
background: rgba(0, 0, 0, 0.02);
border-left: 3px solid #b91c1c;
border-radius: 2px;
max-width: 100%;
}
.slogan-text {
font-family: 'Georgia', 'Times New Roman', serif;
font-size: 12px;
font-style: italic;
color: #666;
font-family: 'Kaiti', 'STKaiti', serif;
font-size: 15px;
color: #4b5563;
line-height: 1.5;
word-break: break-all;
display: block;
}
// Right Side: Address
.content-right {
flex: 1;
display: flex;
flex-direction: column;
justify-content: flex-end;
align-items: flex-start;
min-width: 120px;
justify-content: flex-start; // Start from top area
min-width: 200px;
padding-top: 15%; // Approximately the golden ratio point of the content height
padding-bottom: 30px; // Ensure space for vote count
}
.address-zone {
text-align: left;
border-bottom: 1px solid #999;
padding-bottom: 8px;
margin-left: -25px;
margin-top: -40px;
width: 100%;
}
.address-line {
display: flex;
align-items: baseline;
gap: 6px;
margin-bottom: 6px;
gap: 8px;
margin-bottom: 18px; // Slightly tighter for more refined look
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
padding-bottom: 3px;
&:last-child {
margin-bottom: 0;
@@ -321,36 +355,42 @@ defineExpose({
.label {
font-family: 'SimSun', 'Songti SC', serif;
font-size: 11px;
color: #666;
min-width: 24px;
font-size: 14px;
color: #6b7280;
min-width: 30px;
}
.value {
font-family: 'Kaiti', 'STKaiti', serif;
font-size: 13px;
color: #2c2c2c;
font-size: 18px;
color: #1f2937;
flex: 1;
line-height: 1.2;
transform: rotate(-0.5deg);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
// Footer Zone
.footer-zone {
display: flex;
justify-content: flex-end;
align-items: center;
margin-top: auto;
padding-top: 8px;
position: relative;
z-index: 2;
position: absolute;
right: 15px;
bottom: 15px;
z-index: 5;
.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);
font-size: 16px;
font-weight: 800;
color: #b91c1c;
padding: 6px 14px;
background: white;
border: 1.5px solid #b91c1c;
border-radius: 2px;
box-shadow: 3px 3px 0 rgba(185, 28, 28, 0.1);
white-space: nowrap;
}
}
</style>

View File

@@ -90,8 +90,8 @@ const currentDate = computed(() => {
.postmark {
position: relative;
width: 70px;
height: 70px;
width: 100%;
height: 100%;
// Multiply blend mode for realism
mix-blend-mode: multiply;
animation: stamp-reveal 0.3s ease-out forwards;
@@ -108,9 +108,9 @@ const currentDate = computed(() => {
font-family: 'Kaiti', 'STKaiti', serif;
font-weight: bold;
&.top { font-size: 11px; }
&.date { font-size: 10px; letter-spacing: 0.5px; }
&.bottom { font-size: 10px; }
&.top { font-size: 14px; }
&.date { font-size: 12px; letter-spacing: 0.5px; }
&.bottom { font-size: 12px; }
}
.grunge-overlay {

View File

@@ -37,6 +37,7 @@ export interface VoteEvent {
candidateId: string;
category: string;
totalVotes: number;
programVotes?: number;
delta: number;
timestamp: number;
}

View File

@@ -36,6 +36,7 @@ export const useAdminStore = defineStore('admin', () => {
const programs = ref<Array<{ id: string; name: string; teamName: string; order: number; status: string; votes: number; stamps: any[] }>>([]);
const allowLateCatch = ref(true);
const currentProgramId = ref<string | null>(null);
const awards = ref<any[]>([]);
// Lottery State
const lotteryRound = ref<LotteryRound>(1);
@@ -206,6 +207,21 @@ export const useAdminStore = defineStore('admin', () => {
syncFromServer(state);
});
// Real-time vote updates (for totalVotes and program votes)
socketInstance.on(SOCKET_EVENTS.VOTE_UPDATED as any, (data: { candidateId: string; totalVotes?: number; programVotes?: number; delta?: number }) => {
const program = programs.value.find(p => p.id === data.candidateId);
if (program) {
if (typeof data.programVotes === 'number') {
program.votes = data.programVotes;
} else if (typeof data.delta === 'number') {
program.votes += data.delta;
}
}
if (typeof data.totalVotes === 'number') {
totalVotes.value = data.totalVotes;
}
});
socket.value = socketInstance as GalaSocket;
}
@@ -215,6 +231,7 @@ export const useAdminStore = defineStore('admin', () => {
votingPaused.value = state.voting.subPhase === 'PAUSED';
totalVotes.value = state.voting.totalVotes;
programs.value = state.voting.programs || [];
awards.value = state.voting.awards || [];
allowLateCatch.value = state.voting.allowLateCatch ?? true;
currentProgramId.value = state.voting.currentProgramId || null;
lotteryRound.value = state.lottery.round;
@@ -404,6 +421,7 @@ export const useAdminStore = defineStore('admin', () => {
programs,
allowLateCatch,
currentProgramId,
awards,
lotteryRound,
lotterySubPhase,
stormStartedAt,

View File

@@ -19,12 +19,27 @@ const prizeConfigLoading = ref(false);
const prizeConfigSaving = ref(false);
const editingPrizes = ref<PrizeConfig[]>([]);
async function readJsonSafe(res: Response): Promise<any> {
const text = await res.text();
if (!text) {
return null;
}
try {
return JSON.parse(text);
} catch (error) {
throw new Error('响应不是有效 JSON');
}
}
// Load prize configuration from server
async function loadPrizeConfig() {
prizeConfigLoading.value = true;
try {
const res = await fetch('/api/admin/prizes');
const data = await res.json();
const data = await readJsonSafe(res);
if (!res.ok) {
throw new Error(data?.error || data?.message || `加载奖项配置失败(${res.status})`);
}
if (data.success && data.data?.prizes) {
editingPrizes.value = data.data.prizes.map((p: any) => ({ ...p }));
}
@@ -44,7 +59,10 @@ async function savePrizeConfig() {
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ prizes: editingPrizes.value }),
});
const data = await res.json();
const data = await readJsonSafe(res);
if (!res.ok) {
throw new Error(data?.error || data?.message || `保存奖项配置失败(${res.status})`);
}
if (data.success) {
showPrizeConfig.value = false;
} else {
@@ -98,7 +116,10 @@ async function importParticipants() {
body: formData,
});
const data = await response.json();
const data = await readJsonSafe(response);
if (!response.ok) {
throw new Error(data?.error || data?.message || `导入失败(${response.status})`);
}
// 确保保留 success 字段,后端返回结构为 { success: true, data: {...} }
importResult.value = {
success: data.success ?? data.data?.success ?? false,
@@ -132,7 +153,10 @@ const tagLabels: Record<string, string> = {
async function loadParticipants() {
try {
const response = await fetch('/api/admin/participants');
const data = await response.json();
const data = await readJsonSafe(response);
if (!response.ok) {
throw new Error(data?.error || data?.message || `加载参与者失败(${response.status})`);
}
if (data.success && data.data?.count > 0) {
importResult.value = {
success: true,
@@ -273,7 +297,7 @@ function showEntryQR() {
function hideQR() {
const socket = admin.getSocket();
if (socket) {
socket.emit('display:hide_qr' as any, );
socket.emit('display:hide_qr' as any, {});
}
}

View File

@@ -39,12 +39,16 @@ function handleStateSync(state: AdminState) {
}
// Handle real-time vote updates
function handleVoteUpdate(data: { candidateId: string; totalVotes: number }) {
function handleVoteUpdate(data: { candidateId: string; totalVotes?: number; programVotes?: number; delta?: number }) {
if (renderer) {
renderer.updateVotes(data.candidateId, data.totalVotes);
if (typeof data.programVotes === 'number') {
renderer.updateVotes(data.candidateId, data.programVotes);
}
}
// Update total votes
totalVotes.value = data.totalVotes;
if (typeof data.totalVotes === 'number') {
totalVotes.value = data.totalVotes;
}
}
onMounted(async () => {

View File

@@ -34,16 +34,24 @@ function handleStateSync(state: AdminState) {
}
// 监听投票更新事件
function handleVoteUpdate(data: { candidateId: string; totalVotes: number; stamp?: any }) {
function handleVoteUpdate(data: { candidateId: string; totalVotes?: number; programVotes?: number; delta?: number; stamp?: any }) {
const program = programs.value.find(p => p.id === data.candidateId);
if (program) {
program.votes = data.totalVotes;
if (typeof data.programVotes === 'number') {
program.votes = data.programVotes;
} else if (typeof data.delta === 'number') {
program.votes += data.delta;
}
// 如果有印章信息,添加到列表触发动画
if (data.stamp) {
if (!program.stamps) program.stamps = [];
program.stamps.push(data.stamp);
}
// 更新总票数
}
// 更新总票数
if (typeof data.totalVotes === 'number') {
totalVotes.value = data.totalVotes;
} else {
totalVotes.value = programs.value.reduce((sum, p) => sum + p.votes, 0);
}
}
@@ -99,15 +107,8 @@ onUnmounted(() => {
</main>
</div>
</template>
<style lang="scss" scoped>
// Philatelic postcard theme colors
$color-paper: #FDFBF7;
$color-ink: #2c2c2c;
$color-red: #c41e3a;
$color-gold: #d4af37;
$color-text-muted: #666;
@use '../assets/styles/variables.scss' as *;
.live-voting-view {
width: 100%;
@@ -116,51 +117,65 @@ $color-text-muted: #666;
flex-direction: column;
position: relative;
overflow: hidden;
background: $color-paper;
color: $color-ink;
background: radial-gradient(circle at center, #b91c1c 0%, #7f1d1d 100%);
color: #fff;
// Add a subtle paper texture overlay
&::before {
content: '';
position: absolute;
top: 0; left: 0; right: 0; bottom: 0;
background-image: url("https://www.transparenttextures.com/patterns/pinstriped-suit.png");
opacity: 0.1;
pointer-events: none;
z-index: 1;
}
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 20px 40px;
padding: 20px 60px;
position: relative;
z-index: 100;
background: rgba(255, 255, 255, 0.9);
border-bottom: 1px solid #ddd;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
background: rgba(0, 0, 0, 0.2);
backdrop-filter: blur(10px);
border-bottom: 1px solid rgba($color-gold, 0.2);
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
flex-wrap: wrap;
gap: 12px;
gap: 20px;
.back-btn {
background: white;
border: 1px solid $color-ink;
color: $color-ink;
padding: 8px 16px;
border-radius: 4px;
background: rgba(255, 255, 255, 0.1);
border: 1px solid rgba($color-gold, 0.5);
color: $color-gold;
padding: 10px 24px;
border-radius: 30px;
cursor: pointer;
font-size: 14px;
transition: all 0.2s;
transition: all $transition-fast;
&:hover {
background: $color-ink;
color: white;
background: rgba($color-gold, 0.2);
transform: translateX(-4px);
}
}
.title {
font-size: 32px;
font-size: 48px;
font-family: 'SimSun', 'Songti SC', serif;
font-weight: bold;
color: $color-red;
letter-spacing: 8px;
font-weight: 800;
color: #fff;
letter-spacing: 12px;
margin: 0;
text-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}
.header-right {
display: flex;
align-items: center;
gap: 24px;
gap: 32px;
flex-wrap: wrap;
}
@@ -168,110 +183,65 @@ $color-text-muted: #666;
display: flex;
flex-direction: column;
align-items: flex-end;
background: white;
padding: 8px 16px;
border-radius: 8px;
border: 1px solid #ddd;
background: rgba(0, 0, 0, 0.3);
padding: 10px 24px;
border-radius: 12px;
border: 1px solid rgba($color-gold, 0.3);
box-shadow: inset 0 0 15px rgba($color-gold, 0.1);
.counter-label {
font-size: 12px;
color: $color-text-muted;
margin-bottom: 2px;
color: rgba(255, 255, 255, 0.6);
margin-bottom: 4px;
letter-spacing: 2px;
}
.counter-value {
font-size: 28px;
font-size: 36px;
font-weight: bold;
color: $color-red;
color: $color-gold;
line-height: 1;
font-family: 'Courier New', monospace;
text-shadow: 0 0 12px rgba($color-gold, 0.5);
}
}
.status {
display: flex;
align-items: center;
gap: 12px;
gap: 16px;
.status-badge {
padding: 6px 16px;
border-radius: 4px;
padding: 8px 20px;
border-radius: 20px;
font-size: 14px;
font-weight: 500;
background: #f5f5f5;
color: $color-text-muted;
border: 1px solid #ddd;
font-weight: 600;
background: rgba(255, 255, 255, 0.1);
color: rgba(255, 255, 255, 0.8);
border: 1px solid rgba(255, 255, 255, 0.2);
&.open {
background: rgba(34, 197, 94, 0.1);
color: #16a34a;
border-color: rgba(34, 197, 94, 0.3);
background: rgba(74, 222, 128, 0.1);
color: #4ade80;
border-color: rgba(74, 222, 128, 0.4);
box-shadow: 0 0 15px rgba(74, 222, 128, 0.1);
}
}
.online-count {
font-size: 14px;
color: $color-text-muted;
color: rgba(255, 255, 255, 0.7);
}
.connection-dot {
width: 8px;
height: 8px;
width: 10px;
height: 10px;
border-radius: 50%;
background: #ccc;
background: #475569;
&.connected {
background: #22c55e;
}
}
}
// Responsive adjustments
@media (max-width: 900px) {
padding: 16px 20px;
.title {
font-size: 24px;
letter-spacing: 4px;
}
.vote-counter .counter-value {
font-size: 22px;
}
}
@media (max-width: 600px) {
padding: 12px 16px;
justify-content: center;
.title {
font-size: 20px;
letter-spacing: 2px;
width: 100%;
text-align: center;
order: -1;
}
.back-btn {
padding: 6px 12px;
font-size: 12px;
}
.header-right {
gap: 12px;
}
.vote-counter {
padding: 6px 12px;
.counter-value {
font-size: 18px;
}
}
.status {
.online-count {
display: none;
background: #4ade80;
box-shadow: 0 0 10px #4ade80;
}
}
}
@@ -279,6 +249,25 @@ $color-text-muted: #666;
.grid-container {
flex: 1;
overflow: hidden;
overflow: visible;
position: relative;
z-index: 2;
}
// Responsive adjustments
@media (max-width: 1200px) {
.header {
padding: 20px 40px;
.title { font-size: 36px; letter-spacing: 8px; }
}
}
@media (max-width: 900px) {
.header {
padding: 16px 20px;
justify-content: center;
.title { width: 100%; text-align: center; margin-bottom: 10px; }
.header-right { width: 100%; justify-content: space-between; }
}
}
</style>

View File

@@ -11,28 +11,19 @@ function goBack() {
router.push('/');
}
// Award type labels
const awardLabels: Record<string, string> = {
creative: '最佳创意奖',
visual: '最佳视觉奖',
atmosphere: '最佳气氛奖',
performance: '最佳表演奖',
teamwork: '最佳团队奖',
popularity: '最受欢迎奖',
potential: '最具潜力奖',
};
// Compute award statistics grouped by award type
// Compute award statistics grouped by award config from server
const awardResults = computed(() => {
const results: Array<{
awardType: string;
awardName: string;
remark: string;
programs: Array<{ id: string; name: string; teamName: string; votes: number; percentage: number }>;
totalVotes: number;
}> = [];
// Process each award type
TICKET_TYPES.forEach(awardType => {
// Process each award from admin store
admin.awards.forEach(award => {
const awardType = award.id;
const programStats: Map<string, { name: string; teamName: string; votes: number }> = new Map();
// Aggregate stamps by program for this award type
@@ -67,7 +58,9 @@ const awardResults = computed(() => {
results.push({
awardType,
awardName: awardLabels[awardType] || awardType,
awardName: award.name,
awardIcon: award.icon,
remark: award.remark || '',
programs,
totalVotes,
});
@@ -101,6 +94,8 @@ onMounted(() => {
<h2 class="category-name">{{ award.awardName }}</h2>
<span class="total-votes">{{ award.totalVotes }} </span>
</div>
<div class="award-stamp">{{ award.awardIcon }}</div>
<p v-if="award.remark" class="category-remark">{{ award.remark }}</p>
<div class="results-list">
<div v-if="award.programs.length === 0" class="no-results">
@@ -135,58 +130,77 @@ onMounted(() => {
.vote-results-view {
width: 100%;
height: 100%;
background: $color-bg-gradient;
background: radial-gradient(circle at center, #b91c1c 0%, #7f1d1d 100%);
display: flex;
flex-direction: column;
overflow: auto;
position: relative;
// Add a subtle paper texture overlay
&::before {
content: '';
position: absolute;
top: 0; left: 0; right: 0; bottom: 0;
background-image: url("https://www.transparenttextures.com/patterns/pinstriped-suit.png");
opacity: 0.1;
pointer-events: none;
}
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 24px 40px;
padding: 30px 60px;
flex-shrink: 0;
z-index: 10;
.back-btn {
background: none;
border: 1px solid $color-gold;
background: rgba(255, 255, 255, 0.1);
border: 1px solid rgba($color-gold, 0.5);
color: $color-gold;
padding: 8px 16px;
border-radius: 8px;
padding: 10px 20px;
border-radius: 30px;
cursor: pointer;
font-size: 14px;
transition: all $transition-fast;
backdrop-filter: blur(5px);
&:hover {
background: rgba($color-gold, 0.1);
background: rgba($color-gold, 0.2);
transform: translateX(-4px);
}
}
.title {
font-size: 36px;
font-weight: bold;
font-size: 48px;
font-weight: 800;
letter-spacing: 4px;
text-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.status-indicator {
display: flex;
align-items: center;
gap: 8px;
gap: 10px;
font-size: 14px;
color: rgba(255, 255, 255, 0.6);
color: rgba(255, 255, 255, 0.8);
background: rgba(0, 0, 0, 0.2);
padding: 8px 16px;
border-radius: 20px;
.dot {
width: 8px;
height: 8px;
width: 10px;
height: 10px;
border-radius: 50%;
&.online {
background: #22c55e;
box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
background: #4ade80;
box-shadow: 0 0 12px #4ade80;
}
&.offline {
background: #666;
background: #94a3b8;
}
}
}
@@ -195,112 +209,184 @@ onMounted(() => {
.results-grid {
flex: 1;
display: grid;
grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
gap: 20px;
padding: 20px 40px 40px;
grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
gap: 40px;
padding: 20px 60px 80px;
align-content: start;
}
.category-card {
background: rgba(255, 255, 255, 0.05);
border: 1px solid rgba($color-gold, 0.3);
border-radius: 12px;
padding: 20px;
position: relative;
background: #fdfcf0; // Parchment color
background-image: radial-gradient(#e5e7eb 0.5px, transparent 0.5px);
background-size: 20px 20px;
border-radius: 4px;
padding: 30px;
box-shadow:
0 10px 30px rgba(0, 0, 0, 0.3),
0 1px 2px rgba(0, 0, 0, 0.1);
color: #2c2c2c;
min-height: 380px;
display: flex;
flex-direction: column;
transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
// Random staggered rotation for organic "tossed on table" look
&:nth-child(odd) { transform: rotate(-1deg); }
&:nth-child(even) { transform: rotate(1.5deg); }
&:nth-child(3n) { transform: rotate(-0.5deg); }
&:hover {
transform: rotate(0) scale(1.02);
z-index: 5;
}
// Airmail-style decorative border
&::after {
content: '';
position: absolute;
top: 5px; left: 5px; right: 5px; bottom: 5px;
border: 1px solid rgba(185, 28, 28, 0.1);
pointer-events: none;
}
.category-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16px;
align-items: flex-start;
margin-bottom: 20px;
padding-bottom: 12px;
border-bottom: 1px solid rgba($color-gold, 0.2);
border-bottom: 2px solid #b91c1c;
.category-name {
font-size: 28px;
color: #b91c1c;
font-weight: 800;
margin: 0;
font-family: 'SimSun', serif;
}
.total-votes {
font-size: 14px;
color: #7f1d1d;
background: rgba(185, 28, 28, 0.08);
padding: 4px 12px;
border: 1px solid rgba(185, 28, 28, 0.2);
border-radius: 4px;
font-weight: 600;
}
}
.category-name {
font-size: 20px;
color: $color-gold;
font-weight: 600;
margin: 0;
.award-stamp {
position: absolute;
top: 20px;
right: 20px;
font-size: 64px;
opacity: 0.1;
transform: rotate(20deg);
filter: grayscale(1);
pointer-events: none;
z-index: 0;
user-select: none;
}
.total-votes {
font-size: 14px;
color: rgba(255, 255, 255, 0.5);
background: rgba($color-gold, 0.1);
padding: 4px 10px;
border-radius: 12px;
.category-remark {
font-size: 16px;
color: #4b5563;
font-family: 'Kaiti', 'STKaiti', serif;
line-height: 1.6;
margin: 0 0 24px 0;
padding: 12px;
background: rgba(0, 0, 0, 0.02);
border-radius: 8px;
border-left: 4px solid rgba($color-gold, 0.4);
font-style: normal;
}
.results-list {
flex: 1;
display: flex;
flex-direction: column;
gap: 10px;
gap: 12px;
}
.no-results {
padding: 20px;
text-align: center;
color: rgba(255, 255, 255, 0.4);
flex: 1;
display: flex;
align-items: center;
justify-content: center;
color: #94a3b8;
font-style: italic;
font-size: 18px;
font-family: 'Kaiti', serif;
letter-spacing: 2px;
border: 2px dashed #e2e8f0;
border-radius: 8px;
}
.result-item {
display: flex;
align-items: center;
gap: 12px;
padding: 10px 12px;
background: rgba(255, 255, 255, 0.03);
border-radius: 8px;
gap: 15px;
padding: 12px 16px;
background: white;
border: 1px solid #e5e7eb;
border-radius: 6px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
&.winner {
background: rgba($color-gold, 0.1);
border: 1px solid $color-gold;
background: #fffbef;
border: 1.5px solid #b91c1c;
box-shadow: 0 4px 6px rgba(185, 28, 28, 0.1);
.rank {
background: $color-gold;
color: #000;
background: #b91c1c;
color: white;
}
.name {
color: $color-gold;
color: #b91c1c;
font-weight: bold;
}
.bar {
background: linear-gradient(90deg, $color-gold-dark, $color-gold);
background: linear-gradient(90deg, #991b1b, #ef4444);
}
}
.rank {
width: 26px;
height: 26px;
width: 28px;
height: 28px;
display: flex;
align-items: center;
justify-content: center;
background: rgba(255, 255, 255, 0.1);
background: #f1f5f9;
color: #64748b;
border-radius: 50%;
font-size: 13px;
font-weight: bold;
font-size: 14px;
font-weight: 800;
flex-shrink: 0;
}
.info {
display: flex;
flex-direction: column;
min-width: 80px;
max-width: 100px;
min-width: 100px;
max-width: 140px;
}
.name {
font-size: 14px;
color: $color-text-light;
font-size: 16px;
color: #1e293b;
font-weight: 600;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.team {
font-size: 11px;
color: rgba(255, 255, 255, 0.4);
font-size: 12px;
color: #64748b;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
@@ -308,51 +394,71 @@ onMounted(() => {
.bar-container {
flex: 1;
height: 18px;
background: rgba(255, 255, 255, 0.1);
border-radius: 9px;
height: 14px;
background: #f8fafc;
border: 1px solid #f1f5f9;
border-radius: 10px;
overflow: hidden;
.bar {
height: 100%;
background: linear-gradient(90deg, $color-primary-dark, $color-primary);
border-radius: 9px;
transition: width 1s ease;
background: linear-gradient(90deg, #475569, #94a3b8);
border-radius: 10px;
transition: width 1s cubic-bezier(0.16, 1, 0.3, 1);
}
}
.votes {
width: 50px;
width: 55px;
text-align: right;
font-size: 14px;
color: $color-text-muted;
font-size: 16px;
color: #1e293b;
font-weight: 800;
font-family: 'monospace';
flex-shrink: 0;
}
}
}
// Custom Scrollbar
.vote-results-view::-webkit-scrollbar {
width: 12px;
}
.vote-results-view::-webkit-scrollbar-track {
background: rgba(0, 0, 0, 0.1);
}
.vote-results-view::-webkit-scrollbar-thumb {
background: rgba($color-gold, 0.3);
border-radius: 6px;
border: 3px solid transparent;
background-clip: content-box;
}
// Responsive
@media (max-width: 1200px) {
.results-grid {
grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
padding: 20px 30px;
}
}
@media (max-width: 768px) {
.header {
padding: 16px 20px;
padding: 20px;
flex-direction: column;
gap: 15px;
.title {
font-size: 24px;
}
.title { font-size: 32px; }
}
.results-grid {
grid-template-columns: 1fr;
padding: 16px 20px;
gap: 16px;
padding: 10px 20px;
gap: 20px;
}
.category-card {
padding: 16px;
.category-name {
font-size: 18px;
}
min-height: auto;
padding: 20px;
}
}
</style>