Parcourir la source

課程頁面UI更新

paññābhinanda il y a 5 ans
Parent
commit
75f0310536
6 fichiers modifiés avec 255 ajouts et 139 suppressions
  1. 0 1
      app/collect/index.php
  2. BIN
      app/course/img/default.jpg
  3. 240 118
      app/course/index.php
  4. 5 1
      app/course/list_new.php
  5. 10 11
      app/course/teacher_list.php
  6. 0 8
      app/pcdl/index.php

+ 0 - 1
app/collect/index.php

@@ -89,7 +89,6 @@ include "../pcdl/html_head.php";
         .collect_card {
             display: block;
             padding: 1rem 1.5rem;
-            box-shadow: 0 3px 6px rgb(0 0 0 / 16%);
         }
 
         .collect_title {

BIN
app/course/img/default.jpg


+ 240 - 118
app/course/index.php

@@ -1,136 +1,258 @@
 <?PHP
 include "../pcdl/html_head.php";
 ?>
+
 <body>
 
-<?php
-    require_once("../pcdl/head_bar.php");
-?>
-<style>
-	.content_block{
-		flex: 0 0 auto;
-		width: 25%;
-		padding: 10px;
-	}
-
-	.index_inner{
-		width: 960px;
-		margin-left: auto;
-		margin-right: auto;
-	}
-	.content_inner{
-		display:flex;
-	}
-	.h3{
-		font-size: 16px;
-	}
-	.index_list_categories{
-		margin: 2em 0;
-	}
-	
-	.index_list_categories a:hover{
-		color: var(--tool-link-hover-color);
-	}
-	/*.index_list_categories a,a:link{
+	<?php
+	require_once("../pcdl/head_bar.php");
+	?>
+	<style>
+		.content_block {
+			width: 230px;
+		}
+
+		.index_inner {
+			margin-left: auto;
+			margin-right: auto;
+		}
+
+		.content_inner {
+			display: grid;
+			justify-content: center;
+			grid-gap: 20px;
+		}
+
+		.title_bar {
+			justify-content: space-between;
+			display: flex;
+			margin: 1em 0;
+			align-items: center;
+		}
+
+		h3 {
+			font-size: 18px;
+			margin: 0;
+		}
+
+		.index_list_categories {
+			padding: 1rem;
+			margin-bottom: 2rem;
+		}
+
+		.index_list_categories a:hover {
+			color: var(--tool-link-hover-color);
+		}
+
+		/*.index_list_categories a,a:link{
 		color: var(--main-color);
 	}*/
-	.index_list_categories button{
-		border: none;
-	}
-	
-	.pd-10{
-		padding:10px;
-	}
-	.card li{
-		white-space: unset;
-	}
-	.card code{
-		white-space: unset;
-	}
+		.index_list_categories button {
+			border: none;
+		}
+
+		.card li {
+			white-space: unset;
+		}
+
+		.card code {
+			white-space: unset;
+		}
+
+		.teacher_photo {
+			width: 230px;
+			height: 178px;
+			background-color: gray;
+			border-radius: 8px;
+		}
+
+		.teacher_text {
+			padding: 0 5px;
+		}
+
+		.teacher_text .title {
+			font-size: 120%;
+			font-weight: 700;
+			margin: 0.5em 0;
+		}
+
+		.teacher_intro {
+			display: -webkit-box;
+			-webkit-box-orient: vertical;
+			overflow: hidden;
+			text-overflow: ellipsis;
+			width: 100%;
+			-webkit-line-clamp: 3;
+		}
+
+		#course_list_complete .card,
+		#course_list_ongoing .card {
+			height: 120px;
+			padding: 0;
+			display: grid;
+			grid-template-columns: 120px 1fr;
+		}
+
+		.course_block {
+			background-color: #f5f5f5;
+			padding: 1rem;
+		}
+
+		.course_right {
+			padding: 10px;
+			display: flex;
+			flex-direction: column;
+			width: calc(100% - 10px);
+		}
+
+		.card_photo {
+			border-radius: 20px 0 0 20px;
+		}
+
+		.course_right .title a {
+			font-size: 120%;
+			font-weight: 700;
+			display: -webkit-box;
+			-webkit-box-orient: vertical;
+			overflow: hidden;
+			text-overflow: ellipsis;
+			-webkit-line-clamp: 2;
+			color: var(--main-color);
+		}
+
+		.subtitle {
+			margin-top: auto;
+			display: -webkit-box;
+			-webkit-box-orient: vertical;
+			overflow: hidden;
+			text-overflow: ellipsis;
+			width: 100%;
+			-webkit-line-clamp: 2;
+		}
+
+		@media screen and (min-width:800px) {
+			.index_list_categories {
+				max-width: 760px;
+				margin: 0 auto 3rem auto;
+			}
+
+			.content_inner {
+				grid-template-columns: 230px 230px 230px;
+			}
+
+			h3 {
+				font-size: 22px;
+
+			}
+
+			.course_block h3 {
+				text-align: center;
+				margin: 1em 0;
+			}
+
+			#course_list_ongoing,
+			#course_list_complete {
+				max-width: 600px;
+				margin: 0 auto;
+			}
+		}
+
+		@media screen and (min-width:1020px) {
+			.index_list_categories {
+				max-width: 1020px;
+			}
+
+			.content_inner {
+				grid-template-columns: 230px 230px 230px 230px;
+			}
+		}
 	</style>
