visuddhinanda 5 лет назад
Родитель
Сommit
cc6cbdf000
2 измененных файлов с 43 добавлено и 19 удалено
  1. 9 0
      app/course/course_list.php
  2. 34 19
      app/course/index.php

+ 9 - 0
app/course/course_list.php

@@ -6,6 +6,15 @@ require_once "../public/_pdo.php";
 require_once '../public/load_lang.php';
 require_once '../media/function.php';
 
+/*
+状态
+
+0 删除
+10 私有
+20 不公开列出
+30 公开连载
+40 已完结
+*/
 if(isset($_GET["teacher"])){
     $teacher = " teacher = '".$_GET["teacher"]."'";
 }

+ 34 - 19
app/course/index.php

@@ -70,40 +70,55 @@ include "../pcdl/html_head.php";
 			xDiv.innerHTML=data;
 		}
 	});
-	</script>	
-    <div class="card" style="margin:1em;">
-    过滤
-    </div>
-    <div id="course_list">
-    </div >
+	</script>
+	<div class="course_block">	
+		<div class="title" >
+		连载中
+		</div>
+		<div id="course_list_ongoing">
+		</div >
+	</div>	
+
+	<div class="course_block">	
+		<div class="title" >
+		已完结
+		</div>
+		<div id="course_list_complete">
+		</div >
+	</div>
+
     <script>
 	$.get("../course/course_list.php",function(data,status){
         let arrData = JSON.parse(data);
-        let html="";
+        let html_complete="";
+        let html_ongoing="";
+		
         for (const iterator of arrData) {
+			let html="";
             html += '<div class="card" style="display:flex;margin:1em;padding:10px;">';
-
             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>';
 			let summary = "";
-        try{
-            summary = marked(iterator.summary);
-        }
-        catch(e){
-
-        }      
+			try{
+				summary = marked(iterator.summary);
+			}
+			catch(e){
+			}
             html += '<div class="summary"  style="padding-bottom:5px;">'+summary+'</div>';
-
             html += '</div>';
-
             html += '<div style="flex:3;max-width:15em;">';
-
             html += '</div>';
-
             html += '</div>';
-            $("#course_list").html(html);
+			if(iterator.status==40){
+				html_complete += html;
+			}
+			else if(iterator.status==30){
+				html_ongoing += html;
+			}
         }
+		$("#course_list_complete").html(html_complete);
+		$("#course_list_ongoing").html(html_ongoing);
 	});
 	</script>