diff --git a/miniapp/pages/discover/discover.ts b/miniapp/pages/discover/discover.ts index 0e12955..1400b98 100644 --- a/miniapp/pages/discover/discover.ts +++ b/miniapp/pages/discover/discover.ts @@ -44,6 +44,9 @@ interface DiscoverData { educations: Array<{ code: string; label: string }>; maritalStatuses: Array<{ code: string; label: string }>; actionLoadingUserId: string; + // 抽屉滚动/高亮定位 + panelScrollTo: string; + panelHighlight: string; } const DEFAULT_MIN_AGE = 18; @@ -89,6 +92,8 @@ Page({ { code: 'divorced', label: '离异' }, ], actionLoadingUserId: '', + panelScrollTo: '', + panelHighlight: '', } as DiscoverData, onLoad() { @@ -186,9 +191,10 @@ Page({ this.fetchDiscover(true); }, - /** 打开筛选面板,并同步当前 applied 状态到 temp */ - openFilterPanel() { - console.log('[discover] openFilterPanel called'); + /** 打开筛选面板,并同步当前 applied 状态到 temp,可选定位到 target section */ + openFilterPanel(e?: WechatMiniprogram.TouchEvent) { + const target = e ? (e.currentTarget.dataset as any).target as string | undefined : undefined; + const sectionMap: Record = { age: 'sec-age', education: 'sec-education', marital: 'sec-marital', region: 'sec-region' }; const a = this.data.applied; this.setData({ showFilter: true, @@ -197,8 +203,8 @@ Page({ tempMaxAge: a.maxAge, tempEducationCode: a.educationCode, tempMaritalStatus: a.maritalStatus, - }, () => { - console.log('[discover] showFilter set to true, current state:', JSON.stringify(this.data.applied)); + panelScrollTo: target ? (sectionMap[target] || '') : '', + panelHighlight: target || '', }); }, diff --git a/miniapp/pages/discover/discover.wxml b/miniapp/pages/discover/discover.wxml index eec427a..9a5bc88 100644 --- a/miniapp/pages/discover/discover.wxml +++ b/miniapp/pages/discover/discover.wxml @@ -19,9 +19,9 @@ 推荐 丹阳本地 - 年龄 - 学历 - 婚姻 + 年龄 + 学历 + 婚姻 @@ -30,47 +30,49 @@ - - - - 年龄范围 - {{tempMinAge}}–{{tempMaxAge}} 岁 + + + + + 年龄范围 + {{tempMinAge}}–{{tempMaxAge}} 岁 + + + - - - - - - 地区 - - {{item.label}} + + + 地区 + + {{item.label}} + - - - - 学历 - - {{item.label}} + + + 学历 + + {{item.label}} + - - - - 婚姻状态 - - {{item.label}} + + + 婚姻状态 + + {{item.label}} + - + 重置 diff --git a/miniapp/pages/discover/discover.wxss b/miniapp/pages/discover/discover.wxss index 4dd95e7..00130ef 100644 --- a/miniapp/pages/discover/discover.wxss +++ b/miniapp/pages/discover/discover.wxss @@ -16,8 +16,10 @@ /* 遮罩层 + 底部抽屉样式 */ .filter-mask{position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,.35);z-index:10} -.filter-panel-wrap{position:fixed;left:0;right:0;bottom:0;z-index:11;background:#fff;border-radius:28rpx 28rpx 0 0;max-height:78vh;padding:32rpx 28rpx calc(28rpx + env(safe-area-inset-bottom));box-shadow:0 -10rpx 40rpx rgba(31,32,89,.15);overflow-y:auto} -.filter-section{margin-bottom:28rpx} +.filter-panel-wrap{position:fixed;left:0;right:0;bottom:0;z-index:11;background:#fff;border-radius:28rpx 28rpx 0 0;max-height:78vh;box-shadow:0 -10rpx 40rpx rgba(31,32,89,.15);display:flex;flex-direction:column;padding:24rpx 28rpx 28rpx} +.filter-scroll-wrap{flex:1;max-height:calc(78vh - 140rpx);padding:8rpx 0 0} +.filter-section{margin-bottom:28rpx;padding:16rpx 20rpx;border-radius:16rpx;transition:background .2s,box-shadow .2s} +.filter-section.hl{background:#FFF5F8;box-shadow:inset 0 0 0 2rpx var(--mini-accent-pink)} .filter-heading{display:flex;justify-content:space-between} .filter-label{display:block;font-size:24rpx;font-weight:650;color:#282D4E} .filter-value{font-size:21rpx;color:#777E99}