-<div class="index_inner" >
-    
-	<div class="index_list_categories">
-		<div class="title_bar">
-			<span class="title h3"><?php echo $_local->gui->speaker ?></span>	
-			<span class="title_more"><a href="../course"><?php echo $_local->gui->more ?></a></span>
-		</div>
-		<div class="content">
-			<div id="course_list_new" class="content_inner">
 
 
+	<div class="index_inner">
 
+		<div class="index_list_categories">
+			<div class="title_bar">
+				<h3><?php echo $_local->gui->speaker ?></h3>
+				<span class="title_more"><a href="../course"><?php echo $_local->gui->more ?></a></span>
+			</div>
+			<div class="content">
+				<div id="course_list_new" class="content_inner">
+
+
+
+				</div>
 			</div>
 		</div>
-	</div>
-	<script>
-	$.get("../course/teacher_list.php",function(data,status){
-		let xDiv = document.getElementById("course_list_new");
-		if(xDiv){
-			xDiv.innerHTML=data;
-		}
-	});
-	</script>
-	<div class="course_block">	
-		<div class="title" >
-		<?php echo $_local->gui->in_progress; ?>
+		<script>
+			$.get("../course/teacher_list.php", function(data, status) {
+				let xDiv = document.getElementById("course_list_new");
+				if (xDiv) {
+					xDiv.innerHTML = data;
+				}
+			});
+		</script>
+		<div class="course_block">
+			<h3>
+				<?php echo $_local->gui->in_progress; ?>
+			</h3>
+			<div id="course_list_ongoing">
+			</div>
 		</div>
-		<div id="course_list_ongoing">
-		</div >
-	</div>	
 
-	<div class="course_block">	
-		<div class="title" >
-		<?php echo $_local->gui->already_over; ?>
+		<div class="course_block">
+			<h3>
+				<?php echo $_local->gui->already_over; ?>
+			</h3>
+			<div id="course_list_complete">
+			</div>
 		</div>
-		<div id="course_list_complete">
-		</div >
+
+		<script>
+			var speaker = "<?php echo $_local->gui->speaker . ':' . $row['teacher'] ?>";
+
+			$.get("../course/course_list.php", function(data, status) {
+				let arrData = JSON.parse(data);
+				let html_complete = "";
+				let html_ongoing = "";
+
+				for (const iterator of arrData) {
+					let html = "";
+					html += '<div class="card">';
+					html += '<div style="height:120px;width:120px;">';
+					html += '<img src="../../tmp/images/course/' + iterator.id + '.jpg" alt="cover" width="120" height="120"  class="card_photo">';
+					html += '</div>';
+					html += '<div class="course_right">';
+					html += '<div class="title"><a href="../course/course.php?id=' + iterator.id + '">' + iterator.title + '</a></div>';
+
+					//協助補上代碼:
+					html += '<div class="author">主講人:</div>';
+
+					html += '<div class="subtitle">' + iterator.subtitle + '</div>';
+
+					/*let summary = "";
+					try {
+						summary = marked(iterator.summary);
+					} catch (e) {}
+					html += '<div class="summary">' + summary + '</div>';*/
+					html += '</div>';
+					html += '</div>';
+					if (iterator.status == 40) {
+						html_complete += html;
+					} else if (iterator.status == 30 || iterator.status == 20) {
+						html_ongoing += html;
+					}
+				}
+				$("#course_list_complete").html(html_complete);
+				$("#course_list_ongoing").html(html_ongoing);
+				$("img").one("error", function() {
+					$(this).attr("src", "../course/img/default.jpg");
+				});
+			});
+		</script>
+
 	</div>
 
