|
|
@ -144,9 +144,12 @@ const actions = {
|
|
|
|
if (data.traceType !== 0) {
|
|
|
|
if (data.traceType !== 0) {
|
|
|
|
let index = state.task.findIndex((item) => item.traceId === data.traceId);
|
|
|
|
let index = state.task.findIndex((item) => item.traceId === data.traceId);
|
|
|
|
if (index !== -1) {
|
|
|
|
if (index !== -1) {
|
|
|
|
|
|
|
|
console.info('[chat] data', data);
|
|
|
|
commit('delTask', index);
|
|
|
|
commit('delTask', index);
|
|
|
|
dispatch('handle', data);
|
|
|
|
dispatch('handle', data);
|
|
|
|
|
|
|
|
} else if (data.traceType === 25) {
|
|
|
|
console.info('[chat] msg', data);
|
|
|
|
console.info('[chat] msg', data);
|
|
|
|
|
|
|
|
dispatch('handle', data);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
console.info('[chat] deprecated', data);
|
|
|
|
console.info('[chat] deprecated', data);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -155,12 +158,12 @@ const actions = {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 处理数据
|
|
|
|
* 处理数据
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
handle: ({ state, commit, dispatch }, { code, traceType, content, session }) => {
|
|
|
|
handle: ({ state, commit, dispatch }, { code, traceType, content }) => {
|
|
|
|
if (code === 200) {
|
|
|
|
if (code === 200) {
|
|
|
|
switch (traceType) {
|
|
|
|
switch (traceType) {
|
|
|
|
case 25: // 收到消息
|
|
|
|
case 25: // 收到消息
|
|
|
|
if (session.id === state.currentSession) {
|
|
|
|
if (content.sessionId === state.currentSession) {
|
|
|
|
commit('setMessageList', [...state.messageList, content.content]);
|
|
|
|
commit('setMessageList', [...state.messageList, content]);
|
|
|
|
dispatch('submitRead');
|
|
|
|
dispatch('submitRead');
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
dispatch('querySession');
|
|
|
|
dispatch('querySession');
|
|
|
@ -173,7 +176,7 @@ const actions = {
|
|
|
|
commit('setSessionData', content);
|
|
|
|
commit('setSessionData', content);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 28: // 消息列表
|
|
|
|
case 28: // 消息列表
|
|
|
|
commit('setMessageList', content);
|
|
|
|
commit('setMessageList', [...content, ...state.messageList]);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 29: // 客服列表
|
|
|
|
case 29: // 客服列表
|
|
|
|
commit('setCustomerServiceList', content);
|
|
|
|
commit('setCustomerServiceList', content);
|
|
|
@ -195,10 +198,10 @@ const actions = {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 查询会话消息列表
|
|
|
|
* 查询会话消息列表
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
querySessionMessage: ({ state, dispatch }) => {
|
|
|
|
querySessionMessage: ({ state, dispatch }, data) => {
|
|
|
|
dispatch('invoke', {
|
|
|
|
dispatch('invoke', {
|
|
|
|
traceType: 28,
|
|
|
|
traceType: 28,
|
|
|
|
content: { sessionId: state.currentSession, size: 100, topMessageId: null },
|
|
|
|
content: { sessionId: state.currentSession, size: 10, topMessageId: null, ...data },
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|