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

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

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