Commit 4fd2e1d8 by 吴云建

会话调整

parent 10cc168f
......@@ -3,7 +3,7 @@
<div class="search-wrap" v-if="!modelName">
<el-input
class="keyword-input"
placeholder="昵称、手机、Email、备注"
placeholder="会话标题"
prefix-icon="el-icon-search"
v-model="searchKeyword"
v-on:keyup.enter.native="search"
......@@ -12,7 +12,7 @@
></el-input>
<i v-if="!isInPage" class="close-btn el-icon-close" @click="$emit('close')"></i>
</div>
<chat-list v-if="!modelName" :searchKeyword="searchKeyword" ref="chatListComp" />
<chat-list v-if="!modelName" ref="chatListComp" />
<chat-list-model v-if="modelName" @update-page-info="$emit('update-page-info', $event)" ref="chatListModel"/>
<div class="chat-content-wrap" v-if="chatVisible && onShow" >
<chat :modelName="modelName"/>
......@@ -54,9 +54,8 @@ export default class ChatContainer extends Vue {
@Ref("chatListModel") chatListModel: ChatListModel;
@buttonThrottle()
private search() {
this.chatListComp.search()
this.chatListComp.search(this.searchKeyword)
}
@Watch("$route") routeUpdate() {
......
......@@ -75,7 +75,7 @@ export function parserMessage(type: string, rawMsg: string) {
@Component({ components: { avatar } })
export default class ChatList extends Vue {
@Prop(String) searchKeyword;
private searchKeyword = "";
@chatStore.Action(ChatStore.ACTION_GET_MY_CHAT_LIST)
private readonly getMyChatList!: ChatStore.ACTION_GET_MY_CHAT_LIST;
......@@ -110,8 +110,10 @@ export default class ChatList extends Vue {
@Ref("scrollbar")
private scrollbar: Vue & { update: () => void };
private sseTs = 0;
private get chatRooms() {
return this.chatList?.list || [];
return this.chatList?.list.filter(chat => chat.title.indexOf(this.searchKeyword) > -1) || [];
}
private isSelected(item: ChatType) {
......@@ -137,8 +139,12 @@ export default class ChatList extends Vue {
}
onTransportMessage() {
this.getMyChatList()
// this.hideChat()
const ts = new Date().getTime();
if (ts - this.sseTs > 100) {
this.getMyChatList()
// this.hideChat()
this.sseTs = ts;
}
}
private goToOnlyRoom() {
......@@ -155,13 +161,8 @@ export default class ChatList extends Vue {
this.saveChatId(chat_id);
}
public async search() {
let searchKeyword = this.searchKeyword.trim();
if (!searchKeyword) {
await this.getMyChatList();
} else {
await this.getMyChatList(searchKeyword);
}
public async search(searchKeyword: string) {
this.searchKeyword = searchKeyword.trim();
}
private async goToChatRoom(data: ChatType) {
......
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