Browse Source

课程支持句子链接

visuddhinanda 5 years ago
parent
commit
1610900d3b
3 changed files with 22 additions and 42 deletions
  1. 4 18
      app/course/lesson.js
  2. 16 22
      app/course/my_lesson_edit.php
  3. 2 2
      app/course/my_lesson_update.php

+ 4 - 18
app/course/lesson.js

@@ -168,7 +168,9 @@ function lesson_load(lesson_id) {
 					html += "<div id='course_info_attachment' class='course_info_block'>";
 					html += "<h2>" + gLocal.gui.attachment + "</h2>";
 					try {
-						html += marked(lesson_info.attachment);
+						html += "<div class='course_info_content'>";
+						html += note_init(lesson_info.attachment);
+						html += "</div>";
 					} catch (e) {
 						html += e.message;
 					}
@@ -189,7 +191,7 @@ function lesson_load(lesson_id) {
 				}
 				//end of attachment
 				$("#lesson_info").html(html);
-
+				note_refresh_new();
 				render_lesson_list(lesson_info.course_id, lesson_info.id);
 			}
 		}
@@ -240,22 +242,6 @@ function render_lesson_list(id, currLesson) {
 
 				html += "</div>";
 
-				/*
-				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 += "<div >" + gLocal.gui.duration + ":" + sdt + "</div>";
-				
-
-				html += '<div ><span class="lesson_status">' + lesson_time + "</span></div>";
-*/
-
 				html += "</div>";
 			}
 			$("#lesson_list").html(html);

+ 16 - 22
app/course/my_lesson_edit.php

@@ -72,24 +72,6 @@ echo '</div>';
 echo '<div></div>';
 echo '</div>';
 
-/*
-$coverList = array();
-
-$coverList[] = $lesson_info["cover"];
-
-$covers = media_get($coverList);
-foreach ($covers as $value) {
-    $cover["{$value["id"]}"] = $value["link"];
-}
-
-    $coverlink = $cover["{$lesson_info["cover"]}"];
-    if(substr($coverlink,0,6)=="media:"){
-        $cover_html = '<div style="width: 20em;"><img src="'._DIR_USER_IMG_LINK_.'/'.substr($coverlink,6).'" width="100%" height="auto"></div>';
-    }
-    else{
-        $cover_html =  '<div style="width: 20em;"><img src="'.$coverlink.'" width="50" height="50"></div>';
-    }
-*/
 echo '<div style="display:flex;">';
 
 echo '<div style="flex:8;padding:0 0.8em;">';
@@ -113,6 +95,14 @@ echo '<div id="userfilelist">';
     echo '<div style="flex:8;"><input type="input" name = "subtitle" value="'.$lesson_info["subtitle"].'" /></div>';
     echo '</div>';
 
+    
+    # 主讲人
+    echo '<div style="display:flex;">';
+    echo '<div style="flex:2;">'.$_local->gui->speaker.'</div>';
+    echo '<div id="teacher_id" style="flex:8;"></div>';
+    echo '<input id="form_teacher" type="hidden" name="teacher" value="'.$lesson_info["teacher"].'" />';
+    echo '</div>'; 
+
     echo '<div style="display:flex;">';
     echo '<div style="flex:2;">'.$_local->gui->introduction.'</div>';
     echo '<div style="flex:8;"><textarea name="summary" style="height:6em;">'.$lesson_info["summary"].'</textarea></div>';
@@ -137,20 +127,24 @@ echo '<div id="userfilelist">';
     echo '</div>';
     echo '</div>';
 
+    #直播
     echo '<div style="display:flex;">';
     echo '<div style="flex:2;">'.$_local->gui->notice_live.'</div>';
     echo '<div style="flex:8;"><textarea name="live" style="height:6em;">'.$lesson_info["live"].'</textarea></div>';
     echo '</div>';
+
+    #录播
     echo '<div style="display:flex;">';
     echo '<div style="flex:2;">'.$_local->gui->record_replay.'</div>';
     echo '<div style="flex:8;"><textarea name="replay" style="height:6em;">'.$lesson_info["replay"].'</textarea></div>';
     echo '</div>';
 
+
+    #附件
     echo '<div style="display:flex;">';
-    echo '<div style="flex:2;">'.$_local->gui->speaker.'</div>';
-    echo '<div id="teacher_id" style="flex:8;"></div>';
-    echo '<input id="form_teacher" type="hidden" name="teacher" value="'.$lesson_info["teacher"].'" />';
-    echo '</div>'; 
+    echo '<div style="flex:2;">'.$_local->gui->attachment.'</div>';
+    echo '<div style="flex:8;"><textarea name="attachment" style="height:10em;">'.$lesson_info["attachment"].'</textarea></div>';
+    echo '</div>';
 
 echo '</div>';
 ?>

+ 2 - 2
app/course/my_lesson_update.php

@@ -11,7 +11,7 @@ $course_id = PDO_FetchOne($query,array($_POST["lesson"]));
 $query="UPDATE course SET  receive_time= ?  , modify_time= ?   where  id = ?  ";
 PDO_Execute($query,array(mTime(),mTime(),$course_id));
 
-$query="UPDATE lesson SET title = ? , subtitle = ? , date = ? , duration = ? , live = ? , replay = ? , summary = ? , teacher = ?  , receive_time= ?  , modify_time= ?   where  id = ?  ";
+$query="UPDATE lesson SET title = ? , subtitle = ? , date = ? , duration = ? , live = ? , replay = ? , summary = ? , teacher = ?  , attachment = ?, receive_time= ?  , modify_time= ?   where  id = ?  ";
 $sth = $PDO->prepare($query);
 
 $data = strtotime($_POST["lesson_date"]);
@@ -20,7 +20,7 @@ $timezone = $_POST["lesson_timezone"];
 $datatime = ($data+$time+$timezone*60)*1000;
 $duration = strtotime($_POST["duration"]) - strtotime("today");
 
-$sth->execute(array($_POST["title"] , $_POST["subtitle"] ,$datatime, $duration , $_POST["live"] , $_POST["replay"] , $_POST["summary"] ,  $_POST["teacher"] ,  mTime() , mTime() , $_POST["lesson"]));
+$sth->execute(array($_POST["title"] , $_POST["subtitle"] ,$datatime, $duration , $_POST["live"] , $_POST["replay"] , $_POST["summary"] ,  $_POST["teacher"] , $_POST["attachment"] ,  mTime() , mTime() , $_POST["lesson"]));
 $respond=array("status"=>0,"message"=>"");
 if (!$sth || ($sth && $sth->errorCode() != 0)) {
 	$error = PDO_ErrorInfo();