几何动画预设集成验证

正在检查服务器状态...
正在检查预设集成...
`; // 检查服务器状态 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 += `
预设名称
${presetData.name}
预设类型
${presetData.kind}
对齐方式
${presetData.align}
几何形状
${presetData.shapes.join(', ')}
颜色方案
${presetData.colors.join(', ')}
动画效果
${presetData.animations.join(', ')}
`; presetDetails.innerHTML = detailsHTML; presetInfo.style.display = 'block'; // 滚动到详情区域 presetInfo.scrollIntoView({ behavior: 'smooth' }); } // 页面加载时自动检查 window.onload = function() { checkServer(); };