From 701d878f7d941ce9731547b3c4baae6474b4c997 Mon Sep 17 00:00:00 2001 From: wangyifeng <812766448@qq.com> Date: Tue, 13 May 2025 19:05:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=85=A5=E8=81=8A=E5=A4=A9APP?= =?UTF-8?q?=E7=9A=84=E5=85=A8=E5=B1=80=E6=90=9C=E7=B4=A2=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=EF=BC=8C=E5=8C=85=E6=8B=AC=E6=90=9C=E7=B4=A2=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E3=80=81=E6=90=9C=E7=B4=A2=E9=A1=B9=E5=92=8C=E9=AB=98=E4=BA=AE?= =?UTF-8?q?=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/search/highLightText.vue | 70 +++ src/components/search/searchItem.vue | 337 +++++++++++ src/components/search/searchList.vue | 743 ++++++++++++++++++++++++ src/views/message/inner/IndexSider.vue | 88 ++- 4 files changed, 1223 insertions(+), 15 deletions(-) create mode 100644 src/components/search/highLightText.vue create mode 100644 src/components/search/searchItem.vue create mode 100644 src/components/search/searchList.vue diff --git a/src/components/search/highLightText.vue b/src/components/search/highLightText.vue new file mode 100644 index 0000000..2839885 --- /dev/null +++ b/src/components/search/highLightText.vue @@ -0,0 +1,70 @@ + + + + + {{ part.text }} + + {{ part.text }} + + + + + + + diff --git a/src/components/search/searchItem.vue b/src/components/search/searchItem.vue new file mode 100644 index 0000000..54fd755 --- /dev/null +++ b/src/components/search/searchItem.vue @@ -0,0 +1,337 @@ + + + + + + + {{ resultType }} + + + + + + + + + {{ '(' + groupNum + ')' }} + + + + + {{ chatRecordCreatedAt }} + + + + + + + + + + + + + + diff --git a/src/components/search/searchList.vue b/src/components/search/searchList.vue new file mode 100644 index 0000000..6604189 --- /dev/null +++ b/src/components/search/searchList.vue @@ -0,0 +1,743 @@ + + + + + + + + + {{ getResultKeysValue(searchResultKey) }} + + + + + + + + + + {{ getHasMoreResult(searchResultKey) }} + + + + + + + + + + + diff --git a/src/views/message/inner/IndexSider.vue b/src/views/message/inner/IndexSider.vue index f8fe9a6..c51cca9 100644 --- a/src/views/message/inner/IndexSider.vue +++ b/src/views/message/inner/IndexSider.vue @@ -35,6 +35,7 @@ import xSearchForm from '@/components/x-naive-ui/x-search-form/index.vue' import xNDataTable from '@/components/x-naive-ui/x-n-data-table/index.vue' import flTree from '@/components/flnlayout/tree/flnindex.vue' import { processError, processSuccess } from '@/utils/helper/message.js' +import chatAppSearchList from '@/components/search/searchList.vue' const currentInstance = getCurrentInstance() const $request = currentInstance?.appContext.config.globalProperties?.$request @@ -54,6 +55,48 @@ const searchKeyword = ref('') const topItems = computed((): ISession[] => talkStore.topItems) const unreadNum = computed(() => talkStore.talkUnreadNum) +//自定义搜索 +const renderChatAppSearch = () => { + return h( + chatAppSearchList, + { + // searchResultKey: 'user_infos', + // searchItem: { + // avatar: + // 'https://e-cdn.fontree.cn/fonchain-main/prod/image/18248/avatar/a0b2bee7-947f-465a-986e-10a1b2b87032.png', + // created_at: '2025-03-27 14:44:23', + // erp_user_id: 18248, + // id: 44, + // mobile: '18994430450', + // nickname: '周俊耀' + // }, + // searchText: '周' + searchResultPageSize: 3, + listLimit: true, + apiRequest: ServeSeachQueryAll, + searchText: '王', + onClickSearchItem: (searchText, searchResultKey, talk_type, receiver_id, res) => { + console.log(searchText, searchResultKey, talk_type, receiver_id) + const result = JSON.parse(decodeURIComponent(res)) + console.log(result) + } + }, + {} + ) +} + +//ES搜索聊天记录-主页搜索什么都有、指定用户、指定群、群与用户概览 +const ServeSeachQueryAll = () => { + let url = '/api/v1/elasticsearch/query-all' + let params = {} + let config = { + baseURL: import.meta.env.VITE_BASE_API + } + return $request.HTTP.components.postDataByParams(url, params, config).then((res) => { + console.log(res) + }) +} + const state = reactive({ isShowAddressBookModal: false, // 是否显示通讯录模态框 customModalStyle: { @@ -176,6 +219,13 @@ const state = reactive({ groupChatListPageSize: 10, // 群聊列表表格每页条数 groupChatListTotal: 0, // 群聊列表表格总条数 groupChatListSearchGroupName: '', // 群聊列表搜索条件-群聊名称 + chatSearchOptions: [ + { + key: 'chatSearch', + type: 'render', + render: renderChatAppSearch + } + ] // 聊天搜索选项 }) const items = computed((): ISession[] => { @@ -388,7 +438,6 @@ const handleGroupChatListPaginationSize = (value) => { console.log(value, 'value') state.groupChatListPageSize = value } - @@ -406,25 +455,30 @@ const handleGroupChatListPaginationSize = (value) => { - - - - - - + + + + + + { - + 员工通讯录 群聊列表 @@ -696,7 +754,7 @@ html[theme-mode='dark'] { width: 100%; padding: 0 12px; :deep(.n-tabs-tab--active) { - color: #46299d!important; + color: #46299d !important; } .addressBook-content { display: flex;