Commit ab388239 authored by shirlyn.guo's avatar shirlyn.guo 👌🏻

chore: 个人空间&应用广场搜索优化

parent 2e9d37f4
...@@ -45,6 +45,7 @@ const { arrivedState } = useScroll(cardContentWrapRef, { behavior }) ...@@ -45,6 +45,7 @@ const { arrivedState } = useScroll(cardContentWrapRef, { behavior })
;(function () { ;(function () {
handleGetMallCategoryList() handleGetMallCategoryList()
agentApplicationClassifyIsLoading.value = true
handleGetAgentApplicationList() handleGetAgentApplicationList()
})() })()
...@@ -92,7 +93,8 @@ function handleGetAgentApplicationList(update = false, search = false) { ...@@ -92,7 +93,8 @@ function handleGetAgentApplicationList(update = false, search = false) {
pagingInfo: pagingInfo.value, pagingInfo: pagingInfo.value,
categoryId: agentTypeId.value, categoryId: agentTypeId.value,
} }
fetchGetAgentApplicationList<PersonalAppConfigState[]>(payload).then((res) => { fetchGetAgentApplicationList<PersonalAppConfigState[]>(payload)
.then((res) => {
agentApplicationList.value = update ? res.data : [...agentApplicationList.value, ...res.data] agentApplicationList.value = update ? res.data : [...agentApplicationList.value, ...res.data]
pagingInfo.value = res.pagingInfo as PaginationInfo pagingInfo.value = res.pagingInfo as PaginationInfo
...@@ -102,7 +104,8 @@ function handleGetAgentApplicationList(update = false, search = false) { ...@@ -102,7 +104,8 @@ function handleGetAgentApplicationList(update = false, search = false) {
: t('personal_space_module.agent_module.agent_list_module.empty_agent_list') : t('personal_space_module.agent_module.agent_list_module.empty_agent_list')
emptyTableImage.value = emptyTableImage.value =
searchQuery.value && agentApplicationList.value.length === 0 ? searchEmptyImage : applicationEmptyImage searchQuery.value && agentApplicationList.value.length === 0 ? searchEmptyImage : applicationEmptyImage
})
.finally(() => {
agentApplicationClassifyIsLoading.value = false agentApplicationClassifyIsLoading.value = false
agentApplicationBottomIsLoading.value = false agentApplicationBottomIsLoading.value = false
}) })
...@@ -133,9 +136,31 @@ function handleGetMallCategoryList() { ...@@ -133,9 +136,31 @@ function handleGetMallCategoryList() {
function handleToUseAgentApplication(agentId: string) { function handleToUseAgentApplication(agentId: string) {
router.push({ name: 'ShareWebApplication', params: { agentId: agentId } }) router.push({ name: 'ShareWebApplication', params: { agentId: agentId } })
} }
function handleAddAgentApplications() { function handleAddAgentApplications() {
router.push({ name: 'PersonalAppSetting' }) router.push({ name: 'PersonalAppSetting' })
} }
function handleEnterKeypress(event: KeyboardEvent) {
if (event.code === 'Enter' && !event.shiftKey) {
event.preventDefault()
if (searchQuery.value.trim() === '') return
agentApplicationClassifyIsLoading.value = true
handleGetAgentApplicationList(true, true)
}
}
function handleSearchGetApplicationList(clear = false) {
if (clear) {
agentApplicationClassifyIsLoading.value = true
searchQuery.value = ''
} else {
if (searchQuery.value.trim() === '') return
agentApplicationClassifyIsLoading.value = true
}
handleGetAgentApplicationList(true, true)
}
</script> </script>
<template> <template>
...@@ -154,10 +179,11 @@ function handleAddAgentApplications() { ...@@ -154,10 +179,11 @@ function handleAddAgentApplications() {
:placeholder="t('common_module.search')" :placeholder="t('common_module.search')"
class="search-input rounded-[26px]! text-[16px]! leading-[32px]! border-[#9ea3ff]! border-[1px] py-[6px] shadow-[0_4px_10px_0px_rgba(103,103,103,.1)]" class="search-input rounded-[26px]! text-[16px]! leading-[32px]! border-[#9ea3ff]! border-[1px] py-[6px] shadow-[0_4px_10px_0px_rgba(103,103,103,.1)]"
clearable clearable
@keyup.enter="handleGetAgentApplicationList(true, true)" :on-clear="() => handleSearchGetApplicationList(true)"
@keyup.enter="handleEnterKeypress"
> >
<template #prefix> <template #prefix>
<div @click="handleGetAgentApplicationList(true)"> <div @click="() => handleSearchGetApplicationList(false)">
<img src="@/assets/images/search.png" width="14" height="14" class="mr-[5px] cursor-pointer" /> <img src="@/assets/images/search.png" width="14" height="14" class="mr-[5px] cursor-pointer" />
</div> </div>
</template> </template>
...@@ -204,8 +230,8 @@ function handleAddAgentApplications() { ...@@ -204,8 +230,8 @@ function handleAddAgentApplications() {
<n-scrollbar style="max-height: 920px"> <n-scrollbar style="max-height: 920px">
<div> <div>
<div class="mt-[14px] min-h-[800px]"> <div class="mt-[14px] min-h-[800px]">
<div class="flex justify-center"> <div v-show="agentApplicationClassifyIsLoading" class="flex h-[500px] items-center justify-center">
<n-spin v-show="agentApplicationClassifyIsLoading" size="large" /> <n-spin size="large" />
</div> </div>
<div <div
v-show="!agentApplicationClassifyIsLoading && agentApplicationList.length !== 0" v-show="!agentApplicationClassifyIsLoading && agentApplicationList.length !== 0"
......
...@@ -125,6 +125,8 @@ function handleBasePublishingStatusGetAgentList() { ...@@ -125,6 +125,8 @@ function handleBasePublishingStatusGetAgentList() {
function handleEnterKeypress(event: KeyboardEvent) { function handleEnterKeypress(event: KeyboardEvent) {
if (event.code === 'Enter' && !event.shiftKey) { if (event.code === 'Enter' && !event.shiftKey) {
event.preventDefault() event.preventDefault()
if (agentSearchInputValue.value.trim() === '') return
agentAppListLoading.value = true
getApplicationList() getApplicationList()
} }
...@@ -184,9 +186,16 @@ function handleSelectAddType() { ...@@ -184,9 +186,16 @@ function handleSelectAddType() {
router.push({ name: 'PersonalAppSetting' }) router.push({ name: 'PersonalAppSetting' })
} }
// function handleAnalysisPersonalApp(personalApp: PersonalAppConfigState) { function handleSearchGetApplicationList(clear = false) {
// console.log('分析', personalApp) if (clear) {
// } agentAppListLoading.value = true
agentSearchInputValue.value = ''
} else {
if (agentSearchInputValue.value.trim() === '') return
agentAppListLoading.value = true
}
getApplicationList()
}
const handleCardContentScrollDebounce = debounce( const handleCardContentScrollDebounce = debounce(
(event: { target: { scrollTop: number; clientHeight: number; scrollHeight: number } }) => { (event: { target: { scrollTop: number; clientHeight: number; scrollHeight: number } }) => {
...@@ -198,6 +207,10 @@ const handleCardContentScrollDebounce = debounce( ...@@ -198,6 +207,10 @@ const handleCardContentScrollDebounce = debounce(
}, },
200, 200,
) )
// function handleAnalysisPersonalApp(personalApp: PersonalAppConfigState) {
// console.log('分析', personalApp)
// }
</script> </script>
<template> <template>
...@@ -214,6 +227,8 @@ const handleCardContentScrollDebounce = debounce( ...@@ -214,6 +227,8 @@ const handleCardContentScrollDebounce = debounce(
v-model:value="agentSearchInputValue" v-model:value="agentSearchInputValue"
:placeholder="t('common_module.search')" :placeholder="t('common_module.search')"
class="w-[256px]! h-[32px]!" class="w-[256px]! h-[32px]!"
clearable
:on-clear="() => handleSearchGetApplicationList(true)"
@keypress="handleEnterKeypress" @keypress="handleEnterKeypress"
> >
<template #suffix> <template #suffix>
...@@ -222,16 +237,16 @@ const handleCardContentScrollDebounce = debounce( ...@@ -222,16 +237,16 @@ const handleCardContentScrollDebounce = debounce(
size="16" size="16"
fill="#999" fill="#999"
:stroke-width="3" :stroke-width="3"
class="cursor-pointer text-base" class="ml-[10px] cursor-pointer text-base"
@click="getApplicationList()" @click="() => handleSearchGetApplicationList(false)"
/> />
</template> </template>
</NInput> </NInput>
</div> </div>
<n-scrollbar style="max-height: 700px" @scroll="handleCardContentScrollDebounce"> <n-scrollbar style="max-height: 700px" @scroll="handleCardContentScrollDebounce">
<div ref="cardContentWrapRef" class="pb-[50px]"> <div ref="cardContentWrapRef" class="pb-[50px]">
<div class="flex justify-center"> <div v-show="agentAppListLoading" class="flex h-[700px] items-center justify-center">
<n-spin v-show="agentAppListLoading" size="large" /> <n-spin size="large" />
</div> </div>
<div v-show="!agentAppListLoading" class="mt-[5px]"> <div v-show="!agentAppListLoading" class="mt-[5px]">
<div v-if="agentAppList.length" class="grid-content grid grid-cols-4"> <div v-if="agentAppList.length" class="grid-content grid grid-cols-4">
......
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 to comment