From fe5577265aac35895c53966d9453220318846e59 Mon Sep 17 00:00:00 2001 From: hzm <934585316@qq.com> Date: Sun, 8 Feb 2026 05:44:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=95=8C=E9=9D=A2=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E5=A4=B1=E8=B4=A5=E9=94=99=E8=AF=AF=E6=8F=90?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/page.jsx | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/app/page.jsx b/app/page.jsx index 5cfe077..185ba19 100644 --- a/app/page.jsx +++ b/app/page.jsx @@ -2174,6 +2174,18 @@ export default function HomePage() { // 成功提示弹窗 const [successModal, setSuccessModal] = useState({ open: false, message: '' }); + // 轻提示 (Toast) + const [toast, setToast] = useState({ show: false, message: '', type: 'info' }); // type: 'info' | 'success' | 'error' + const toastTimeoutRef = useRef(null); + + const showToast = (message, type = 'info') => { + if (toastTimeoutRef.current) clearTimeout(toastTimeoutRef.current); + setToast({ show: true, message, type }); + toastTimeoutRef.current = setTimeout(() => { + setToast((prev) => ({ ...prev, show: false })); + }, 3000); + }; + const [updateModalOpen, setUpdateModalOpen] = useState(false); const [cloudConfigModal, setCloudConfigModal] = useState({ open: false, userId: null }); const syncDebounceRef = useRef(null); @@ -3363,12 +3375,14 @@ export default function HomePage() { if (updateError) throw updateError; localStorage.setItem('localUpdatedAt', now); + showToast(`同步云端配置异常`, 'error'); if (showTip) { setSuccessModal({ open: true, message: '已同步云端配置' }); } } catch (e) { console.error('同步云端配置异常', e); + showToast(`同步云端配置异常:${e}`, 'error'); } }; @@ -5007,6 +5021,51 @@ export default function HomePage() { )} + + {/* 全局轻提示 Toast */} + + {toast.show && ( + + {toast.type === 'error' && ( + + + + + )} + {toast.type === 'success' && ( + + + + )} + {toast.message} + + )} + ); }