提交 cd02a5f0 编写于 作者: DCloud_JSON's avatar DCloud_JSON

更新 优化多个会话切换的草稿功能,提升性能

上级 e1b28dd3
......@@ -253,7 +253,9 @@
aboutUserKeyword: '',
memberListScrollTop: 0,
chooseMoreMsg: false,
checkedMsgList: []
checkedMsgList: [],
// 聊天输入框内容
chatInputContent: '',
};
},
props: {
......@@ -319,24 +321,6 @@
})
},
//聊天数据
//当前会话的聊天框文字内容
chatInputContent: {
get() {
// console.log('this.conversation',this.conversation);
return this.conversation?.chatInputContent || '';
},
set(chatInputContent) {
// #ifdef APP-NVUE
if(this.nvueSetChatInputContent){
clearTimeout(this.nvueSetChatInputContent)
}
this.nvueSetChatInputContent = setTimeout(()=>this.conversation.chatInputContent = chatInputContent,1000)
// #endif
// #ifndef APP-NVUE
this.conversation.chatInputContent = chatInputContent
// #endif
}
},
canSend() {
if(typeof this.chatInputContent === 'string'){
return this.chatInputContent.trim() != ''
......@@ -660,9 +644,15 @@
async load(param) {
this.answerMsg = false
// conversation_id = "single_eff0518ad35e16a8a025cc8af03e0388"
if(this.conversation.id){
// 设置(含清空)上一个会话的chatInputContent 实现多个会话之间的草稿功能
this.conversation.chatInputContent = this.chatInputContent
}
// console.log('conversation_id',conversation_id);
this.conversation = await uniIm.conversation.get(param)
// 初始化会话的chatInputContent
this.chatInputContent = this.conversation.chatInputContent
// this.conversation.call_list = []
// console.log('this.conversation',this.conversation)
......@@ -1118,10 +1108,7 @@
msg.body = msg.body.trim();
// 阻止发送空消息
if (!msg.body.length) {
this.$nextTick(() => {
this.chatInputContent = '';
this.textareaHeight = 26;
});
this.resetChatInput()
return uni.showToast({
title: '不能发送空消息',
icon: 'none'
......@@ -1163,12 +1150,6 @@
}
}
this.$nextTick(e => {
this.chatInputContent = '';
this.textareaHeight = 26;
this.answerMsg = false
});
//如果是回复某一条消息,需要带上相关id
if (this.answerMsg !== false) {
msg.about_msg_id = this.answerMsg._id
......@@ -1177,6 +1158,8 @@
// 消息列表追加此消息。此时消息状态值为0,表示发送中
let resMsg = this.conversation.msgList.push(msg)
this.resetChatInput()
this.$nextTick(() => {
this.showLast()
// #ifdef APP-NVUE
......@@ -1197,6 +1180,12 @@
return msg;
}
},
resetChatInput() {
this.chatInputContent = ''
this.textareaHeight = 26
// 关闭引用的消息
this.answerMsg = false
},
getCallUid(param){
let aboutNicknameList = []
if( this.isWidescreen){
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册