From 7eca128bb58ce4e171d6f7cc646b90578e41124d Mon Sep 17 00:00:00 2001 From: XingQue Date: Mon, 27 Jul 2026 05:11:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=8A=A2=E5=8D=95?= =?UTF-8?q?=E6=B1=A0=E5=BC=B9=E7=AA=97=E5=9B=BE=E7=89=87=E4=B8=8D=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=EF=BC=88scroll-view=20=E9=AB=98=E5=BA=A6=E5=A1=8C?= =?UTF-8?q?=E9=99=B7=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- components/popup-notice/popup-notice.js | 26 +++++++++++------------ components/popup-notice/popup-notice.wxss | 9 ++++---- pages/accept-order/accept-order.js | 12 +++++++---- 3 files changed, 24 insertions(+), 23 deletions(-) diff --git a/components/popup-notice/popup-notice.js b/components/popup-notice/popup-notice.js index 3b0d2bf..0c1cfc3 100644 --- a/components/popup-notice/popup-notice.js +++ b/components/popup-notice/popup-notice.js @@ -71,28 +71,26 @@ Component({ } if (hasImages) { - const processed = []; const screenWidth = wx.getSystemInfoSync().windowWidth; - const containerWidth = screenWidth * 0.86; - const imageWidth = Math.max(containerWidth - 60, 200); - for (let i = 0; i < safeImages.length; i++) { - const img = safeImages[i]; - const fullUrl = this.getFullImageUrl(img.url); - let imageHeight = 200; + const containerWidth = Math.min(screenWidth * 0.86, 310); + const imageWidth = Math.max(containerWidth - 30, 200); + // 先立刻用默认高度展示,避免 getImageInfo 慢/失败时空白 + const processed = safeImages.map((img) => ({ + url: this.getFullImageUrl(img.url), + text: img.text, + height: 280, + })); + this.setData({ processedImages: processed }); + for (let i = 0; i < processed.length; i++) { + const fullUrl = processed[i].url; try { const res = await this.getImageInfoPromise(fullUrl); const realHeight = (imageWidth * res.height) / res.width; - imageHeight = realHeight; + this.setData({ [`processedImages[${i}].height`]: realHeight }); } catch (e) { console.error('获取图片信息失败', fullUrl, e); } - processed.push({ - url: fullUrl, - text: img.text, - height: imageHeight, - }); } - this.setData({ processedImages: processed }); } }, diff --git a/components/popup-notice/popup-notice.wxss b/components/popup-notice/popup-notice.wxss index c6067d2..c4afc70 100644 --- a/components/popup-notice/popup-notice.wxss +++ b/components/popup-notice/popup-notice.wxss @@ -17,7 +17,8 @@ .popup-container { width: 86%; max-width: 620rpx; - height: auto; + /* 必须给明确高度:scroll-view 依赖父级高度,height:auto 会导致图片区塌成 0 */ + height: 68vh; max-height: 68vh; background: white; border-radius: 28rpx; @@ -80,16 +81,14 @@ } .scroll-wrapper { - flex: 1 1 auto; - min-height: 120rpx; - max-height: 48vh; + flex: 1; + min-height: 0; overflow: hidden; width: 100%; } .scroll-view { height: 100%; - max-height: 48vh; width: 100%; padding: 0; } diff --git a/pages/accept-order/accept-order.js b/pages/accept-order/accept-order.js index 7a54565..77b20dc 100644 --- a/pages/accept-order/accept-order.js +++ b/pages/accept-order/accept-order.js @@ -120,6 +120,7 @@ Page({ this.persistPageCache(); this._skipShowRefresh = true; await this.loadMyZhidingOrders(true); + this.tryShowAcceptOrderPopup(); return; } @@ -131,13 +132,16 @@ Page({ this.persistPageCache(banner); app.globalData._acceptOrderSessionReady = true; - if (!app.globalData._acceptOrderPopupDone) { - PopupService.checkAndShow(this, 'jiedan'); - app.globalData._acceptOrderPopupDone = true; - } + this.tryShowAcceptOrderPopup(); this._skipShowRefresh = true; }, + tryShowAcceptOrderPopup() { + if (app.globalData._acceptOrderPopupDone) return; + app.globalData._acceptOrderPopupDone = true; + PopupService.checkAndShow(this, 'jiedan'); + }, + persistPageCache(extra = {}) { const d = this.data; app.globalData._acceptOrderPageCache = {