From 89eab211e49652198e1a54f288aeb378728e3a87 Mon Sep 17 00:00:00 2001 From: streakingman Date: Tue, 4 Oct 2022 16:48:23 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BA=A4=E4=BA=92=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ConfigDialog.tsx | 10 +++++- src/components/ThemeChanger.module.scss | 44 ++++++++++++++++++------- src/components/ThemeChanger.tsx | 7 ++-- 3 files changed, 46 insertions(+), 15 deletions(-) diff --git a/src/components/ConfigDialog.tsx b/src/components/ConfigDialog.tsx index 15cdf00..f22ee1b 100644 --- a/src/components/ConfigDialog.tsx +++ b/src/components/ConfigDialog.tsx @@ -256,8 +256,11 @@ export const ConfigDialog: FC<{ }); }; + const [uploading, setUploading] = useState(false); // 生成二维码和链接 const onGenQrLinkClick = () => { + if (uploading) return; + setUploading(true); setConfigError(''); generateTheme() .then((theme) => { @@ -273,6 +276,7 @@ export const ConfigDialog: FC<{ setConfigError( '五分钟内只能上传一次(用的人有点多十分抱歉😭),先保存预览看看效果把~' ); + setUploading(false); return; } @@ -294,11 +298,15 @@ export const ConfigDialog: FC<{ .catch(({ error }) => { setConfigError(error); setGenLink(''); + }) + .finally(() => { + setUploading(false); }); }) .catch((e) => { setConfigError(e); setGenLink(''); + setUploading(false); }); }; @@ -499,7 +507,7 @@ export const ConfigDialog: FC<{ 保存并预览