Bläddra i källkod

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

visuddhinanda 5 år sedan
förälder
incheckning
19f404c5d5
3 ändrade filer med 271 tillägg och 126 borttagningar
  1. 106 111
      app/course/course.js
  2. 164 14
      app/course/course.php
  3. 1 1
      app/ucenter/active.php

+ 106 - 111
app/course/course.js

@@ -1,114 +1,109 @@
 function course_load(course_id) {
-	$.get(
-		"../course/course_get.php",
-		{
-			id: course_id,
-		},
-		function (data, status) {
-			let html = "";
-			let course_info = JSON.parse(data);
-			if (course_info) {
-				//head
-				html += "<div id='course_info_head' class='course_info_block'>";
-				html += "<div id='course_info_head_1'>";
-				html += "<div id='course_info_head_face'>";
-				html += "<img src='../../tmp/images/course/" + course_info.id + ".jpg' />";
-				html += "</div>";
-				html += "<div id='course_info_head_title'>";
-				html += "<div id='course_title'>" + course_info.title + "</div>";
-				html += "<div id='course_subtitle'>" + course_info.subtitle + "</div>";
-				html += "<div id='course_button'>";
-				html += "<button>" + gLocal.gui.watch + "</button>";
-				html += "<button disabled>" + gLocal.gui.sign_up + "</button>";
-				html += "</div>";
-				html += "</div>";
-				html += "</div>";
+    $.get(
+        "../course/course_get.php", {
+            id: course_id,
+        },
+        function(data, status) {
+            let html = "";
+            let course_info = JSON.parse(data);
+            if (course_info) {
+                //head
+                html += "<div id='course_info_head' class='course_info_block'>";
+                html += "<div id='course_info_head_1'>";
+                html += "<div id='course_info_head_face'>";
+                html += "<img src='../../tmp/images/course/" + course_info.id + ".jpg' />";
+                html += "</div>";
+                html += "<div id='course_info_head_title'>";
+                html += "<div id='course_title'>" + course_info.title + "</div>";
+                html += "<div id='course_subtitle'>" + course_info.subtitle + "</div>";
+                html += "<div id='course_button'>";
+                html += "<button class='disable'>" + gLocal.gui.watch + "</button>";
+                html += "<button disabled class='disable'>" + gLocal.gui.sign_up + "</button>";
+                html += "</div>";
+                html += "</div>";
+                html += "</div>";
 
-				html += "<div id='course_info_head_2'>";
-				html += "<span><span>" + gLocal.gui.speaker + ":</span>";
-				html +=
-					"<a href='../uhome/course.php?userid=" +
-					course_info.teacher +
-					"'>" +
-					course_info.teacher_info.nickname +
-					"</a>";
-				html += "</span>";
-				//html += "<span>地区:缅甸</span>";
-				html += "</div>";
-				// end of course_info_head_2
-				html += "</div>";
-				//end of head
-				//summary
-				if (course_info.summary.length > 0) {
-					html += "<div id='course_info_summary' class='course_info_block'>";
-					html += "<h2>" + gLocal.gui.introduction + "</h2>";
-					try {
-						html += marked(course_info.summary);
-					} catch (e) {
-						html += e.message;
-					}
-					html += "</div>";
-				}
-				//end of summary
-				//attachment
-				if (course_info.attachment.length > 0) {
-					html += "<div id='course_info_attachment' class='course_info_block'>";
-					html += "<h2>" + gLocal.gui.attachment + "</h2>";
-					try {
-						html += marked(course_info.attachment);
-					} catch (e) {
-						html += e.message;
-					}
-					html += "</div>";
-				}
-				//end of attachment
-
-				$("#course_info").html(html);
-				$("img").one("error", function () {
-					$(this).attr("src", "../course/img/default.jpg");
-				});
-			}
-		}
-	);
+                html += "<div id='course_info_head_2'>";
+                html += "<span><span>" + gLocal.gui.speaker + ": </span>";
+                html +=
+                    "<a href='../uhome/course.php?userid=" +
+                    course_info.teacher +
+                    "'>" +
+                    course_info.teacher_info.nickname +
+                    "</a>";
+                html += "</span>";
+                //html += "<span>地区:缅甸</span>";
+                html += "</div>";
+                // end of course_info_head_2
+                html += "</div>";
+                //end of head
+                //summary
+                if (course_info.summary.length > 0) {
+                    html += "<div id='course_info_summary' class='course_info_block'>";
+                    html += "<h2>" + gLocal.gui.introduction + "</h2>";
+                    try {
+                        html += marked(course_info.summary);
+                    } catch (e) {
+                        html += e.message;
+                    }
+                    html += "</div>";
+                }
+                //end of summary
+                //attachment
+                if (course_info.attachment.length > 0) {
+                    html += "<div id='course_info_attachment' class='course_info_block'>";
+                    html += "<h2>" + gLocal.gui.attachment + "</h2>";
+                    try {
+                        html += marked(course_info.attachment);
+                    } catch (e) {
+                        html += e.message;
+                    }
+                    html += "</div>";
+                }
+                //end of attachment
 
-	$.get(
-		"../course/lesson_list.php",
-		{
-			id: course_id,
-		},
-		function (data, status) {
-			let arrLesson = JSON.parse(data);
-			let html = "";
-			for (const lesson of arrLesson) {
-				//计算课程是否已经开始
-				let now = new Date();
-				let class_lesson_time = "";
-				let dt = lesson["duration"] / 60;
-				if (now < lesson["date"]) {
-					class_lesson_time = "not_started";
-				} else if (now > lesson["date"] && now < lesson["date"] + dt * 1000) {
-					class_lesson_time = "in_progress";
-				} else {
-					class_lesson_time = "already_over";
-				}
+                $("#course_info").html(html);
+                $("img").one("error", function() {
+                    $(this).attr("src", "../course/img/default.jpg");
+                });
+            }
+        }
+    );
 
-				html += '<div class="lesson_card" >';
-				let d = new Date();
-				d.setTime(lesson["date"]);
-				let strData = d.toLocaleDateString();
-				let strTime = d.toLocaleTimeString();
-				html += '<div class="pd-10">';
-				html += "<div class='datatime " + class_lesson_time + "'>" + strData + " " + strTime + "</div>";
-				html +=
-					'<div class="title" ><a href="../course/lesson.php?id=' +
-					lesson["id"] +
-					'" style="color:var(--main-color);">' +
-					lesson["title"] +
-					"</a></div>";
+    $.get(
+        "../course/lesson_list.php", {
+            id: course_id,
+        },
+        function(data, status) {
+            let arrLesson = JSON.parse(data);
+            let html = "";
+            for (const lesson of arrLesson) {
+                //计算课程是否已经开始
+                let now = new Date();
+                let class_lesson_time = "";
+                let dt = lesson["duration"] / 60;
+                if (now < lesson["date"]) {
+                    class_lesson_time = "not_started";
+                } else if (now > lesson["date"] && now < lesson["date"] + dt * 1000) {
+                    class_lesson_time = "in_progress";
+                } else {
+                    class_lesson_time = "already_over";
+                }
 
-				html += "</div>";
+                html += '<div class="lesson_card" >';
+                let d = new Date();
+                d.setTime(lesson["date"]);
+                let strData = d.toLocaleDateString();
+                let strTime = d.toLocaleTimeString();
+                html += "<div class='datatime " + class_lesson_time + "'>" + strData + " " + strTime + "</div>";
+                html +=
+                    '<div class="title" ><a href="../course/lesson.php?id=' +
+                    lesson["id"] +
+                    '" style="color:var(--main-color);">' +
+                    lesson["title"] +
+                    "</a></div>";
 
-				/*
+                /*
 				let dt = lesson["duration"] / 60;
 				let sdt = "";
 				if (dt > 59) {
@@ -124,9 +119,9 @@ function course_load(course_id) {
 				html += '<div ><span class="lesson_status">' + lesson_time + "</span></div>";
 */
 
-				html += "</div>";
-			}
-			$("#lesson_list").html(html);
-		}
-	);
-}
+                html += "</div>";
+            }
+            $("#lesson_list").html(html);
+        }
+    );
+}

