Commit 585e1c18 by panjiangyi

从im拿会话列表

parent c102ba83
Showing with 25 additions and 37 deletions
...@@ -58,7 +58,10 @@ ...@@ -58,7 +58,10 @@
</div> </div>
</div> </div>
</div> </div>
<div class="empty" v-if="chatRooms && chatRooms.length <= 0"> <div
class="empty"
v-if="chatRooms && chatRooms.length <= 0"
>
{{ searchKeyword ? "无相关接待" : "无接待" }} {{ searchKeyword ? "无相关接待" : "无接待" }}
</div> </div>
</el-scrollbar> </el-scrollbar>
...@@ -101,9 +104,6 @@ export default class ChatList extends Vue { ...@@ -101,9 +104,6 @@ export default class ChatList extends Vue {
@chatStore.State(ChatStore.STATE_CHAT_CURRENT_CHAT_ID) @chatStore.State(ChatStore.STATE_CHAT_CURRENT_CHAT_ID)
private readonly chatId!: ChatStore.STATE_CHAT_CURRENT_CHAT_ID; private readonly chatId!: ChatStore.STATE_CHAT_CURRENT_CHAT_ID;
@chatStore.State(ChatStore.STATE_CHAT_CURRENT_CHAT_UNIPLAT_ID)
private readonly currentChatUniplatId!: ChatStore.STATE_CHAT_CURRENT_CHAT_UNIPLAT_ID;
@chatStore.State(ChatStore.STATE_CHAT_CURRENT_CHAT_VERSION) @chatStore.State(ChatStore.STATE_CHAT_CURRENT_CHAT_VERSION)
private readonly uniplatVersion!: ChatStore.STATE_CHAT_CURRENT_CHAT_VERSION; private readonly uniplatVersion!: ChatStore.STATE_CHAT_CURRENT_CHAT_VERSION;
...@@ -123,7 +123,7 @@ export default class ChatList extends Vue { ...@@ -123,7 +123,7 @@ export default class ChatList extends Vue {
private readonly saveChatTitle!: ChatStore.MUTATION_SAVE_CHAT_TITLE; private readonly saveChatTitle!: ChatStore.MUTATION_SAVE_CHAT_TITLE;
@chatStore.Mutation(ChatStore.MUTATION_SHOW_CHAT) @chatStore.Mutation(ChatStore.MUTATION_SHOW_CHAT)
private readonly showChat: ChatStore.MUTATION_SHOW_CHAT private readonly showChat: ChatStore.MUTATION_SHOW_CHAT;
@Prop({ type: String, default: "-1" }) @Prop({ type: String, default: "-1" })
private selected!: string; private selected!: string;
...@@ -135,8 +135,8 @@ export default class ChatList extends Vue { ...@@ -135,8 +135,8 @@ export default class ChatList extends Vue {
} }
private isSelected(item: Chat) { private isSelected(item: Chat) {
if (this.currentChatUniplatId) { if (this.chatId) {
return item.uniplatId === this.currentChatUniplatId; return item.chat_id === this.chatId;
} }
return this.selected === item.uniplatId; return this.selected === item.uniplatId;
} }
...@@ -181,14 +181,15 @@ export default class ChatList extends Vue { ...@@ -181,14 +181,15 @@ export default class ChatList extends Vue {
} }
private goToChatRoom(data: Chat) { private goToChatRoom(data: Chat) {
if (this.currentChatUniplatId === data.uniplatId) { if (this.chatId === data.chat_id) {
this.showChat(); this.showChat();
return; return;
} }
const wantedChatRoom = this.chatRooms.find( const wantedChatRoom = this.chatRooms.find(
(k) => k.uniplatId === data.uniplatId (k) => k.chat_id === data.chat_id
); );
if (wantedChatRoom == null) return; if (wantedChatRoom == null) return;
console.log("fuck", wantedChatRoom);
this.saveChatId({ this.saveChatId({
chatId: wantedChatRoom.chat_id, chatId: wantedChatRoom.chat_id,
v: data.uniplat_version, v: data.uniplat_version,
......
<template> <template>
<div class="chat-room-con h-100 pos-rel"> <div class="chat-room-con h-100 pos-rel">
{{ chatId }}-{{ uniplatId }}
<div class="chat-panel"> <div class="chat-panel">
<div class="chat-area h-100"> <div class="chat-area h-100">
<template v-if="notOnlyCheck"> <template v-if="notOnlyCheck">
...@@ -24,13 +25,7 @@ ...@@ -24,13 +25,7 @@
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
import { import { Component, Prop, Provide, Vue, Watch } from "vue-property-decorator";
Component,
Prop,
Provide,
Vue,
Watch,
} from "vue-property-decorator";
import MessageInput from "@/customer-service/message-input.vue"; import MessageInput from "@/customer-service/message-input.vue";
import messages from "@/customer-service/message-list.vue"; import messages from "@/customer-service/message-list.vue";
...@@ -45,6 +40,12 @@ type RoomInfoTab = "customer" | "order"; ...@@ -45,6 +40,12 @@ type RoomInfoTab = "customer" | "order";
}, },
}) })
export default class ChatRoom extends Vue { export default class ChatRoom extends Vue {
@chatStore.State(ChatStore.STATE_CHAT_CURRENT_CHAT_ID)
private readonly chatId!: ChatStore.STATE_CHAT_CURRENT_CHAT_ID;
@chatStore.State(ChatStore.STATE_CHAT_CURRENT_CHAT_VERSION)
private readonly uniplatId!: ChatStore.STATE_CHAT_CURRENT_CHAT_VERSION;
@chatStore.Getter(ChatStore.GETTER_CURRENT_CHAT_PRESENT_MEMBERS) @chatStore.Getter(ChatStore.GETTER_CURRENT_CHAT_PRESENT_MEMBERS)
private readonly chatMembers!: ChatStore.GETTER_CURRENT_CHAT_PRESENT_MEMBERS; private readonly chatMembers!: ChatStore.GETTER_CURRENT_CHAT_PRESENT_MEMBERS;
...@@ -114,7 +115,6 @@ export default class ChatRoom extends Vue { ...@@ -114,7 +115,6 @@ export default class ChatRoom extends Vue {
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.chat-status { .chat-status {
display: inline-block; display: inline-block;
width: 46px; width: 46px;
......
...@@ -285,28 +285,15 @@ export default { ...@@ -285,28 +285,15 @@ export default {
commit, commit,
}) /* ...params: Parameters<ChatStore.ACTION_GET_MY_CHAT_LIST> */ { }) /* ...params: Parameters<ChatStore.ACTION_GET_MY_CHAT_LIST> */ {
const data = await xim.fetchChatList(); const data = await xim.fetchChatList();
console.log("debugg", data); const chatList = data.args[0];
const { pageData } = await model().list().query({ commit(ChatStore.MUTATION_SAVE_CHAT_LIST, {
pageIndex: 1, list: chatList.map(chat => {
item_size: 50,
});
const result = pageData.rows
.map((row) => {
return { return {
uniplatId: row.id.value, ...chat,
chat_id: Number(row.ImChatId.value), chat_id: chat.id,
msg: row.LastMsgContent.value,
customer_name: row.id.value,
customer_avatar_url: "",
uniplat_version: Number(row.uniplat_version.value),
msg_type: row.LastMsgType.value,
is_finish: row.Status.value,
}; };
}) }),
.filter((k) => !k.is_finish); total: 9999,
commit(ChatStore.MUTATION_SAVE_CHAT_LIST, {
list: result,
total: pageData.record_count,
}); });
}, },
// async [ChatStore.ACTION_JOIN_CHAT]( // async [ChatStore.ACTION_JOIN_CHAT](
......
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