Просмотр исходного кода

Merge branch 'master' of https://github.com/visuddhinanda/mint

Bhikkhu-Kosalla 5 лет назад
Родитель
Сommit
410804fbcb
5 измененных файлов с 56 добавлено и 15 удалено
  1. 31 8
      app/course/course.php
  2. 13 0
      app/course/course_get.php
  3. 9 2
      app/course/index.php
  4. 1 3
      app/course/lesson.php
  5. 2 2
      app/course/list_new.php

+ 31 - 8
app/course/course.php

@@ -48,18 +48,16 @@ echo '</div>';
 
 echo "<div  class='index_inner'>";
 
-echo '<div class="card" style="margin:1em;">';
+echo '<div class="card" style="margin:1em;padding:10px;">';
     echo '<div class="title">';
     echo '简介';
     echo '</div>';
-    echo '<div class="detail">';
-    echo $course_info["summary"];
+    echo '<div id="course_summary" class="detail">';
     echo '</div>';
     echo '<div class="title">';
     echo '参考资料';
     echo '</div>';    
-    echo '<div class="detail">';
-    echo $course_info["attachment"];
+    echo '<div id="course_attachment"  class="detail">';
     echo '</div>';   
 echo '</div>';
 
@@ -70,11 +68,36 @@ echo "</div>";
 
 ?>
 </div>
-<script src="../public/js/marked.js"></script>
 <script>
     $("#main_video_win").height($("#main_video_win").width()*9/16);
+    $.get("../course/course_get.php",
+  {
+    id:"<?php echo $_GET["id"]; ?>"
+  },
+  function(data,status){
+      let arrLesson = JSON.parse(data);
+      if(arrLesson && arrLesson.length>0){
+        let summary = "";
+        try{
+            summary = marked(arrLesson[0]["summary"]);
+        }
+        catch(e){
+
+        }          
+        $("#course_summary").html(summary);
+
+        let attachment = "";
+        try{
+            attachment = marked(arrLesson[0]["attachment"]);
+        }
+        catch(e){
+
+        }          
+        $("#course_attachment").html(attachment);
+      }
+    });
 
-    $.get("../course/lesson_list.php",
+$.get("../course/lesson_list.php",
   {
     id:"<?php echo $_GET["id"]; ?>"
   },
@@ -86,7 +109,7 @@ echo "</div>";
 
         html+= '<div style="flex:7;">';
         html+= '<div class="pd-10">';
-        html+= '<div class="title" style="padding-bottom:5px;font-size:100%;font-weight:600;"><a href="../course/lesson.php?id='+lesson["id"]+'">'+lesson["title"]+'</a></div>';
+        html+= '<div class="title" style="padding-bottom:5px;font-size:200%;font-weight:600;"><a href="../course/lesson.php?id='+lesson["id"]+'" style="color:var(--main-color);">'+lesson["title"]+'</a></div>';
         html += '<div style="overflow-y: scroll;max-height: 20em;">';
         let summary = "";
         try{

+ 13 - 0
app/course/course_get.php

@@ -0,0 +1,13 @@
+<?php
+//
+
+require_once "../path.php";
+require_once "../public/_pdo.php";
+
+global $PDO;
+PDO_Connect("sqlite:"._FILE_DB_COURSE_);
+$query = "select * from course where id = '{$_GET["id"]}'   limit 0,1";
+$fAllLesson = PDO_FetchAll($query);
+echo json_encode($fAllLesson, JSON_UNESCAPED_UNICODE);
+
+?>

+ 9 - 2
app/course/index.php

@@ -85,8 +85,15 @@ include "../pcdl/html_head.php";
 
             html += '<div style="flex:7;">';
             html +=  '<div class="title" style="padding-bottom:5px;font-size:110%;font-weight:600;"><a href="../course/course.php?id='+iterator.id+'">'+iterator.title+'</a></div>';
-            html += '<div class="summary"  style="padding-bottom:5px;">'+iterator.subtitle+'</div>';
-            html += '<div class="summary"  style="padding-bottom:5px;">'+iterator.summary+'</div>';
+			html += '<div class="summary"  style="padding-bottom:5px;">'+iterator.subtitle+'</div>';
+			let summary = "";
+        try{
+            summary = marked(iterator.summary);
+        }
+        catch(e){
+
+        }      
+            html += '<div class="summary"  style="padding-bottom:5px;">'+summary+'</div>';
 
             html += '</div>';
 

+ 1 - 3
app/course/lesson.php

@@ -61,8 +61,6 @@ echo '</div>';
 
 echo "<div  class='index_inner'>";
 
-
-
 echo "<div id='lesson_list'>";
 
 echo "</div>";
@@ -85,7 +83,7 @@ echo "</div>";
 
         html+= '<div style="flex:7;">';
         html+= '<div class="pd-10">';
-        html+= '<div class="title" style="padding-bottom:5px;font-size:100%;font-weight:600;">'+lesson["title"]+'</div>';
+        html+= '<div class="title" style="padding-bottom:5px;font-size:200%;font-weight:600;">'+lesson["title"]+'</div>';
         html += '<div style="">';
         let summary = "";
         try{

+ 2 - 2
app/course/list_new.php

@@ -17,13 +17,13 @@ foreach($Fetch as $row){
 
     echo '<div class="pd-10">';
     echo '<div class="title" style="padding-bottom:5px;font-size:110%;font-weight:600;"><a href="../course/course.php?id='.$row["id"].'">'.$row["title"].'</a></div>';
-    echo '<div class="summary"  style="padding-bottom:5px;">'.$row["subtitle"].'</div>';
+    echo '<div class="summary"  style="padding-bottom:5px;color: #ad4b00;">'.$row["subtitle"].'</div>';
     echo '<div class="author"  style="padding-bottom:5px;margin-bottom:0.4em;">主讲:';
     echo '<a href="../uhome/course.php?userid='.$row['teacher'].'">';
     echo ucenter_getA($row["teacher"]);
     echo '</a>';
     echo '</div>';    
-    echo '<div class="summary"  style="padding-bottom:5px;">'.$row["summary"].'</div>';
+    echo '<div class="summary"  style="padding-bottom:5px;height: 4.5em;line-height: 1.5em;overflow-y: hidden;">'.$row["summary"].'</div>';
     echo '</div>';
     echo '<div class="pd-10" style="display:flex;justify-content: space-between;">';
     echo '<button>赞<span>3</span></button><button>订阅<span>23</span></button>';