|
@@ -30,27 +30,17 @@
|
|
|
@menu-avatar-click="handleMenuAvatarClick"
|
|
|
@pick-image="handleImageClick"
|
|
|
@send="handleSend">
|
|
|
- <template #cover>
|
|
|
- <div>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- <template #message-title="contact">
|
|
|
- <div>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
-
|
|
|
- <template #sidebar-contact-fixedtop="contact">
|
|
|
- <div>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
-
|
|
|
- <template #sidebar-message-fixedtop="message">
|
|
|
- <div>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
-
|
|
|
- <template #message-side="contact">
|
|
|
- <div>
|
|
|
+ <template #sidebar-message-top>
|
|
|
+ <div style="padding: 8px;">
|
|
|
+ <el-input
|
|
|
+ v-model="searchKeyword"
|
|
|
+ prefix-icon="el-icon-search"
|
|
|
+ placeholder="搜索"
|
|
|
+ size="small"
|
|
|
+ clearable
|
|
|
+ @input="handleSearch"
|
|
|
+ style="width: 100%;"
|
|
|
+ />
|
|
|
</div>
|
|
|
</template>
|
|
|
</lemon-imui>
|
|
@@ -157,7 +147,8 @@ export default {
|
|
|
open: false
|
|
|
},
|
|
|
imSocket: null,
|
|
|
- imUrl: process.env.VUE_APP_IM_WS_URL
|
|
|
+ imUrl: process.env.VUE_APP_IM_WS_URL,
|
|
|
+ searchKeyword: '',
|
|
|
};
|
|
|
},
|
|
|
created(){
|
|
@@ -521,6 +512,24 @@ export default {
|
|
|
this.$refs.userDetail.getDetail(sessionId);
|
|
|
}, 1);
|
|
|
},
|
|
|
+ // 搜索
|
|
|
+ handleSearch() {
|
|
|
+ const keyword = this.searchKeyword.trim().toLowerCase();
|
|
|
+ if (!keyword) {
|
|
|
+ // 为空时显示全部
|
|
|
+ this.$refs.IMUI.initConversations(this.conversationData);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 过滤会话列表
|
|
|
+ const filtered = this.conversationData.filter(item => {
|
|
|
+ // 搜索最后一条消息内容和联系人名
|
|
|
+ return (
|
|
|
+ (item.lastContent && item.lastContent.toLowerCase().includes(keyword)) ||
|
|
|
+ (item.displayName && item.displayName.toLowerCase().includes(keyword))
|
|
|
+ );
|
|
|
+ });
|
|
|
+ this.$refs.IMUI.initConversations(filtered);
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|