From 5e5e5a764126bc7d19a5cee7f627d787f84ab220 Mon Sep 17 00:00:00 2001 From: Trae AI Date: Sat, 17 Jan 2026 17:14:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A6=96=E9=A1=B5=E4=B8=8A?= =?UTF-8?q?=E6=BB=91=E5=B9=BF=E5=91=8A=E9=9A=90=E8=97=8F=E6=97=B6=E5=87=BA?= =?UTF-8?q?=E7=8E=B0=E5=A4=A7=E9=87=8F=E7=A9=BA=E7=99=BD=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/index.js | 27 +-------------------------- pages/index/index.wxml | 5 +++-- pages/index/index.wxss | 22 +++++++++++++++++++--- project.private.config.json | 2 +- 4 files changed, 24 insertions(+), 32 deletions(-) diff --git a/pages/index/index.js b/pages/index/index.js index 8b62274..16dc41a 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -2377,32 +2377,7 @@ Page({ } } - // 动态调整top-section-container的高度和商品列表的位置,确保布局正确 - const query = wx.createSelectorQuery().in(this); - query.select('.top-section-container').node(); - query.select('.goods-list').node(); - query.select('.goods-section').node(); - query.exec((res) => { - if (res && res[0] && res[0].node && res[1] && res[1].node && res[2] && res[2].node) { - const containerNode = res[0].node; - const goodsNode = res[1].node; - const goodsSectionNode = res[2].node; - - if (this.data.headerElementsHidden) { - // 隐藏时调整容器高度和商品列表位置,精确计算高度 - containerNode.style.height = '175rpx'; - containerNode.style.minHeight = '175rpx'; - goodsNode.style.paddingTop = '0'; - goodsSectionNode.style.marginTop = '175rpx'; - } else { - // 显示时恢复容器高度和商品列表位置 - containerNode.style.height = 'auto'; - containerNode.style.minHeight = '580rpx'; - goodsNode.style.paddingTop = '0'; - goodsSectionNode.style.marginTop = '580rpx'; - } - } - }); + // 动态调整已通过CSS过渡和动态类实现,此处不再需要直接操作DOM // 搜索框始终固定显示,不做隐藏处理 diff --git a/pages/index/index.wxml b/pages/index/index.wxml index 1225e3c..8ee28a0 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -1,6 +1,6 @@ - + @@ -251,7 +251,7 @@ - + diff --git a/pages/index/index.wxss b/pages/index/index.wxss index 467c435..dcbcbfb 100644 --- a/pages/index/index.wxss +++ b/pages/index/index.wxss @@ -70,7 +70,19 @@ page { flex-direction: column; align-items: center; overflow: visible; - transition: height 0.3s ease; + transition: all 0.3s ease; +} + +/* 隐藏广告和功能按钮时的容器样式 */ +.top-section-container.hidden-elements { + height: 175rpx; + min-height: 175rpx; +} + +/* 显示广告和功能按钮时的容器样式 */ +.top-section-container.show-elements { + height: auto; + min-height: 580rpx; } /* 广告轮播图样式 */ @@ -160,7 +172,12 @@ page { background: transparent; z-index: 1; margin-top: 580rpx; - transition: margin-top 0.3s ease; + transition: all 0.3s ease; +} + +/* 隐藏广告时商品区域上移 */ +.goods-section.with-hidden-header { + margin-top: 175rpx; } /* 标题样式调整 */ @@ -204,7 +221,6 @@ page { overflow-y: auto; -webkit-overflow-scrolling: touch; background: transparent; - transition: padding-top 0.3s ease; } /* 品种筛选区域调整 - 确保在商品图层之上,搜索框之下 */ diff --git a/project.private.config.json b/project.private.config.json index 8a7e510..7ce16c7 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -1,6 +1,6 @@ { "libVersion": "3.10.3", - "projectname": "ppp", + "projectname": "ly2266", "setting": { "urlCheck": false, "coverView": true,