fix: 修复抢单池弹窗图片不显示(scroll-view 高度塌陷)

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
XingQueandCursor committed 2026-07-27 05:11:30 +08:00
1 parent 83a5a0aaf0
commit 7eca128bb5
3 files changed
+24 -23

No files matched your search

+12 -14
View File
@@ -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 });
}
},
+4 -5
View File
@@ -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;
}
+8 -4
View File
@@ -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 = {