From c0a90ae89dea7f42a7aaf2f877412ef4bd14caab Mon Sep 17 00:00:00 2001 From: kuaifan Date: Tue, 21 May 2024 15:13:25 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B6=88=E6=81=AF=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E6=A1=86=E5=9B=9E=E5=A4=8D=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manage/components/ChatInput/index.vue | 8 ++++++ .../pages/manage/components/ChatInput/one.js | 25 ++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/resources/assets/js/pages/manage/components/ChatInput/index.vue b/resources/assets/js/pages/manage/components/ChatInput/index.vue index c8d9dc1c4..be42bc7d8 100755 --- a/resources/assets/js/pages/manage/components/ChatInput/index.vue +++ b/resources/assets/js/pages/manage/components/ChatInput/index.vue @@ -222,6 +222,7 @@ import touchclick from "../../../../directives/touchclick"; import TransferDom from "../../../../directives/transfer-dom"; import clickoutside from "../../../../directives/clickoutside"; import longpress from "../../../../directives/longpress"; +import {inputLoadAdd, inputLoadIsLast, inputLoadRemove} from "./one"; import {isMarkdownFormat} from "../../../../store/markdown"; import {Store} from "le5le-store"; @@ -342,6 +343,9 @@ export default { fullQuill: null, }; }, + created() { + inputLoadAdd(this.dialogId, this._uid) + }, mounted() { this.init(); // @@ -370,6 +374,7 @@ export default { $A.loadScript('js/emoticon.all.js') }, beforeDestroy() { + inputLoadRemove(this.dialogId, this._uid) if (this.quill) { this.quill.getModule("mention")?.hideMentionList(); this.quill = null @@ -1361,6 +1366,9 @@ export default { if (!this.quill) { return; } + if (!inputLoadIsLast(this.dialogId, this._uid)) { + return; + } const {index} = this.quill.getSelection(true); this.quill.insertEmbed(index, "mention", data, Quill.sources.USER); this.quill.insertText(index + 1, " ", Quill.sources.USER); diff --git a/resources/assets/js/pages/manage/components/ChatInput/one.js b/resources/assets/js/pages/manage/components/ChatInput/one.js index f85d4c4a3..c62c67da6 100644 --- a/resources/assets/js/pages/manage/components/ChatInput/one.js +++ b/resources/assets/js/pages/manage/components/ChatInput/one.js @@ -2,6 +2,29 @@ import Vue from 'vue'; import Emoji from "./emoji.vue"; import {Modal} from "view-design-hi"; +const inputLoadUid = {} + +function inputLoadAdd(dialogId, uid) { + if (typeof inputLoadUid[dialogId] === "undefined") { + inputLoadUid[dialogId] = []; + } + inputLoadUid[dialogId].push(uid) +} + +function inputLoadRemove(dialogId, uid) { + if (typeof inputLoadUid[dialogId] === "undefined") { + return; + } + inputLoadUid[dialogId] = inputLoadUid[dialogId].filter(v => v !== uid) +} + +function inputLoadIsLast(dialogId, uid) { + if (typeof inputLoadUid[dialogId] === "undefined") { + return false; + } + return inputLoadUid[dialogId][inputLoadUid[dialogId].length - 1] === uid +} + function choiceEmojiOne() { return new Promise(resolve => { const Instance = new Vue({ @@ -53,4 +76,4 @@ function choiceEmojiOne() { }) } -export {choiceEmojiOne} +export {choiceEmojiOne, inputLoadAdd, inputLoadRemove, inputLoadIsLast}