diff --git a/public/index.html b/public/index.html index 4446dbb..8aa5c44 100644 --- a/public/index.html +++ b/public/index.html @@ -56,7 +56,7 @@ } .stats-summary { - background-color: #f5f5f5; + background-color: #44444423; padding: 15px; border-radius: 8px; margin: 20px 0; @@ -80,6 +80,43 @@ grid-template-columns: 1fr; } } + + .stats-header { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 10px; + } + + .refresh-icon { + font-size: 16px; + margin-left: 10px; + display: inline-block; + animation: none; + } + + @keyframes spin { + from { + transform: rotate(0deg); + } + + to { + transform: rotate(360deg); + } + } + + .spinning { + animation: spin 1s linear infinite; + } + + .stats-summary, + table { + transition: opacity 0.3s ease; + } + + .fade { + opacity: 0.6; + } @@ -101,9 +138,33 @@ // 加载统计数据 async function loadStats() { try { + // 添加刷新动画 + const refreshIcon = document.querySelector('.refresh-icon'); + const summaryElement = document.getElementById('stats-summary'); + const detailElement = document.getElementById('stats-detail'); + + if (refreshIcon) { + refreshIcon.classList.add('spinning'); + } + if (summaryElement) summaryElement.classList.add('fade'); + if (detailElement) detailElement.classList.add('fade'); + + // 获取数据 const response = await fetch('/stats'); const stats = await response.json(); - updateStats(stats); + + // 更新统计 + await updateStats(stats); + + // 移除动画 + setTimeout(() => { + if (refreshIcon) { + refreshIcon.classList.remove('spinning'); + } + if (summaryElement) summaryElement.classList.remove('fade'); + if (detailElement) detailElement.classList.remove('fade'); + }, 300); + } catch (error) { console.error('Error loading stats:', error); } @@ -128,7 +189,9 @@ // 更新总体统计 const summaryHtml = `
📊 接口调用统计
+