first commit

This commit is contained in:
xiaomai
2025-09-15 00:28:27 +08:00
commit ae8d3ce510
28 changed files with 2882 additions and 0 deletions

8
20250916/README.md Normal file
View File

@@ -0,0 +1,8 @@
这个是大屏的赞助人 Sponsor List
https://dinner.tootaio.com/20250916/sponsor-list/
这个是手机版,客人可以看的 Sponsor List
https://dinner.tootaio.com/20250916/sponsor-list-mobile/
这个是 PPT用电脑看左右键换页面背景图给我之后我放上去
https://dinner.tootaio.com/20250916/ppt/

View File

@@ -0,0 +1,146 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>赞助名单展示</title>
<!-- TailwindCSS CDN -->
<script src="https://cdn.tailwindcss.com"></script>
<!-- Vue 3 CDN -->
<script src="https://unpkg.com/vue@3/dist/vue.global.prod.js"></script>
<style>
/* 跑马灯滚动效果 */
.scroll-list {
overflow: hidden;
height: 220px; /* 固定高度,超出部分隐藏 */
position: relative;
}
.scroll-inner {
display: flex;
flex-direction: column;
animation: scrollUp 12s linear infinite;
}
@keyframes scrollUp {
0% { transform: translateY(0); }
100% { transform: translateY(-50%); }
}
</style>
</head>
<body :class="theme" class="min-h-screen flex flex-col items-center py-10 transition-colors duration-500" id="app">
<!-- 主题切换按钮 -->
<!-- <button @click="toggleTheme"
class="mb-6 px-4 py-2 rounded-lg shadow text-white"
:class="theme === 'light' ? 'bg-gray-800' : 'bg-yellow-400 text-black'">
{{ theme === 'light' ? '🌙 夜间模式' : '☀️ 日间模式' }}
</button> -->
<div class="w-full max-w-5xl px-6">
<!-- 标题 -->
<h1 class="text-3xl font-bold text-center mb-8"
:class="theme === 'light' ? 'text-gray-800' : 'text-gray-200'">
🎉 感谢所有赞助人 🎉
</h1>
<!-- 赞助金额 -->
<div class="mb-12">
<h2 class="text-2xl font-semibold mb-4 text-blue-500">💰 赞助金额</h2>
<div class="scroll-list">
<div class="scroll-inner" :style="{ animationDuration: sponsors.length * 1.5 + 's' }">
<div v-for="s in sponsors" :key="s.name"
class="flex justify-between items-center mb-2 px-4 py-2 rounded-lg shadow"
:class="theme === 'light' ? 'bg-white text-gray-700' : 'bg-gray-800 text-gray-200'">
<span>{{ s.name }}</span>
<span class="font-bold text-green-500">RM {{ s.amount.toLocaleString() }}</span>
</div>
<!-- 复制一份实现无缝循环 -->
<div v-for="s in sponsors" :key="s.name + '-copy'"
class="flex justify-between items-center mb-2 px-4 py-2 rounded-lg shadow"
:class="theme === 'light' ? 'bg-white text-gray-700' : 'bg-gray-800 text-gray-200'">
<span>{{ s.name }}</span>
<span class="font-bold text-green-500">RM {{ s.amount.toLocaleString() }}</span>
</div>
</div>
</div>
<div class="mt-4 text-right font-medium"
:class="theme === 'light' ? 'text-gray-700' : 'text-gray-300'">
赞助人数: {{ sponsors.length }} |
总金额: <span class="text-green-500 font-bold">RM {{ totalAmount.toLocaleString() }}</span>
</div>
</div>
<!-- 席位赞助 -->
<div>
<h2 class="text-2xl font-semibold mb-4 text-purple-500">🪑 席位赞助</h2>
<div class="scroll-list">
<div class="scroll-inner" :style="{ animationDuration: seats.length * 1.5 + 's' }">
<div v-for="s in seats" :key="s.name"
class="flex justify-between items-center mb-2 px-4 py-2 rounded-lg shadow"
:class="theme === 'light' ? 'bg-white text-gray-700' : 'bg-gray-800 text-gray-200'">
<span>{{ s.name }}</span>
<span class="font-bold text-blue-500">{{ s.seat }} 席</span>
</div>
<!-- 复制一份实现无缝循环 -->
<div v-for="s in seats" :key="s.name + '-copy'"
class="flex justify-between items-center mb-2 px-4 py-2 rounded-lg shadow"
:class="theme === 'light' ? 'bg-white text-gray-700' : 'bg-gray-800 text-gray-200'">
<span>{{ s.name }}</span>
<span class="font-bold text-blue-500">{{ s.seat }} 席</span>
</div>
</div>
</div>
<div class="mt-4 text-right font-medium"
:class="theme === 'light' ? 'text-gray-700' : 'text-gray-300'">
席位总数: <span class="text-blue-500 font-bold">{{ totalSeats }}</span>
</div>
</div>
</div>
<script>
const { createApp } = Vue;
createApp({
data() {
return {
sponsors: [],
seats: [],
totalAmount: 0,
totalSeats: 0,
theme: 'light' // 默认浅色
};
},
methods: {
toggleTheme() {
this.theme = this.theme === 'light' ? 'dark' : 'light';
}
},
mounted() {
// 动态加载 JSON
Promise.all([
fetch('../data/sponsors.json').then(res => res.json()),
fetch('../data/seats.json').then(res => res.json())
]).then(([sponsors, seats]) => {
this.sponsors = sponsors;
this.seats = seats;
this.totalAmount = sponsors.reduce((sum, s) => sum + Number(s.amount), 0);
this.totalSeats = seats.reduce((sum, s) => sum + Number(s.seat), 0);
}).catch(err => {
console.error("加载 JSON 数据失败,使用 mock 数据", err);
// fallback mock 数据
this.sponsors = [
{ name: "亮湘厨中国烧烤", amount: 8000 },
{ name: "未来教育基金会", amount: 20000 },
{ name: "星空科技集团", amount: 15000 }
];
this.seats = [
{ name: "郑来兴", seat: 1 },
{ name: "未来教育基金会", seat: 5 }
];
this.totalAmount = this.sponsors.reduce((sum, s) => sum + Number(s.amount), 0);
this.totalSeats = this.seats.reduce((sum, s) => sum + Number(s.seat), 0);
});
}
}).mount('#app');
</script>
</body>
</html>

View File

@@ -0,0 +1,104 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>赞助人名单 - 多主题大屏展示</title>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"
/>
<link rel="stylesheet" href="style.css">
</head>
<body class="theme-default">
<div class="container">
<div class="theme-panel">
<div
class="theme-btn theme-default active"
data-theme="default"
title="深海蓝主题"
></div>
<div
class="theme-btn theme-light-btn"
data-theme="light"
title="浅色主题"
></div>
<div
class="theme-btn theme-purple-btn"
data-theme="purple"
title="深紫主题"
></div>
<div
class="theme-btn theme-green-btn"
data-theme="green"
title="绿色主题"
></div>
<div
class="theme-btn theme-red-btn"
data-theme="red"
title="红色主题"
></div>
<div
class="theme-btn theme-orange-btn"
data-theme="orange"
title="橙色主题"
></div>
<div
class="theme-btn theme-pink-btn"
data-theme="pink"
title="粉色主题"
></div>
<div
class="theme-btn theme-gold-btn"
data-theme="gold"
title="金色主题"
></div>
<div
class="theme-btn theme-tech-btn"
data-theme="tech"
title="科技蓝主题"
></div>
<div
class="theme-btn theme-dark-minimal-btn"
data-theme="dark-minimal"
title="深色简约"
></div>
<div
class="theme-btn theme-sunset-btn"
data-theme="sunset"
title="日落主题"
></div>
</div>
<div class="header">
<h1>赞助人名单</h1>
<!-- <p class="subtitle">衷心感谢以下企业及个人的慷慨赞助</p> -->
<div class="stats">
<!-- <div id="totalSponsors"><i class="fas fa-users"></i> 赞助单位: 0</div> -->
<div id="totalAmount"><i class="fas fa-coins"></i> 总金额: RM 0</div>
<!-- <div id="totalSeats"><i class="fas fa-chair"></i> 席位总数: 0</div> -->
</div>
</div>
<div class="main-content">
<div class="section">
<h2>赞助金额</h2>
<div class="scroll-container">
<div class="scroll-content" id="moneyList"></div>
</div>
</div>
<div class="section">
<h2>席位赞助</h2>
<div class="scroll-container">
<div class="scroll-content" id="seatList"></div>
</div>
</div>
</div>
<div class="footer">
<p id="footerText">感谢所有赞助商对本次活动的大力支持 | 2023年</p>
</div>
</div>
<script src="script.js"></script>
</body>
</html>

View File

