diff --git a/resources/assets/js/pages/manage/components/ChatInput/index.vue b/resources/assets/js/pages/manage/components/ChatInput/index.vue index a0418dcfc..3e4c596e5 100755 --- a/resources/assets/js/pages/manage/components/ChatInput/index.vue +++ b/resources/assets/js/pages/manage/components/ChatInput/index.vue @@ -31,7 +31,7 @@ ref="editor" class="no-dark-content" :style="editorStyle" - @click.stop="" + @click.stop="onClickEditor" @paste="handlePaste"> @@ -465,9 +465,6 @@ export default { } }, 200); } - this.$nextTick(_ => { - this.updateEmojiQuick(this.value) - }) } else { this.$emit('on-blur') } @@ -699,11 +696,13 @@ export default { }, updateEmojiQuick(text) { - if (!this.isFocus) { + if (!this.isFocus || !text) { + this.emojiQuickShow = false return } this.emojiQuickTimer && clearTimeout(this.emojiQuickTimer) this.emojiQuickTimer = setTimeout(_ => { + text = text.replace(/ /g," ") text = text.replace(/<[^>]+>/g, "") if (text && text.indexOf(" ") === -1 @@ -730,7 +729,7 @@ export default { } } this.emojiQuickShow = false - }, 200) + }, 100) }, setText(value) { @@ -766,6 +765,10 @@ export default { }, 600) }, + onClickEditor() { + this.updateEmojiQuick(this.value) + }, + focus() { this.$nextTick(() => { if (this.quill) { diff --git a/resources/assets/js/store/actions.js b/resources/assets/js/store/actions.js index 7327c55fc..329bed029 100644 --- a/resources/assets/js/store/actions.js +++ b/resources/assets/js/store/actions.js @@ -2159,6 +2159,29 @@ export default { } else { state.dialogIns.push(data); } + // 会话消息总数量大于200时只保留最近打开的5个会话 + const msg_max = 200 + const retain_num = 5 + if (state.dialogMsgs.length > msg_max) { + state.dialogHistory = state.dialogHistory.filter(id => id != data.dialog_id) + state.dialogHistory.push(data.dialog_id) + if (state.dialogHistory.length > retain_num) { + const historys = state.dialogHistory.slice().reverse() + const newIds = [] + const delIds = [] + historys.forEach(id => { + if (newIds.length < retain_num || state.dialogIns.findIndex(item => item.dialog_id == id) > -1) { + newIds.push(id) + } else { + delIds.push(id) + } + }) + if (delIds.length > 0) { + state.dialogMsgs = state.dialogMsgs.filter(item => !delIds.includes(item.dialog_id)); + } + state.dialogHistory = newIds + } + } }, /** diff --git a/resources/assets/js/store/state.js b/resources/assets/js/store/state.js index 28ee9345d..de436aacb 100644 --- a/resources/assets/js/store/state.js +++ b/resources/assets/js/store/state.js @@ -79,6 +79,7 @@ const stateData = { dialogIns: [], dialogMsgs: [], dialogTodos: [], + dialogHistory: [], dialogInputCache: $A.getStorageArray("cacheDialogInput"), dialogMsgTransfer: {time: 0},