更改发送消息模式为promise

This commit is contained in:
2022-02-28 13:45:17 +08:00
parent bf94cca533
commit 39b8f158c0
9 changed files with 647 additions and 466 deletions

View File

@@ -1,17 +1,7 @@
<template>
<view class="sent--text">
<input
class="input"
type="text"
:auto-blur="true"
:focus="focusState"
v-model="inputTxt"
confirm-type="send"
cursor-spacing="10"
@focus="focus"
@blur="blur"
@confirm="sent"
/>
<input class="input" type="text" :auto-blur="true" :focus="focusState" v-model="inputTxt" confirm-type="send"
cursor-spacing="10" @focus="focus" @blur="blur" @confirm="sent" />
</view>
</template>
@@ -55,33 +45,33 @@
focusState: false,
inputTxt: ''
}
},
created(){
uni.$on('emojiValue', res => {
this.inputTxt = res.value
})
},
},
created() {
uni.$on('emojiValue', res => {
this.inputTxt = res.value
})
},
methods: {
sent() {
sent() {
if (!this.disabled) {
im.sentText(this.conversationType, this.targetId, this.inputTxt, this.sender, () => {
im.sentText(this.conversationType, this.targetId, this.inputTxt).then(() => {
RongIMLib.clearTextMessageDraft(this.conversationType, this.targetId)
this.$emit('success')
this.inputTxt = ''
})
}
},
focus() {
focus() {
this.$emit('focus')
},
blur(e) {
blur(e) {
uni.hideKeyboard()
this.$emit('blur', e.detail)
}
},
destroyed() {
uni.$off('emojiValue')
},
destroyed() {
uni.$off('emojiValue')
}
}
</script>
@@ -91,6 +81,7 @@
display: flex;
flex-direction: row;
justify-content: space-between;
.input {
background: #F3F6FB;
height: 70rpx;