copy dashboard

This commit is contained in:
Caikecheng
2025-10-22 19:45:56 +08:00
parent 7d861e3401
commit 02b1279185
5 changed files with 579 additions and 4484 deletions

View File

@@ -0,0 +1,94 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>华实学伴 - 专业的在线学习平台</title>
<!-- Bootstrap 5 CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- Font Awesome 图标 -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
<link rel="stylesheet" href="/static/css/dashboard.css">
</head>
<body>
{% include 'navbar.html' %} <!-- 引入navbar.html -->
<section class="search-section">
<div class="container">
<div class="row justify-content-center">
<div class="col-lg-8">
<div class="search-container">
<div class="input-group">
<input type="text" class="form-control form-control-lg" placeholder="搜索您感兴趣的课程...">
<button class="btn btn-primary btn-lg" type="button">
<i class="fas fa-search me-1"></i> 搜索
</button>
</div>
</div>
</div>
</div>
</div>
</section>
<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> -->
<div class="col-md-6 col-lg-4">
<div class="course-card card h-100" onclick="openCourseProgress('{{course._id}}')">
<img src="{{course.image_url}}"
class="course-img" alt="课程封面">
<div class="card-body d-flex flex-column">
<span class="course-category">艺术设计</span>
<h5 class="course-title">{{course.name}}</h5>
<p class="course-instructor">{{course.description}}</p>
<div class="course-meta">
<span><i class="far fa-user me-1"></i> 初级</span>
<span class="course-rating"><i class="fas fa-star"></i> 4.7</span>
</div>
<div class="mt-auto d-grid gap-2 d-md-flex">
<button class="btn btn-view flex-fill"><i class="far fa-eye me-1"></i> 查看课程</button>
<button class="btn btn-enroll flex-fill"><i class="fas fa-plus me-1"></i> 选课</button>
</div>
</div>
</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>
<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>