From e95ace080db2517916b953ec37b252c94a491891 Mon Sep 17 00:00:00 2001 From: yezian Date: Tue, 24 Dec 2024 15:29:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=8A=9F=E8=83=BD=EF=BC=9B?= =?UTF-8?q?=E6=9B=B4=E6=8D=A2icon?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/ImageViewer/index.jsx | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/components/ImageViewer/index.jsx b/components/ImageViewer/index.jsx index 435d86f..e413b9d 100644 --- a/components/ImageViewer/index.jsx +++ b/components/ImageViewer/index.jsx @@ -75,12 +75,14 @@ export function ImageViewer({ }; //查看原图 + const [isLoading, setIsLoading] = useState(false); const handleCheckOriginalImage = async (index) => { const isVip = await checkRole(); if (!isVip) { setIsVipModalVisible(true); return; } + setIsLoading(true); const apiUrl = process.env.EXPO_PUBLIC_API_URL; try { const base = await baseRequest(); @@ -123,6 +125,8 @@ export function ImageViewer({ }); } catch (error) { console.error(error); + } finally { + setIsLoading(false); } }; @@ -211,12 +215,15 @@ export function ImageViewer({ ), }} > - + {isLoading && } + {!isLoading && ( + + )}