index.php 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. <?PHP
  2. include "../pcdl/html_head.php";
  3. ?>
  4. <body>
  5. <?php
  6. require_once("../pcdl/head_bar.php");
  7. ?>
  8. <style>
  9. .padding_LR_1rem {
  10. padding: 0 1rem;
  11. }
  12. .content_block {
  13. width: 230px;
  14. }
  15. .index_inner {
  16. margin-left: auto;
  17. margin-right: auto;
  18. }
  19. .content_inner {
  20. display: grid;
  21. justify-content: center;
  22. grid-gap: 20px;
  23. }
  24. .collect_head_bar {
  25. background-color: #212121;
  26. height: 280px;
  27. padding: 30px;
  28. color: white;
  29. }
  30. .section_inner {
  31. max-width: 960px;
  32. margin: 0 auto;
  33. }
  34. .title_bar {
  35. justify-content: space-between;
  36. display: flex;
  37. margin: 1em 0;
  38. align-items: center;
  39. }
  40. h1 {
  41. font-size: 42px;
  42. font-weight: 700;
  43. margin: 0.3em 0;
  44. }
  45. h3 {
  46. font-size: 18px;
  47. margin: 0;
  48. }
  49. .index_list_categories {
  50. padding: 1rem;
  51. margin-bottom: 2rem;
  52. }
  53. .index_list_categories a:hover {
  54. color: var(--tool-link-hover-color);
  55. }
  56. /*.index_list_categories a,a:link{
  57. color: var(--main-color);
  58. }*/
  59. .index_list_categories button {
  60. border: none;
  61. }
  62. .card li {
  63. white-space: unset;
  64. }
  65. .card code {
  66. white-space: unset;
  67. }
  68. .teacher_photo {
  69. width: 230px;
  70. height: 178px;
  71. background-color: gray;
  72. border-radius: 8px;
  73. }
  74. .teacher_text {
  75. padding: 0 5px;
  76. }
  77. .teacher_text .title {
  78. font-size: 120%;
  79. font-weight: 700;
  80. margin: 0.5em 0;
  81. }
  82. .teacher_intro {
  83. display: -webkit-box;
  84. -webkit-box-orient: vertical;
  85. overflow: hidden;
  86. text-overflow: ellipsis;
  87. width: 100%;
  88. -webkit-line-clamp: 3;
  89. }
  90. #course_list_complete .card,
  91. #course_list_ongoing .card {
  92. height: 120px;
  93. padding: 0;
  94. display: grid;
  95. grid-template-columns: 120px 1fr;
  96. }
  97. .course_block {
  98. background-color: #f5f5f5;
  99. padding: 1rem;
  100. }
  101. .course_right {
  102. padding: 10px;
  103. display: flex;
  104. flex-direction: column;
  105. width: calc(100% - 10px);
  106. }
  107. .card_photo {
  108. object-fit: cover;
  109. border-radius: 20px 0 0 20px;
  110. }
  111. .course_right .title a {
  112. font-size: 120%;
  113. font-weight: 700;
  114. display: -webkit-box;
  115. -webkit-box-orient: vertical;
  116. overflow: hidden;
  117. text-overflow: ellipsis;
  118. -webkit-line-clamp: 2;
  119. color: var(--main-color);
  120. }
  121. .subtitle {
  122. margin-top: auto;
  123. display: -webkit-box;
  124. -webkit-box-orient: vertical;
  125. overflow: hidden;
  126. text-overflow: ellipsis;
  127. width: 100%;
  128. -webkit-line-clamp: 2;
  129. }
  130. @media screen and (min-width:800px) {
  131. .index_list_categories {
  132. max-width: 760px;
  133. margin: 0 auto 3rem auto;
  134. }
  135. .content_inner {
  136. grid-template-columns: 230px 230px 230px;
  137. }
  138. h3 {
  139. font-size: 22px;
  140. }
  141. .course_block h3 {
  142. text-align: center;
  143. margin: 1em 0;
  144. }
  145. #course_list_ongoing,
  146. #course_list_complete {
  147. max-width: 600px;
  148. margin: 0 auto;
  149. }
  150. }
  151. @media screen and (min-width:1020px) {
  152. .index_list_categories {
  153. max-width: 1020px;
  154. }
  155. .content_inner {
  156. grid-template-columns: 230px 230px 230px 230px;
  157. }
  158. }
  159. </style>
  160. <script src="../public/js/marked.js"></script>
  161. <div class="index_inner">
  162. <div id="course_head_bar" class="collect_head_bar">
  163. <div class="section_inner">
  164. <h1><?php echo $_local->gui->lesson ;?></h1>
  165. <div style="max-width:30em"><?php echo $_local->gui->lesson_intro; ?></div>
  166. </div>
  167. </div>
  168. <div class="index_list_categories">
  169. <div class="title_bar">
  170. <h3><?php echo $_local->gui->speaker ;?></h3>
  171. <span class="title_more"><a href="../course"><?php echo $_local->gui->more ?></a></span>
  172. </div>
  173. <div class="content">
  174. <div id="course_list_new" class="content_inner">
  175. </div>
  176. </div>
  177. </div>
  178. <script>
  179. $.get("../course/teacher_list.php", function(data, status) {
  180. let xDiv = document.getElementById("course_list_new");
  181. if (xDiv) {
  182. xDiv.innerHTML = data;
  183. }
  184. });
  185. /*$(".teacher_intro").each(function(){
  186. $(this).innerHTML=marked($(this).innerHTML);
  187. });*/
  188. </script>
  189. <div class="course_block">
  190. <h3>
  191. <?php echo $_local->gui->in_progress; ?>
  192. </h3>
  193. <div id="course_list_ongoing">
  194. </div>
  195. </div>
  196. <div class="course_block">
  197. <h3>
  198. <?php echo $_local->gui->already_over; ?>
  199. </h3>
  200. <div id="course_list_complete">
  201. </div>
  202. </div>
  203. <script>
  204. $(document).ready(function() {
  205. $("#nav_course").addClass('active');
  206. });
  207. $.get("../course/course_list.php", function(data, status) {
  208. let arrData = JSON.parse(data);
  209. let html_complete = "";
  210. let html_ongoing = "";
  211. for (const iterator of arrData) {
  212. let html = "";
  213. html += '<div class="card">';
  214. html += '<div style="height:120px;width:120px;">';
  215. html += '<img src="../../tmp/images/course/' + iterator.id + '.jpg" alt="cover" width="120" height="120" class="card_photo">';
  216. html += '</div>';
  217. html += '<div class="course_right">';
  218. html += '<div class="title"><a href="../course/course.php?id=' + iterator.id + '">' + iterator.title + '</a></div>';
  219. //教师名字
  220. html += '<div class="author">' + gLocal.gui.speaker + ':';
  221. html += "<a href='../uhome/course.php?userid=" + iterator.teacher + "'>"
  222. html += iterator.teacher_info.nickname;
  223. html += "</a>";
  224. html += '</div>';
  225. html += '<div class="subtitle">' + iterator.subtitle + '</div>';
  226. /*let summary = "";
  227. try {
  228. summary = marked(iterator.summary);
  229. } catch (e) {}
  230. html += '<div class="summary">' + summary + '</div>';*/
  231. html += '</div>';
  232. html += '</div>';
  233. if (iterator.status == 40) {
  234. html_complete += html;
  235. } else if (iterator.status == 30 || iterator.status == 20) {
  236. html_ongoing += html;
  237. }
  238. }
  239. $("#course_list_complete").html(html_complete);
  240. $("#course_list_ongoing").html(html_ongoing);
  241. $("img").one("error", function() {
  242. $(this).attr("src", "../course/img/default.jpg");
  243. });
  244. });
  245. </script>
  246. </div>
  247. <?php
  248. include "../pcdl/html_foot.php";
  249. ?>