no message

This commit is contained in:
kuaifan 2022-11-16 20:52:17 +08:00
parent 21b6479dbe
commit 70ec88e57d
3 changed files with 33 additions and 6 deletions

View File

@ -31,7 +31,7 @@
ref="editor" ref="editor"
class="no-dark-content" class="no-dark-content"
:style="editorStyle" :style="editorStyle"
@click.stop="" @click.stop="onClickEditor"
@paste="handlePaste"></div> @paste="handlePaste"></div>
<!-- 工具栏 --> <!-- 工具栏 -->
@ -465,9 +465,6 @@ export default {
} }
}, 200); }, 200);
} }
this.$nextTick(_ => {
this.updateEmojiQuick(this.value)
})
} else { } else {
this.$emit('on-blur') this.$emit('on-blur')
} }
@ -699,11 +696,13 @@ export default {
}, },
updateEmojiQuick(text) { updateEmojiQuick(text) {
if (!this.isFocus) { if (!this.isFocus || !text) {
this.emojiQuickShow = false
return return
} }
this.emojiQuickTimer && clearTimeout(this.emojiQuickTimer) this.emojiQuickTimer && clearTimeout(this.emojiQuickTimer)
this.emojiQuickTimer = setTimeout(_ => { this.emojiQuickTimer = setTimeout(_ => {
text = text.replace(/&nbsp;/g," ")
text = text.replace(/<[^>]+>/g, "") text = text.replace(/<[^>]+>/g, "")
if (text if (text
&& text.indexOf(" ") === -1 && text.indexOf(" ") === -1
@ -730,7 +729,7 @@ export default {
} }
} }
this.emojiQuickShow = false this.emojiQuickShow = false
}, 200) }, 100)
}, },
setText(value) { setText(value) {
@ -766,6 +765,10 @@ export default {
}, 600) }, 600)
}, },
onClickEditor() {
this.updateEmojiQuick(this.value)
},
focus() { focus() {
this.$nextTick(() => { this.$nextTick(() => {
if (this.quill) { if (this.quill) {

View File

@ -2159,6 +2159,29 @@ export default {
} else { } else {
state.dialogIns.push(data); 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
}
}
}, },
/** /**

View File

@ -79,6 +79,7 @@ const stateData = {
dialogIns: [], dialogIns: [],
dialogMsgs: [], dialogMsgs: [],
dialogTodos: [], dialogTodos: [],
dialogHistory: [],
dialogInputCache: $A.getStorageArray("cacheDialogInput"), dialogInputCache: $A.getStorageArray("cacheDialogInput"),
dialogMsgTransfer: {time: 0}, dialogMsgTransfer: {time: 0},