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 += "
"; html += "
"; html += "
"; html += ""; html += "
"; html += "
"; html += "
" + course_info.title + "
"; html += "
" + course_info.subtitle + "
"; html += "
"; html += ""; html += ""; html += "
"; html += "
"; html += "
"; html += "
"; html += "" + gLocal.gui.speaker + ": "; html += "" + course_info.teacher_info.nickname + ""; html += ""; //html += "地区:缅甸"; html += "
"; // end of course_info_head_2 html += "
"; //end of head //summary if (course_info.summary.length > 0) { html += "
"; html += "

" + gLocal.gui.introduction + "

"; try { html += marked(course_info.summary); } catch (e) { html += e.message; } html += "
"; } //end of summary //attachment if (course_info.attachment.length > 0) { html += "
"; html += "

" + gLocal.gui.attachment + "

"; try { html += marked(course_info.attachment); } catch (e) { html += e.message; } html += "
"; } //end of attachment $("#course_info").html(html); $("#page_title").text(course_info.title); $("img").one("error", function () { $(this).attr("src", "../course/img/default.jpg"); }); } } ); $.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 += '
'; let d = new Date(); d.setTime(lesson["date"]); let strData = d.toLocaleDateString(); let strTime = d.toLocaleTimeString(); html += "
" + strData + " " + strTime + "
"; html += '
' + lesson["title"] + "
"; /* let dt = lesson["duration"] / 60; let sdt = ""; if (dt > 59) { sdt += Math.floor(dt / 60) + "小时"; } let m = dt % 60; if (m > 0) { sdt += (dt % 60) + "分钟"; } html += "
" + gLocal.gui.duration + ":" + sdt + "
"; html += '
' + lesson_time + "
"; */ html += "
"; } $("#lesson_list").html(html); } ); }