From 7207fa88da9a17b1b6d7cdc0ce42e7a16fcb027c Mon Sep 17 00:00:00 2001 From: Areo-Joe <1047726015@qq.com> Date: Tue, 24 Sep 2024 15:27:11 +0800 Subject: [PATCH] fix(tcb-shop): fix handling cloud image; fix homepage price --- miniprogram/tcb-shop/pages/home/home.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/miniprogram/tcb-shop/pages/home/home.js b/miniprogram/tcb-shop/pages/home/home.js index f5412dd..d67e201 100644 --- a/miniprogram/tcb-shop/pages/home/home.js +++ b/miniprogram/tcb-shop/pages/home/home.js @@ -59,13 +59,9 @@ Page({ async loadHomeSwiper() { const { images } = await getHomeSwiper(); - const imgSrcs = ( - await wx.cloud.getTempFileURL({ - fileList: images, - }) - ).fileList.map((x) => x.tempFileURL); + const handledImages = await getCloudImageTempUrl(images); - this.setData({ imgSrcs }); + this.setData({ imgSrcs: handledImages }); }, onReTry() { @@ -89,7 +85,7 @@ Page({ const images = nextList.map((x) => x.cover_image); const handledImages = await getCloudImageTempUrl(images); handledImages.forEach((image, index) => (nextList[index].cover_image = image)); - await Promise.all(nextList.map(async (spu) => (spu.price = await getPrice(spu._id)))); + await Promise.all(nextList.map(async (spu) => (spu.price = await getPrice(spu._id).catch(() => 0.01)))); const goodsList = fresh ? nextList : this.data.goodsList.concat(nextList);