Commit 960fc374 authored by shirlyn.guo's avatar shirlyn.guo 👌🏻

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

parent dff9ac99
......@@ -36,7 +36,7 @@ const cardContentWrapRef = useTemplateRef<HTMLDivElement>('cardContentWrapRef')
const isShowCarousel = ref(true)
const smooth = ref(false)
const agentApplicationBottomIsLoading = ref(false)
const agentApplicationClassifyIsLoading = ref(false)
const agentApplicationClassifyIsLoading = ref(true)
const emptyTableText = ref(t('personal_space_module.agent_module.agent_list_module.empty_agent_list'))
const emptyTableImage = ref(applicationEmptyImage)
......@@ -45,7 +45,6 @@ const { arrivedState } = useScroll(cardContentWrapRef, { behavior })
;(function () {
handleGetMallCategoryList()
agentApplicationClassifyIsLoading.value = true
handleGetAgentApplicationList()
})()
......@@ -75,12 +74,16 @@ watch(
},
)
function handleGetAgentApplicationList(update = false, search = false) {
function handleGetAgentApplicationList(update = false, search = false, clear = false) {
const agentTypeId = ref<number | null>(0)
if (clear && searchQuery.value.trim() === '') return
if (agentApplicationBottomIsLoading.value && agentApplicationClassifyIsLoading.value) return
if (search && searchQuery.value.length !== 0) {
isShowCarousel.value = false
agentApplicationClassifyIsLoading.value = true
} else {
isShowCarousel.value = true
}
......@@ -144,10 +147,7 @@ function handleAddAgentApplications() {
function handleEnterKeypress(event: KeyboardEvent) {
if (event.code === 'Enter' && !event.shiftKey) {
event.preventDefault()
if (searchQuery.value.trim() === '') return
agentApplicationClassifyIsLoading.value = true
handleGetAgentApplicationList(true, true)
handleGetAgentApplicationList(true, true, true)
}
}
......@@ -155,11 +155,10 @@ function handleSearchGetApplicationList(clear = false) {
if (clear) {
agentApplicationClassifyIsLoading.value = true
searchQuery.value = ''
handleGetAgentApplicationList(true, true)
} else {
if (searchQuery.value.trim() === '') return
agentApplicationClassifyIsLoading.value = true
handleGetAgentApplicationList(true, true, true)
}
handleGetAgentApplicationList(true, true)
}
</script>
......
......@@ -56,7 +56,7 @@ const pagingInfo = ref<PaginationInfo>({
const agentAppList = ref<PersonalAppConfigState[]>([])
const agentSearchInputValue = ref('')
const agentAppListLoading = ref(false)
const agentAppListLoading = ref(true)
const agentAppListBottomLoadingMore = ref(false)
const emptyTableText = ref(t('personal_space_module.agent_module.agent_list_module.application_empty'))
......@@ -78,11 +78,15 @@ watch(
},
)
;(function () {
agentAppListLoading.value = true
getApplicationList()
})()
function getApplicationList(isLoadMore = false) {
function getApplicationList(isLoadMore = false, clear = false) {
if (clear && agentSearchInputValue.value.trim() === '') {
return
} else {
if (!agentAppListBottomLoadingMore.value) agentAppListLoading.value = true
}
if (!isLoadMore) {
pagingInfo.value.pageNo = 1
pagingInfo.value.totalPages = 0
......@@ -122,16 +126,6 @@ function handleBasePublishingStatusGetAgentList() {
getApplicationList()
}
function handleEnterKeypress(event: KeyboardEvent) {
if (event.code === 'Enter' && !event.shiftKey) {
event.preventDefault()
if (agentSearchInputValue.value.trim() === '') return
agentAppListLoading.value = true
getApplicationList()
}
}
function handleDeletePersonalApp(agentId: string) {
window.$message
.ctWarning(t('personal_space_module.agent_module.agent_list_module.delete_agent_dialog_title'))
......@@ -190,11 +184,17 @@ function handleSearchGetApplicationList(clear = false) {
if (clear) {
agentAppListLoading.value = true
agentSearchInputValue.value = ''
getApplicationList()
} else {
if (agentSearchInputValue.value.trim() === '') return
agentAppListLoading.value = true
getApplicationList(false, true)
}
}
function handleEnterKeypress(event: KeyboardEvent) {
if (event.code === 'Enter' && !event.shiftKey) {
event.preventDefault()
getApplicationList(false, true)
}
getApplicationList()
}
const handleCardContentScrollDebounce = debounce(
......
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