Files
ALL-teach_sys/frontend_视觉设计/test_dashboard_api.html
KQL cd2e307402 初始化12个产业教务系统项目
主要内容:
- 包含12个产业的完整教务系统前端代码
- 智能启动脚本 (start-industry.sh)
- 可视化产业导航页面 (index.html)
- 项目文档 (README.md)

优化内容:
- 删除所有node_modules和.yoyo文件夹,从7.5GB减少到2.7GB
- 添加.gitignore文件避免上传不必要的文件
- 自动依赖管理和智能启动系统

产业列表:
1. 文旅产业 (5150)
2. 智能制造 (5151)
3. 智能开发 (5152)
4. 财经商贸 (5153)
5. 视觉设计 (5154)
6. 交通物流 (5155)
7. 大健康 (5156)
8. 土木水利 (5157)
9. 食品产业 (5158)
10. 化工产业 (5159)
11. 能源产业 (5160)
12. 环保产业 (5161)

🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-24 14:14:14 +08:00

75 lines
2.9 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html>
<head>
<title>测试Dashboard API</title>
</head>
<body>
<h1>Dashboard数据测试</h1>
<div id="output"></div>
<script type="module">
// 测试API调用
async function testDashboardAPI() {
try {
const response = await fetch('http://localhost:5154/api/dashboard/stats');
const contentType = response.headers.get('content-type');
let data;
if (contentType && contentType.includes('application/json')) {
data = await response.json();
} else {
// 可能返回的是HTML开发服务器的默认页面
// 尝试直接导入mockData
const module = await import('./src/data/mockData.js');
data = {
success: true,
data: module.mockData.dashboardStatistics
};
}
console.log('API Response:', data);
const output = document.getElementById('output');
// 显示基本信息
output.innerHTML = `
<h2>数据结构检查</h2>
<p>Success: ${data.success}</p>
<p>Has data: ${data.data ? '✓' : '✗'}</p>
<p>Has ranking: ${data.data?.ranking ? '✓' : '✗'}</p>
<p>Has topStudents: ${data.data?.ranking?.topStudents ? '✓' : '✗'}</p>
<p>topStudents length: ${data.data?.ranking?.topStudents?.length || 0}</p>
<h2>前3名学生</h2>
<ul>
${data.data?.ranking?.topStudents?.slice(0, 3).map(s =>
`<li>${s.rank}. ${s.name || s.studentName} - ${s.score}分</li>`
).join('') || '<li>无数据</li>'}
</ul>
<h2>李沐阳第10名</h2>
${(() => {
const liMuyang = data.data?.ranking?.topStudents?.find(s =>
s.name === "李沐阳​" || s.studentName === "李沐阳​"
);
if (liMuyang) {
return `
<p>排名: ${liMuyang.rank}</p>
<p>分数: ${liMuyang.score}</p>
<p>是当前用户: ${liMuyang.isMe}</p>
`;
}
return '<p>未找到李沐阳的数据</p>';
})()}
`;
} catch (error) {
console.error('Error:', error);
document.getElementById('output').innerHTML = `<p style="color: red;">错误: ${error.message}</p>`;
}
}
testDashboardAPI();
</script>
</body>
</html>