fix: 计数方法修改

master
xjs 2025-04-17 13:58:04 +08:00
parent 03e986876f
commit e0c4509356
2 changed files with 13 additions and 17 deletions

View File

@ -34,7 +34,7 @@
:show-close="true"
custom-header-class="text-[36rpx]! text-[#303030]! font-medium!"
>
<FilterMenu ref="filterMenuRef" />
<FilterMenu ref="filterMenuRef" @change="handleChange" />
<template #footer>
<view class="flex items-center px-[32rpx]">
<button
@ -76,11 +76,12 @@ const close = () => {
const filterMenuRef = ref()
const handleChange = (params) => {
badgeValue.value = params.length
}
const handleResult = () => {
let _params = filterMenuRef.value.handleConfirm()
countBadgeValue(_params)
console.log(_params)
let params = {
p: userStore.userInfo.estimatedAchievement.sp,
@ -116,19 +117,6 @@ const handleResult = () => {
}
})
}
const countBadgeValue = (params) => {
badgeValue.value = 0
for (let key in params) {
let value = params[key]
if (value instanceof Object) {
badgeValue.value += value ? Object.keys(value).length : 0
} else if (typeof value === 'string' && value.trim() !== '') {
badgeValue.value += 1
}
}
}
</script>
<style lang="scss" scoped>

View File

@ -86,6 +86,8 @@ const props = defineProps({
},
})
const emits = defineEmits(['change'])
const menus = [
{ id: 1, name: '阶段' },
{ id: 2, name: '院校省份' },
@ -132,6 +134,7 @@ const handleRegionChangeObj = (val: any[]) => {
value: item,
})
})
emits('change', filterParams.value)
}
const handleNatureChangeObj = (val: any[]) => {
@ -144,6 +147,7 @@ const handleNatureChangeObj = (val: any[]) => {
value: item,
})
})
emits('change', filterParams.value)
}
const handleUniTypeChangeObj = (val: any[]) => {
@ -156,6 +160,7 @@ const handleUniTypeChangeObj = (val: any[]) => {
value: item,
})
})
emits('change', filterParams.value)
}
const handleCollegeFeatureChangeObj = (val: any[]) => {
@ -167,6 +172,7 @@ const handleCollegeFeatureChangeObj = (val: any[]) => {
value: item,
})
})
emits('change', filterParams.value)
}
const handlePhaseChange = (val: any) => {
@ -179,6 +185,7 @@ const handlePhaseChange = (val: any) => {
value: { ...val, name: val.batch },
})
}
emits('change', filterParams.value)
}
const handleRemove = (removeItem: { type: string; value: any }, index: number) => {
@ -212,6 +219,7 @@ const handleRemove = (removeItem: { type: string; value: any }, index: number) =
} else {
filterParams.value.splice(index, 1)
}
emits('change', filterParams.value)
}
const handleConfirm = () => {