Explorar el Código

调整译文紧凑模式时间显示为绝对时间

visuddhinanda hace 5 años
padre
commit
079ac01571
Se han modificado 4 ficheros con 50 adiciones y 5 borrados
  1. 39 0
      app/public/js/comm.js
  2. 0 1
      app/studio/file_index.php
  3. 6 1
      app/term/note.js
  4. 5 3
      app/term/term.css

+ 39 - 0
app/public/js/comm.js

@@ -187,5 +187,44 @@ function getPassDataTime(time) {
 	}
 	return strPassTime;
 }
+function getFullDataTime(time) {
+	let inputDate = new Date();
+	inputDate.setTime(time);
+	return inputDate.toLocaleString();
+}
+function getDataTime(time) {
+	let today = new Date();
+	let inputDate = new Date();
+	inputDate.setTime(time);
+
+	let day = inputDate.getDate();
+	let month = inputDate.getMonth() + 1;
+	let year = inputDate.getFullYear();
+
+	let hours = inputDate.getHours();
+	let minutes = inputDate.getMinutes();
+	let seconds = inputDate.getSeconds();
+
+	let today_day = today.getDate();
+	let today_month = today.getMonth() + 1;
+	let today_year = today.getFullYear();
+
+	let today_hours = today.getHours();
+	let today_minutes = today.getMinutes();
+	let today_seconds = today.getSeconds();
+
+	let output = "";
+	if (today_day == day && today_month == month && today_year == year) {
+		//当天
+		output = hours + ":" + minutes;
+	} else if (today_year != year) {
+		//不同年
+		output = year;
+	} else {
+		//同一年
+		output = month + "/" + day;
+	}
+	return output;
+}
 //所有页面都需要在加载的的时候设置浏览器时区
 setTimeZone();

+ 0 - 1
app/studio/file_index.php

@@ -41,7 +41,6 @@ switch ($op) {
         break;
     case "getall";
         //
-        $time = time();
         $query = "select * from fileindex where user_id='$uid' AND  id='{$_POST["doc_id"]}'";
         $Fetch = PDO_FetchAll($query);
         $iFetch = count($Fetch);

+ 6 - 1
app/term/note.js

@@ -827,7 +827,12 @@ function render_one_sent_tran_a(iterator) {
 		html += '<span class="head_img">' + iterator.editor_name.nickname.slice(0, 1) + "</span>";
 	}
 	html += "</div>";
-	html += '<div class="date">' + getPassDataTime(iterator.update_time) + "</div>";
+	html +=
+		'<div class="date" title="' +
+		getFullDataTime(iterator.update_time) +
+		'">' +
+		getDataTime(iterator.update_time) +
+		"</div>";
 	html += "</div>";
 	html += '<div class="body">';
 	html += '<div class="head_bar">';

+ 5 - 3
app/term/term.css

@@ -559,10 +559,10 @@ pw {
 	display: flex;
 }
 .sent_tran:hover {
-	background-color: var(--btn-border-color);
+	background-color: rgba(0.5, 0.5, 0.5, 0.02);
 }
 .left_bar {
-	flex: 2;
+	flex: 1;
 	display: flex;
 }
 .sent_tran .left_bar > .face {
@@ -576,12 +576,14 @@ pw {
 }
 .compact .left_bar > .date {
 	display: block;
+	font-size: 80%;
+	color: var(--main-color1);
 }
 
 .sent_tran_inner > .body {
 	width: 100%;
 	display: block;
-	flex: 13;
+	flex: 20;
 }
 .preview {
 	font-size: 110%;