From 5d22f09e928b5b10fc4830259c89fb0d0011ad2a 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: Tue, 20 Jan 2026 11:17:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=82=B9=E5=87=BBtop?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E5=9B=9E=E5=88=B0=E9=A1=B6=E9=83=A8=E3=80=81?= =?UTF-8?q?=E8=AF=84=E8=AE=BA=E5=86=85=E5=AE=B9=E4=B8=8D=E6=8D=A2=E8=A1=8C?= =?UTF-8?q?=E3=80=81=E8=AF=84=E8=AE=BA=E5=8C=BA=E5=B8=83=E5=B1=80=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/goods-detail/goods-detail.wxss | 14 +++++++++----- pages/index/index.js | 19 +++++++++++++++++++ pages/index/index.wxml | 14 +++++++++++++- utils/api.js | 4 ++-- 4 files changed, 43 insertions(+), 8 deletions(-) diff --git a/pages/goods-detail/goods-detail.wxss b/pages/goods-detail/goods-detail.wxss index 4cda2b2..9217c41 100644 --- a/pages/goods-detail/goods-detail.wxss +++ b/pages/goods-detail/goods-detail.wxss @@ -1052,7 +1052,7 @@ video.slider-media .wx-video-volume-icon { .comments-header { display: flex; justify-content: space-between; - align-items: flex-start; + align-items: center; margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid #f0f0f0; @@ -1170,6 +1170,9 @@ video.slider-media .wx-video-volume-icon { font-size: 14px; line-height: 1.6; color: #595959; + word-break: break-all; + word-wrap: break-word; + white-space: normal; } .comment-footer { @@ -1354,12 +1357,13 @@ video.slider-media .wx-video-volume-icon { background-color: #1890ff; color: #ffffff; border: none; - border-radius: 12rpx; - padding: 24rpx 64rpx; - font-size: 32rpx; + border-radius: 8rpx; + padding: 16rpx 48rpx; + font-size: 28rpx; font-weight: 600; - box-shadow: 0 4rpx 12rpx rgba(24, 144, 255, 0.3); + box-shadow: 0 2rpx 8rpx rgba(24, 144, 255, 0.3); transition: all 0.3s ease; + white-space: nowrap; } .comment-button:active { diff --git a/pages/index/index.js b/pages/index/index.js index 8ba1a1f..c3ed2fb 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -2503,11 +2503,30 @@ Page({ // 回到顶部 scrollToTop: function () { + // 使用数据绑定的方式回到顶部,这是小程序中最可靠的方式 this.setData({ scrollTop: 0, searchSectionVisible: true, showBackToTop: false }); + + // 作为备选方案,确保滚动到顶部 + const scrollView = this.selectComponent('#goodsScrollView'); + if (scrollView) { + // 添加微小延迟确保数据绑定生效后再调用scrollTo + setTimeout(() => { + scrollView.scrollTo({ + scrollTop: 0, + duration: 300 + }); + }, 50); + } + }, + + // 图片加载完成事件 + onImageLoad(e) { + console.log('图片加载完成:', e); + // 可以在这里添加图片加载完成后的处理逻辑,比如统计加载时间、显示动画等 }, // 上拉加载更多 diff --git a/pages/index/index.wxml b/pages/index/index.wxml index ab51958..8e032bc 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -160,6 +160,7 @@ bindscrolltolower="onReachBottom" bindscroll="onScroll" scroll-y="true" + scroll-top="{{scrollTop}}" refresher-enabled="{{true}}" refresher-triggered="{{isRefreshing}}" refresher-default-style="black" @@ -172,7 +173,7 @@ 🏠 - 入驻 + 我要卖蛋 📣 @@ -182,6 +183,10 @@ 🚻 我们 + + 🚻 + 添加桌面 + @@ -291,5 +296,12 @@ + + + top + \ No newline at end of file diff --git a/utils/api.js b/utils/api.js index aad4987..80b722c 100644 --- a/utils/api.js +++ b/utils/api.js @@ -39,9 +39,9 @@ function isRealDevice() { // 尝试通过系统信息判断环境 - 增强版 try { - const systemInfo = wx.getSystemInfoSync(); + const deviceInfo = wx.getDeviceInfo(); // 明确识别开发者工具环境 - if (systemInfo && (systemInfo.platform === 'devtools' || systemInfo.environment === 'devtools')) { + if (deviceInfo && (deviceInfo.platform === 'devtools' || deviceInfo.environment === 'devtools')) { return false; } // 其他平台都认为是真机