From fdf1a3eaa028be1a7f1d0145f8ceab66d2e328b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E9=A3=9E=E6=B4=8B?= <15778543+xufeiyang6017@user.noreply.gitee.com> Date: Fri, 16 Jan 2026 13:04:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E9=AB=98=E7=BA=A7=E7=AD=9B?= =?UTF-8?q?=E9=80=89=E5=B7=A6=E5=8F=B3=E5=B8=83=E5=B1=80=E5=B9=B6=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E6=93=8D=E4=BD=9C=E6=8C=89=E9=92=AE=E8=A2=AB=E9=81=AE?= =?UTF-8?q?=E6=8C=A1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/index.js | 19 ++++++ pages/index/index.wxml | 139 ++++++++++++++--------------------------- pages/index/index.wxss | 88 ++++++++++++++++++++++++++ 3 files changed, 155 insertions(+), 91 deletions(-) diff --git a/pages/index/index.js b/pages/index/index.js index 40600b6..c2e002a 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -139,6 +139,17 @@ Page({ showSpecificationPicker: false, showProductNamePicker: false, showAdvancedRegionPicker: false, + + // 筛选分类数据(左侧) + filterCategories: [ + { label: '地区', value: 'region' }, + { label: '蛋壳颜色', value: 'shellColor' }, + { label: '商品名称', value: 'productName' }, + { label: '规格', value: 'specification' }, + { label: '蛋黄类型', value: 'yolkType' } + ], + // 当前选中的筛选分类 + selectedFilterCategory: 'region', // 蛋壳颜色选项 shellColorOptions: [ { label: '全部颜色', value: 'all' }, @@ -1995,6 +2006,14 @@ Page({ showAdvancedFilter: false }); }, + + // 选择筛选分类(左侧) + selectFilterCategory: function (e) { + const category = e.currentTarget.dataset.category; + this.setData({ + selectedFilterCategory: category + }); + }, // 应用高级筛选 applyAdvancedFilter: function () { diff --git a/pages/index/index.wxml b/pages/index/index.wxml index d405b56..fc3cdab 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -111,137 +111,96 @@ 高级筛选 - - - 地区 - + + + + - {{advancedFilters.region === 'all' ? '全国' : advancedFilters.region}} - + {{item.label}} - + + + + + + + + 全部 + {{item.label}} - - - - - - 蛋壳颜色 - - - {{advancedFilters.shellColor === 'all' ? '全部颜色' : advancedFilters.shellColor}} - - - + + + + + 全部颜色 + {{item.label}} - - - - - - 商品名称 - - - {{advancedFilters.productName === 'all' ? '全部商品' : advancedFilters.productName}} - - - + + + + + 全部商品 + {{item.label}} - - - - - - 规格 - - - {{advancedFilters.specification === 'all' ? '全部规格' : advancedFilters.specification}} - - - + + + + + 全部规格 + {{item.label}} - - - - - - 蛋黄类型 - - - {{advancedFilters.yolkType === 'all' ? '全部蛋黄' : advancedFilters.yolkType}} - - - + + + + + 全部蛋黄 + @@ -251,8 +210,6 @@ - - 重置 diff --git a/pages/index/index.wxss b/pages/index/index.wxss index 2d4c66f..93ace63 100644 --- a/pages/index/index.wxss +++ b/pages/index/index.wxss @@ -565,6 +565,89 @@ wx-button:not([size=mini]) { box-shadow: 0 -4rpx 20rpx rgba(0, 0, 0, 0.2); } +/* 筛选内容区域 */ +.filter-content { + display: flex; + flex: 1; + overflow: hidden; +} + +/* 左侧分类列表 */ +.filter-left { + width: 25%; + background-color: #f5f5f5; + overflow-y: auto; +} + +.filter-category-item { + padding: 30rpx 0; + text-align: center; + font-size: 28rpx; + color: #333; + border-bottom: 1rpx solid #e0e0e0; + transition: all 0.3s ease; +} + +.filter-category-item.active { + background-color: white; + color: #1677ff; + font-weight: bold; + border-right: 4rpx solid #1677ff; +} + +.filter-category-item:hover { + background-color: #e8f4ff; +} + +/* 右侧内容区域 */ +.filter-right { + width: 75%; + background-color: white; + overflow-y: auto; +} + +.filter-right-content { + padding: 20rpx; +} + +.filter-option { + display: inline-block; + padding: 16rpx 24rpx; + margin: 12rpx; + border-radius: 20rpx; + border: 2rpx solid #e0e0e0; + font-size: 26rpx; + color: #666; + background-color: white; + transition: all 0.3s ease; + white-space: nowrap; +} + +.filter-option.active { + background-color: #1677ff; + color: white; + border-color: #1677ff; +} + +.filter-option:hover { + border-color: #1677ff; + color: #1677ff; +} + +.filter-option.all-option { + width: calc(100% - 48rpx); + text-align: center; + margin: 12rpx; + background-color: #f0f0f0; + border-color: #d9d9d9; +} + +.filter-option.all-option.active { + background-color: #1677ff; + color: white; + border-color: #1677ff; +} + /* 动画效果 */ @keyframes fadeIn { from { opacity: 0; } @@ -672,6 +755,11 @@ wx-button:not([size=mini]) { padding: 20rpx; gap: 20rpx; border-top: 2rpx solid #eee; + position: sticky; + bottom: 0; + background-color: white; + z-index: 10; + box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.1); } .filter-action-btn {