Clean up stray files; fix widget.html hasOwnProperty; fix package.json test script

Co-authored-by: yhlhoh <205733785+yhlhoh@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]andyhlhoh committed 2026-03-17 02:51:26 +00:00
1 parent a845707585
commit 55b1d861cc
7 files changed
+2 -1392

No files matched your search

-1
View File
@@ -1 +0,0 @@
+1 -1
View File
@@ -4,7 +4,7 @@
"description": "",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"test": "echo \"No tests configured\"",
"start": "node server.js"
},
"keywords": [],
-1
View File
@@ -1 +0,0 @@
-335
View File
@@ -1,335 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>几何动画预设测试</title>
<style>
body {
font-family: system-ui, sans-serif;
margin: 0;
padding: 20px;
background: #1a1a2e;
color: #fff;
}
.container {
max-width: 1200px;
margin: 0 auto;
}
h1 {
color: #ff69b4;
text-align: center;
margin-bottom: 30px;
}
.test-area {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 30px;
margin-bottom: 40px;
}
.widget-frame {
width: 100%;
height: 200px;
border: 2px solid #333;
border-radius: 10px;
overflow: hidden;
background: #000;
}
.controls {
background: rgba(255, 255, 255, 0.05);
padding: 20px;
border-radius: 10px;
border: 1px solid rgba(255, 255, 255, 0.1);
}
.control-group {
margin-bottom: 20px;
}
label {
display: block;
margin-bottom: 8px;
color: #00bfff;
font-weight: 600;
}
select, button {
width: 100%;
padding: 10px;
border-radius: 6px;
border: 1px solid #444;
background: #2a2a3e;
color: #fff;
font-size: 14px;
}
button {
background: linear-gradient(135deg, #ff69b4, #00bfff);
border: none;
cursor: pointer;
font-weight: 600;
transition: transform 0.2s;
}
button:hover {
transform: translateY(-2px);
}
.info {
background: rgba(0, 191, 255, 0.1);
padding: 15px;
border-radius: 8px;
border-left: 4px solid #00bfff;
margin-top: 20px;
}
.info h3 {
margin-top: 0;
color: #00bfff;
}
.preset-list {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 20px;
margin-top: 30px;
}
.preset-card {
background: rgba(255, 255, 255, 0.05);
border-radius: 10px;
padding: 20px;
border: 1px solid rgba(255, 255, 255, 0.1);
transition: all 0.3s ease;
}
.preset-card:hover {
transform: translateY(-5px);
border-color: #ff69b4;
box-shadow: 0 10px 30px rgba(255, 105, 180, 0.2);
}
.preset-name {
font-size: 18px;
font-weight: 700;
color: #ff69b4;
margin-bottom: 8px;
}
.preset-desc {
font-size: 14px;
opacity: 0.8;
margin-bottom: 15px;
}
.preset-meta {
display: flex;
justify-content: space-between;
font-size: 12px;
opacity: 0.6;
}
</style>
</head>
<body>
<div class="container">
<h1>几何动画预设测试</h1>
<div class="test-area">
<div>
<h2>预设预览</h2>
<div class="widget-frame" id="widgetFrame">
<!-- 预设将在这里加载 -->
</div>
</div>
<div class="controls">
<h2>控制面板</h2>
<div class="control-group">
<label for="presetSelect">选择预设</label>
<select id="presetSelect">
<option value="">请选择预设...</option>
</select>
</div>
<div class="control-group">
<label for="alignSelect">对齐方式</label>
<select id="alignSelect">
<option value="left">左对齐</option>
<option value="center">居中</option>
<option value="right" selected>右对齐</option>
</select>
</div>
<button id="loadPresetBtn">加载预设</button>
<button id="refreshBtn" style="margin-top: 10px; background: linear-gradient(135deg, #9d4edd, #ff69b4);">刷新预设列表</button>
<div class="info">
<h3>使用说明</h3>
<p>1. 选择预设类型</p>
<p>2. 调整对齐方式</p>
<p>3. 点击"加载预设"按钮</p>
<p>4. 预设将显示在左侧预览区域</p>
</div>
</div>
</div>
<h2>可用预设列表</h2>
<div class="preset-list" id="presetList">
<!-- 预设列表将通过JS动态生成 -->
</div>
</div>
<script>
// 获取DOM元素
const widgetFrame = document.getElementById('widgetFrame');
const presetSelect = document.getElementById('presetSelect');
const alignSelect = document.getElementById('alignSelect');
const loadPresetBtn = document.getElementById('loadPresetBtn');
const refreshBtn = document.getElementById('refreshBtn');
const presetList = document.getElementById('presetList');
// 获取预设列表
async function fetchPresets() {
try {
const response = await fetch('/api/presets');
const presets = await response.json();
return presets;
} catch (error) {
console.error('获取预设列表失败:', error);
return [];
}
}
// 加载预设到iframe
function loadPreset(preset) {
const align = alignSelect.value;
// 创建iframe
const iframe = document.createElement('iframe');
iframe.style.width = '100%';
iframe.style.height = '100%';
iframe.style.border = 'none';
iframe.sandbox = 'allow-scripts allow-same-origin';
// 设置iframe内容
const htmlContent = `
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
html, body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
overflow: hidden;
background: transparent;
}
${preset.extraCss || ''}
</style>
</head>
<body>
${preset.html}
</body>
</html>
`;
// 清空并添加新的iframe
widgetFrame.innerHTML = '';
widgetFrame.appendChild(iframe);
// 写入内容
const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
iframeDoc.open();
iframeDoc.write(htmlContent);
iframeDoc.close();
}
// 填充预设选择器
async function populatePresetSelect() {
const presets = await fetchPresets();
// 清空选项
presetSelect.innerHTML = '<option value="">请选择预设...</option>';
// 添加预设选项
presets.forEach((preset, index) => {
const option = document.createElement('option');
option.value = index;
option.textContent = preset.name;
presetSelect.appendChild(option);
});
// 显示预设列表
displayPresetList(presets);
}
// 显示预设列表
function displayPresetList(presets) {
presetList.innerHTML = '';
presets.forEach((preset, index) => {
const card = document.createElement('div');
card.className = 'preset-card';
card.innerHTML = `
<div class="preset-name">${preset.name}</div>
<div class="preset-desc">${preset.description}</div>
<div class="preset-meta">
<span>类型: ${preset.kind}</span>
<span>对齐: ${preset.align}</span>
</div>
`;
// 点击卡片加载预设
card.addEventListener('click', () => {
presetSelect.value = index;
loadPreset(preset);
});
presetList.appendChild(card);
});
}
// 事件监听
loadPresetBtn.addEventListener('click', async () => {
const selectedIndex = presetSelect.value;
if (selectedIndex === '') {
alert('请先选择一个预设');
return;
}
const presets = await fetchPresets();
const selectedPreset = presets[selectedIndex];
if (selectedPreset) {
loadPreset(selectedPreset);
}
});
refreshBtn.addEventListener('click', populatePresetSelect);
// 页面加载时初始化
document.addEventListener('DOMContentLoaded', () => {
populatePresetSelect();
// 默认加载几何动画预设
setTimeout(async () => {
const presets = await fetchPresets();
const geometricPreset = presets.find(p => p.name === '几何动画预设');
if (geometricPreset) {
const index = presets.indexOf(geometricPreset);
presetSelect.value = index;
loadPreset(geometricPreset);
}
}, 1000);
});
</script>
</body>
</html>
-453
View File
@@ -1,453 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>几何动画预设 - 简单测试</title>
<style>
body {
margin: 0;
padding: 0;
background: #000;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
font-family: system-ui, sans-serif;
}
.test-container {
width: 800px;
height: 200px;
position: relative;
border: 2px solid #333;
border-radius: 10px;
overflow: hidden;
background: #000;
}
.controls {
position: absolute;
top: 10px;
right: 10px;
z-index: 1000;
background: rgba(0, 0, 0, 0.7);
padding: 10px;
border-radius: 5px;
border: 1px solid #444;
}
button {
background: linear-gradient(135deg, #ff69b4, #00bfff);
border: none;
color: white;
padding: 8px 16px;
border-radius: 4px;
cursor: pointer;
font-weight: 600;
margin: 5px;
}
button:hover {
opacity: 0.9;
}
.status {
position: absolute;
bottom: 10px;
left: 10px;
color: #00ff88;
font-size: 12px;
background: rgba(0, 0, 0, 0.7);
padding: 5px 10px;
border-radius: 4px;
}
</style>
</head>
<body>
<div class="test-container" id="widgetContainer">
<!-- 几何动画预设将在这里加载 -->
</div>
<div class="controls">
<button onclick="loadGeometricPreset()">加载几何动画预设</button>
<button onclick="reloadPreset()">重新加载</button>
<button onclick="toggleAnimation()">暂停/继续动画</button>
</div>
<div class="status" id="status">就绪</div>
<script>
let currentIframe = null;
let animationPaused = false;
// 几何动画预设HTML
const geometricPresetHTML = `<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'/>
<style>
html, body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
overflow: hidden;
font-family: system-ui, -apple-system, sans-serif;
color: #fff;
background: transparent;
}
.lt-root {
position: relative;
width: 100%;
height: 100%;
padding: 15px 20px;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: flex-end;
}
/* 几何图形背景 */
.geometric-bg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 0;
}
.geo-shape {
position: absolute;
opacity: 0.4;
filter: blur(0.5px);
mix-blend-mode: screen;
animation: floatGeo 8s infinite ease-in-out;
}
@keyframes floatGeo {
0%, 100% {
transform: translate(0, 0) rotate(0deg);
}
50% {
transform: translate(10px, -15px) rotate(180deg);
}
}
/* 内容面板 */
.lt-container {
position: relative;
z-index: 1;
background: rgba(15, 20, 30, 0.9);
backdrop-filter: blur(15px);
border-radius: 14px;
padding: 18px 22px;
border: 1px solid rgba(255, 255, 255, 0.15);
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
max-width: 380px;
min-width: 300px;
transition: all 0.3s ease;
}
.lt-container:hover {
transform: translateY(-2px);
box-shadow: 0 15px 50px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.2);
}
.lt-header {
display: flex;
align-items: center;
margin-bottom: 12px;
}
.geo-icon {
width: 32px;
height: 32px;
background: linear-gradient(135deg, #ff69b4, #00bfff);
border-radius: 8px;
margin-right: 10px;
display: flex;
align-items: center;
justify-content: center;
font-size: 16px;
animation: rotateIcon 6s infinite linear;
}
.geo-icon span {
transform: rotate(-45deg);
}
@keyframes rotateIcon {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.lt-title {
font-size: 20px;
font-weight: 700;
background: linear-gradient(90deg, #ff69b4, #00bfff);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
margin-bottom: 2px;
}
.lt-tag {
font-size: 11px;
letter-spacing: 0.08em;
text-transform: uppercase;
color: #00bfff;
font-weight: 600;
}
.lt-description {
font-size: 13px;
line-height: 1.5;
opacity: 0.9;
margin-bottom: 16px;
}
.lt-features {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 10px;
margin-bottom: 16px;
}
.lt-feature {
background: rgba(255, 255, 255, 0.05);
border-radius: 8px;
padding: 10px;
border: 1px solid rgba(255, 255, 255, 0.08);
}
.lt-feature-title {
font-size: 12px;
font-weight: 600;
margin-bottom: 4px;
}
.lt-feature-desc {
font-size: 10px;
opacity: 0.7;
line-height: 1.3;
}
.lt-status {
display: flex;
align-items: center;
justify-content: space-between;
padding-top: 12px;
border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.status-dot {
width: 6px;
height: 6px;
background: #00ff88;
border-radius: 50%;
animation: pulseDot 2s infinite;
}
@keyframes pulseDot {
0%, 100% {
opacity: 1;
}
50% {
opacity: 0.5;
}
}
.status-text {
font-size: 11px;
opacity: 0.8;
}
.lt-time {
font-size: 10px;
opacity: 0.6;
}
</style>
</head>
<body>
<div class="lt-root">
<div class="geometric-bg" id="geoContainer"></div>
<div class="lt-container">
<div class="lt-header">
<div class="geo-icon"><span>◈</span></div>
<div>
<div class="lt-title">几何动画预设</div>
<div class="lt-tag">GEOMETRIC PRESET</div>
</div>
</div>
<div class="lt-description">
动态几何图形动画效果,包含多种形状的浮动动画,适合科技展示和创意直播。
</div>
<div class="lt-features">
<div class="lt-feature">
<div class="lt-feature-title">动态图形</div>
<div class="lt-feature-desc">多种几何形状浮动动画</div>
</div>
<div class="lt-feature">
<div class="lt-feature-title">渐变色彩</div>
<div class="lt-feature-desc">彩虹渐变配色方案</div>
</div>
<div class="lt-feature">
<div class="lt-feature-title">3D效果</div>
<div class="lt-feature-desc">CSS 3D变换动画</div>
</div>
<div class="lt-feature">
<div class="lt-feature-title">实时交互</div>
<div class="lt-feature-desc">鼠标悬停响应效果</div>
</div>
</div>
<div class="lt-status">
<div style="display: flex; align-items: center; gap: 6px;">
<div class="status-dot"></div>
<div class="status-text">动画运行中</div>
</div>
<div class="lt-time" id="timeDisplay">15:30</div>
</div>
</div>
</div>
<script>
// 更新时间显示
function updateTime() {
const now = new Date();
const hours = now.getHours().toString().padStart(2, '0');
const minutes = now.getMinutes().toString().padStart(2, '0');
document.getElementById('timeDisplay').textContent = \`\${hours}:\${minutes}\`;
}
// 创建几何图形
function createGeometry() {
const container = document.getElementById('geoContainer');
const shapes = ['circle', 'square', 'triangle'];
const colors = [
'rgba(255,105,180,0.25)',
'rgba(0,191,255,0.25)',
'rgba(50,205,50,0.25)',
'rgba(255,215,0,0.25)',
'rgba(138,43,226,0.25)'
];
// 创建10个几何图形
for (let i = 0; i < 10; i++) {
const shape = document.createElement('div');
shape.className = 'geo-shape';
const shapeType = shapes[Math.floor(Math.random() * shapes.length)];
const color = colors[Math.floor(Math.random() * colors.length)];
const size = Math.random() * 60 + 20;
const left = Math.random() * 100;
const top = Math.random() * 100;
const duration = Math.random() * 6 + 4;
const delay = Math.random() * 2;
shape.style.width = \`\${size}px\`;
shape.style.height = \`\${size}px\`;
shape.style.left = \`\${left}%\`;
shape.style.top = \`\${top}%\`;
shape.style.animationDelay = \`\${delay}s\`;
shape.style.animationDuration = \`\${duration}s\`;
if (shapeType === 'triangle') {
shape.style.width = '0';
shape.style.height = '0';
shape.style.borderLeft = \`\${size/2}px solid transparent\`;
shape.style.borderRight = \`\${size/2}px solid transparent\`;
shape.style.borderBottom = \`\${size}px solid \${color}\`;
shape.style.background = 'none';
} else if (shapeType === 'circle') {
shape.style.borderRadius = '50%';
shape.style.background = \`radial-gradient(circle, \${color}, transparent 70%)\`;
} else {
shape.style.borderRadius = '8px';
shape.style.background = color;
}
container.appendChild(shape);
}
}
// 初始化
document.addEventListener('DOMContentLoaded', function() {
updateTime();
createGeometry();
setInterval(updateTime, 60000);
});
</script>
</body>
</html>`;
function loadGeometricPreset() {
const container = document.getElementById('widgetContainer');
container.innerHTML = '';
const iframe = document.createElement('iframe');
iframe.style.width = '100%';
iframe.style.height = '100%';
iframe.style.border = 'none';
iframe.sandbox = 'allow-scripts allow-same-origin';
container.appendChild(iframe);
currentIframe = iframe;
const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
iframeDoc.open();
iframeDoc.write(geometricPresetHTML);
iframeDoc.close();
document.getElementById('status').textContent = '几何动画预设已加载';
document.getElementById('status').style.color = '#00ff88';
}
function reloadPreset() {
if (currentIframe) {
const iframeDoc = currentIframe.contentDocument || currentIframe.contentWindow.document;
iframeDoc.open();
iframeDoc.write(geometricPresetHTML);
iframeDoc.close();
document.getElementById('status').textContent = '预设已重新加载';
document.getElementById('status').style.color = '#00bfff';
}
}
function toggleAnimation() {
if (!currentIframe) return;
const iframeDoc = currentIframe.contentDocument || currentIframe.contentWindow.document;
const shapes = iframeDoc.querySelectorAll('.geo-shape');
animationPaused = !animationPaused;
shapes.forEach(shape => {
if (animationPaused) {
shape.style.animationPlayState = 'paused';
} else {
shape.style.animationPlayState = 'running';
}
});
const statusText = animationPaused ? '动画已暂停' : '动画已继续';
document.getElementById('status').textContent = statusText;
document.getElementById('status').style.color = animationPaused ? '#ff69b4' : '#00ff88';
}
// 页面加载时自动加载预设
window.onload = function() {
setTimeout(loadGeometricPreset, 500);
};
</script>
</body>
</html>
-598
View File
@@ -1,598 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>验证几何动画预设集成</title>
<style>
body {
font-family: system-ui, sans-serif;
margin: 20px;
background: #1a1a2e;
color: #fff;
}
.container {
max-width: 800px;
margin: 0 auto;
}
h1 {
color: #ff69b4;
text-align: center;
}
.status {
padding: 15px;
border-radius: 8px;
margin: 20px 0;
text-align: center;
font-weight: bold;
}
.success {
background: rgba(0, 255, 136, 0.1);
border: 2px solid #00ff88;
color: #00ff88;
}
.error {
background: rgba(255, 69, 0, 0.1);
border: 2px solid #ff4500;
color: #ff4500;
}
.info {
background: rgba(0, 191, 255, 0.1);
border: 2px solid #00bfff;
color: #00bfff;
}
.preset-preview {
width: 100%;
height: 200px;
border: 2px solid #333;
border-radius: 10px;
overflow: hidden;
background: #000;
margin: 20px 0;
}
.controls {
display: flex;
gap: 10px;
margin: 20px 0;
}
button {
padding: 10px 20px;
border: none;
border-radius: 6px;
background: linear-gradient(135deg, #ff69b4, #00bfff);
color: white;
font-weight: bold;
cursor: pointer;
flex: 1;
}
button:hover {
opacity: 0.9;
}
.preset-info {
background: rgba(255, 255, 255, 0.05);
padding: 20px;
border-radius: 10px;
margin-top: 20px;
}
.preset-info h3 {
color: #ff69b4;
margin-top: 0;
}
.preset-details {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 10px;
margin-top: 15px;
}
.detail-item {
background: rgba(255, 255, 255, 0.03);
padding: 10px;
border-radius: 6px;
border: 1px solid rgba(255, 255, 255, 0.1);
}
.detail-label {
font-size: 12px;
opacity: 0.7;
margin-bottom: 5px;
}
.detail-value {
font-size: 14px;
font-weight: 600;
}
</style>
</head>
<body>
<div class="container">
<h1>几何动画预设集成验证</h1>
<div id="serverStatus" class="status info">
正在检查服务器状态...
</div>
<div id="presetStatus" class="status info">
正在检查预设集成...
</div>
<div class="controls">
<button onclick="checkServer()">检查服务器</button>
<button onclick="loadPreset()">加载预设</button>
<button onclick="showPresetInfo()">显示预设信息</button>
</div>
<div class="preset-preview" id="previewFrame">
<!-- 预设将在这里显示 -->
</div>
<div class="preset-info" id="presetInfo" style="display: none;">
<h3>几何动画预设详情</h3>
<div class="preset-details" id="presetDetails">
<!-- 预设详情将在这里显示 -->
</div>
</div>
</div>
<script>
// 几何动画预设的HTML内容(从server.js中提取)
const geometricPresetHTML = `<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'/>
<style>
html, body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
overflow: hidden;
font-family: system-ui, -apple-system, sans-serif;
color: #fff;
background: transparent;
}
.lt-root {
position: relative;
width: 100%;
height: 100%;
padding: 15px 20px;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: flex-end;
}
.geometric-bg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 0;
}
.geo-shape {
position: absolute;
opacity: 0.4;
filter: blur(0.5px);
mix-blend-mode: screen;
animation: floatGeo 8s infinite ease-in-out;
}
@keyframes floatGeo {
0%, 100% {
transform: translate(0, 0) rotate(0deg);
}
50% {
transform: translate(10px, -15px) rotate(180deg);
}
}
.lt-container {
position: relative;
z-index: 1;
background: rgba(15, 20, 30, 0.9);
backdrop-filter: blur(15px);
border-radius: 14px;
padding: 18px 22px;
border: 1px solid rgba(255, 255, 255, 0.15);
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
max-width: 380px;
min-width: 300px;
transition: all 0.3s ease;
}
.lt-container:hover {
transform: translateY(-2px);
box-shadow: 0 15px 50px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.2);
}
.lt-header {
display: flex;
align-items: center;
margin-bottom: 12px;
}
.geo-icon {
width: 32px;
height: 32px;
background: linear-gradient(135deg, #ff69b4, #00bfff);
border-radius: 8px;
margin-right: 10px;
display: flex;
align-items: center;
justify-content: center;
font-size: 16px;
animation: rotateIcon 6s infinite linear;
}
.geo-icon span {
transform: rotate(-45deg);
}
@keyframes rotateIcon {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.lt-title {
font-size: 20px;
font-weight: 700;
background: linear-gradient(90deg, #ff69b4, #00bfff);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
margin-bottom: 2px;
}
.lt-tag {
font-size: 11px;
letter-spacing: 0.08em;
text-transform: uppercase;
color: #00bfff;
font-weight: 600;
}
.lt-description {
font-size: 13px;
line-height: 1.5;
opacity: 0.9;
margin-bottom: 16px;
}
.lt-features {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 10px;
margin-bottom: 16px;
}
.lt-feature {
background: rgba(255, 255, 255, 0.05);
border-radius: 8px;
padding: 10px;
border: 1px solid rgba(255, 255, 255, 0.08);
}
.lt-feature-title {
font-size: 12px;
font-weight: 600;
margin-bottom: 4px;
}
.lt-feature-desc {
font-size: 10px;
opacity: 0.7;
line-height: 1.3;
}
.lt-status {
display: flex;
align-items: center;
justify-content: space-between;
padding-top: 12px;
border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.status-dot {
width: 6px;
height: 6px;
background: #00ff88;
border-radius: 50%;
animation: pulseDot 2s infinite;
}
@keyframes pulseDot {
0%, 100% {
opacity: 1;
}
50% {
opacity: 0.5;
}
}
.status-text {
font-size: 11px;
opacity: 0.8;
}
.lt-time {
font-size: 10px;
opacity: 0.6;
}
</style>
</head>
<body>
<div class="lt-root">
<div class="geometric-bg" id="geoContainer"></div>
<div class="lt-container">
<div class="lt-header">
<div class="geo-icon"><span>◈</span></div>
<div>
<div class="lt-title">几何动画预设</div>
<div class="lt-tag">GEOMETRIC PRESET</div>
</div>
</div>
<div class="lt-description">
动态几何图形动画效果,包含多种形状的浮动动画,适合科技展示和创意直播。
</div>
<div class="lt-features">
<div class="lt-feature">
<div class="lt-feature-title">动态图形</div>
<div class="lt-feature-desc">多种几何形状浮动动画</div>
</div>
<div class="lt-feature">
<div class="lt-feature-title">渐变色彩</div>
<div class="lt-feature-desc">彩虹渐变配色方案</div>
</div>
<div class="lt-feature">
<div class="lt-feature-title">3D效果</div>
<div class="lt-feature-desc">CSS 3D变换动画</div>
</div>
<div class="lt-feature">
<div class="lt-feature-title">实时交互</div>
<div class="lt-feature-desc">鼠标悬停响应效果</div>
</div>
</div>
<div class="lt-status">
<div style="display: flex; align-items: center; gap: 6px;">
<div class="status-dot"></div>
<div class="status-text">动画运行中</div>
</div>
<div class="lt-time" id="timeDisplay">15:30</div>
</div>
</div>
</div>
<script>
function updateTime() {
const now = new Date();
const hours = now.getHours().toString().padStart(2, '0');
const minutes = now.getMinutes().toString().padStart(2, '0');
document.getElementById('timeDisplay').textContent = \`\${hours}:\${minutes}\`;
}
function createGeometry() {
const container = document.getElementById('geoContainer');
const shapes = ['circle', 'square', 'triangle'];
const colors = [
'rgba(255,105,180,0.25)',
'rgba(0,191,255,0.25)',
'rgba(50,205,50,0.25)',
'rgba(255,215,0,0.25)',
'rgba(138,43,226,0.25)'
];
for (let i = 0; i < 10; i++) {
const shape = document.createElement('div');
shape.className = 'geo-shape';
const shapeType = shapes[Math.floor(Math.random() * shapes.length)];
const color = colors[Math.floor(Math.random() * colors.length)];
const size = Math.random() * 60 + 20;
const left = Math.random() * 100;
const top = Math.random() * 100;
const duration = Math.random() * 6 + 4;
const delay = Math.random() * 2;
shape.style.width = \`\${size}px\`;
shape.style.height = \`\${size}px\`;
shape.style.left = \`\${left}%\`;
shape.style.top = \`\${top}%\`;
shape.style.animationDelay = \`\${delay}s\`;
shape.style.animationDuration = \`\${duration}s\`;
if (shapeType === 'triangle') {
shape.style.width = '0';
shape.style.height = '0';
shape.style.borderLeft = \`\${size/2}px solid transparent\`;
shape.style.borderRight = \`\${size/2}px solid transparent\`;
shape.style.borderBottom = \`\${size}px solid \${color}\`;
shape.style.background = 'none';
} else if (shapeType === 'circle') {
shape.style.borderRadius = '50%';
shape.style.background = \`radial-gradient(circle, \${color}, transparent 70%)\`;
} else {
shape.style.borderRadius = '8px';
shape.style.background = color;
}
container.appendChild(shape);
}
}
document.addEventListener('DOMContentLoaded', function() {
updateTime();
createGeometry();
setInterval(updateTime, 60000);
});
</script>
</body>
</html>`;
// 检查服务器状态
async function checkServer() {
const statusDiv = document.getElementById('serverStatus');
statusDiv.className = 'status info';
statusDiv.textContent = '正在检查服务器状态...';
try {
const response = await fetch('/health');
if (response.ok) {
statusDiv.className = 'status success';
statusDiv.textContent = '✅ 服务器运行正常';
// 检查预设
checkPresetIntegration();
} else {
statusDiv.className = 'status error';
statusDiv.textContent = '❌ 服务器响应异常';
}
} catch (error) {
statusDiv.className = 'status error';
statusDiv.textContent = '❌ 无法连接到服务器';
console.error('服务器检查失败:', error);
}
}
// 检查预设集成
async function checkPresetIntegration() {
const statusDiv = document.getElementById('presetStatus');
statusDiv.className = 'status info';
statusDiv.textContent = '正在检查预设集成...';
try {
const response = await fetch('/api/presets');
if (response.ok) {
const presets = await response.json();
const geometricPreset = presets.find(p => p.name === '几何动画预设');
if (geometricPreset) {
statusDiv.className = 'status success';
statusDiv.textContent = `✅ 几何动画预设已成功集成 (第${presets.indexOf(geometricPreset) + 1}个预设)`;
} else {
statusDiv.className = 'status error';
statusDiv.textContent = '❌ 未找到几何动画预设';
}
} else {
statusDiv.className = 'status error';
statusDiv.textContent = '❌ 无法获取预设列表';
}
} catch (error) {
statusDiv.className = 'status error';
statusDiv.textContent = '❌ 检查预设集成失败';
console.error('预设检查失败:', error);
}
}
// 加载预设到预览框
function loadPreset() {
const previewFrame = document.getElementById('previewFrame');
previewFrame.innerHTML = '';
const iframe = document.createElement('iframe');
iframe.style.width = '100%';
iframe.style.height = '100%';
iframe.style.border = 'none';
iframe.sandbox = 'allow-scripts allow-same-origin';
previewFrame.appendChild(iframe);
const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
iframeDoc.open();
iframeDoc.write(geometricPresetHTML);
iframeDoc.close();
// 更新状态
const statusDiv = document.getElementById('presetStatus');
statusDiv.className = 'status success';
statusDiv.textContent = '✅ 几何动画预设已加载到预览框';
}
// 显示预设信息
function showPresetInfo() {
const presetInfo = document.getElementById('presetInfo');
const presetDetails = document.getElementById('presetDetails');
const presetData = {
name: '几何动画预设',
description: '动态几何图形动画,包含多种形状的浮动效果',
kind: 'geometric',
align: 'right',
features: [
'动态几何图形动画',
'多种形状浮动效果',
'渐变色彩方案',
'3D变换动画',
'实时交互效果',
'响应式设计'
],
shapes: ['圆形', '方形', '三角形'],
colors: ['粉色渐变', '蓝色渐变', '绿色渐变', '黄色渐变', '紫色渐变'],
animations: ['浮动动画', '旋转动画', '脉冲效果', '3D变换']
};
// 生成详情HTML
let detailsHTML = '';
detailsHTML += `
<div class="detail-item">
<div class="detail-label">预设名称</div>
<div class="detail-value">${presetData.name}</div>
</div>
<div class="detail-item">
<div class="detail-label">预设类型</div>
<div class="detail-value">${presetData.kind}</div>
</div>
<div class="detail-item">
<div class="detail-label">对齐方式</div>
<div class="detail-value">${presetData.align}</div>
</div>
<div class="detail-item">
<div class="detail-label">几何形状</div>
<div class="detail-value">${presetData.shapes.join(', ')}</div>
</div>
<div class="detail-item">
<div class="detail-label">颜色方案</div>
<div class="detail-value">${presetData.colors.join(', ')}</div>
</div>
<div class="detail-item">
<div class="detail-label">动画效果</div>
<div class="detail-value">${presetData.animations.join(', ')}</div>
</div>
`;
presetDetails.innerHTML = detailsHTML;
presetInfo.style.display = 'block';
// 滚动到详情区域
presetInfo.scrollIntoView({ behavior: 'smooth' });
}
// 页面加载时自动检查
window.onload = function() {
checkServer();
};
</script>
</body>
</html>
+1 -3
View File
@@ -137,9 +137,7 @@
function fillPlaceholders(html, contentData) {
if (!html || !contentData) return html || '';
return html.replace(/\{\{(\w+)\}\}/g, (match, key) => {
return Object.prototype.hasOwnProperty.call(contentData, key)
? String(contentData[key])
: match;
return key in contentData ? String(contentData[key]) : match;
});
}