+ 164 - 14
app/course/course.php

@@ -2,23 +2,173 @@
 
 include "../pcdl/html_head.php";
 ?>
+
 <body>
-<script language="javascript" src="../course/course.js"></script>
+    <script language="javascript" src="../course/course.js"></script>
 
-<?php
+    <?php
     require_once("../pcdl/head_bar.php");
-?>
+    ?>
 
 <link type="text/css" rel="stylesheet" href="./style.css" />
+    <style>
+        .disable {
+            cursor: not-allowed;
+            opacity: 0.5;
+        }
+
+        #main_video_win iframe {
+            width: 100%;
+            height: 100%;
+        }
+
+        #course_frame {
+            display: flex;
+        }
+
+        #course_content {
+            margin: 0;
+            padding: 0;
+        }
+
+        #lesson_list {}
+
+        #course_info_head_1 {
+            display: grid;
+            grid-template-columns: 200px 1fr;
+            grid-gap: 20px;
+        }
+
+        #course_info_head_face {
+            /*width: 200px;
+            height: 200px;*/
+        }
+
+        #course_info_head_face img {
+            width: 200px;
+            height: 200px;
+            border-radius: 12px;
+            object-fit: cover;
+        }
+
+        .section_inner {
+            max-width: 960px;
+            margin: 0 auto;
+        }
+
+        #course_info_head_title {
+            display: flex;
+            flex-direction: column;
+            word-wrap: break-word;
+        }
+
+        #course_title {
+            font-size: 22px;
+            font-weight: 700;
+        }
+
+        #course_subtitle {
+            font-size: 13px;
+            padding: 10px 0;
+            word-wrap: break-word;
+        }
+
+        #course_button {
+            margin-top: auto;
+        }
+
+        #lesson_list_shell {
+            padding: 1rem;
+            background-color: #f5f5f5;
+        }
+
+        .course_info_block {
+            padding: 1rem 0;
+        }
+
+        #course_info_summary {
+            border-top: 1px solid var(--border-line-color);
+            border-bottom: 1px solid var(--border-line-color);
+        }
+
+        .course_info_block h2 {
+            font-size: 16px;
+        }
+
+        #lesson_list {
+            column-count: 2;
+            position: relative;
+        }
+
+        #lesson_list .lesson_card {
+            padding: 10px 10px 10px 0;
+            -webkit-column-break-inside: avoid;
+            page-break-inside: avoid;
+            break-inside: avoid;
+        }
+
+        .datatime {
+            display: inline;
+        }
+
+        .not_started {
+            background-color: orangered;
+            color: var(--bg-color);
+        }
+
+        .in_progress,
+        .already_over {
+            color: var(--btn-hover-bg-color);
+        }
+
+        .lesson_card .title {
+            margin-top: 5px;
+            font-size: 17px;
+            font-weight: 600;
+            display: -webkit-box;
+            -webkit-box-orient: vertical;
+            overflow: hidden;
+            text-overflow: ellipsis;
+            width: 100%;
+            -webkit-line-clamp: 2;
+        }
+
+        #course_info_head_2 {
+            margin: 1rem 0;
+        }
+
+        @media screen and (max-width:800px) {
+            #lesson_list {
+                column-count: 1;
+            }
+
+            #course_info_head_1 {
+                grid-template-columns: 100px 1fr;
+                grid-gap: 10px;
+            }
+
+            #course_info_head_face img {
+                width: 100px;
+                height: 100px;
+                border-radius: 6px;
+            }
+        }
+    </style>
+
+
+
+    <div id='course_content'>
+        <div id='course_info_shell' style='padding:1rem;'>
+            <div id='course_info' class="section_inner"></div>
+        </div>
+        <div id='lesson_list_shell'>
+            <div id='lesson_list' class="section_inner"></div>
+        </div>
+    </div>
 
-<div id='course_content' >
-    <div id='course_info_shell'><div id='course_info' class="section_inner"></div></div>
-    <div id='lesson_list_shell'><div id='lesson_list' class="section_inner"></div></div>
-</div>
-
-<script>
-    course_load("<?php echo $_GET["id"]; ?>");
-</script>
-<?php
-include "../pcdl/html_foot.php";
-?>
+    <script>
+        course_load("<?php echo $_GET["id"]; ?>");
+    </script>
+    <?php
+    include "../pcdl/html_foot.php";
+    ?>

+ 1 - 1
app/ucenter/active.php

@@ -8,7 +8,7 @@ require_once "../public/php/define.php";
 function add_edit_event($type=0,$data=null){
 	date_default_timezone_set("UTC");
 	define("MAX_INTERVAL",600000);
-	define("MIN_INTERVAL",10000);
+	define("MIN_INTERVAL",60000);
 	
 	if(isset($_COOKIE["userid"])){
 		$dns = "sqlite:"._FILE_DB_USER_ACTIVE_;