@@ -0,0 +1,136 @@
// 自动更新年份
document.getElementById(
"footerText"
).innerHTML = `© ${new Date().getFullYear()} Tootaio.com 保留所有权利。| 由 <a href="https://tootaio.com" target="_blank" rel="noopener">Tootaio</a> 制作。`;
// 主题切换功能
const themeButtons = document.querySelectorAll(".theme-btn");
const body = document.body;
themeButtons.forEach((button) => {
button.addEventListener("click", () => {
const theme = button.getAttribute("data-theme");
// 移除所有主题类
body.classList.remove(
"theme-default",
"theme-light",
"theme-purple",
"theme-green",
"theme-red",
"theme-orange",
"theme-pink",
"theme-gold",
"theme-tech",
"theme-dark-minimal",
"theme-sunset"
);
// 添加所选主题类
if (theme !== "default") {
body.classList.add(`theme-${theme}`);
}
// 更新活动按钮状态
themeButtons.forEach((btn) => btn.classList.remove("active"));
button.classList.add("active");
// 保存主题到本地存储
localStorage.setItem("selectedTheme", theme);
});
});
// 检查本地存储中的主题偏好
const savedTheme = localStorage.getItem("selectedTheme");
if (savedTheme) {
const themeButton = document.querySelector(
`.theme-btn[data-theme="${savedTheme}"]`
);
if (themeButton) {
themeButton.click();
}
}
// 页面初始化
function initSponsorsAndSeats(sponsors, seats) {
const moneyList = document.getElementById("moneyList");
const seatList = document.getElementById("seatList");
let totalAmount = 0;
sponsors.forEach((s) => {
totalAmount += parseFloat(s.amount);
const div = document.createElement("div");
div.className = "sponsor-item";
div.innerHTML = `<span>${s.name}</span><span class="amount">RM ${Number(
s.amount
).toLocaleString()}</span>`;
moneyList.appendChild(div);
});
// 复制一份实现无缝滚动
moneyList.innerHTML += moneyList.innerHTML;
let totalSeats = 0;
seats.forEach((s) => {
totalSeats += parseInt(s.seat);
const div = document.createElement("div");
div.className = "seat-item";
div.innerHTML = `<span>${s.name}</span><span class="amount">${s.seat} 席</span>`;
seatList.appendChild(div);
});
seatList.innerHTML += seatList.innerHTML;
// 更新统计数据
const totalSponsors = document.getElementById("totalSponsors");
if (totalSponsors) {
totalSponsors.innerHTML = ""; // 清空现有内容
var totalSponsorsIcon = document.createElement("i");
totalSponsorsIcon.className = "fas fa-users";
totalSponsors.prepend(totalSponsorsIcon);
totalSponsors.appendChild(
document.createTextNode(` 赞助单位: ${sponsors.length}`)
);
}
const totalAmountEl = document.getElementById("totalAmount");
totalAmountEl.innerHTML = ""; // 清空现有内容
var totalAmountIcon = document.createElement("i");
totalAmountIcon.className = "fas fa-coins";
totalAmountEl.prepend(totalAmountIcon);
totalAmountEl.appendChild(
document.createTextNode(` 总金额: RM ${totalAmount.toLocaleString()}`)
);
const totalSeatsEl = document.getElementById("totalSeats");
if (totalSeatsEl) {
totalSeatsEl.innerHTML = ""; // 清空现有内容
var totalSeatsIcon = document.createElement("i");
totalSeatsIcon.className = "fas fa-chair";
totalSeatsEl.prepend(totalSeatsIcon);
totalSeatsEl.appendChild(
document.createTextNode(` 席位总数: ${totalSeats}`)
);
}
}
// 🚀 动态加载 JSON 数据
Promise.all([
fetch("../data/sponsors.json").then((res) => res.json()),
fetch("../data/seats.json").then((res) => res.json()),
])
.then(([sponsors, seats]) => {
initSponsorsAndSeats(sponsors, seats);
})
.catch((err) => {
console.error("加载 JSON 数据失败,回退到本地 mock 数据", err);
// 备用 mock 数据(防止页面空白)
const mockSponsors = [
{ name: "亮湘厨中国烧烤", amount: 8000 },
{ name: "星空科技集团", amount: 15000 },
{ name: "未来教育基金会", amount: 20000 },
];
const mockSeats = [
{ name: "郑来兴", seat: 1 },
{ name: "未来教育基金会", seat: 5 },
];
initSponsorsAndSeats(mockSponsors, mockSeats);
});

View File

