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 @@ + + + + + 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 @@ + + + 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 @@ + + + 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 } -