From bac352d245c6a5b6f29324fa5ad89271bde31a81 Mon Sep 17 00:00:00 2001 From: "xie.bx" Date: Tue, 8 Nov 2022 16:43:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AD=A3=E5=9C=A8=E5=BC=80=E5=8F=91=E8=AF=AD?= =?UTF-8?q?=E8=A8=80=E4=BC=A0=E8=BE=93=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- im-ui/src/components/chat/ChatBox.vue | 23 +++++- im-ui/src/components/chat/ChatVoice.vue | 100 ++++++++++++++++++++++++ im-ui/src/view/Home.vue | 8 +- 3 files changed, 123 insertions(+), 8 deletions(-) create mode 100644 im-ui/src/components/chat/ChatVoice.vue diff --git a/im-ui/src/components/chat/ChatBox.vue b/im-ui/src/components/chat/ChatBox.vue index ec4a92d..14bf987 100644 --- a/im-ui/src/components/chat/ChatBox.vue +++ b/im-ui/src/components/chat/ChatBox.vue @@ -20,7 +20,6 @@
-
+
+
@@ -46,6 +47,8 @@ + + @@ -54,6 +57,7 @@ import MessageItem from "./MessageItem.vue"; import FileUpload from "../common/FileUpload.vue"; import Emotion from "../common/Emotion.vue"; + import ChatVoice from "./ChatVoice.vue"; export default { name: "chatPrivate", @@ -61,7 +65,8 @@ MessageItem, FileUpload, ChatGroupSide, - Emotion + Emotion, + ChatVoice }, props: { chat: { @@ -74,6 +79,7 @@ group: {}, groupMembers: [], sendText: "", + showVoice: false, // 是否显示语音录制弹窗 showSide: false, // 是否显示群聊信息栏 showEmotion: false, // 是否显示emoji表情 emoBoxPos: { // emoji表情弹出位置 @@ -83,6 +89,7 @@ } }, methods: { + handleImageSuccess(res, file) { let msgInfo = { recvId: file.raw.targetId, @@ -213,9 +220,17 @@ }, handleEmotion(emoText) { this.sendText += emoText; + this.showEmotion = false; // 保持输入框焦点 this.$refs.sendBox.focus(); }, + showVoiceBox() { + this.showVoice = true; + + }, + closeVoiceBox(){ + this.showVoice = false; + }, setTargetId(msgInfo, targetId) { if (this.chat.type == "GROUP") { msgInfo.groupId = targetId; @@ -336,7 +351,7 @@ watch: { chat: { handler(newChat, oldChat) { - if(newChat.targetId > 0 && (newChat.type != oldChat.type || newChat.targetId != oldChat.targetId)){ + if (newChat.targetId > 0 && (newChat.type != oldChat.type || newChat.targetId != oldChat.targetId)) { if (this.chat.type == "GROUP") { this.loadGroup(this.chat.targetId); } else { @@ -346,7 +361,7 @@ this.sendText = ""; // 保持输入框焦点 this.$refs.sendBox.focus(); - } + } }, deep: true } diff --git a/im-ui/src/components/chat/ChatVoice.vue b/im-ui/src/components/chat/ChatVoice.vue new file mode 100644 index 0000000..a18250e --- /dev/null +++ b/im-ui/src/components/chat/ChatVoice.vue @@ -0,0 +1,100 @@ + + + + + diff --git a/im-ui/src/view/Home.vue b/im-ui/src/view/Home.vue index f654c7d..85f6d84 100644 --- a/im-ui/src/view/Home.vue +++ b/im-ui/src/view/Home.vue @@ -23,7 +23,7 @@ - + @@ -34,7 +34,7 @@ - +