Commit 585e1c18 by panjiangyi

从im拿会话列表

parent c102ba83
Showing with 390 additions and 402 deletions
<template> <template>
<div class="chat-list-con h-100"> <div class="chat-list-con h-100">
<div class="chat-list h-100"> <div class="chat-list h-100">
<el-input <el-input
class="keyword-input" class="keyword-input"
placeholder="昵称、手机、Email、备注" placeholder="昵称、手机、Email、备注"
prefix-icon="el-icon-search" prefix-icon="el-icon-search"
v-model="searchKeyword" v-model="searchKeyword"
v-on:keyup.enter.native="search" v-on:keyup.enter.native="search"
clearable clearable
@clear="search" @clear="search"
></el-input> ></el-input>
<div class="chat-list-scroll"> <div class="chat-list-scroll">
<el-scrollbar class="h-100 no-bottom-scrollbar"> <el-scrollbar class="h-100 no-bottom-scrollbar">
<div <div
v-for="item in chatRooms" v-for="item in chatRooms"
:key="item.chat_id" :key="item.chat_id"
class="chat-item" class="chat-item"
:class="{ selected: isSelected(item) }" :class="{ selected: isSelected(item) }"
@click="goToChatRoom(item)" @click="goToChatRoom(item)"
> >
<div <div
class="chat-avatar pos-rel" class="chat-avatar pos-rel"
:class="{ 'red-dot': item.unread_msg_count > 0 }" :class="{ 'red-dot': item.unread_msg_count > 0 }"
> >
<avatar <avatar
shape="circle" shape="circle"
:size="36" :size="36"
:src="item.customer_avatar_url" :src="item.customer_avatar_url"
/> />
</div> </div>
<div class="chat-info"> <div class="chat-info">
<div <div
class=" class="
chat-info-left chat-info-left
d-flex d-flex
justify-content-between justify-content-between
align-items-center align-items-center
" "
> >
<div <div
:title="item.customer_name" :title="item.customer_name"
class="chat-name flex-fill text-dot-dot-dot" class="chat-name flex-fill text-dot-dot-dot"
> >
<!-- <span>{{ <!-- <span>{{
item.customer_name || item.customer_name ||
item.customer_mobile || item.customer_mobile ||
item.customer_eid item.customer_eid
}}</span> --> }}</span> -->
<span>{{ item.chat_id }}</span> <span>{{ item.chat_id }}</span>
</div> </div>
<div v-if="item.last_msg_ts" class="chat-time"> <div v-if="item.last_msg_ts" class="chat-time">
{{ formatTimestamp(item.last_msg_ts) }} {{ formatTimestamp(item.last_msg_ts) }}
</div> </div>
</div> </div>
<div class="chat-msg text-dot-dot-dot"> <div class="chat-msg text-dot-dot-dot">
{{ parseMesage(item) }} {{ parseMesage(item) }}
</div> </div>
</div>
</div>
<div
class="empty"
v-if="chatRooms && chatRooms.length <= 0"
>
{{ searchKeyword ? "无相关接待" : "无接待" }}
</div>
</el-scrollbar>
</div> </div>
</div> </div>
<div class="empty" v-if="chatRooms && chatRooms.length <= 0">
{{ searchKeyword ? "无相关接待" : "无接待" }}
</div>
</el-scrollbar>
</div>
</div> </div>
</div>
</template> </template>
<script lang="ts"> <script lang="ts">
...@@ -78,234 +81,232 @@ import { chatStore, ChatStore } from "@/customer-service/store/model"; ...@@ -78,234 +81,232 @@ import { chatStore, ChatStore } from "@/customer-service/store/model";
import { formatTime, TimeFormatRule } from "@/customer-service/utils/time"; import { formatTime, TimeFormatRule } from "@/customer-service/utils/time";
import Chat from "@/customer-service/xim"; import Chat from "@/customer-service/xim";
export function parserMessage(type: string, rawMsg: string) { export function parserMessage(type: string, rawMsg: string) {
if (!type) return ""; if (!type) return "";
if (!rawMsg) return ""; if (!rawMsg) return "";
const msg = JSON.parse(rawMsg); const msg = JSON.parse(rawMsg);
if (type === "text") { if (type === "text") {
return msg.text; return msg.text;
} else if (type === "image") { } else if (type === "image") {
return `[图片]`; return `[图片]`;
} else if (type === "file") { } else if (type === "file") {
return `[文件]`; return `[文件]`;
} else { } else {
return `[不支持的消息格式]`; return `[不支持的消息格式]`;
} }
} }
type Chat = NonNullable<ChatStore.STATE_MY_CHAT_ROOM_LIST>["list"][number]; type Chat = NonNullable<ChatStore.STATE_MY_CHAT_ROOM_LIST>["list"][number];
@Component({ components: { avatar } }) @Component({ components: { avatar } })
export default class ChatList extends Vue { export default class ChatList extends Vue {
@chatStore.Action(ChatStore.ACTION_GET_MY_CHAT_LIST) @chatStore.Action(ChatStore.ACTION_GET_MY_CHAT_LIST)
private readonly getMyChatList!: ChatStore.ACTION_GET_MY_CHAT_LIST; private readonly getMyChatList!: ChatStore.ACTION_GET_MY_CHAT_LIST;
@chatStore.State(ChatStore.STATE_CHAT_CURRENT_CHAT_ID)
private readonly chatId!: ChatStore.STATE_CHAT_CURRENT_CHAT_ID;
@chatStore.State(ChatStore.STATE_CHAT_CURRENT_CHAT_ID) @chatStore.State(ChatStore.STATE_CHAT_CURRENT_CHAT_VERSION)
private readonly chatId!: ChatStore.STATE_CHAT_CURRENT_CHAT_ID; private readonly uniplatVersion!: ChatStore.STATE_CHAT_CURRENT_CHAT_VERSION;
@chatStore.State(ChatStore.STATE_CHAT_CURRENT_CHAT_UNIPLAT_ID) @chatStore.State(ChatStore.STATE_MY_CHAT_ROOM_LIST)
private readonly currentChatUniplatId!: ChatStore.STATE_CHAT_CURRENT_CHAT_UNIPLAT_ID; private readonly chatList!: ChatStore.STATE_MY_CHAT_ROOM_LIST;
@chatStore.State(ChatStore.STATE_CHAT_CURRENT_CHAT_VERSION) @chatStore.Action(ChatStore.ACTION_SAVE_CURRENT_CHAT_ID_VERSION)
private readonly uniplatVersion!: ChatStore.STATE_CHAT_CURRENT_CHAT_VERSION; private readonly saveChatId!: ChatStore.ACTION_SAVE_CURRENT_CHAT_ID_VERSION;
@chatStore.State(ChatStore.STATE_MY_CHAT_ROOM_LIST) @chatStore.Mutation(ChatStore.MUTATION_SAVE_MYSELF_ID)
private readonly chatList!: ChatStore.STATE_MY_CHAT_ROOM_LIST; private readonly saveMyId!: ChatStore.MUTATION_SAVE_MYSELF_ID;
@chatStore.Action(ChatStore.ACTION_SAVE_CURRENT_CHAT_ID_VERSION) @chatStore.Mutation(ChatStore.MUTATION_SET_CHAT_SOURCE)
private readonly saveChatId!: ChatStore.ACTION_SAVE_CURRENT_CHAT_ID_VERSION; private readonly setSource!: ChatStore.MUTATION_SET_CHAT_SOURCE;
@chatStore.Mutation(ChatStore.MUTATION_SAVE_MYSELF_ID) @chatStore.Mutation(ChatStore.MUTATION_SAVE_CHAT_TITLE)
private readonly saveMyId!: ChatStore.MUTATION_SAVE_MYSELF_ID; private readonly saveChatTitle!: ChatStore.MUTATION_SAVE_CHAT_TITLE;
@chatStore.Mutation(ChatStore.MUTATION_SET_CHAT_SOURCE) @chatStore.Mutation(ChatStore.MUTATION_SHOW_CHAT)
private readonly setSource!: ChatStore.MUTATION_SET_CHAT_SOURCE; private readonly showChat: ChatStore.MUTATION_SHOW_CHAT;
@chatStore.Mutation(ChatStore.MUTATION_SAVE_CHAT_TITLE) @Prop({ type: String, default: "-1" })
private readonly saveChatTitle!: ChatStore.MUTATION_SAVE_CHAT_TITLE; private selected!: string;
@chatStore.Mutation(ChatStore.MUTATION_SHOW_CHAT) private searchKeyword = "";
private readonly showChat: ChatStore.MUTATION_SHOW_CHAT
@Prop({ type: String, default: "-1" }) private get chatRooms() {
private selected!: string; return this.chatList?.list || [];
}
private isSelected(item: Chat) {
if (this.chatId) {
return item.chat_id === this.chatId;
}
return this.selected === item.uniplatId;
}
private searchKeyword = ""; async created() {
await this.getMyChatList();
this.setSource(ChatStore.StateChatSourceDirection.Server);
this.selectFirstChat();
}
private get chatRooms() { mounted() {
return this.chatList?.list || []; this.saveMyId();
} this.goToOnlyRoom();
}
private isSelected(item: Chat) { private goToOnlyRoom() {
if (this.currentChatUniplatId) { if (this.chatRooms.length === 1) {
return item.uniplatId === this.currentChatUniplatId; const wantedChat = this.chatRooms[0];
this.goToChatRoom(wantedChat);
}
} }
return this.selected === item.uniplatId;
} private selectFirstChat() {
if (this.chatId != null) return;
async created() { if (!this.chatRooms.length) return;
await this.getMyChatList(); const { chat_id, uniplat_version, uniplatId } = this.chatRooms[0];
this.setSource(ChatStore.StateChatSourceDirection.Server); this.saveChatId({
this.selectFirstChat(); chatId: chat_id,
} v: uniplat_version,
uniplatId,
mounted() { });
this.saveMyId();
this.goToOnlyRoom();
}
private goToOnlyRoom() {
if (this.chatRooms.length === 1) {
const wantedChat = this.chatRooms[0];
this.goToChatRoom(wantedChat);
} }
}
private selectFirstChat() {
if (this.chatId != null) return;
if (!this.chatRooms.length) return;
const { chat_id, uniplat_version, uniplatId } = this.chatRooms[0];
this.saveChatId({
chatId: chat_id,
v: uniplat_version,
uniplatId,
});
}
@buttonThrottle() @buttonThrottle()
private async search() { private async search() {
this.searchKeyword = this.searchKeyword.trim(); this.searchKeyword = this.searchKeyword.trim();
if (!this.searchKeyword) { if (!this.searchKeyword) {
await this.getMyChatList(); await this.getMyChatList();
} else { } else {
await this.getMyChatList(this.searchKeyword); await this.getMyChatList(this.searchKeyword);
}
}
private goToChatRoom(data: Chat) {
if (this.chatId === data.chat_id) {
this.showChat();
return;
}
const wantedChatRoom = this.chatRooms.find(
(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,
uniplatId: data.uniplatId,
}).finally(this.raiseChatIdChanged);
this.showChat();
this.$emit("close");
this.saveChatTitle(data.uniplatId);
}
private raiseChatIdChanged() {
this.$emit("change");
} }
}
private goToChatRoom(data: Chat) { private parseMesage(data: Chat) {
if (this.currentChatUniplatId === data.uniplatId) { return parserMessage(data.msg_type, data.msg);
this.showChat(); }
return;
private formatTimestamp(v: number) {
return formatTime(v, { short: true, rule: TimeFormatRule.Hour12 });
} }
const wantedChatRoom = this.chatRooms.find(
(k) => k.uniplatId === data.uniplatId
);
if (wantedChatRoom == null) return;
this.saveChatId({
chatId: wantedChatRoom.chat_id,
v: data.uniplat_version,
uniplatId: data.uniplatId,
}).finally(this.raiseChatIdChanged);
this.showChat();
this.$emit("close");
this.saveChatTitle(data.uniplatId);
}
private raiseChatIdChanged() {
this.$emit("change");
}
private parseMesage(data: Chat) {
return parserMessage(data.msg_type, data.msg);
}
private formatTimestamp(v: number) {
return formatTime(v, { short: true, rule: TimeFormatRule.Hour12 });
}
} }
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.chat-list-con { .chat-list-con {
.title { .title {
padding-left: 20px; padding-left: 20px;
line-height: 59px; line-height: 59px;
font-size: 18px; font-size: 18px;
border-bottom: 1px solid #e1e1e1; border-bottom: 1px solid #e1e1e1;
} }
} }
.chat-list { .chat-list {
text-align: center; text-align: center;
} }
.chat-list-scroll { .chat-list-scroll {
height: calc(100% - 50px); height: calc(100% - 50px);
.empty { .empty {
margin-top: 100%; margin-top: 100%;
} }
} }
.keyword-input { .keyword-input {
width: 200px; width: 200px;
margin: 15px 0; margin: 15px 0;
/deep/ .el-input__inner { /deep/ .el-input__inner {
font-size: 13px;
height: 30px;
line-height: 30px;
border-radius: 15px;
padding-right: 15px;
}
/deep/ .el-icon-time {
background: transparent;
}
}
.chat-list {
.chat-item {
cursor: pointer;
padding: 10px 15px;
&:hover {
background: #e4f0ff;
}
&.selected {
background: #f0f0f0;
}
.chat-avatar {
display: inline-block;
vertical-align: middle;
width: 36px;
height: 36px;
margin-right: 15px;
&.red-dot::before {
content: "";
position: absolute;
width: 8px;
height: 8px;
background: #e87005;
border-radius: 50%;
z-index: 1;
right: -4px;
top: -4px;
}
}
.chat-info {
display: inline-block;
vertical-align: middle;
width: calc(100% - 51px);
}
.chat-info-left {
text-align: start;
font-size: 14px;
line-height: 20px;
color: #333333;
margin-bottom: 10px;
.chat-time {
text-align: end;
flex: none;
color: #999999;
margin-left: 10px;
font-size: 13px; font-size: 13px;
line-height: 1; height: 30px;
} line-height: 30px;
border-radius: 15px;
padding-right: 15px;
} }
.chat-msg { /deep/ .el-icon-time {
color: #888; background: transparent;
text-align: start; }
font-size: 13px; }
margin-top: -3px; .chat-list {
.chat-item {
cursor: pointer;
padding: 10px 15px;
&:hover {
background: #e4f0ff;
}
&.selected {
background: #f0f0f0;
}
.chat-avatar {
display: inline-block;
vertical-align: middle;
width: 36px;
height: 36px;
margin-right: 15px;
&.red-dot::before {
content: "";
position: absolute;
width: 8px;
height: 8px;
background: #e87005;
border-radius: 50%;
z-index: 1;
right: -4px;
top: -4px;
}
}
.chat-info {
display: inline-block;
vertical-align: middle;
width: calc(100% - 51px);
}
.chat-info-left {
text-align: start;
font-size: 14px;
line-height: 20px;
color: #333333;
margin-bottom: 10px;
.chat-time {
text-align: end;
flex: none;
color: #999999;
margin-left: 10px;
font-size: 13px;
line-height: 1;
}
}
.chat-msg {
color: #888;
text-align: start;
font-size: 13px;
margin-top: -3px;
}
} }
}
} }
</style> </style>
<template> <template>
<div class="chat-room-con h-100 pos-rel"> <div class="chat-room-con h-100 pos-rel">
<div class="chat-panel"> {{ chatId }}-{{ uniplatId }}
<div class="chat-area h-100"> <div class="chat-panel">
<template v-if="notOnlyCheck"> <div class="chat-area h-100">
<div class="chat-messages pos-rel"> <template v-if="notOnlyCheck">
<div <div class="chat-messages pos-rel">
v-if="getCurrentInputingPeople.length" <div
class="someone-inputing" v-if="getCurrentInputingPeople.length"
> class="someone-inputing"
{{ getCurrentInputingPeople }}正在输入 >
{{ getCurrentInputingPeople }}正在输入
</div>
<messages />
</div>
<div class="chat-input">
<message-input @error="onError" />
</div>
</template>
<template v-else>
<messages />
</template>
</div> </div>
<messages /> </div>
</div>
<div class="chat-input">
<message-input @error="onError" />
</div>
</template>
<template v-else>
<messages />
</template>
</div>
</div> </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";
...@@ -39,152 +34,157 @@ import { ChatStore, chatStore } from "@/customer-service/store/model"; ...@@ -39,152 +34,157 @@ import { ChatStore, chatStore } from "@/customer-service/store/model";
type RoomInfoTab = "customer" | "order"; type RoomInfoTab = "customer" | "order";
@Component({ @Component({
components: { components: {
MessageInput, MessageInput,
messages, messages,
}, },
}) })
export default class ChatRoom extends Vue { export default class ChatRoom extends Vue {
@chatStore.Getter(ChatStore.GETTER_CURRENT_CHAT_PRESENT_MEMBERS) @chatStore.State(ChatStore.STATE_CHAT_CURRENT_CHAT_ID)
private readonly chatMembers!: ChatStore.GETTER_CURRENT_CHAT_PRESENT_MEMBERS; private readonly chatId!: ChatStore.STATE_CHAT_CURRENT_CHAT_ID;
@chatStore.Mutation(ChatStore.MUTATION_CLEAR_CURRENT_CHAT_MEMBERS) @chatStore.State(ChatStore.STATE_CHAT_CURRENT_CHAT_VERSION)
private readonly clearChatMembers!: ChatStore.MUTATION_CLEAR_CURRENT_CHAT_MEMBERS; private readonly uniplatId!: ChatStore.STATE_CHAT_CURRENT_CHAT_VERSION;
@chatStore.State(ChatStore.STATE_CURRENT_CHAT_TITLE) @chatStore.Getter(ChatStore.GETTER_CURRENT_CHAT_PRESENT_MEMBERS)
private readonly chatTitle!: ChatStore.STATE_CURRENT_CHAT_TITLE; private readonly chatMembers!: ChatStore.GETTER_CURRENT_CHAT_PRESENT_MEMBERS;
@chatStore.State(ChatStore.STATE_CURRENT_CHAT_INPUTING) @chatStore.Mutation(ChatStore.MUTATION_CLEAR_CURRENT_CHAT_MEMBERS)
private readonly currentInputPeople!: ChatStore.STATE_CURRENT_CHAT_INPUTING; private readonly clearChatMembers!: ChatStore.MUTATION_CLEAR_CURRENT_CHAT_MEMBERS;
@chatStore.State(ChatStore.STATE_CHAT_CURRENT_CHAT_UNIPLAT_ID) @chatStore.State(ChatStore.STATE_CURRENT_CHAT_TITLE)
private readonly currentChatUniplatId!: ChatStore.STATE_CHAT_CURRENT_CHAT_UNIPLAT_ID; private readonly chatTitle!: ChatStore.STATE_CURRENT_CHAT_TITLE;
@chatStore.State(ChatStore.STATE_MY_CHAT_ROOM_LIST) @chatStore.State(ChatStore.STATE_CURRENT_CHAT_INPUTING)
private readonly myChatList!: ChatStore.STATE_MY_CHAT_ROOM_LIST; private readonly currentInputPeople!: ChatStore.STATE_CURRENT_CHAT_INPUTING;
private allChatList = { list: [] }; @chatStore.State(ChatStore.STATE_CHAT_CURRENT_CHAT_UNIPLAT_ID)
private readonly currentChatUniplatId!: ChatStore.STATE_CHAT_CURRENT_CHAT_UNIPLAT_ID;
@Prop({ type: Function }) @chatStore.State(ChatStore.STATE_MY_CHAT_ROOM_LIST)
private close?: () => void; private readonly myChatList!: ChatStore.STATE_MY_CHAT_ROOM_LIST;
@Provide() showReadSummary = true; private allChatList = { list: [] };
@Watch("currentChatUniplatId") @Prop({ type: Function })
private whenCurrentChatIdChanged(newValue: string, oldValue: string) { private close?: () => void;
if (Number(oldValue) === Number(newValue)) return;
this.clearChatMembers();
}
private activeTab: RoomInfoTab = "customer"; @Provide() showReadSummary = true;
private get getCurrentInputingPeople() { @Watch("currentChatUniplatId")
return this.currentInputPeople private whenCurrentChatIdChanged(newValue: string, oldValue: string) {
.map(() => "" /* this.userInfo[k].name */) if (Number(oldValue) === Number(newValue)) return;
.join("、"); this.clearChatMembers();
} }
private activeTab: RoomInfoTab = "customer";
private get getCurrentInputingPeople() {
return this.currentInputPeople
.map(() => "" /* this.userInfo[k].name */)
.join("、");
}
private get currentChat() { private get currentChat() {
const chatId = this.currentChatUniplatId; const chatId = this.currentChatUniplatId;
if (this.myChatList == null) return; if (this.myChatList == null) return;
const result = this.myChatList.list.find((k) => k.uniplatId === chatId); const result = this.myChatList.list.find((k) => k.uniplatId === chatId);
// if (result) return result; // if (result) return result;
// result = this.allChatList.list.find((k) => k.uniplatId === chatId); // result = this.allChatList.list.find((k) => k.uniplatId === chatId);
return result ?? {}; return result ?? {};
} }
private get notOnlyCheck(): boolean { private get notOnlyCheck(): boolean {
return true; return true;
} }
private get customerInfoTabShow() { private get customerInfoTabShow() {
return this.activeTab === "customer"; return this.activeTab === "customer";
} }
private get orderInfoTabShow() { private get orderInfoTabShow() {
return this.activeTab === "order"; return this.activeTab === "order";
} }
private onError(msg: string) { private onError(msg: string) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.error(msg); console.error(msg);
this.$message.error(msg); this.$message.error(msg);
} }
} }
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.chat-status { .chat-status {
display: inline-block; display: inline-block;
width: 46px; width: 46px;
height: 20px; height: 20px;
line-height: 20px; line-height: 20px;
background: #22bd7a; background: #22bd7a;
font-size: 13px; font-size: 13px;
border-radius: 2px; border-radius: 2px;
color: #ffffff; color: #ffffff;
text-align: center; text-align: center;
margin-left: 10px; margin-left: 10px;
&.chat-done { &.chat-done {
background: #c5d4e5; background: #c5d4e5;
} }
} }
.chat-panel { .chat-panel {
height: 100%; height: 100%;
.chat-area, .chat-area,
.chat-info { .chat-info {
display: inline-block; display: inline-block;
vertical-align: top; vertical-align: top;
} }
.chat-area { .chat-area {
width: 100%; width: 100%;
} }
.chat-info { .chat-info {
width: 349px; width: 349px;
border-left: 1px solid #e1e1e1; border-left: 1px solid #e1e1e1;
} }
} }
.info-tabs { .info-tabs {
height: 40px; height: 40px;
line-height: 40px; line-height: 40px;
border-bottom: 1px solid #f0f0f0; border-bottom: 1px solid #f0f0f0;
.info-tab { .info-tab {
display: inline-block; display: inline-block;
vertical-align: top; vertical-align: top;
width: 50%; width: 50%;
text-align: center; text-align: center;
font-size: 15px; font-size: 15px;
color: #333; color: #333;
cursor: pointer; cursor: pointer;
&.active { &.active {
font-weight: 600; font-weight: 600;
}
} }
}
} }
.chat-area { .chat-area {
--input-height: 130px; --input-height: 130px;
.chat-messages { .chat-messages {
height: calc(100% - 130px + 1px); height: calc(100% - 130px + 1px);
border-bottom: 1px solid #e1e1e1; border-bottom: 1px solid #e1e1e1;
} }
.chat-input { .chat-input {
height: var(--input-height); height: var(--input-height);
} }
} }
.order-info-con { .order-info-con {
height: calc(100% - 40px); height: calc(100% - 40px);
} }
.someone-inputing { .someone-inputing {
position: absolute; position: absolute;
left: 20px; left: 20px;
bottom: 20px; bottom: 20px;
z-index: 1; z-index: 1;
color: #c2c2c2; color: #c2c2c2;
} }
</style> </style>
...@@ -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