-    <script>
-
-	$.get("../course/course_list.php",function(data,status){
-        let arrData = JSON.parse(data);
-        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:3;max-width:15em;">';
-			html += '<img src="../../tmp/images/course/'+iterator.id+'.jpg" alt="cover" width="200" height="200">'
-            html += '</div>';
-            html += '<div style="flex:7;padding:5px;">';
-            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){
-			}
-            html += '<div class="summary"  style="padding-bottom:5px;">'+summary+'</div>';
-            html += '</div>';
-            html += '<div style="flex:3;max-width:15em;">';
-            html += '</div>';
-            html += '</div>';
-			if(iterator.status==40){
-				html_complete += html;
-			}
-			else if(iterator.status==30 || iterator.status==20 ){
-				html_ongoing += html;
-			}
-        }
-		$("#course_list_complete").html(html_complete);
-		$("#course_list_ongoing").html(html_ongoing);
-		$("img").one("error", function(){  
-    	$(this).attr("src", "../course/img/default.jpg");   
-	});
-	});
-	</script>	
-
-    </div>
-
-<?php
-include "../pcdl/html_foot.php";
-?>
+	<?php
+	include "../pcdl/html_foot.php";
+	?>

+ 5 - 1
app/course/list_new.php

@@ -13,7 +13,11 @@ $Fetch = PDO_FetchAll($query);
 
 foreach ($Fetch as $row) {
     echo '<div class="card">';
-    echo '<div class="card_photo"></div>';
+    echo '<div>';
+    /* 需協助完善封面代碼...
+    echo '<img src="../../tmp/images/course/' . $iterator['id'] . '.jpg" alt="cover" width="120" height="120"  class="card_photo">';
+*/
+    echo '</div>';
     echo '<div class="course_right">';
     echo '<div class="title"><a href="../course/course.php?id=' . $row["id"] . '">' . $row["title"] . '</a></div>';
     echo '<div class="author">' . $_local->gui->speaker . ':';

+ 10 - 11
app/course/teacher_list.php

@@ -7,23 +7,22 @@ require_once '../public/load_lang.php';
 require_once '../ucenter/function.php';
 
 global $PDO;
-PDO_Connect("sqlite:"._FILE_DB_COURSE_);
+PDO_Connect("sqlite:" . _FILE_DB_COURSE_);
 $query = "select teacher,count(*) as co from course where 1 group by teacher order by co DESC limit 0,4";
 $Fetch = PDO_FetchAll($query);
 
-foreach($Fetch as $value){
+foreach ($Fetch as $value) {
     echo '<div class="content_block">';
-    echo '<div class="card pd-10">';
-    echo '<div class="title" style="padding-bottom:5px;font-size:110%;font-weight:600;"><a href="../uhome/course.php?userid='.$value['teacher'].'">'.ucenter_getA($value['teacher']).'</a></div>';
-    
+    echo '<div class="teacher_photo"></div>';
+    echo '<div class="teacher_text">';
+    echo '<div class="title"><a href="../uhome/course.php?userid=' . $value['teacher'] . '">' . ucenter_getA($value['teacher']) . '</a></div>';
+    echo '<div class="teacher_intro">講師簡介</div>';
+    /*
     $query = "select id, title  from course where teacher = '{$value['teacher']}'  order by create_time DESC limit 0,5";
     $FetchTeacher = PDO_FetchAll($query);
-    foreach($FetchTeacher as $row){
-        echo '<div class="title" style="padding-bottom:5px;"><a href="../course/course.php?id='.$row["id"].'">'.$row["title"].'</a></div>';
-
-    }    
+    foreach ($FetchTeacher as $row) {
+        echo '<div class="title" style="padding-bottom:5px;"><a href="../course/course.php?id=' . $row["id"] . '">' . $row["title"] . '</a></div>';
+    }*/
     echo '</div>';
     echo '</div>';
 }
-
-?>

+ 0 - 8
app/pcdl/index.php

@@ -6,12 +6,6 @@ require_once '../pcdl/html_head.php';
 	<script language="javascript" src="../pcdl/index.js"></script>
 
 	<style>
-		.content_block {
-			flex: 0 0 auto;
-			width: 25%;
-			padding: 10px;
-		}
-
 		.content_inner {
 			display: flex;
 		}
@@ -100,8 +94,6 @@ require_once '../pcdl/html_head.php';
 		}
 
 		.card_photo {
-			height: 100%;
-			background: gray;
 			border-radius: 20px 0 0 20px;
 		}