|
|
@ -333,7 +333,11 @@ export default { |
|
|
tmpId: this.generateId(), |
|
|
tmpId: this.generateId(), |
|
|
type: this.$enums.MESSAGE_TYPE.TEXT, |
|
|
type: this.$enums.MESSAGE_TYPE.TEXT, |
|
|
content: autoReply.replyTitle, |
|
|
content: autoReply.replyTitle, |
|
|
receipt: this.isReceipt |
|
|
receipt: this.isReceipt, |
|
|
|
|
|
selfSend: true, |
|
|
|
|
|
sendId: this.mine.id, |
|
|
|
|
|
sendTime: new Date().getTime(), |
|
|
|
|
|
status: this.$enums.MESSAGE_STATUS.SENDED, |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
this.fillTargetId(userMsgInfo, this.chat.targetId); |
|
|
this.fillTargetId(userMsgInfo, this.chat.targetId); |
|
|
@ -341,95 +345,73 @@ export default { |
|
|
if (!chat) return; |
|
|
if (!chat) return; |
|
|
|
|
|
|
|
|
let tmpUserMessage = this.buildTmpMessage(userMsgInfo); |
|
|
let tmpUserMessage = this.buildTmpMessage(userMsgInfo); |
|
|
|
|
|
tmpUserMessage.status = this.$enums.MESSAGE_STATUS.SENDED; |
|
|
this.chatStore.insertMessage(tmpUserMessage, chat); |
|
|
this.chatStore.insertMessage(tmpUserMessage, chat); |
|
|
this.moveChatToTop(); |
|
|
this.moveChatToTop(); |
|
|
|
|
|
|
|
|
this.sendMessageRequest(userMsgInfo) |
|
|
this.triggerAutoReply(autoReply); |
|
|
.then((m) => { |
|
|
|
|
|
tmpUserMessage = JSON.parse(JSON.stringify(tmpUserMessage)); |
|
|
|
|
|
tmpUserMessage.id = m.id; |
|
|
|
|
|
tmpUserMessage.status = m.status; |
|
|
|
|
|
this.chatStore.updateMessage(tmpUserMessage, chat); |
|
|
|
|
|
|
|
|
|
|
|
this.triggerAutoReply(autoReply); |
|
|
this.scrollToBottom(); |
|
|
|
|
|
this.isReceipt = false; |
|
|
this.scrollToBottom(); |
|
|
|
|
|
this.isReceipt = false; |
|
|
|
|
|
}) |
|
|
|
|
|
.catch(() => { |
|
|
|
|
|
tmpUserMessage = JSON.parse(JSON.stringify(tmpUserMessage)); |
|
|
|
|
|
tmpUserMessage.status = this.$enums.MESSAGE_STATUS.FAILED; |
|
|
|
|
|
this.chatStore.updateMessage(tmpUserMessage, chat); |
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
triggerAutoReply(autoReply) { |
|
|
triggerAutoReply(autoReply) { |
|
|
let tmpId = this.generateId(); |
|
|
let tmpId = this.generateId(); |
|
|
|
|
|
|
|
|
let replyMsgInfo = { |
|
|
let replyMsgInfo = { |
|
|
tmpId: tmpId, |
|
|
tmpId: tmpId, |
|
|
sendId: this.chat.targetId, |
|
|
sendId: this.chat.targetId, |
|
|
recvId: this.mine.id, |
|
|
recvId: this.mine.id, |
|
|
type: autoReply.replyType, |
|
|
type: autoReply.replyType, |
|
|
receipt: false |
|
|
receipt: false, |
|
|
}; |
|
|
selfSend: false, |
|
|
|
|
|
sendTime: new Date().getTime(), |
|
|
if (autoReply.replyType === 0) { |
|
|
status: this.$enums.MESSAGE_STATUS.SENDED, |
|
|
replyMsgInfo.content = autoReply.replyContent; |
|
|
}; |
|
|
} else if (autoReply.replyType === 1) { |
|
|
|
|
|
replyMsgInfo.content = JSON.stringify({ |
|
|
if (autoReply.replyType === 0) { |
|
|
originUrl: autoReply.replyContent, |
|
|
replyMsgInfo.content = autoReply.replyContent; |
|
|
thumbUrl: autoReply.replyContent, |
|
|
} else if (autoReply.replyType === 1) { |
|
|
}); |
|
|
replyMsgInfo.content = JSON.stringify({ |
|
|
} |
|
|
originUrl: autoReply.replyContent, |
|
|
|
|
|
thumbUrl: autoReply.replyContent, |
|
|
let typingMessage = { |
|
|
}); |
|
|
id: this.generateId(), |
|
|
} |
|
|
tmpId: tmpId, |
|
|
|
|
|
sendId: this.chat.targetId, |
|
|
let typingMessage = { |
|
|
recvId: this.mine.id, |
|
|
id: this.generateId(), |
|
|
selfSend: false, |
|
|
tmpId: tmpId, |
|
|
sendTime: new Date().getTime(), |
|
|
sendId: this.chat.targetId, |
|
|
type: this.$enums.MESSAGE_TYPE.TIP_TEXT, |
|
|
recvId: this.mine.id, |
|
|
content: this.$t('chat.typing'), |
|
|
selfSend: false, |
|
|
status: this.$enums.MESSAGE_STATUS.SENDING |
|
|
sendTime: new Date().getTime(), |
|
|
}; |
|
|
type: this.$enums.MESSAGE_TYPE.TIP_TEXT, |
|
|
|
|
|
content: this.$t('chat.typing'), |
|
|
this.chatStore.insertMessage(typingMessage, this.chat); |
|
|
status: this.$enums.MESSAGE_STATUS.SENDING |
|
|
|
|
|
}; |
|
|
this.$http({ |
|
|
this.chatStore.insertMessage(typingMessage, this.chat); |
|
|
url: "/message/private/send", |
|
|
this.chatStore.deleteMessage(typingMessage, this.chat); |
|
|
method: "post", |
|
|
|
|
|
data: replyMsgInfo |
|
|
let replyMessage = { |
|
|
}).then(res => { |
|
|
id: this.generateId(), |
|
|
this.chatStore.deleteMessage(typingMessage, this.chat); |
|
|
tmpId: tmpId, |
|
|
|
|
|
sendId: this.chat.targetId, |
|
|
if (res && res.id) { |
|
|
recvId: this.mine.id, |
|
|
let replyMessage = { |
|
|
selfSend: false, |
|
|
id: res.id, |
|
|
sendTime: new Date().getTime(), |
|
|
tmpId: tmpId, |
|
|
type: autoReply.replyType, |
|
|
sendId: this.chat.targetId, |
|
|
content: replyMsgInfo.content, |
|
|
recvId: this.mine.id, |
|
|
status: this.$enums.MESSAGE_STATUS.SENDED, |
|
|
selfSend: false, |
|
|
}; |
|
|
sendTime: new Date().getTime(), |
|
|
|
|
|
type: autoReply.replyType, |
|
|
if (this.isGroup) { |
|
|
content: replyMsgInfo.content, |
|
|
replyMessage.groupId = this.chat.targetId; |
|
|
status: this.$enums.MESSAGE_STATUS.SENDED |
|
|
replyMessage.readedCount = 0; |
|
|
}; |
|
|
} |
|
|
|
|
|
|
|
|
this.chatStore.insertMessage(replyMessage, this.chat); |
|
|
this.chatStore.insertMessage(replyMessage, this.chat); |
|
|
this.scrollToBottom(); |
|
|
this.scrollToBottom(); |
|
|
} |
|
|
}, |
|
|
}).catch(err => { |
|
|
|
|
|
console.error("自动回复发送失败", err); |
|
|
|
|
|
this.chatStore.deleteMessage(typingMessage, this.chat); |
|
|
|
|
|
|
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
title: this.$t('chat.autoReplyFailed'), |
|
|
|
|
|
icon: "none" |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
onRecorderInput() { |
|
|
onRecorderInput() { |
|
|
this.showRecord = true; |
|
|
this.showRecord = true; |
|
|
|