Parcourir la source

lesson 加 course 标题

visuddhinanda il y a 5 ans
Parent
commit
e035f4c4c0
3 fichiers modifiés avec 45 ajouts et 8 suppressions
  1. 28 3
      app/course/lesson.js
  2. 14 2
      app/course/lesson.php
  3. 3 3
      app/course/style.css

+ 28 - 3
app/course/lesson.js

@@ -192,17 +192,42 @@ function lesson_load(lesson_id) {
 				//end of attachment
 				$("#lesson_info").html(html);
 				note_refresh_new();
+				render_course_info(lesson_info.course_id);
 				render_lesson_list(lesson_info.course_id, lesson_info.id);
 			}
 		}
 	);
 }
-
-function render_lesson_list(id, currLesson) {
+function render_course_info(course_id) {
+	$.get(
+		"../course/course_get.php",
+		{
+			id: course_id,
+		},
+		function (data, status) {
+			let html = "";
+			let course_info = JSON.parse(data);
+			if (course_info) {
+				let html = "";
+				html += "<div id='parent_title'>";
+				html += "<a href='../course/course.php?id=" + course_info.id + "'>";
+				html += course_info.title;
+				html += "</a>";
+				html += "</div>";
+				html += "<div id='course_button'>";
+				html += "<button>关注</button>";
+				html += "<button>报名</button>";
+				html += "</div>";
+				$("#course_info").html(html);
+			}
+		}
+	);
+}
+function render_lesson_list(course_id, currLesson) {
 	$.get(
 		"../course/lesson_list.php",
 		{
-			id: id,
+			id: course_id,
 		},
 		function (data, status) {
 			let arrLesson = JSON.parse(data);

+ 14 - 2
app/course/lesson.php

@@ -1,5 +1,5 @@
 <?PHP
-include "../pcdl/html_head.php";
+    include "../pcdl/html_head.php";
 ?>
 <body>
 <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
@@ -14,7 +14,19 @@ include "../pcdl/html_head.php";
 
 <style>
 #course_info_shell{
-    baackground-color:gray;
+    background-color: var(--box-bg-color1);
+}
+#course_info{
+    display:flex;
+    justify-content: space-between;
+    padding: 6px;
+}
+
+#parent_title,#parent_title a {
+    font-size: 13px;
+    line-height: 2.4em;
+    font-weight: 500;
+    color: var(--tool-color);
 }
 </style>
 

+ 3 - 3
app/course/style.css

@@ -24,7 +24,7 @@
 	margin: 0 auto;
 }
 #course_info_head_title {
-	padding: 12px;
+	padding: 12px 0;
 }
 #course_title {
 	font-size: 22px;
@@ -43,7 +43,7 @@
 	border-top: 1px solid var(--box-bg-color2);
 	padding: 10px 5px;
 }
-.course_info_block:first {
+.course_info_block:first-child {
 	border-top: none;
 }
 .course_info_block h2 {
@@ -89,5 +89,5 @@
 	color: gray;
 }
 #course_info_head_2 {
-	padding: 10px;
+	padding: 10px 0;
 }