fix(chat): 修复消息显示逻辑并添加发送失败提示
This commit is contained in:
parent
28c617a33d
commit
a4ee711418
|
|
@ -118,10 +118,18 @@
|
|||
{{ formatShowTime(message.sendDate) }}
|
||||
</view>
|
||||
|
||||
<!-- 提示 -->
|
||||
<!-- message.sendUserType 0 AI 1 学生 2 教师 3 提示(目前只有2和3有用) -->
|
||||
<view class="message-tip" v-if="message.sendUserType === 3">
|
||||
{{ message.message }}
|
||||
</view>
|
||||
|
||||
<!-- 0 发送消息 -->
|
||||
<view
|
||||
class="message-right"
|
||||
v-if="message.senderId === vuex_user.Id"
|
||||
v-if="
|
||||
message.senderId === vuex_user.Id && message.sendUserType === 2
|
||||
"
|
||||
:id="'msg-' + message.id"
|
||||
>
|
||||
<view class="message-content">
|
||||
|
|
@ -137,7 +145,11 @@
|
|||
<!-- 1 收到消息 -->
|
||||
<view
|
||||
class="message-left"
|
||||
v-if="message.senderId !== vuex_user.Id"
|
||||
v-if="
|
||||
message.senderId !== vuex_user.Id &&
|
||||
message.sendUserType !== 2 &&
|
||||
message.sendUserType !== 3
|
||||
"
|
||||
:id="'msg-' + message.id"
|
||||
>
|
||||
<image
|
||||
|
|
@ -309,7 +321,6 @@ export default {
|
|||
this.$u.api
|
||||
.SendMessage_PrivateApi(message)
|
||||
.then((res) => {
|
||||
console.log(res, "发送消息成功");
|
||||
if (res.succeed) {
|
||||
// 添加到消息列表
|
||||
const msgUserData = {
|
||||
|
|
@ -331,6 +342,14 @@ export default {
|
|||
// this.$nextTick(() => {
|
||||
// this.scrollToBottom();
|
||||
// });
|
||||
} else {
|
||||
// 清空输入框
|
||||
this.messageValue = "";
|
||||
// 发送失败
|
||||
uni.showToast({
|
||||
title: res.error || "发送失败",
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
|
|
@ -568,6 +587,12 @@ export default {
|
|||
color: #999999;
|
||||
padding: 20rpx;
|
||||
}
|
||||
.message-tip {
|
||||
text-align: center;
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
padding-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.message-left,
|
||||
.message-right {
|
||||
|
|
|
|||
Loading…
Reference in New Issue