fix:转移会话不更新问题

feat-im-0607-ch
ch 2 years ago
parent 97639e7964
commit c755ff3eb0

@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-06-07 15:41:05
* @LastEditors: ch
* @LastEditTime: 2022-06-13 16:30:57
* @LastEditTime: 2022-06-13 17:16:27
* @Description: file content
*/
import * as api from '@/api/chat';
@ -65,7 +65,7 @@ const getters = {
payload = '[解析异常]';
}
} else if (type === 7) {
payload = '[撤回消息]';
payload = payload.text;
} else {
payload = '[未知类型]';
}
@ -155,12 +155,14 @@ const actions = {
* 提交转移会话
*/
submitTransferSession: ({}, data) => {
api.transferCustomerService({
storeId: 1,
...data,
}).then((res) => {
console.log(res, 'resresres');
});
return api
.transferCustomerService({
storeId: 1,
...data,
})
.then((res) => {
console.log(res, 'resresres');
});
},
};
export default {

@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-06-07 15:52:37
* @LastEditors: ch
* @LastEditTime: 2022-06-13 16:18:45
* @LastEditTime: 2022-06-13 17:32:19
* @Description: file content
*/
import * as api from '@/api/chat';

@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-05-18 14:54:47
* @LastEditors: ch
* @LastEditTime: 2022-06-13 15:16:50
* @LastEditTime: 2022-06-13 18:54:30
* @Description: file content
*/
import '@/utils/poto-req';
@ -193,9 +193,9 @@ class MsbIm {
newData = [
...historyData,
{
fromAvatar: ctx.fromAvatar,
fromAvatar: ctx.session.fromAvatar,
fromId: ctx.fromId,
fromNickname: ctx.fromNickname,
fromNickname: ctx.session.fromNickname,
id: ctx.sessionId,
lastMessage: ctx,
messageList: [ctx],
@ -270,6 +270,7 @@ class MsbIm {
return Promise.reject(error);
}
const { content } = result;
let newData = [];
content.sessionVOS.forEach((item) => {
if (item.lastMessage) {
@ -280,13 +281,14 @@ class MsbIm {
if (hisIndex >= 0) {
historyData[hisIndex].lastMessage = item.lastMessage;
historyData[hisIndex].unreadCount++;
this.setSessionData(historyData);
newData.push(historyData);
} else {
item.messageList = [];
const newData = [...historyData, item];
this.setSessionData(newData);
newData = [...newData, item];
}
});
this.setSessionData(newData);
return Promise.resolve(result);
}
/**

@ -49,7 +49,7 @@
</li>
</el-scrollbar>
</div>
<div v-if="currentSession" class="content">
<div v-if="currentSession.id" class="content">
<div class="content-header">
<div class="content-header-left">
<div class="name" :class="{ [`sex-` + currentSession?.fromSex]: true }">
@ -178,7 +178,7 @@
message: '',
});
const sessionList = computed(() => store.state.chat.sessionData);
const currentSession = computed(() => sessionList.value.find((item) => item.id === currentSessionId.value));
const currentSession = computed(() => sessionList.value.find((item) => item.id === currentSessionId.value) || {});
const handleChangeSession = (id) => {
currentSessionId.value = id;
// ID
@ -209,7 +209,7 @@
: 0;
nextTick(() => {
// if (!old?.length || value.indexOf(old[0]) === 0) {
refsMessageList.value.setScrollTop(refsMessageList.value.resize$.scrollHeight);
refsMessageList.value && refsMessageList.value.setScrollTop(refsMessageList.value.resize$.scrollHeight);
// } else {
// refsMessageList.value.setScrollTop(refsMessageList.value.resize$.scrollHeight - offset);
// }
@ -293,11 +293,16 @@
confirmButtonText: '确定',
});
if (res.action === 'confirm') {
store.dispatch('chat/submitTransferSession', {
toWaiterId: row.waiterId,
sessionId: unref(currentSessionId),
reason: res.value,
});
store
.dispatch('chat/submitTransferSession', {
toWaiterId: row.waiterId,
sessionId: unref(currentSessionId),
reason: res.value,
})
.then((res) => {
Im.setCurSessionId(null);
Im.getSessionList();
});
transferVisible.value = false;
}
} catch (e) {

Loading…
Cancel
Save