@@ -0,0 +1,474 @@
:root {
/* 默认主题 - 深海蓝 */
--primary-bg: linear-gradient(135deg, #0f1c30, #1a2a6c);
--card-bg: rgba(0, 0, 0, 0.3);
--primary-text: #ffffff;
--accent-color: #4fc3f7;
--secondary-accent: #ffd700;
--header-color: #ffd700;
--stats-color: #4fc3f7;
--item-bg: rgba(255, 255, 255, 0.05);
--sponsor-border: #4fc3f7;
--seat-border: #ffd700;
--shadow-color: rgba(0, 0, 0, 0.5);
}
/* 浅色主题 */
.theme-light {
--primary-bg: linear-gradient(135deg, #f5f7fa, #e4e8f0);
--card-bg: rgba(255, 255, 255, 0.8);
--primary-text: #2d3748;
--accent-color: #3182ce;
--secondary-accent: #d69e2e;
--header-color: #2b6cb0;
--stats-color: #4a5568;
--item-bg: rgba(0, 0, 0, 0.05);
--sponsor-border: #3182ce;
--seat-border: #d69e2e;
--shadow-color: rgba(0, 0, 0, 0.1);
}
/* 深紫色主题 */
.theme-purple {
--primary-bg: linear-gradient(135deg, #1a1a2e, #4a154b);
--card-bg: rgba(0, 0, 0, 0.4);
--primary-text: #f0e6ef;
--accent-color: #9f7aea;
--secondary-accent: #faf089;
--header-color: #faf089;
--stats-color: #9f7aea;
--item-bg: rgba(255, 255, 255, 0.08);
--sponsor-border: #9f7aea;
--seat-border: #faf089;
--shadow-color: rgba(0, 0, 0, 0.6);
}
/* 绿色主题 */
.theme-green {
--primary-bg: linear-gradient(135deg, #0a2f1d, #1a3c2b);
--card-bg: rgba(0, 0, 0, 0.35);
--primary-text: #e6fffa;
--accent-color: #38b2ac;
--secondary-accent: #fefcbf;
--header-color: #fefcbf;
--stats-color: #38b2ac;
--item-bg: rgba(255, 255, 255, 0.06);
--sponsor-border: #38b2ac;
--seat-border: #fefcbf;
--shadow-color: rgba(0, 0, 0, 0.55);
}
/* 红色主题 */
.theme-red {
--primary-bg: linear-gradient(135deg, #2a0e0e, #8b0000);
--card-bg: rgba(0, 0, 0, 0.4);
--primary-text: #ffe6e6;
--accent-color: #ff6b6b;
--secondary-accent: #ffd93d;
--header-color: #ffd93d;
--stats-color: #ff6b6b;
--item-bg: rgba(255, 255, 255, 0.08);
--sponsor-border: #ff6b6b;
--seat-border: #ffd93d;
--shadow-color: rgba(0, 0, 0, 0.6);
}
/* 橙色主题 */
.theme-orange {
--primary-bg: linear-gradient(135deg, #332211, #cc5500);
--card-bg: rgba(0, 0, 0, 0.35);
--primary-text: #fff5e6;
--accent-color: #ff8c42;
--secondary-accent: #ffd700;
--header-color: #ffd700;
--stats-color: #ff8c42;
--item-bg: rgba(255, 255, 255, 0.07);
--sponsor-border: #ff8c42;
--seat-border: #ffd700;
--shadow-color: rgba(0, 0, 0, 0.55);
}
/* 粉色主题 */
.theme-pink {
--primary-bg: linear-gradient(135deg, #2e1a2e, #8a2be2);
--card-bg: rgba(0, 0, 0, 0.4);
--primary-text: #fce4ec;
--accent-color: #ff6ec7;
--secondary-accent: #a5d6ff;
--header-color: #a5d6ff;
--stats-color: #ff6ec7;
--item-bg: rgba(255, 255, 255, 0.08);
--sponsor-border: #ff6ec7;
--seat-border: #a5d6ff;
--shadow-color: rgba(0, 0, 0, 0.6);
}
/* 金色奢华主题 */
.theme-gold {
--primary-bg: linear-gradient(135deg, #1a1818, #4a3c2a);
--card-bg: rgba(0, 0, 0, 0.5);
--primary-text: #f8ecc9;
--accent-color: #c5a572;
--secondary-accent: #ffd700;
--header-color: #ffd700;
--stats-color: #c5a572;
--item-bg: rgba(200, 170, 100, 0.1);
--sponsor-border: #c5a572;
--seat-border: #ffd700;
--shadow-color: rgba(0, 0, 0, 0.7);
}
/* 科技蓝主题 */
.theme-tech {
--primary-bg: linear-gradient(135deg, #001425, #003a5d);
--card-bg: rgba(0, 30, 60, 0.6);
--primary-text: #e0f7ff;
--accent-color: #00c8ff;
--secondary-accent: #00ffcc;
--header-color: #00ffcc;
--stats-color: #00c8ff;
--item-bg: rgba(0, 200, 255, 0.1);
--sponsor-border: #00c8ff;
--seat-border: #00ffcc;
--shadow-color: rgba(0, 40, 80, 0.7);
}
/* 深色简约主题 */
.theme-dark-minimal {
--primary-bg: linear-gradient(135deg, #0a0a0a, #2d2d2d);
--card-bg: rgba(40, 40, 40, 0.7);
--primary-text: #e0e0e0;
--accent-color: #7c7c7c;
--secondary-accent: #ffffff;
--header-color: #ffffff;
--stats-color: #7c7c7c;
--item-bg: rgba(255, 255, 255, 0.05);
--sponsor-border: #7c7c7c;
--seat-border: #ffffff;
--shadow-color: rgba(0, 0, 0, 0.8);
}
/* 日落主题 */
.theme-sunset {
--primary-bg: linear-gradient(135deg, #0f1c30, #e25822);
--card-bg: rgba(0, 0, 0, 0.4);
--primary-text: #fff5e6;
--accent-color: #ff8c42;
--secondary-accent: #ffd93d;
--header-color: #ffd93d;
--stats-color: #ff8c42;
--item-bg: rgba(255, 255, 255, 0.08);
--sponsor-border: #ff8c42;
--seat-border: #ffd93d;
--shadow-color: rgba(0, 0, 0, 0.6);
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
transition: background-color 0.5s ease, color 0.5s ease, transform 0.3s ease;
}
body {
background: var(--primary-bg);
color: var(--primary-text);
font-family: "Microsoft YaHei", sans-serif;
padding: 20px;
overflow-x: hidden;
min-height: 100vh;
}
.container {
max-width: 1800px;
margin: auto;
position: relative;
}
.theme-panel {
position: fixed;
top: 50%;
right: 20px;
transform: translateY(-50%);
display: flex;
flex-direction: column;
gap: 12px;
z-index: 100;
background: var(--card-bg);
padding: 15px;
border-radius: 20px;
box-shadow: 0 5px 20px var(--shadow-color);
backdrop-filter: blur(5px);
}
.theme-btn {
width: 30px;
height: 30px;
border-radius: 50%;
border: 2px solid var(--primary-text);
cursor: pointer;
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.theme-btn:hover {
transform: scale(1.15);
box-shadow: 0 0 10px var(--secondary-accent);
}
.theme-btn.active {
transform: scale(1.2);
box-shadow: 0 0 15px var(--secondary-accent);
}
.theme-default {
background: linear-gradient(135deg, #0f1c30, #1a2a6c);
}
.theme-light-btn {
background: linear-gradient(135deg, #f5f7fa, #e4e8f0);
}
.theme-purple-btn {
background: linear-gradient(135deg, #1a1a2e, #4a154b);
}
.theme-green-btn {
background: linear-gradient(135deg, #0a2f1d, #1a3c2b);
}
.theme-red-btn {
background: linear-gradient(135deg, #2a0e0e, #8b0000);
}
.theme-orange-btn {
background: linear-gradient(135deg, #332211, #cc5500);
}
.theme-pink-btn {
background: linear-gradient(135deg, #2e1a2e, #8a2be2);
}
.theme-gold-btn {
background: linear-gradient(135deg, #1a1818, #4a3c2a);
}
.theme-tech-btn {
background: linear-gradient(135deg, #001425, #003a5d);
}
.theme-dark-minimal-btn {
background: linear-gradient(135deg, #0a0a0a, #2d2d2d);
}
.theme-sunset-btn {
background: linear-gradient(135deg, #0f1c30, #e25822);
}
.header,
.footer {
text-align: center;
padding: 30px;
background: var(--card-bg);
border-radius: 20px;
box-shadow: 0 10px 30px var(--shadow-color);
backdrop-filter: blur(10px);
margin-bottom: 30px;
border: 1px solid rgba(255, 255, 255, 0.1);
}
.footer {
margin-top: 30px;
padding: 20px;
}
h1 {
font-size: 2rem;
color: var(--header-color);
margin-bottom: 15px;
text-shadow: 0 2px 10px var(--shadow-color);
letter-spacing: 1.5px;
}
a {
color: var(--accent-color);
text-decoration: none;
transition: color 0.3s ease;
}
.subtitle {
font-size: 1.5rem;
color: var(--primary-text);
opacity: 0.9;
margin-bottom: 25px;
}
.stats {
display: flex;
justify-content: center;
gap: 50px;
margin: 25px 0;
}
.stats div {
font-size: 3rem;
color: var(--stats-color);
font-weight: bold;
display: flex;
align-items: center;
gap: 12px;
padding: 12px 20px;
background: var(--item-bg);
border-radius: 12px;
}
.stats i {
font-size: 2.2rem;
}
.main-content {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 30px;
margin-top: 20px;
}
.section {
background: var(--card-bg);
border-radius: 20px;
padding: 30px;
height: 650px;
position: relative;
overflow: hidden;
box-shadow: 0 10px 30px var(--shadow-color);
backdrop-filter: blur(5px);
border: 1px solid rgba(255, 255, 255, 0.1);
}
.section h2 {
text-align: center;
color: var(--accent-color);
margin-bottom: 25px;
font-size: 2.4rem;
text-shadow: 0 1px 5px var(--shadow-color);
position: relative;
padding-bottom: 12px;
}
.section h2:after {
content: "";
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
width: 100px;
height: 4px;
background: var(--secondary-accent);
border-radius: 4px;
}
.scroll-container {
height: 540px;
overflow: hidden;
position: relative;
border-radius: 15px;
margin-top: 15px;
}
.scroll-content {
position: absolute;
width: 100%;
}
.sponsor-item,
.seat-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 18px 25px;
margin: 15px 0;
background: var(--item-bg);
border-radius: 12px;
font-size: 1.7rem;
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.sponsor-item:hover,
.seat-item:hover {
transform: translateY(-3px);
box-shadow: 0 8px 20px var(--shadow-color);
}
.sponsor-item {
border-left: 6px solid var(--sponsor-border);
}
.seat-item {
border-left: 6px solid var(--seat-border);
}
.amount {
color: var(--secondary-accent);
font-weight: bold;
font-size: 1.8rem;
}
.scroll-content {
animation: scroll 40s linear infinite;
}
.scroll-content:hover {
animation-play-state: paused;
}
@keyframes scroll {
0% {
transform: translateY(0);
}
100% {
transform: translateY(-50%);
}
}
/* 响应式设计 */
@media (max-width: 1200px) {
.main-content {
grid-template-columns: 1fr;
}
h1 {
font-size: 3rem;
}
.stats {
gap: 20px;
}
}
@media (max-width: 768px) {
.stats {
flex-direction: column;
gap: 15px;
}
.header,
.footer {
padding: 20px;
}
.section {
padding: 20px;
height: 500px;
}
.scroll-container {
height: 400px;
}
.theme-panel {
top: auto;
bottom: 20px;
right: 20px;
flex-direction: row;
transform: none;
}
}

View File

@@ -0,0 +1,426 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>赞助人名单</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
body {
background: linear-gradient(135deg, #1a2a6c, #2a4b8c);
color: #333;
padding: 20px;
min-height: 100vh;
}
.container {
max-width: 1200px;
margin: 0 auto;
}
header {
text-align: center;
margin-bottom: 40px;
padding: 30px 20px;
background: linear-gradient(to right, #2c3e50, #4a6491);
border-radius: 10px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
color: white;
position: relative;
overflow: hidden;
}
header::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="100" height="100" opacity="0.05"><text x="50%" y="50%" font-size="50" text-anchor="middle" dominant-baseline="middle" fill="white">❤</text></svg>');
background-repeat: repeat;
opacity: 0.1;
}
h1 {
font-size: 2.8rem;
margin-bottom: 10px;
color: #ffd700;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
position: relative;
display: inline-block;
}
h1::after {
content: '';
display: block;
width: 50%;
height: 3px;
background: #ffd700;
margin: 10px auto;
border-radius: 2px;
}
.subtitle {
font-size: 1.2rem;
color: #e0e0e0;
max-width: 800px;
margin: 0 auto;
line-height: 1.6;
}
.tabs {
display: flex;
justify-content: center;
margin-bottom: 30px;
flex-wrap: wrap;
}
.tab {
padding: 12px 25px;
background: #f8f9fa;
border: none;
border-radius: 30px;
margin: 0 10px 10px;
cursor: pointer;
font-weight: 600;
transition: all 0.3s ease;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.tab:hover {
background: #e9ecef;
transform: translateY(-2px);
}
.tab.active {
background: #ffd700;
color: #1a2a6c;
}
.cards-container {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 20px;
margin-bottom: 40px;
}
.card {
background: white;
border-radius: 10px;
overflow: hidden;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
transition: transform 0.3s ease, box-shadow 0.3s ease;
display: flex;
flex-direction: column;
}
.card:hover {
transform: translateY(-5px);
box-shadow: 0 12px 20px rgba(0, 0, 0, 0.15);
}
.card-header {
background: linear-gradient(to right, #4a6491, #2c3e50);
color: white;
padding: 15px 20px;
position: relative;
}
.card-header::after {
content: '';
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 5px;
background: #ffd700;
}
.card-body {
padding: 20px;
flex-grow: 1;
}
.sponsor-name {
font-size: 1.3rem;
font-weight: 600;
margin-bottom: 10px;
color: #2c3e50;
}
.sponsor-amount {
font-size: 1.5rem;
font-weight: 700;
color: #2a4b8c;
margin: 15px 0;
display: flex;
align-items: center;
}
.sponsor-amount i {
margin-right: 10px;
color: #ffd700;
}
.badge {
display: inline-block;
padding: 5px 12px;
border-radius: 20px;
font-size: 0.85rem;
font-weight: 600;
margin-top: 10px;
}
.badge-gold {
background: #fff8e1;
color: #ffab00;
border: 1px solid #ffd700;
}
.badge-blue {
background: #e3f2fd;
color: #1565c0;
border: 1px solid #42a5f5;
}
.stats {
display: flex;
justify-content: space-around;
background: #f8f9fa;
border-radius: 10px;
padding: 20px;
margin: 30px 0;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}
.stat-item {
text-align: center;
}
.stat-number {
font-size: 2.5rem;
font-weight: 700;
color: #ffd700;
text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);
}
.stat-label {
font-size: 1rem;
color: #495057;
margin-top: 5px;
}
footer {
text-align: center;
padding: 20px;
color: #e0e0e0;
font-size: 0.9rem;
margin-top: 40px;
}
@media (max-width: 768px) {
.cards-container {
grid-template-columns: 1fr;
}
h1 {
font-size: 2.2rem;
}
.stats {
flex-direction: column;
gap: 20px;
}
}
.highlight {
background-color: #fff8e1;
border-left: 4px solid #ffd700;
}
</style>
</head>
<body>
<div class="container">
<header>
<h1>赞助人名单</h1>
<p class="subtitle">衷心感谢以下企业及个人对本次活动的大力支持与慷慨赞助,您的贡献是活动成功举办的重要保障。</p>
</header>
<div class="stats">
<div class="stat-item">
<div class="stat-number">33</div>
<div class="stat-label">赞助企业/个人</div>
</div>
<div class="stat-item">
<div class="stat-number">RM 75,387.88</div>
<div class="stat-label">赞助总额</div>
</div>
<div class="stat-item">
<div class="stat-number">49</div>
<div class="stat-label">席位总数</div>
</div>
</div>
<div class="tabs">
<button class="tab active" onclick="filterCards('all')">全部赞助</button>
<button class="tab" onclick="filterCards('high')">高额赞助 (RM 5000+)</button>
<button class="tab" onclick="filterCards('medium')">中等赞助 (RM 1000-5000)</button>
<button class="tab" onclick="filterCards('seats')">席位赞助</button>
</div>
<div class="cards-container">
<!-- 赞助金额卡片 -->
<div class="card highlight">
<div class="card-header">
<h2>最高赞助</h2>
</div>
<div class="card-body">
<div class="sponsor-name">Fipay</div>
<div class="sponsor-amount"><i class="fas fa-crown"></i> RM 15,547</div>
<span class="badge badge-gold">铂金赞助商</span>
</div>
</div>
<div class="card">
<div class="card-header">
<h2>钻石赞助</h2>
</div>
<div class="card-body">
<div class="sponsor-name">EV777</div>
<div class="sponsor-amount"><i class="fas fa-gem"></i> RM 10,000</div>
</div>
</div>
<div class="card">
<div class="card-header">
<h2>钻石赞助</h2>
</div>
<div class="card-body">
<div class="sponsor-name">Smart 6655</div>
<div class="sponsor-amount"><i class="fas fa-gem"></i> RM 10,000</div>
</div>
</div>
<div class="card">
<div class="card-header">
<h2>黄金赞助</h2>
</div>
<div class="card-body">
<div class="sponsor-name">亮湘厨中国烧烤</div>
<div class="sponsor-amount"><i class="fas fa-award"></i> RM 8,000</div>
</div>
</div>
<div class="card">
<div class="card-header">
<h2>白银赞助</h2>
</div>
<div class="card-body">
<div class="sponsor-name">99 IT</div>
<div class="sponsor-amount"><i class="fas fa-medal"></i> RM 5,000</div>
</div>
</div>
<!-- 更多赞助卡片 -->
<div class="card">
<div class="card-header">
<h2>白银赞助</h2>
</div>
<div class="card-body">
<div class="sponsor-name">周凯雄</div>
<div class="sponsor-amount"><i class="fas fa-medal"></i> RM 5,000</div>
</div>
</div>
<div class="card">
<div class="card-header">
<h2>青铜赞助</h2>
</div>
<div class="card-body">
<div class="sponsor-name">LT Group</div>
<div class="sponsor-amount"><i class="fas fa-star"></i> RM 4,000</div>
</div>
</div>
<div class="card">
<div class="card-header">
<h2>青铜赞助</h2>
</div>
<div class="card-body">
<div class="sponsor-name">联兴气车</div>
<div class="sponsor-amount"><i class="fas fa-star"></i> RM 3,500</div>
</div>
</div>
<!-- 席位赞助卡片 -->
<div class="card">
<div class="card-header">
<h2>席位赞助</h2>
</div>
<div class="card-body">
<div class="sponsor-name">郑来兴</div>
<div class="sponsor-amount"><i class="fas fa-chair"></i> 1 席</div>
<span class="badge badge-blue">席位赞助商</span>
</div>
</div>
<div class="card">
<div class="card-header">
<h2>席位赞助</h2>
</div>
<div class="card-body">
<div class="sponsor-name">大宝榴莲</div>
<div class="sponsor-amount"><i class="fas fa-chair"></i> 1 席</div>
<span class="badge badge-blue">席位赞助商</span>
</div>
</div>
<div class="card">
<div class="card-header">
<h2>席位赞助</h2>
</div>
<div class="card-body">
<div class="sponsor-name">姚招盛</div>
<div class="sponsor-amount"><i class="fas fa-chair"></i> 1 席</div>
<span class="badge badge-blue">席位赞助商</span>
</div>
</div>
<!-- 更多席位赞助卡片 -->
<div class="card">
<div class="card-header">
<h2>席位赞助</h2>
</div>
<div class="card-body">
<div class="sponsor-name">黄啟业</div>
<div class="sponsor-amount"><i class="fas fa-chair"></i> 1 席</div>
<span class="badge badge-blue">席位赞助商</span>
</div>
</div>
</div>
<footer>
<p>感谢所有赞助商对本次活动的大力支持 | 2023年</p>
</footer>
</div>
<script>
function filterCards(category) {
// 简化实现:实际应用中应根据类别筛选卡片
document.querySelectorAll('.tab').forEach(tab => tab.classList.remove('active'));
event.currentTarget.classList.add('active');
// 这里只是演示,实际应根据卡片数据实现筛选功能
alert('筛选功能: ' + category + ' (在实际应用中这里会筛选显示相应内容)');
}
</script>
</body>
</html>

47
20250916/data/seats.json Normal file
View File

@@ -0,0 +1,47 @@
[
{ "name": "郑来兴", "seat": 1 },
{ "name": "大宝榴莲", "seat": 1 },
{ "name": "姚招盛", "seat": 1 },
{ "name": "黄啟业", "seat": 1 },
{ "name": "江仁楷", "seat": 1 },
{ "name": "伯乐集团", "seat": 1 },
{ "name": "陈祥龙", "seat": 1 },
{ "name": "颜凯伟", "seat": 1 },
{ "name": "陈家晟", "seat": 1 },
{ "name": "永和工业有限公司", "seat": 1 },
{ "name": "三泰kopitiam", "seat": 1 },
{ "name": "林文庆", "seat": 1 },
{ "name": "居銮dw", "seat": 1 },
{ "name": "居銮阿童", "seat": 1 },
{ "name": "王重晟", "seat": 1 },
{ "name": "张国靖", "seat": 1 },
{ "name": "領善精密刀具貿易", "seat": 1 },
{ "name": "快乐园", "seat": 1 },
{ "name": "瞿永钦", "seat": 1 },
{ "name": "陳学發", "seat": 1 },
{ "name": "黄祖全", "seat": 1 },
{ "name": "黄耀宏", "seat": 1 },
{ "name": "蔡金莱", "seat": 1 },
{ "name": "国安生果", "seat": 1 },
{ "name": "荣成生命礼仪有限公司", "seat": 1 },
{ "name": "李福丞", "seat": 1 },
{ "name": "Phone Point Telecommunication Sdn Bhd", "seat": 1 },
{ "name": "鼎盛集团", "seat": 1 },
{ "name": "潘联国", "seat": 1 },
{ "name": "刘云鳞", "seat": 1 },
{ "name": "klevin ou", "seat": 1 },
{ "name": "吴厚雄", "seat": 1 },
{ "name": "黄金林", "seat": 1 },
{ "name": "Sin Chu Hin BP", "seat": 1 },
{ "name": "LT Group", "seat": 1 },
{ "name": "永平天保公", "seat": 1 },
{ "name": "永平福满家美食阁", "seat": 1 },
{ "name": "颜汉龙", "seat": 1 },
{ "name": "明義柅轮电池服务", "seat": 1 },
{ "name": "MDL AUTO WERKZ", "seat": 1 },
{ "name": "柔中汽车机件有限公司", "seat": 1 },
{ "name": "永兴石灰", "seat": 1 },
{ "name": "winbox", "seat": 1 },
{ "name": "南利企业", "seat": 1 },
{ "name": "戴祖发", "seat": 1 }
]

View File

@@ -0,0 +1,33 @@
[
{ "name": "Fipay", "amount": 15547 },
{ "name": "EV777", "amount": 10000 },
{ "name": "Smart 6655", "amount": 10000 },
{ "name": "亮湘厨中国烧烤", "amount": 8000 },
{ "name": "99 IT", "amount": 5000 },
{ "name": "周凯雄", "amount": 5000 },
{ "name": "LT Group", "amount": 4000 },
{ "name": "联兴气车", "amount": 3500 },
{ "name": "程华强", "amount": 3000 },
{ "name": "吴厚雄", "amount": 3000 },
{ "name": "GoDrive Car Rental SDN BHD", "amount": 1888.88 },
{ "name": "江先峰", "amount": 1547 },
{ "name": "顺发吊车", "amount": 1000 },
{ "name": "白俊雄", "amount": 1000 },
{ "name": "裕源生果有限公司", "amount": 1000 },
{ "name": "福泉风水", "amount": 800 },
{ "name": "吴田财", "amount": 547 },
{ "name": "许展鸿", "amount": 547 },
{ "name": "林凯胜", "amount": 547 },
{ "name": "新强羽球馆", "amount": 547 },
{ "name": "江彩珊", "amount": 500 },
{ "name": "居銮阿伟", "amount": 500 },
{ "name": "小K", "amount": 500 },
{ "name": "詹志新", "amount": 500 },
{ "name": "林22", "amount": 500 },
{ "name": "謝明忠", "amount": 500 },
{ "name": "許忠礼", "amount": 500 },
{ "name": "four season fruity sdn bhd", "amount": 500 },
{ "name": "陈文毅", "amount": 500 },
{ "name": "青海茶餐室", "amount": 500 },
{ "name": "八子", "amount": 200 }
]

View File

@@ -0,0 +1,41 @@
{
"manifest": "/templates/manifest.json",
"slides": [
{
"type": "cover",
"template": "cover",
"data": {
"title": "柔佛永平关圣公联谊会",
"subtitle": "筹募活动基金联欢晚会",
"date": "2025年9月16日",
"location": "永平富华冷气酒家"
},
"background": "https://picsum.photos/1920/1080?grayscale"
},
{
"type": "speech",
"template": "speech",
"data": {
"name": "林添顺",
"nameEn": "YB Ling Tian Soon (Ah Soon)",
"title": "柔佛州州议员兼州行政议员",
"avatar": "images/林添顺.jpg",
"bio": "马华公会MCA领袖现任柔佛州永平区州议员兼州行政议会卫生及环境委员会主席。青年政治人物积极推动民生与公共服务改善关注教育、环境及社区发展。"
},
"background": "https://picsum.photos/1920/1080?grayscale&random=1",
"overrideCss": "overrides/zhanghua.css"
},
{
"type": "speech",
"template": "speech",
"data": {
"name": "嘉宾姓名",
"title": "职位 / 头衔",
"avatar": "images/关圣公致辞2.jpg",
"bio": "嘉宾介绍"
},
"background": "https://picsum.photos/1920/1080?grayscale&random=2",
"overrideCss": "overrides/limei.css"
}
]
}

126
20250916/ppt/css/base.css Normal file
View File

@@ -0,0 +1,126 @@
/* ============================
base.css - Banquet PPT 基础样式
============================ */
/* 1. Reset 基础样式 (简化版 normalize) */
*{
box-sizing: border-box;
margin: 0;
padding: 0;
font-family: 'Noto Sans SC', sans-serif;
}
html,
body {
height: 100%;
width: 100%;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
"Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji",
"Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
background-color: #111; /* 深色背景,适合投影 */
color: #fff;
line-height: 1.5;
-webkit-font-smoothing: antialiased;
overflow: hidden; /* 防止出现滚动条 */
}
/* 2. 容器样式 */
#app {
height: 100%;
width: 100%;
position: relative;
overflow: hidden;
}
/* 3. 幻灯片基础样式 */
.banquet-slide {
display: none; /* 默认隐藏js 会控制显示 */
height: 100%;
width: 100%;
padding: 2rem;
position: absolute;
top: 0;
left: 0;
background-color: #222; /* 默认深灰背景 */
background-size: cover;
background-position: center;
display: flex;
align-items: center;
justify-content: center;
font-size: 2rem;
transition: opacity 0.4s ease, transform 0.4s ease;
}
/* 当前显示的 slide可选效果淡入 */
.banquet-slide[style*="block"] {
opacity: 1;
z-index: 1;
}
.banquet-slide[style*="none"] {
opacity: 0;
z-index: 0;
}
/* 4. 标题/正文默认样式 */
h1,
h2,
h3 {
font-weight: bold;
margin-bottom: 1rem;
}
h1 {
font-size: 3rem;
}
h2 {
font-size: 2.2rem;
}
h3 {
font-size: 1.6rem;
}
p {
margin-bottom: 1rem;
font-size: 1.2rem;
}
/* 5. 辅助类 */
.text-center {
text-align: center;
}
.text-right {
text-align: right;
}
.text-left {
text-align: left;
}
.mt-1 {
margin-top: 0.5rem;
}
.mt-2 {
margin-top: 1rem;
}
.mt-3 {
margin-top: 1.5rem;
}
/* 6. 简单过渡动画(可选) */
.fade-in {
animation: fadeIn 0.6s ease forwards;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(15px);
}
to {
opacity: 1;
transform: translateY(0);
}
}

40
20250916/ppt/index.html Normal file
View File

@@ -0,0 +1,40 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>宴会展示PPT</title>
<link
href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700&display=swap"
rel="stylesheet"
/>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"
/>
<link rel="stylesheet" href="css/base.css" />
</head>
<body>
<!-- 渲染容器 -->
<div id="app"></div>
<!-- 引入逻辑 -->
<script type="module">
import { renderBanquet } from "./js/ppt.js";
// 启动应用
document.addEventListener("DOMContentLoaded", async () => {
try {
await renderBanquet(
"config/banquet.json",
"templates/manifest.json",
"#app"
);
console.log("Banquet PPT 初始化完成 🎉");
} catch (err) {
console.error("初始化失败:", err);
}
});
</script>
</body>
</html>

32
20250916/ppt/js/engine.js Normal file
View File

@@ -0,0 +1,32 @@
function escapeHtml(str) {
if (str == null) return "";
return String(str)
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;")
.replace(/'/g, "&#39;");
}
export function renderTemplate(template, data = {}, opts = { allowRaw: true }) {
// 支持 nested keys (a.b.c)
const get = (path) =>
path
.split(".")
.reduce((acc, k) => (acc == null ? undefined : acc[k]), data);
return template.replace(
/\{\{\{\s*([\w$.]+)\s*\}\}\}|\{\{\s*([\w$.]+)\s*\}\}/g,
(m, rawKey, escKey) => {
const key = rawKey || escKey;
const val = get(key);
if (rawKey)
return opts.allowRaw
? val == null
? ""
: String(val)
: escapeHtml(val);
return val == null ? "" : escapeHtml(val);
}
);
}

201
20250916/ppt/js/loader.js Normal file
View File

@@ -0,0 +1,201 @@
// js/loader.js
// 负责:加载 manifest、加载模板 HTML并注入模板 CSS、渲染接口、加载 override CSS
// 依赖:./engine.js 导出的 renderTemplate(template, data, opts)
import { renderTemplate } from "./engine.js";
const manifestCache = new Map(); // manifestPath -> manifest object
const templateCache = new Map(); // cacheKey -> { html, meta, baseUrl }
/**
* Resolve a possibly-relative URL against a base (template HTML path or manifest path).
* Returns an absolute-ish href (as string) that can be used in link[href="..."] matching.
*/
function resolveUrl(href, base) {
try {
// new URL(href, base) will resolve relative href against base
return new URL(href, base).toString();
} catch (e) {
// fallback: return original
return href;
}
}
/**
* Load manifest JSON (模板注册表). 支持缓存。
* manifestPath: string (绝对或相对 URL)
*/
export async function loadManifest(manifestPath = "templates/manifest.json") {
if (manifestCache.has(manifestPath)) return manifestCache.get(manifestPath);
const res = await fetch(manifestPath);
if (!res.ok)
throw new Error(`无法加载 manifest: ${manifestPath} (${res.status})`);
const manifest = await res.json();
// store base for resolving any relative css/html in manifest entries
const base = new URL(location.origin + location.pathname + manifestPath).toString();
manifestCache.set(manifestPath, { data: manifest, base });
return manifestCache.get(manifestPath);
}
/**
* Load template by name using manifest.
* manifestPath: path to manifest (from config) — loader will call loadManifest(manifestPath)
* templateName: key inside manifest (e.g., "speech")
*
* Returns an object:
* {
* html: '<div...>...</div>', // body innerHTML of template
* meta: { html: '/templates/speech.html', css: '/templates/speech.css' },
* baseUrl: 'https://yourhost/templates/' // used to resolve relative hrefs in template
* }
*/
export async function loadTemplateByName(manifestPath, templateName) {
const manifestObj = await loadManifest(manifestPath);
const manifest = manifestObj.data;
const manifestBase = manifestObj.base;
const meta = manifest[templateName];
if (!meta)
throw new Error(`模板未注册: ${templateName} (manifest: ${manifestPath})`);
// determine absolute paths for template html and template css (if provided)
const htmlPath = resolveUrl(meta.html, manifestBase);
const cssPath = meta.css ? resolveUrl(meta.css, manifestBase) : null;
// cacheKey should include both htmlPath and cssPath
const cacheKey = `${htmlPath}::${cssPath || ""}`;
if (templateCache.has(cacheKey)) return templateCache.get(cacheKey);
// fetch template HTML
const res = await fetch(htmlPath);
if (!res.ok)
throw new Error(`无法加载模板 HTML: ${htmlPath} (${res.status})`);
const rawHtml = await res.text();
// inject manifest-declared css (meta.css) into head if present (and not already injected)
if (cssPath) {
injectCssIfNeeded(cssPath);
}
// parse template HTML to capture any <link rel="stylesheet"> declared inside template,
// and inject those into head too (resolving relative hrefs against htmlPath)
const parser = new DOMParser();
const doc = parser.parseFromString(rawHtml, "text/html");
const linkEls = Array.from(doc.querySelectorAll('link[rel="stylesheet"]'));
linkEls.forEach((linkEl) => {
const href = linkEl.getAttribute("href");
if (!href) return;
const resolved = resolveUrl(href, htmlPath);
injectCssIfNeeded(resolved);
});
// optionally: you might want to extract and move inline <style> out,
// but keeping inline <style> inside template HTML is acceptable.
const bodyHtml = doc.body.innerHTML.trim();
const tpl = {
html: bodyHtml,
meta: { ...meta, html: htmlPath, css: cssPath },
baseUrl: new URL(".", htmlPath).toString(),
};
templateCache.set(cacheKey, tpl);
return tpl;
}
/**
* Helper: inject a stylesheet link element into document.head if not already present.
* Performs de-dup by checking existing link[href="..."] after resolving href.
*/
function injectCssIfNeeded(href) {
const absHref = href; // already resolved by resolveUrl
// dedupe: check both full absolute href and possibly same-origin relative forms by comparing full URL
const existing = Array.from(
document.querySelectorAll('link[rel="stylesheet"]')
).some((l) => {
// some browsers return absolute hrefs, so compare URL()
try {
return (
new URL(l.href, location.href).toString() ===
new URL(absHref, location.href).toString()
);
} catch (e) {
return l.getAttribute("href") === absHref;
}
});
if (!existing) {
const link = document.createElement("link");
link.rel = "stylesheet";
link.href = absHref;
document.head.appendChild(link);
}
}
/**
* Render wrapper — 调用 engine.renderTemplate
* tplHtml: string (template HTML body)
* data: object
* opts: { allowRaw: boolean }
*/
export function render(tplHtml, data = {}, opts = { allowRaw: true }) {
return renderTemplate(tplHtml, data, opts);
}
/**
* Load override CSS for an instance (per-slide override), with dedupe.
* href can be absolute or relative; if relative, resolve against current location.
*/
export function loadOverrideCss(href) {
if (!href) return null;
const resolved = resolveUrl(href, location.href);
const link = document.createElement("link");
link.rel = "stylesheet";
link.href = resolved;
link.disabled = true; // 默认禁用
document.head.appendChild(link);
return link;
}
/**
* Optional utility: clear caches (for dev hot-reload)
*/
export function clearCaches() {
manifestCache.clear();
templateCache.clear();
}
/**
* Optional utility: prefetch templates listed in manifest (improves UX)
* manifestPath: path to manifest
* templateNames: array of template names to prefetch; if omitted, prefetch all in manifest.
*/
export async function prefetchTemplates(
manifestPath = "/templates/manifest.json",
templateNames = null
) {
const manifestObj = await loadManifest(manifestPath);
const manifest = manifestObj.data;
const names = templateNames || Object.keys(manifest);
await Promise.all(
names.map((name) => {
const meta = manifest[name];
if (!meta) return Promise.resolve();
const htmlPath = resolveUrl(meta.html, manifestObj.base);
const cssPath = meta.css ? resolveUrl(meta.css, manifestObj.base) : null;
// warm up by fetching html (and cache behavior in loadTemplateByName will handle injection)
return fetch(htmlPath)
.then((r) =>
r.ok
? r.text().then(() => {
if (cssPath) injectCssIfNeeded(cssPath);
})
: Promise.resolve()
)
.catch(() => {});
})
);
}

96
20250916/ppt/js/ppt.js Normal file
View File

@@ -0,0 +1,96 @@
// js/ppt.js
// Banquet PPT 入口:读取 config加载模板渲染幻灯片到 DOM
// 依赖loader.js 提供的 loadTemplateByName/render/loadOverrideCss
import { loadTemplateByName, render, loadOverrideCss } from "./loader.js";
/**
* 渲染整个宴会演示文稿
* @param {string} configPath - 配置文件路径 (例如 '/config/banquet.json')
* @param {string} manifestPath - 模板 manifest 路径 (例如 '/templates/manifest.json')
* @param {string} mountSelector - 容器选择器,渲染幻灯片的 DOM 节点
*/
export async function renderBanquet(
configPath = "config/banquet.json",
manifestPath = "templates/manifest.json",
mountSelector = "#app"
) {
// 读取配置
const res = await fetch(configPath);
if (!res.ok)
throw new Error(`无法加载配置文件: ${configPath} (${res.status})`);
const config = await res.json();
const container = document.querySelector(mountSelector);
if (!container) throw new Error(`容器未找到: ${mountSelector}`);
container.innerHTML = "";
// 存储每个 slide 对应的 CSS link
const overrideLinks = [];
// 遍历 config.slides 渲染
for (const [idx, slide] of config.slides.entries()) {
const { template, data = {}, overrideCss } = slide;
// 加载模板
const tpl = await loadTemplateByName(manifestPath, template);
// 注入实例级 override CSS如果配置了
let cssLink = null;
if (overrideCss) {
cssLink = loadOverrideCss(overrideCss); // 获取 link 元素
}
// 渲染 HTML
const html = render(tpl.html, data, { allowRaw: true });
// 创建 slide 容器
const slideEl = document.createElement("section");
slideEl.classList.add("banquet-slide");
slideEl.dataset.index = idx;
slideEl.innerHTML = html;
// 如果配置了背景,应用背景图
if (slide.background) {
slideEl.style.backgroundImage = `url('${slide.background}')`;
slideEl.style.backgroundSize = "cover";
slideEl.style.backgroundPosition = "center";
}
container.appendChild(slideEl);
overrideLinks[idx] = cssLink; // 保存起来
}
// 简单导航(可扩展)
initNavigation(container, overrideLinks);
}
/**
* 初始化键盘翻页逻辑
*/
function initNavigation(container, overrideLinks) {
let current = 0;
const slides = container.querySelectorAll(".banquet-slide");
function showSlide(i) {
slides.forEach((s, idx) => {
s.style.display = idx === i ? "block" : "none";
});
// 动态切换 CSS只让当前 slide 的 override 生效
overrideLinks.forEach((link, idx) => {
if (link) link.disabled = idx !== i;
});
current = i;
}
showSlide(current);
document.addEventListener("keydown", (e) => {
if (e.key === "ArrowRight" || e.key === "PageDown") {
if (current < slides.length - 1) showSlide(current + 1);
} else if (e.key === "ArrowLeft" || e.key === "PageUp") {
if (current > 0) showSlide(current - 1);
}
});
}

11
20250916/ppt/js/utils.js Normal file
View File

@@ -0,0 +1,11 @@
/** 简单工具 */
export function el(selector, root = document) {
return root.querySelector(selector);
}
export function els(selector, root = document) {
return Array.from(root.querySelectorAll(selector));
}
export function safeAssign(target, src) {
return Object.assign({}, target, src);
}

View File

@@ -0,0 +1,3 @@
/* 示例:李梅的个性化覆盖样式 */
.tpl-speech .speaker-avatar{border-color:#ff7aa2;box-shadow:0 6px 18px rgba(255,122,162,0.12)}
.tpl-speech .speech-card{background:linear-gradient(180deg, rgba(0,0,0,0.5), rgba(0,0,60,0.45))}

View File

@@ -0,0 +1 @@
.tpl-speech .speaker-avatar{border-color:#7abaff}

View File

@@ -0,0 +1,47 @@
.tpl-cover {
width: 100%;
height: 100%;
display: flex;
position: relative;
background: linear-gradient(rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.45));
}
.cover-inner {
text-align: center;
}
.middle {
position: absolute;
left: 50%;
transform: translateX(-50%);
}
.cover-title {
top: 2rem;
font-size: 4rem;
margin-bottom: 0.6rem;
}
.cover-sub {
top: 7rem;
font-size: 4rem;
opacity: 0.85;
}
.cover-date {
bottom: 4.5rem;
font-size: 1.5rem;
opacity: 0.75;
}
.cover-location {
bottom: 2rem;
font-size: 1.5rem;
opacity: 0.75;
}
@media (max-width: 768px) {
.cover-title {
font-size: 2rem;
}
}

View File

@@ -0,0 +1,10 @@
<div class="tpl-cover">
<div class="cover-inner container-sm">
<h1 class="cover-title middle">{{title}}</h1>
<p class="cover-sub middle">{{subtitle}}</p>
<div class="cover-date middle">{{date}}</div>
<div class="cover-location middle">{{location}}</div>
</div>
</div>
<!-- 模板级样式会被 loader 注入到 head -->
<!-- <link rel="stylesheet" href="/templates/cover.css" /> -->

View File

@@ -0,0 +1,4 @@
.tpl-custom{display:flex;align-items:center;justify-content:center}
.custom-card{background:rgba(255,255,255,0.03);padding:22px;border-radius:10px}
.custom-title{font-size:1.8rem;margin-bottom:12px}
.custom-content{font-size:1rem;line-height:1.6}

View File

@@ -0,0 +1,7 @@
<div class="tpl-custom container-sm">
<div class="custom-card">
<h2 class="custom-title">{{title}}</h2>
<div class="custom-content">{{{content}}}</div>
</div>
</div>
<!-- <link rel="stylesheet" href="/templates/custom.css" /> -->

View File

@@ -0,0 +1,5 @@
{
"cover": { "html": "cover.html", "css": "cover.css" },
"speech": { "html": "speech.html", "css": "speech.css" },
"custom": { "html": "custom.html", "css": "custom.css" }
}

View File

@@ -0,0 +1,384 @@
.tpl-speech {
width: 100%;
max-width: 1200px;
display: flex;
justify-content: center;
align-items: center;
position: relative;
z-index: 2;
margin: 0 auto;
}
.speech-card {
background: rgba(20, 20, 20, 0.85);
backdrop-filter: blur(12px);
border-radius: 24px;
padding: 50px;
width: 90%;
box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 215, 0, 0.1);
border: 1px solid rgba(255, 255, 255, 0.08);
position: relative;
overflow: hidden;
}
.speech-card::before {
content: "";
position: absolute;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background: radial-gradient(
circle,
rgba(255, 215, 0, 0.03) 0%,
transparent 70%
);
transform: rotate(30deg);
pointer-events: none;
}
.decorative-elements {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
overflow: hidden;
}
.decorative-corner {
position: absolute;
width: 120px;
height: 120px;
}
.corner-tl {
top: 0;
left: 0;
border-top: 2px solid rgba(255, 215, 0, 0.5);
border-left: 2px solid rgba(255, 215, 0, 0.5);
border-top-left-radius: 24px;
}
.corner-tr {
top: 0;
right: 0;
border-top: 2px solid rgba(255, 215, 0, 0.5);
border-right: 2px solid rgba(255, 215, 0, 0.5);
border-top-right-radius: 24px;
}
.corner-bl {
bottom: 0;
left: 0;
border-bottom: 2px solid rgba(255, 215, 0, 0.5);
border-left: 2px solid rgba(255, 215, 0, 0.5);
border-bottom-left-radius: 24px;
}
.corner-br {
bottom: 0;
right: 0;
border-bottom: 2px solid rgba(255, 215, 0, 0.5);
border-right: 2px solid rgba(255, 215, 0, 0.5);
border-bottom-right-radius: 24px;
}
.gold-line {
position: absolute;
height: 1px;
background: linear-gradient(
90deg,
transparent,
rgba(255, 215, 0, 0.5),
transparent
);
}
.line-1 {
top: 30%;
left: 5%;
right: 5%;
}
.line-2 {
bottom: 30%;
left: 5%;
right: 5%;
}
.speaker-info {
display: flex;
gap: 50px;
align-items: center;
position: relative;
z-index: 2;
}
.avatar-container {
position: relative;
flex-shrink: 0;
}
.speaker-avatar {
width: 320px;
height: 320px;
border-radius: 16px;
object-fit: cover;
border: 1px solid rgba(255, 215, 0, 0.3);
box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5), 0 0 30px rgba(255, 215, 0, 0.1);
transition: all 0.4s ease;
position: relative;
z-index: 2;
}
.speaker-avatar:hover {
transform: scale(1.02);
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 40px rgba(255, 215, 0, 0.15);
}
.avatar-glow {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 340px;
height: 340px;
background: radial-gradient(
circle,
rgba(255, 215, 0, 0.2) 0%,
transparent 70%
);
border-radius: 20px;
filter: blur(10px);
z-index: 1;
opacity: 0;
transition: opacity 0.4s ease;
}
.avatar-container:hover .avatar-glow {
opacity: 0.5;
}
.speaker-meta {
flex: 1;
}
.speaker-name {
font-size: 4.2rem;
font-weight: 700;
margin-bottom: 15px;
color: #fff;
text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.5);
letter-spacing: 1.5px;
position: relative;
display: inline-block;
}
.speaker-name::after {
content: "";
position: absolute;
bottom: -10px;
left: 0;
width: 80px;
height: 3px;
background: linear-gradient(90deg, #ffd700, transparent);
border-radius: 2px;
}
.speaker-name-en {
font-size: 2rem;
font-weight: 400;
margin-bottom: 25px;
color: rgba(255, 255, 255, 0.8);
font-style: italic;
letter-spacing: 1px;
}
.speaker-title {
font-size: 1.8rem;
font-weight: 300;
margin-bottom: 35px;
color: rgba(255, 255, 255, 0.85);
padding-left: 20px;
border-left: 4px solid #ffd700;
text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
}
.speaker-bio {
background: rgba(0, 0, 0, 0.25);
padding: 30px;
border-radius: 12px;
margin-top: 35px;
font-size: 1.2rem;
line-height: 1.9;
text-align: justify;
border-left: 4px solid rgba(255, 215, 0, 0.5);
box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.2);
position: relative;
}
.speaker-bio::before {
content: '"';
position: absolute;
top: 15px;
left: 15px;
font-size: 4rem;
color: rgba(255, 215, 0, 0.2);
font-family: serif;
}
.social-links {
display: flex;
gap: 20px;
margin-top: 35px;
}
.social-links a {
display: flex;
align-items: center;
justify-content: center;
width: 55px;
height: 55px;
border-radius: 50%;
background: linear-gradient(
145deg,
rgba(30, 30, 30, 0.9),
rgba(10, 10, 10, 0.9)
);
color: #ffd700;
transition: all 0.3s ease;
text-decoration: none;
font-size: 1.4rem;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3),
inset 0 1px 0 rgba(255, 255, 255, 0.1);
position: relative;
overflow: hidden;
}
.social-links a::before {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(145deg, rgba(255, 215, 0, 0.2), transparent);
opacity: 0;
transition: opacity 0.3s ease;
}
.social-links a:hover {
transform: translateY(-5px);
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4), 0 0 15px rgba(255, 215, 0, 0.2),
inset 0 1px 0 rgba(255, 255, 255, 0.1);
color: #fff;
}
.social-links a:hover::before {
opacity: 1;
}
.watermark {
position: absolute;
bottom: 25px;
right: 25px;
font-size: 1rem;
opacity: 0.5;
letter-spacing: 1px;
}
.event-title {
position: absolute;
top: 25px;
left: 25px;
font-size: 1.1rem;
opacity: 0.7;
letter-spacing: 2px;
text-transform: uppercase;
}
@media (max-width: 1100px) {
.speaker-info {
gap: 40px;
}
.speaker-avatar {
width: 280px;
height: 280px;
}
.avatar-glow {
width: 300px;
height: 300px;
}
.speaker-name {
font-size: 3.5rem;
}
.speaker-name-en {
font-size: 1.8rem;
}
.speaker-title {
font-size: 1.6rem;
}
}
@media (max-width: 992px) {
.speaker-info {
flex-direction: column;
text-align: center;
}
.speaker-name::after {
left: 50%;
transform: translateX(-50%);
}
.speaker-title {
border-left: none;
padding-left: 0;
border-bottom: 3px solid #ffd700;
padding-bottom: 15px;
}
.speech-card {
padding: 40px 30px;
}
}
@media (max-width: 576px) {
.speaker-name {
font-size: 2.8rem;
}
.speaker-name-en {
font-size: 1.5rem;
}
.speaker-title {
font-size: 1.3rem;
}
.speaker-avatar {
width: 240px;
height: 240px;
}
.avatar-glow {
width: 260px;
height: 260px;
}
.speech-card {
padding: 30px 20px;
}
.speaker-bio {
padding: 20px;
font-size: 1.1rem;
}
}

View File

@@ -0,0 +1,38 @@
<section class="tpl-speech container-sm" aria-label="speaker">
<div class="speech-card">
<div class="decorative-elements">
<div class="decorative-corner corner-tl"></div>
<div class="decorative-corner corner-tr"></div>
<div class="decorative-corner corner-bl"></div>
<div class="decorative-corner corner-br"></div>
<div class="gold-line line-1"></div>
<div class="gold-line line-2"></div>
</div>
<div class="event-title">柔佛永平关圣公联谊会 | 筹募活动基金联欢晚会</div>
<div class="speaker-info">
<div class="avatar-container">
<img class="speaker-avatar" src="{{avatar}}" alt="{{name}}" />
<div class="avatar-glow"></div>
</div>
<div class="speaker-meta">
<h2 class="speaker-name">{{name}}</h2>
<h3 class="speaker-name-en text-muted">{{nameEn}}</h3>
<p class="speaker-title text-muted">{{title}}</p>
<div class="speaker-bio">{{bio}}</div>
<div class="social-links">
<a href="#"><i class="fab fa-linkedin-in"></i></a>
<a href="#"><i class="fab fa-twitter"></i></a>
<a href="#"><i class="fab fa-github"></i></a>
<a href="#"><i class="fas fa-envelope"></i></a>
</div>
</div>
</div>
<div class="watermark">嘉宾介绍</div>
</div>
</section>

View File

@@ -0,0 +1,91 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>赞助名单展示</title>
<!-- TailwindCSS CDN -->
<script src="https://cdn.tailwindcss.com"></script>
<!-- Vue 3 CDN -->
<script src="https://unpkg.com/vue@3/dist/vue.global.prod.js"></script>
</head>
<body class="bg-gradient-to-r from-gray-100 to-gray-200 min-h-screen flex flex-col items-center py-10">
<div id="app" class="w-full max-w-5xl px-6">
<!-- 标题 -->
<h1 class="text-3xl font-bold text-center text-gray-800 mb-8">🎉 感谢所有赞助人 🎉</h1>
<!-- 赞助金额 -->
<div class="mb-12">
<h2 class="text-2xl font-semibold mb-4 text-blue-700">💰 赞助金额</h2>
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4">
<div v-for="s in sponsors" :key="s.name"
class="flex justify-between items-center bg-white shadow-md rounded-lg px-4 py-2">
<span class="font-medium text-gray-700">{{ s.name }}</span>
<span class="text-green-600 font-bold">RM {{ s.amount.toLocaleString() }}</span>
</div>
</div>
<div class="mt-4 text-right text-gray-700 font-medium">
赞助人数: {{ sponsors.length }} |
总金额: <span class="text-green-600 font-bold">RM {{ totalAmount.toLocaleString() }}</span>
</div>
</div>
<!-- 席位赞助 -->
<div>
<h2 class="text-2xl font-semibold mb-4 text-purple-700">🪑 席位赞助</h2>
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4">
<div v-for="s in seats" :key="s.name"
class="flex justify-between items-center bg-white shadow-md rounded-lg px-4 py-2">
<span class="font-medium text-gray-700">{{ s.name }}</span>
<span class="text-blue-600 font-bold">{{ s.seat }} 席</span>
</div>
</div>
<div class="mt-4 text-right text-gray-700 font-medium">
席位总数: <span class="text-blue-600 font-bold">{{ totalSeats }}</span>
</div>
</div>
</div>
<script>
const { createApp } = Vue;
createApp({
data() {
return {
sponsors: [],
seats: [],
totalAmount: 0,
totalSeats: 0
};
},
mounted() {
// 🚀 动态加载 JSON
Promise.all([
fetch('../data/sponsors.json').then(res => res.json()),
fetch('../data/seats.json').then(res => res.json())
]).then(([sponsors, seats]) => {
this.sponsors = sponsors;
this.seats = seats;
this.totalAmount = sponsors.reduce((sum, s) => sum + Number(s.amount), 0);
this.totalSeats = seats.reduce((sum, s) => sum + Number(s.seat), 0);
}).catch(err => {
console.error("加载 JSON 数据失败,使用 mock 数据", err);
// 🔙 Fallback mock 数据
this.sponsors = [
{ name: "亮湘厨中国烧烤", amount: 8000 },
{ name: "未来教育基金会", amount: 20000 },
{ name: "星空科技集团", amount: 15000 }
];
this.seats = [
{ name: "郑来兴", seat: 1 },
{ name: "未来教育基金会", seat: 5 }
];
this.totalAmount = this.sponsors.reduce((sum, s) => sum + Number(s.amount), 0);
this.totalSeats = this.seats.reduce((sum, s) => sum + Number(s.seat), 0);
});
}
}).mount('#app');
</script>
</body>
</html>

View File

@@ -0,0 +1,46 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>赞助人名单</title>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"
/>
<link rel="stylesheet" href="style.css">
</head>
<body class="theme-default">
<div class="container">
<div class="header">
<h1>赞助人名单</h1>
<!-- <p class="subtitle">衷心感谢以下企业及个人的慷慨赞助</p> -->
<div class="stats">
<!-- <div id="totalSponsors"><i class="fas fa-users"></i> 赞助单位: 0</div> -->
<div id="totalAmount"><i class="fas fa-coins"></i> 总金额: RM 0</div>
<!-- <div id="totalSeats"><i class="fas fa-chair"></i> 席位总数: 0</div> -->
</div>
</div>
<div class="main-content">
<div class="section">
<h2>赞助金额</h2>
<div class="scroll-container">
<div class="scroll-content" id="moneyList"></div>
</div>
</div>
<div class="section">
<h2>席位赞助</h2>
<div class="scroll-container">
<div class="scroll-content" id="seatList"></div>
</div>
</div>
</div>
<div class="footer">
<p id="footerText">感谢所有赞助商对本次活动的大力支持 | 2023年</p>
</div>
</div>
<script src="script.js"></script>
</body>
</html>

View File

@@ -0,0 +1,88 @@
// 自动更新年份
document.getElementById(
"footerText"
).innerHTML = `© ${new Date().getFullYear()} Tootaio.com 保留所有权利。| 由 <a href="https://tootaio.com" target="_blank" rel="noopener">Tootaio</a> 制作。`;
// 页面初始化
function initSponsorsAndSeats(sponsors, seats) {
const moneyList = document.getElementById("moneyList");
const seatList = document.getElementById("seatList");
let totalAmount = 0;
sponsors.forEach((s) => {
totalAmount += parseFloat(s.amount);
const div = document.createElement("div");
div.className = "sponsor-item";
div.innerHTML = `<span>${s.name}</span><span class="amount">RM ${Number(
s.amount
).toLocaleString()}</span>`;
moneyList.appendChild(div);
});
// 复制一份实现无缝滚动
moneyList.innerHTML += moneyList.innerHTML;
let totalSeats = 0;
seats.forEach((s) => {
totalSeats += parseInt(s.seat);
const div = document.createElement("div");
div.className = "seat-item";
div.innerHTML = `<span>${s.name}</span><span class="amount">${s.seat} 席</span>`;
seatList.appendChild(div);
});
seatList.innerHTML += seatList.innerHTML;
// 更新统计数据
const totalSponsors = document.getElementById("totalSponsors");
if (totalSponsors) {
totalSponsors.innerHTML = ""; // 清空现有内容
var totalSponsorsIcon = document.createElement("i");
totalSponsorsIcon.className = "fas fa-users";
totalSponsors.prepend(totalSponsorsIcon);
totalSponsors.appendChild(
document.createTextNode(` 赞助单位: ${sponsors.length}`)
);
}
const totalAmountEl = document.getElementById("totalAmount");
totalAmountEl.innerHTML = ""; // 清空现有内容
var totalAmountIcon = document.createElement("i");
totalAmountIcon.className = "fas fa-coins";
totalAmountEl.prepend(totalAmountIcon);
totalAmountEl.appendChild(
document.createTextNode(` 总金额: RM ${totalAmount.toLocaleString()}`)
);
const totalSeatsEl = document.getElementById("totalSeats");
if (totalSeatsEl) {
totalSeatsEl.innerHTML = ""; // 清空现有内容
var totalSeatsIcon = document.createElement("i");
totalSeatsIcon.className = "fas fa-chair";
totalSeatsEl.prepend(totalSeatsIcon);
totalSeatsEl.appendChild(
document.createTextNode(` 席位总数: ${totalSeats}`)
);
}
}
// 🚀 动态加载 JSON 数据
Promise.all([
fetch("../data/sponsors.json").then((res) => res.json()),
fetch("../data/seats.json").then((res) => res.json()),
])
.then(([sponsors, seats]) => {
initSponsorsAndSeats(sponsors, seats);
})
.catch((err) => {
console.error("加载 JSON 数据失败,回退到本地 mock 数据", err);
// 备用 mock 数据(防止页面空白)
const mockSponsors = [
{ name: "亮湘厨中国烧烤", amount: 8000 },
{ name: "星空科技集团", amount: 15000 },
{ name: "未来教育基金会", amount: 20000 },
];
const mockSeats = [
{ name: "郑来兴", seat: 1 },
{ name: "未来教育基金会", seat: 5 },
];
initSponsorsAndSeats(mockSponsors, mockSeats);
});

View File

@@ -0,0 +1,237 @@
:root {
/* 橙色主题 */
--primary-bg: linear-gradient(135deg, #332211, #cc5500);
--card-bg: rgba(0, 0, 0, 0.35);
--primary-text: #fff5e6;
--accent-color: #ff8c42;
--secondary-accent: #ffd700;
--header-color: #ffd700;
--stats-color: #ff8c42;
--item-bg: rgba(255, 255, 255, 0.07);
--sponsor-border: #ff8c42;
--seat-border: #ffd700;
--shadow-color: rgba(0, 0, 0, 0.55);
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
transition: background-color 0.5s ease, color 0.5s ease, transform 0.3s ease;
}
body {
background: var(--primary-bg);
color: var(--primary-text);
font-family: "Microsoft YaHei", sans-serif;
padding: 20px;
overflow-x: hidden;
min-height: 100vh;
}
.container {
max-width: 1800px;
margin: auto;
position: relative;
}
.header,
.footer {
text-align: center;
padding: 30px;
background: var(--card-bg);
border-radius: 20px;
box-shadow: 0 10px 30px var(--shadow-color);
backdrop-filter: blur(10px);
margin-bottom: 30px;
border: 1px solid rgba(255, 255, 255, 0.1);
}
.footer {
margin-top: 30px;
padding: 20px;
}
h1 {
font-size: 2rem;
color: var(--header-color);
margin-bottom: 15px;
text-shadow: 0 2px 10px var(--shadow-color);
letter-spacing: 1.5px;
}
a {
color: var(--accent-color);
text-decoration: none;
transition: color 0.3s ease;
}
.subtitle {
font-size: 1.5rem;
color: var(--primary-text);
opacity: 0.9;
margin-bottom: 25px;
}
.stats {
display: flex;
justify-content: center;
gap: 50px;
margin: 25px 0;
}
.stats div {
font-size: 3rem;
color: var(--stats-color);
font-weight: bold;
display: flex;
align-items: center;
gap: 12px;
padding: 12px 20px;
background: var(--item-bg);
border-radius: 12px;
}
.stats i {
font-size: 2.2rem;
}
.main-content {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 30px;
margin-top: 20px;
}
.section {
background: var(--card-bg);
border-radius: 20px;
padding: 30px;
height: 650px;
position: relative;
overflow: hidden;
box-shadow: 0 10px 30px var(--shadow-color);
backdrop-filter: blur(5px);
border: 1px solid rgba(255, 255, 255, 0.1);
}
.section h2 {
text-align: center;
color: var(--accent-color);
margin-bottom: 25px;
font-size: 2.4rem;
text-shadow: 0 1px 5px var(--shadow-color);
position: relative;
padding-bottom: 12px;
}
.section h2:after {
content: "";
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
width: 100px;
height: 4px;
background: var(--secondary-accent);
border-radius: 4px;
}
.scroll-container {
height: 540px;
overflow: hidden;
position: relative;
border-radius: 15px;
margin-top: 15px;
}
.scroll-content {
position: absolute;
width: 100%;
}
.sponsor-item,
.seat-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 18px 25px;
margin: 15px 0;
background: var(--item-bg);
border-radius: 12px;
font-size: 1.7rem;
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.sponsor-item:hover,
.seat-item:hover {
transform: translateY(-3px);
box-shadow: 0 8px 20px var(--shadow-color);
}
.sponsor-item {
border-left: 6px solid var(--sponsor-border);
}
.seat-item {
border-left: 6px solid var(--seat-border);
}
.amount {
color: var(--secondary-accent);
font-weight: bold;
font-size: 1.8rem;
}
.scroll-content {
animation: scroll 40s linear infinite;
}
.scroll-content:hover {
animation-play-state: paused;
}
@keyframes scroll {
0% {
transform: translateY(0);
}
100% {
transform: translateY(-50%);
}
}
/* 响应式设计 */
@media (max-width: 1200px) {
.main-content {
grid-template-columns: 1fr;
}
h1 {
font-size: 3rem;
}
.stats {
gap: 20px;
}
}
@media (max-width: 768px) {
.stats {
flex-direction: column;
gap: 15px;
}
.header,
.footer {
padding: 20px;
}
.section {
padding: 20px;
height: 500px;
}
.scroll-container {
height: 400px;
}
}