Files
hsa/Html/apps/templates/dashboard.html
2025-10-22 16:12:30 +08:00

60 lines
2.4 KiB
HTML
Raw 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 lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>学生个人主页</title>
<link rel="stylesheet" href="/static/css/dashboard.css">
</head>
<body>
{% include 'navbar.html' %} <!-- 引入navbar.html -->
<div class="dashboard">
<h2 class="dashboard-title">—— 我的选课 ——</h2>
<div class="course-cards" id="course-cards">
<!-- 循环生成课程卡片 -->
{% for course in user_selected_course %}
<div class="course-card" onclick="openCourseProgress('{{course._id}}')">
<img src="{{course.image_url}}" alt="课程封面" class="course-image">
<div class="course-info">
<h3 class="course-name">{{course.name}}</h3>
<p class="course-description">{{course.description}}</p>
</div> <!-- 补充闭合标签 -->
</div> <!-- 补充闭合标签 -->
{% endfor %}
</div>
</div>
<!-- 右侧滑出的学习进度卡片 -->
<div id="courseProgress" class="course-progress">
<div class="progress-header">
<span id="course-title"></span>
<button class="close-btn" onclick="closeCourseProgress()">×</button>
</div>
<div class="progress-content">
<p>当前学习进度: <span id="progress"></span></p>
<hr/>
<h3>章节列表:</h3>
<ul id="chapter-list">
<!-- 章节列表会在点击课程时动态生成 -->
</ul>
</div>
</div>
{% include 'foot.html' %}
<script src="/static/js/dashboard.js"></script>
<script>
// 解析用户数据和课程数据
console.log(`{{user_data}}`.replaceAll("&#39;", "\"").replaceAll("True", "true").replaceAll("False", "false"))
console.log(`{{user_course_data}}`.replaceAll("&#34;", "\"").replaceAll("True", "true").replaceAll("False", "false"))
let user_data = JSON.parse(`{{user_data}}`.replaceAll("&#39;", "\"").replaceAll("True", "true").replaceAll("False", "false"));
let user_course_data = JSON.parse(`{{user_course_data}}`.replaceAll("&#34;", "\"").replaceAll("True", "true").replaceAll("False", "false"))
console.log(user_data)
console.log(user_course_data)
show_user_data(user_data, user_course_data)
</script>
</body>
</html>