Commit ea792670 by 杨铁龙

step commit

parent d2b53e6d
...@@ -238,6 +238,7 @@ ...@@ -238,6 +238,7 @@
top: calc(100% - 130px + 1px); top: calc(100% - 130px + 1px);
height: 6px; height: 6px;
width: 100%; width: 100%;
z-index: 1;
&:hover { &:hover {
background-color: #eee; background-color: #eee;
......
...@@ -10,9 +10,7 @@ ...@@ -10,9 +10,7 @@
import { Component, Ref, Vue, Watch } from "vue-property-decorator"; import { Component, Ref, Vue, Watch } from "vue-property-decorator";
import ChatInput, { isFileElement, isImageOrFile } from "./hybrid-input.vue"; import ChatInput, { isFileElement, isImageOrFile } from "./hybrid-input.vue";
import { MessageType } from "../model"; import { MessageType } from "../model";
// import { uploadFile } from "../service/upload";
import xim from "../xim/xim"; import xim from "../xim/xim";
import Chat from "../xim";
import { ChatStore, chatStore } from "@/customer-service/store/model"; import { ChatStore, chatStore } from "@/customer-service/store/model";
@Component({ components: { ChatInput } }) @Component({ components: { ChatInput } })
......
...@@ -573,12 +573,11 @@ export default { ...@@ -573,12 +573,11 @@ export default {
ChatStore.GETTER_CURRENT_CURRENT_CHAT ChatStore.GETTER_CURRENT_CURRENT_CHAT
] as ChatType; ] as ChatType;
// TODO 发消息 // TODO 发消息
return xim.sendMsg( return xim
"users", .sendMsg("users", chat.chat_id, params.msgType, params.msg)
chat.chat_id, .then(() => {
params.msgType, dispatch(ChatStore.ACTION_GET_FRESH_MESSAGE);
params.msg });
);
// return await Chat.getSdk() // return await Chat.getSdk()
// .model(chat.model_name) // .model(chat.model_name)
// .chat(chat.obj_id, orgId()) // .chat(chat.obj_id, orgId())
...@@ -749,16 +748,19 @@ export default { ...@@ -749,16 +748,19 @@ export default {
}, },
async [ChatStore.ACTION_SAVE_CURRENT_CHAT_ID_VERSION]( async [ChatStore.ACTION_SAVE_CURRENT_CHAT_ID_VERSION](
{ state, commit, dispatch }, { state, commit, dispatch },
chatId: ChatStore.STATE_CHAT_CURRENT_CHAT_ID p: {
chatId: ChatStore.STATE_CHAT_CURRENT_CHAT_ID;
uid: number;
}
) { ) {
if (!chatId) { if (!p.chatId) {
return; return;
} }
const chatList = state[ChatStore.STATE_MY_CHAT_ROOM_LIST]; const chatList = state[ChatStore.STATE_MY_CHAT_ROOM_LIST];
let wantedChatRoom = chatList.find((k) => k.chat_id === chatId); let wantedChatRoom = chatList.find((k) => k.chat_id === p.chatId);
if (!wantedChatRoom) { if (!wantedChatRoom) {
const data = await xim.fetchChat(chatId); const data = await xim.fetchChat(p.chatId);
if (!data) { if (!data) {
return; return;
} }
...@@ -771,13 +773,10 @@ export default { ...@@ -771,13 +773,10 @@ export default {
commit(ChatStore.MUTATION_CLEAR_SINGLE_CHAT); commit(ChatStore.MUTATION_CLEAR_SINGLE_CHAT);
} }
// if (!state[ChatStore.STATE_CHAT_CURRENT_USER_UID]) { commit(ChatStore.MUTATION_SET_CURRENT_USER_UID, p.uid);
// const userInfo = await Chat.getSdk().getUserInfo();
// commit(ChatStore.MUTATION_SET_CURRENT_USER_UID, userInfo.id);
// }
commit(ChatStore.MUTATION_CLEAR_CHAT_MSG_HISTORY); commit(ChatStore.MUTATION_CLEAR_CHAT_MSG_HISTORY);
commit(ChatStore.MUTATION_SAVE_CURRENT_CHAT_ID, chatId); commit(ChatStore.MUTATION_SAVE_CURRENT_CHAT_ID, p.chatId);
// getChatModelInfo( // getChatModelInfo(
// wantedChatRoom.model_name, // wantedChatRoom.model_name,
...@@ -809,7 +808,7 @@ export default { ...@@ -809,7 +808,7 @@ export default {
} finally { } finally {
commit( commit(
ChatStore.MUTATION_SAVE_CHAT_TITLE, ChatStore.MUTATION_SAVE_CHAT_TITLE,
wantedChatRoom.title || `在线咨询-${chatId}` wantedChatRoom.title || `在线咨询-${p.chatId}`
); );
commit(ChatStore.MUTATION_INITING_CHAT_DONE); commit(ChatStore.MUTATION_INITING_CHAT_DONE);
commit(ChatStore.MUTATION_SCROLL_TO_BOTTOM); commit(ChatStore.MUTATION_SCROLL_TO_BOTTOM);
...@@ -883,23 +882,9 @@ export default { ...@@ -883,23 +882,9 @@ export default {
const id = Number( const id = Number(
state[ChatStore.STATE_CHAT_CURRENT_CHAT_UNIPLAT_ID] state[ChatStore.STATE_CHAT_CURRENT_CHAT_UNIPLAT_ID]
); );
// await model()
// .action("update")
// .updateInitialParams({
// selected_list: [{ v, id }],
// })
// .addInputs_parameter({
// Status: ChatStatus.terminated,
// })
// .execute();
await dispatch(ChatStore.ACTION_GET_MY_CHAT_LIST); await dispatch(ChatStore.ACTION_GET_MY_CHAT_LIST);
const firstChat = state[ChatStore.STATE_MY_CHAT_ROOM_LIST][0]; const firstChat = state[ChatStore.STATE_MY_CHAT_ROOM_LIST][0];
if (firstChat == null) return; if (firstChat == null) return;
// await getChatModelInfo(
// firstChat.model_name,
// firstChat.obj_id,
// firstChat.detail_name
// );
await dispatch( await dispatch(
ChatStore.ACTION_SAVE_CURRENT_CHAT_ID_VERSION, ChatStore.ACTION_SAVE_CURRENT_CHAT_ID_VERSION,
firstChat.chat_id firstChat.chat_id
......
...@@ -286,9 +286,10 @@ export namespace ChatStore { ...@@ -286,9 +286,10 @@ export namespace ChatStore {
}) => Promise<number>; }) => Promise<number>;
export const ACTION_SAVE_CURRENT_CHAT_ID_VERSION = "action:保存当前chat-id"; export const ACTION_SAVE_CURRENT_CHAT_ID_VERSION = "action:保存当前chat-id";
export type ACTION_SAVE_CURRENT_CHAT_ID_VERSION = ( export type ACTION_SAVE_CURRENT_CHAT_ID_VERSION = (p: {
chatId: ChatStore.STATE_CHAT_CURRENT_CHAT_ID chatId: ChatStore.STATE_CHAT_CURRENT_CHAT_ID;
) => Promise<void>; uid: number;
}) => Promise<void>;
export const ACTION_CLEAR_CURRENT_CHAT_DATA = "action:清空当前会话数据"; export const ACTION_CLEAR_CURRENT_CHAT_DATA = "action:清空当前会话数据";
export type ACTION_CLEAR_CURRENT_CHAT_DATA = () => Promise<void>; export type ACTION_CLEAR_CURRENT_CHAT_DATA = () => Promise<void>;
......
...@@ -47,7 +47,7 @@ class Chat { ...@@ -47,7 +47,7 @@ class Chat {
option.message && (this.messageController = option.message); option.message && (this.messageController = option.message);
option.avatar !== undefined && (this.defaultAvatar = option.avatar); option.avatar !== undefined && (this.defaultAvatar = option.avatar);
// indexDb缓存
// if (!option.disabledIndexDb) { // if (!option.disabledIndexDb) {
// await this.setupIndexDb("test").catch((err) => { // await this.setupIndexDb("test").catch((err) => {
// // 必须catch error不然小程序不会向后运行 // // 必须catch error不然小程序不会向后运行
......
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