From 837f72af461383741583d32348fa7011fdce0487 Mon Sep 17 00:00:00 2001 From: xsx <825657193@qq.com> Date: Sun, 28 Jul 2024 21:22:32 +0800 Subject: [PATCH] =?UTF-8?q?web=E7=AB=AFui=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- im-ui/src/components/chat/ChatAtBox.vue | 11 +++++++--- im-ui/src/components/chat/ChatBox.vue | 21 ++++++++++++------- im-ui/src/components/chat/ChatGroupMember.vue | 12 +++++++---- im-ui/src/components/common/Emotion.vue | 2 +- 4 files changed, 30 insertions(+), 16 deletions(-) diff --git a/im-ui/src/components/chat/ChatAtBox.vue b/im-ui/src/components/chat/ChatAtBox.vue index 7c371c9..25ab54a 100644 --- a/im-ui/src/components/chat/ChatAtBox.vue +++ b/im-ui/src/components/chat/ChatAtBox.vue @@ -1,8 +1,9 @@ @@ -55,6 +56,10 @@ } }) this.activeIdx = this.showMembers.length > 0 ? 0: -1; + console.log(this.showMembers.length) + if(this.showMembers.length == 0){ + this.close(); + } }, open(pos) { this.show = true; @@ -122,7 +127,7 @@ position: fixed; width: 200px; height: 300px; - border: 1px solid #b4b4b4; + border: 1px solid #53a0e79c; border-radius: 5px; background-color: #f5f5f5; box-shadow: 0px 0px 10px #ccc; diff --git a/im-ui/src/components/chat/ChatBox.vue b/im-ui/src/components/chat/ChatBox.vue index 39ca6ba..6981db5 100644 --- a/im-ui/src/components/chat/ChatBox.vue +++ b/im-ui/src/components/chat/ChatBox.vue @@ -62,8 +62,8 @@ :disabled="lockMessage" @paste.prevent="onEditorPaste" @compositionstart="onEditorCompositionStart" @compositionend="onEditorCompositionEnd" @input="onEditorInput" - :placeholder="placeholder" @blur="onEditBoxBlur()" @keydown.down="onKeyDown" - @keydown.up="onKeyUp" @keydown.enter.prevent="onKeyEnter">x + :placeholder="placeholder" @blur="onEditBoxBlur()" @keyup.down="onKeyDown" + @keyup.up.prevent="onKeyUp" @keydown.enter.prevent="onKeyEnter">x
@@ -107,7 +107,7 @@ import ChatAtBox from "./ChatAtBox.vue" import GroupMemberSelector from "../group/GroupMemberSelector.vue" import RtcGroupJoin from "../rtc/RtcGroupJoin.vue" - + export default { name: "chatPrivate", @@ -164,6 +164,7 @@ } }, onKeyDown() { + console.log("onKeyDown") if (this.$refs.atBox.show) { this.$refs.atBox.moveDown() } @@ -188,13 +189,17 @@ this.focusNode = selection.focusNode; this.focusOffset = selection.focusOffset; }, - onEditorInput(e) { + onEditorInput(e, e2, e3) { // 如果触发 @ if (this.chat.type == "GROUP" && !this.zhLock) { + console.log("onEditorInput") + if (e.inputType === "deleteContentBackward" && !this.atSearchText) { + this.$refs.atBox.close(); + } if (e.data == '@') { // 打开选择弹窗 this.showAtBox(e); - } else { + } else if(this.$refs.atBox.show){ let selection = window.getSelection() let range = selection.getRangeAt(0) this.focusNode = selection.focusNode; @@ -490,7 +495,7 @@ }, onInviteOk(members) { - if(members.length < 2){ + if (members.length < 2) { return; } let userInfos = []; @@ -742,7 +747,7 @@ this.placeholder = "聊点什么吧~"; } }, - generateId(){ + generateId() { // 生成临时id return String(new Date().getTime()) + String(Math.floor(Math.random() * 1000)); } @@ -824,7 +829,7 @@ position: relative; width: 100%; background: #f8f8f8; - + .el-header { padding: 3px; background-color: white; diff --git a/im-ui/src/components/chat/ChatGroupMember.vue b/im-ui/src/components/chat/ChatGroupMember.vue index f1ae8d7..666b2c2 100644 --- a/im-ui/src/components/chat/ChatGroupMember.vue +++ b/im-ui/src/components/chat/ChatGroupMember.vue @@ -1,5 +1,5 @@