Commit 43bd7613 by 吴云建

添加错误消息记录

parent d9931ae1
Showing with 15 additions and 2 deletions
......@@ -87,7 +87,8 @@ export default {
[ChatStore.STATE_FUNC_SCROLL_TO_BOTTOM]: () => true,
[ChatStore.STATE_CURRENT_CHAT_INPUTING]: [],
[ChatStore.STATE_CURRENT_CHAT_INITING]: false,
[ChatStore.STATE_CHAT_CURRENT_USER_TYPE]: ChatStore.STATE_CHAT_CURRENT_USER_TYPE,
[ChatStore.STATE_CHAT_CURRENT_USER_TYPE]: null,
[ChatStore.STATE_CHAT_SEND_FAIL_MESSAGE]: null,
}),
mutations: {
[ChatStore.MUTATION_SHOW_CHAT](state, isSingle?: boolean) {
......@@ -155,6 +156,9 @@ export default {
state[ChatStore.STATE_CHAT_MY_ID] = null;
state[ChatStore.STATE_CHAT_MY_UID] = null;
},
[ChatStore.MUTATION_SAVE_SEND_FAIL_MESSAGE](state, param: string) {
state[ChatStore.STATE_CHAT_SEND_FAIL_MESSAGE] = param;
},
[ChatStore.MUTATION_SET_CHAT_SOURCE](
state,
data: ChatStore.STATE_CHAT_SOURCE
......@@ -378,7 +382,7 @@ export default {
return data;
},
async [ChatStore.ACTION_SEND_MESSAGE](
{ state, dispatch, getters },
{ state, dispatch, getters, commit },
params: Parameters<ChatStore.ACTION_SEND_MESSAGE>[0]
) {
const uniplatId =
......@@ -396,6 +400,7 @@ export default {
return data;
} catch (error) {
// eslint-disable-next-line no-console
commit(ChatStore.MUTATION_SAVE_SEND_FAIL_MESSAGE, JSON.stringify(params))
console.error("testing 信息发送失败", error);
}
},
......
......@@ -60,6 +60,9 @@ export namespace ChatStore {
export const STATE_CURRENT_CHAT_INITING = "当前会是否正在初始化";
export type STATE_CURRENT_CHAT_INITING = boolean
export const STATE_CHAT_SEND_FAIL_MESSAGE = "最新一条发送失败消息";
export type STATE_CHAT_SEND_FAIL_MESSAGE = string | null
/**
* 消息来源,是来自客服端(Server),还是来自于顾客端(Client)
*/
......@@ -119,6 +122,9 @@ export namespace ChatStore {
export const MUTATION_CLEAR_SINGLE_CHAT = "清空单独的会话";
export type MUTATION_CLEAR_SINGLE_CHAT = () => void
export const MUTATION_SAVE_SEND_FAIL_MESSAGE = "更新最新一条发送失败消息";
export type MUTATION_SAVE_SEND_FAIL_MESSAGE = (param: {msg: string, ts: number}) => void
export const MUTATION_SAVE_CURRENT_CHAT_ID = "保存当前chat-id";
export type MUTATION_SAVE_CURRENT_CHAT_ID = (
chatId: ChatStore.STATE_CHAT_CURRENT_CHAT_ID
......@@ -275,6 +281,7 @@ export namespace ChatStore {
export type ACTION_SEND_MESSAGE = (params: {
msgType: "text" | "image" | "file" | "voice" | "video";
msg: string;
ts?: number;
}) => void
export const ACTION_TERINATE_CHAT = "结束会话";
export type ACTION_TERINATE_CHAT = () => Promise<void>
......@@ -322,6 +329,7 @@ export interface ChatStoreState {
[ChatStore.STATE_CHAT_CURRENT_IS_CHAT_MEMBER]: ChatStore.STATE_CHAT_CURRENT_IS_CHAT_MEMBER
[ChatStore.STATE_CHAT_CURRENT_USER_UID]: ChatStore.STATE_CHAT_CURRENT_USER_UID
[ChatStore.STATE_CHAT_CURRENT_USER_TYPE]: ChatStore.STATE_CHAT_CURRENT_USER_TYPE
[ChatStore.STATE_CHAT_SEND_FAIL_MESSAGE]: ChatStore.STATE_CHAT_SEND_FAIL_MESSAGE
}
export const chatStore = namespace(ChatStore.ns);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment