You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

96 lines
2.3 KiB

<template>
<el-container class="chat-page">
<el-aside width="260px" class="aside">
<div class="header">
<el-input class="search-text" size="small" placeholder="搜索" v-model="searchText">
<i class="el-icon-search el-input__icon" slot="prefix"> </i>
</el-input>
</div>
<div class="chat-loading" v-if="loading" v-loading="true" element-loading-text="消息接收中..."
element-loading-spinner="el-icon-loading" element-loading-background="#F9F9F9" element-loading-size="24">
</div>
<el-scrollbar class="chat-items" v-else>
<div v-for="(chat, index) in chatStore.chats" :key="index">
<chat-item v-show="!chat.delete && chat.showName && chat.showName.includes(searchText)" :chat="chat"
:index="index" @click.native="onActiveItem(index)" @delete="onDelItem(index)" @top="onTop(index)"
:active="chat === chatStore.activeChat"></chat-item>
</div>
</el-scrollbar>
</el-aside>
<el-container>
<chat-box v-if="chatStore.activeChat" :chat="chatStore.activeChat"></chat-box>
</el-container>
</el-container>
</template>
<script>
import ChatItem from "../components/chat/ChatItem.vue";
import ChatBox from "../components/chat/ChatBox.vue";
export default {
name: "chat",
components: {
ChatItem,
ChatBox
},
data() {
return {
searchText: "",
messageContent: "",
group: {},
groupMembers: []
}
},
methods: {
onActiveItem(index) {
this.chatStore.setActiveChat(index);
},
onDelItem(index) {
this.chatStore.removeChat(index);
},
onTop(chatIdx) {
this.chatStore.moveTop(chatIdx);
},
},
computed: {
loading() {
return this.chatStore.loadingGroupMsg || this.chatStore.loadingPrivateMsg
}
}
}
</script>
<style lang="scss" scoped>
.chat-page {
.aside {
display: flex;
flex-direction: column;
background: var(--im-background);
.header {
height: 50px;
display: flex;
align-items: center;
padding: 0 8px;
}
.chat-loading {
height: 50px;
background-color: #eee;
.el-icon-loading {
font-size: 24px;
color: var(--im-text-color-light);
}
.el-loading-text {
color: var(--im-text-color-light);
}
}
.chat-items {
flex: 1;
}
}
}
</style>