diff --git a/frontend/src/features/listings/composables/__tests__/useFilterOptions.spec.ts b/frontend/src/features/listings/composables/__tests__/useFilterOptions.spec.ts index 35807e7..0fd9c9e 100644 --- a/frontend/src/features/listings/composables/__tests__/useFilterOptions.spec.ts +++ b/frontend/src/features/listings/composables/__tests__/useFilterOptions.spec.ts @@ -1,5 +1,11 @@ import { describe, it, expect } from 'vitest' -import { rangeLabel, isRangeSelected } from '@/features/listings/composables/useFilterOptions' +import { + awmRangeOptions, + isRangeSelected, + moneyRangeOptions, + rangeLabel, + ratioRangeOptions, +} from '@/features/listings/composables/useFilterOptions' describe('useFilterOptions', () => { describe('rangeLabel', () => { @@ -27,4 +33,10 @@ describe('useFilterOptions', () => { expect(isRangeSelected(undefined, undefined, undefined, undefined)).toBe(true) }) }) + + it('应该隐藏数量过小的首页筛选档位', () => { + expect(awmRangeOptions.some(option => option.label === '0-20')).toBe(false) + expect(moneyRangeOptions.some(option => option.label === '0-50')).toBe(false) + expect(ratioRangeOptions.some(option => option.label === '≤30')).toBe(false) + }) }) diff --git a/frontend/src/features/listings/composables/useFilterOptions.ts b/frontend/src/features/listings/composables/useFilterOptions.ts index b9e0478..f9c3ef9 100644 --- a/frontend/src/features/listings/composables/useFilterOptions.ts +++ b/frontend/src/features/listings/composables/useFilterOptions.ts @@ -9,10 +9,9 @@ export const coinRangeOptions = [ { label: '300以上', min: 300, max: undefined }, ] -/** AWM 子弹数量区间(与移动端档位保持一致) */ +/** AWM 子弹数量区间:移除数量过小的 0-20 档位 */ export const awmRangeOptions = [ { label: '全部', min: undefined, max: undefined }, - { label: '0-20', min: 0, max: 20 }, { label: '20-50', min: 20, max: 50 }, { label: '50-100', min: 50, max: 100 }, { label: '100-200', min: 100, max: 200 }, @@ -21,7 +20,6 @@ export const awmRangeOptions = [ export const ratioRangeOptions = [ { label: '全部', min: undefined, max: undefined }, - { label: '≤30', min: undefined, max: 30 }, { label: '30-35', min: 30, max: 35 }, { label: '35-40', min: 35, max: 40 }, { label: '40-45', min: 40, max: 45 }, @@ -30,7 +28,6 @@ export const ratioRangeOptions = [ export const moneyRangeOptions = [ { label: '全部', min: undefined, max: undefined }, - { label: '0-50', min: 0, max: 50 }, { label: '50-100', min: 50, max: 100 }, { label: '100-150', min: 100, max: 150 }, { label: '150-200', min: 150, max: 200 }, diff --git a/frontend/src/features/listings/views/MobileHomeView.vue b/frontend/src/features/listings/views/MobileHomeView.vue index d646fd6..9c1bbb9 100644 --- a/frontend/src/features/listings/views/MobileHomeView.vue +++ b/frontend/src/features/listings/views/MobileHomeView.vue @@ -111,7 +111,6 @@ const zoneOptions = [ const rangePresets: Record> = { price: [ - { label: '0-50', min: '0', max: '50' }, { label: '50-100', min: '50', max: '100' }, { label: '100-200', min: '100', max: '200' }, { label: '200以上', min: '200', max: '' }, @@ -123,8 +122,6 @@ const rangePresets: Record