perf: 发送消息失败时再次编辑改为重新发送

This commit is contained in:
kuaifan 2023-12-14 14:43:05 +08:00
parent 9497fb1bb6
commit 8d92933e43

View File

@ -1300,7 +1300,7 @@ export default {
this.sendSuccess(data) this.sendSuccess(data)
}).catch(error => { }).catch(error => {
this.$set(tempMsg, 'error', true) this.$set(tempMsg, 'error', true)
this.$set(tempMsg, 'errorData', {type: 'text', content: error.msg, msg: textBody}) this.$set(tempMsg, 'errorData', {type: 'text', mType: type, content: error.msg, msg: textBody})
}); });
} }
if (emptied) { if (emptied) {
@ -1340,7 +1340,7 @@ export default {
this.sendSuccess(data); this.sendSuccess(data);
}).catch(error => { }).catch(error => {
this.$set(tempMsg, 'error', true) this.$set(tempMsg, 'error', true)
this.$set(tempMsg, 'errorData', {type: 'record', content: error.msg, msg}) this.$set(tempMsg, 'errorData', {type: 'record', mType: 'record', content: error.msg, msg})
}); });
}, },
@ -2707,7 +2707,7 @@ export default {
if (data.error !== true) { if (data.error !== true) {
return return
} }
const {type, content, msg} = data.errorData const {type, mType, content, msg} = data.errorData
const config = { const config = {
icon: 'error', icon: 'error',
title: '发送失败', title: '发送失败',
@ -2718,13 +2718,10 @@ export default {
} }
} }
if (type === 'text') { if (type === 'text') {
config.okText = '再次编辑' config.okText = '重新发送'
config.onOk = () => { config.onOk = () => {
this.tempMsgs = this.tempMsgs.filter(({id}) => id != data.id) this.tempMsgs = this.tempMsgs.filter(({id}) => id != data.id)
this.$refs.input.setPasteMode(false) this.sendMsg(msg, mType)
this.msgText = msg
this.inputFocus()
this.$nextTick(_ => this.$refs.input.setPasteMode(true))
} }
} else if (type === 'record') { } else if (type === 'record') {
config.okText = '重新发送' config.okText = '重新发送'