瀏覽代碼

修复时间显示的bug

xie.bx 3 年之前
父節點
當前提交
fe2f3b11e4
共有 2 個文件被更改,包括 2 次插入3 次删除
  1. 0 1
      im-ui/src/components/chat/ChatPrivateVideo.vue
  2. 2 2
      im-ui/src/components/chat/ChatTime.vue

+ 0 - 1
im-ui/src/components/chat/ChatPrivateVideo.vue

@@ -19,7 +19,6 @@
 				 @click="cancel()"></div>
 				<div v-show="state=='CONNECTED'" title="挂断" class="icon iconfont icon-phone-reject reject" style="color: red;"
 				 @click="handup()"></div>
-
 			</div>
 		</div>
 	</el-dialog>

+ 2 - 2
im-ui/src/components/chat/ChatTime.vue

@@ -18,8 +18,8 @@
 				let time = new Date(this.time);
 				let strtime = "";
 				let curTime = new Date();
-				let dayDiff =curTime.getDate() - time.getDate() ;
-				if (time.getDate() === new Date().getDate()) {
+				let dayDiff = Math.floor((curTime.getTime() - time.getTime())/(24*3600*1000)) ;
+				if (dayDiff < 1) {
 					strtime = time.getHours() <= 9 ? "0" + time.getHours() : time.getHours();
 					strtime += ":"
 					strtime += time.getMinutes() <= 9 ? "0" + time.getMinutes() : time.getMinutes();