🔖 chore: Payment loading using user's logo (#252)

当用户设置系统logo的情况下拉起支付弹窗显示用户自己设置的logo而不是显示默认的logo-loading图
This commit is contained in:
ZeroDeng 2024-06-06 20:43:46 +08:00 committed by GitHub
parent 40a6a5d8d8
commit 507ba44910
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -16,11 +16,17 @@ const PayDialog = ({ open, onClose, amount, uuid }) => {
const [qrCodeUrl, setQrCodeUrl] = useState(null); const [qrCodeUrl, setQrCodeUrl] = useState(null);
const [success, setSuccess] = useState(false); const [success, setSuccess] = useState(false);
const [intervalId, setIntervalId] = useState(null); const [intervalId, setIntervalId] = useState(null);
const siteInfoStorage = localStorage.getItem('siteInfo');
let siteInfo;
if (siteInfoStorage) {
siteInfo = JSON.parse(siteInfoStorage);
}
const useLogo = siteInfo.logo ? siteInfo.logo : defaultLogo;
useEffect(() => { useEffect(() => {
if (!open) { if (!open) {
return; return;
} }
setMessage('正在拉起支付中...'); setMessage('正在拉起支付中...');
setLoading(true); setLoading(true);
@ -99,7 +105,7 @@ const PayDialog = ({ open, onClose, amount, uuid }) => {
<DialogContent> <DialogContent>
<DialogContent> <DialogContent>
<Stack direction="column" justifyContent="center" alignItems="center" spacing={2}> <Stack direction="column" justifyContent="center" alignItems="center" spacing={2}>
{loading && <img src={defaultLogo} alt="loading" height="100" />} {loading && <img src={useLogo} alt="loading" height="100" />}
{qrCodeUrl && ( {qrCodeUrl && (
<QRCode <QRCode
value={qrCodeUrl} value={qrCodeUrl}