Browse Source

Merge pull request #217 from visuddhinanda/master

 时间戳问题
visuddhinanda 5 years ago
parent
commit
1a8fc89b4d
3 changed files with 28 additions and 9 deletions
  1. 17 0
      app/course/my_couse.js
  2. 5 2
      app/course/my_lesson_edit.php
  3. 6 7
      app/term/term.css

+ 17 - 0
app/course/my_couse.js

@@ -43,3 +43,20 @@ function course_validate_form(thisform) {
 }
 }
 
 
 function course_list() {}
 function course_list() {}
+
+function time_init() {
+	let lessonTime = new Date(parseInt($("#form_datetime").val()));
+	let month = lessonTime.getMonth() + 1;
+	month = month > 9 ? month : "0" + month;
+	let d = lessonTime.getDate();
+	d = d > 9 ? d : "0" + d;
+	let data = lessonTime.getFullYear() + "-" + month + "-" + d;
+	let strData = "<input type='date'  name='lesson_date' value='" + data + "'/>";
+	$("#form_date").html(strData);
+	let H = lessonTime.getHours();
+	H = H > 9 ? H : "0" + H;
+	let M = lessonTime.getMinutes();
+	M = M > 9 ? M : "0" + M;
+	let strTime = "<input type='time'  name='lesson_time' value='" + H + ":" + M + "'/>";
+	$("#form_time").html(strTime);
+}

+ 5 - 2
app/course/my_lesson_edit.php

@@ -94,9 +94,10 @@ echo '<div id="userfilelist">';
     $strDate = date("Y-m-d",$lesson_info["date"]/1000);
     $strDate = date("Y-m-d",$lesson_info["date"]/1000);
     $strTime = date("H:i",$lesson_info["date"]/1000);
     $strTime = date("H:i",$lesson_info["date"]/1000);
     $strDuration = date("H:i",$lesson_info["duration"]);
     $strDuration = date("H:i",$lesson_info["duration"]);
+    echo '<input type="hidden" id="form_datetime" name="form_time" value="'.$lesson_info["date"].'"/>';
     echo '<input type="hidden" name="lesson_timezone" value=""/>';
     echo '<input type="hidden" name="lesson_timezone" value=""/>';
-    echo $_local->gui->date.':<input type="date" name="lesson_date" value="'.$strDate.'"/>';
-    echo $_local->gui->time.':<input type="time" name="lesson_time" value="'.$strTime.'"/>';
+    echo $_local->gui->date.':<div id="form_date"></div>';
+    echo $_local->gui->time.':<div id="form_time"></div>';
     echo $_local->gui->duration.':<input type="time" name="duration" value="'.$strDuration.'"/>';
     echo $_local->gui->duration.':<input type="time" name="duration" value="'.$strDuration.'"/>';
     echo '</div></div>';
     echo '</div></div>';
 
 
@@ -148,4 +149,6 @@ echo '</div>';
 <script>
 <script>
     name_selector_init("teacher_id",{input_id:"form_teacher"});
     name_selector_init("teacher_id",{input_id:"form_teacher"});
     img_dlg_init("img_cover",{input_id:"cover_id"});
     img_dlg_init("img_cover",{input_id:"cover_id"});
+    time_init();
+    
 </script>
 </script>

+ 6 - 7
app/term/term.css

@@ -151,7 +151,7 @@ commentary,
 com,
 com,
 nt,
 nt,
 blockquote {
 blockquote {
-	margin:0;
+	margin: 0;
 	margin-left: 1.5em;
 	margin-left: 1.5em;
 	display: block;
 	display: block;
 	border-left: 3px solid gray;
 	border-left: 3px solid gray;
@@ -518,10 +518,9 @@ note:hover .note_tool_bar {
 }
 }
 .separate_line {
 .separate_line {
 	border: solid 1px #e8e8e8;
 	border: solid 1px #e8e8e8;
-    border-radius: 3px;
-    margin: 1px 5px;
-    width: 1px;
-    background: #c6c6c6;
-    text-decoration: none;
-}
+	border-radius: 3px;
+	margin: 1px 5px;
+	width: 1px;
+	background: #c6c6c6;
+	text-decoration: none;
 }
 }