diff --git a/App.vue b/App.vue index 2c75b91..06344cc 100644 --- a/App.vue +++ b/App.vue @@ -230,33 +230,35 @@ export default { receiverId: data.ReceiverId, sendDate: data.SendDate, message: data.Message, + sendUserType: data.SendUserType, // 0 AI 1 学生 2 教师 3 提示 }; - const id = data.Id || data.id || Math.random().toString(36).substring(2); - const msg = { - ...processData, - messageType: 0, - filePath: "", - id, - }; - const storeState = (this.$store && this.$store.state) || {}; - const isTransferChat = !!storeState.vuex_isTransferChat; - const activeDialogueId = - storeState.vuex_msgUser?.dialogueManagementId || - storeState.vuex_msgUser?.friendId || - storeState.vuex_msgUser?.id; - const isActiveChat = - activeDialogueId && - String(activeDialogueId) === String(processData.dialogueManagementId); - - if (isTransferChat) { - if (isActiveChat) { - this.$store.commit("push_AiLiveAgentMsg", msg); - } - } else { - if (isActiveChat) { - this.$store.commit("push_Msg", msg); - } - } + const id = + data.Id || data.id || Math.random().toString(36).substring(2); + const msg = { + ...processData, + messageType: 0, + filePath: "", + id, + }; + const storeState = (this.$store && this.$store.state) || {}; + const isTransferChat = !!storeState.vuex_isTransferChat; + const activeDialogueId = + storeState.vuex_msgUser?.dialogueManagementId || + storeState.vuex_msgUser?.friendId || + storeState.vuex_msgUser?.id; + const isActiveChat = + activeDialogueId && + String(activeDialogueId) === String(processData.dialogueManagementId); + + if (isTransferChat) { + if (isActiveChat) { + this.$store.commit("push_AiLiveAgentMsg", msg); + } + } else { + if (isActiveChat) { + this.$store.commit("push_Msg", msg); + } + } // 更新会话列表的未读数 / 文案 / 时间,保持实时展示 if (processData.dialogueManagementId) { @@ -402,9 +404,10 @@ uni-page-body { body { margin: 0; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", - "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", - "Microsoft Yahei", sans-serif; + font-family: + -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", + "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Microsoft Yahei", + sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; // max-width: 1536rpx; diff --git a/pages/chat/index.vue b/pages/chat/index.vue index 7278db6..e1c078c 100644 --- a/pages/chat/index.vue +++ b/pages/chat/index.vue @@ -118,10 +118,18 @@ {{ formatShowTime(message.sendDate) }} + + + + {{ message.message }} + + @@ -137,7 +145,11 @@ { - 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 { diff --git a/pages/home/index/index.vue b/pages/home/index/index.vue index 39fc0e9..ceabb05 100644 --- a/pages/home/index/index.vue +++ b/pages/home/index/index.vue @@ -160,6 +160,7 @@ + {{ message.message }} @@ -229,10 +230,13 @@ + @@ -241,7 +245,7 @@ @@ -361,16 +365,17 @@ - + +