From fe2f3b11e41f968f89b8aa3a6af8b6df844389ad Mon Sep 17 00:00:00 2001 From: "xie.bx" Date: Thu, 1 Dec 2022 13:29:55 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- im-ui/src/components/chat/ChatPrivateVideo.vue | 1 - im-ui/src/components/chat/ChatTime.vue | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/im-ui/src/components/chat/ChatPrivateVideo.vue b/im-ui/src/components/chat/ChatPrivateVideo.vue index 121d1c9..2e28baf 100644 --- a/im-ui/src/components/chat/ChatPrivateVideo.vue +++ b/im-ui/src/components/chat/ChatPrivateVideo.vue @@ -19,7 +19,6 @@ @click="cancel()">
- diff --git a/im-ui/src/components/chat/ChatTime.vue b/im-ui/src/components/chat/ChatTime.vue index f9c324f..b223843 100644 --- a/im-ui/src/components/chat/ChatTime.vue +++ b/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(); -- Gitee From f97d6fef5307d551c113ec950d42fe9ffcf29db6 Mon Sep 17 00:00:00 2001 From: "xie.bx" Date: Thu, 1 Dec 2022 14:16:37 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E8=A7=86=E9=A2=91=E8=81=8A=E5=A4=A9?= =?UTF-8?q?=E5=8A=9F=E8=83=BD-=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- im-ui/src/components/chat/ChatTime.vue | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/im-ui/src/components/chat/ChatTime.vue b/im-ui/src/components/chat/ChatTime.vue index b223843..eae222a 100644 --- a/im-ui/src/components/chat/ChatTime.vue +++ b/im-ui/src/components/chat/ChatTime.vue @@ -17,16 +17,18 @@ formatDate(){ let time = new Date(this.time); let strtime = ""; - let curTime = new Date(); - let dayDiff = Math.floor((curTime.getTime() - time.getTime())/(24*3600*1000)) ; - if (dayDiff < 1) { + + let todayTime = new Date(); + todayTime.setHours(0,0,0,0) + let dayDiff = Math.floor((todayTime.getTime() - time.getTime())/(24*3600*1000)) ; + if (time.getTime() > todayTime.getTime()) { strtime = time.getHours() <= 9 ? "0" + time.getHours() : time.getHours(); strtime += ":" strtime += time.getMinutes() <= 9 ? "0" + time.getMinutes() : time.getMinutes(); - } else if (dayDiff === 1) { + } else if (dayDiff < 1 ) { strtime = "昨天"; } else if (dayDiff < 7) { - strtime = `${dayDiff}天前`; + strtime = `${dayDiff+1}天前`; } else { strtime = time.getMonth()+1+"月"+time.getDate()+"日"; } -- Gitee From b7cde3799505297b06a9cc6bd6a64fa2fcb96925 Mon Sep 17 00:00:00 2001 From: "xie.bx" Date: Wed, 7 Dec 2022 14:37:23 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E5=8F=91=E9=80=81=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- im-ui/src/components/chat/ChatBox.vue | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/im-ui/src/components/chat/ChatBox.vue b/im-ui/src/components/chat/ChatBox.vue index 98a881f..99047e6 100644 --- a/im-ui/src/components/chat/ChatBox.vue +++ b/im-ui/src/components/chat/ChatBox.vue @@ -40,7 +40,7 @@
- +
发送
@@ -94,7 +94,8 @@ x: 0, y: 0 }, - showHistory: false // 是否显示历史聊天记录 + showHistory: false, // 是否显示历史聊天记录 + lockMessage: false // 是否锁定发送 } }, methods: { @@ -269,6 +270,7 @@ } // 填充对方id this.setTargetId(msgInfo, this.chat.targetId); + this.lockMessage = true; this.$http({ url: this.messageAction, method: 'post', @@ -281,11 +283,14 @@ msgInfo.sendId = this.$store.state.userStore.userInfo.id; msgInfo.selfSend = true; this.$store.commit("insertMessage", msgInfo); + }).finally(() => { + // 解除锁定 + this.lockMessage = false; // 保持输入框焦点 - this.$refs.sendBox.focus(); + this.$nextTick(() => this.$refs.sendBox.focus()); // 滚动到底部 this.scrollToBottom(); - }) + }); const e = window.event || arguments[0]; if (e.key === 'Enter' || e.code === 'Enter' || e.keyCode === 13) { e.returnValue = false; -- Gitee