Commit 585e1c18 by panjiangyi

从im拿会话列表

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