Merge branch 'main' of http://sl.vrgon.com:3000/JiXinHui/YingXingAI
This commit is contained in:
commit
8a35f79902
61
App.vue
61
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;
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -160,6 +160,7 @@
|
|||
</view>
|
||||
|
||||
<!-- 提示 -->
|
||||
<!-- message.sendUserType 0 AI 1 学生 2 教师 3 提示(目前只有2和3有用) -->
|
||||
<view class="message-tip" v-if="message.sendUserType === 3">
|
||||
{{ message.message }}
|
||||
</view>
|
||||
|
|
@ -229,10 +230,13 @@
|
|||
|
||||
<!-- 用户消息 -->
|
||||
<!-- 0 用户消息 -->
|
||||
<!-- 排除sendUserType 2 教师 3 提示 -->
|
||||
<view
|
||||
class="message-right"
|
||||
v-else-if="
|
||||
message.interactMode === 0 && message.sendUserType !== 3
|
||||
message.interactMode === 0 &&
|
||||
message.sendUserType !== 3 &&
|
||||
message.sendUserType !== 2
|
||||
"
|
||||
:id="'msg-' + message.id"
|
||||
>
|
||||
|
|
@ -241,7 +245,7 @@
|
|||
</view>
|
||||
<image
|
||||
class="user-avatar"
|
||||
:src="headSculptureUrl"
|
||||
:src="$getHeadImgUrl(vuex_user.HeadSculptureUrl)"
|
||||
mode="scaleToFill"
|
||||
/>
|
||||
</view>
|
||||
|
|
@ -361,16 +365,17 @@
|
|||
</view>
|
||||
|
||||
<!-- 转人工消息 -->
|
||||
<!-- 8 人工回复 -->
|
||||
<!-- 8 人工回复 message.interactMode === 8 -->
|
||||
<!-- 改成 message.sendUserType === 2 -->
|
||||
<view
|
||||
class="message-left"
|
||||
v-else-if="message.interactMode === 8"
|
||||
v-else-if="message.sendUserType === 2"
|
||||
:id="'msg-' + message.id"
|
||||
>
|
||||
<view class="message-content-container-Teacher">
|
||||
<image
|
||||
class="ai-avatar"
|
||||
:src="receiverHeadSculptureUrl"
|
||||
:src="getReceiverHeadSculptureUrl(message)"
|
||||
mode="scaleToFill"
|
||||
/>
|
||||
<view
|
||||
|
|
@ -635,12 +640,6 @@ export default {
|
|||
},
|
||||
|
||||
computed: {
|
||||
headSculptureUrl() {
|
||||
return this.$getHeadImgUrl(this.vuex_user.HeadSculptureUrl);
|
||||
},
|
||||
receiverHeadSculptureUrl() {
|
||||
return this.$getHeadImgUrl(this.vuex_msgUser.headSculptureUrl);
|
||||
},
|
||||
aiMessageGroups() {
|
||||
return Array.isArray(this.vuex_aiMessageGroups)
|
||||
? this.vuex_aiMessageGroups
|
||||
|
|
@ -663,11 +662,11 @@ export default {
|
|||
});
|
||||
},
|
||||
isLiveAgentChat() {
|
||||
if (!this.vuex_isTransferChat) return false;
|
||||
const current = this.currentDMid || "";
|
||||
const active =
|
||||
this.vuex_msgUser && this.vuex_msgUser.dialogueManagementId;
|
||||
return !!(current && active && String(active) === String(current));
|
||||
return !!(
|
||||
this.vuex_isTransferChat &&
|
||||
this.vuex_msgUser?.dialogueManagementId &&
|
||||
this.vuex_msgUser?.receiverId
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
|
|
@ -706,6 +705,11 @@ export default {
|
|||
},
|
||||
|
||||
methods: {
|
||||
// 获取消息头像
|
||||
getReceiverHeadSculptureUrl(message) {
|
||||
return this.$getHeadImgUrl(message.headSculptureUrl);
|
||||
},
|
||||
|
||||
async handleLeftClick() {
|
||||
await this.getChatHistoryList();
|
||||
await this.GetDialogueList_User();
|
||||
|
|
|
|||
|
|
@ -223,6 +223,7 @@ const store = new Vuex.Store({
|
|||
isRead: true,
|
||||
interactMode: isSelf ? 0 : 8,
|
||||
messageType: msg.messageType || msg.MessageType || 0,
|
||||
sendUserType: msg.sendUserType,
|
||||
timeLabel: 0,
|
||||
displayTime: "",
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue