移除首页筛选中的三个低档位

This commit is contained in:
yml2213
2026-08-18 20:45:09 +08:00
parent c4507caf37
commit f1b48f7921
3 changed files with 14 additions and 9 deletions
@@ -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)
})
})
@@ -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 },
@@ -111,7 +111,6 @@ const zoneOptions = [
const rangePresets: Record<string, Array<{ label: string; min: string; max: string }>> = {
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<string, Array<{ label: string; min: string; max: stri
{ label: '500以上', min: '500', max: '' },
],
ratio: [
{ label: '0-20', min: '0', max: '20' },
{ label: '20-30', min: '20', max: '30' },
{ label: '30-40', min: '30', max: '40' },
{ label: '40以上', min: '40', max: '' },
],
@@ -147,7 +144,6 @@ const rangePresets: Record<string, Array<{ label: string; min: string; max: stri
{ label: '70以上', min: '70', max: '' },
],
resource_awmAmmo: [
{ 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' },