From b605ff9b0281438dd8225cd2543b55133b55d7a6 Mon Sep 17 00:00:00 2001 From: "Apple\\Apple" Date: Tue, 10 Jun 2025 00:40:47 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=B1=20feat(TopUp):=20enhance=20mobile?= =?UTF-8?q?=20UX=20with=20responsive=20layout=20and=20bottom=20fixed=20pay?= =?UTF-8?q?ment=20panel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Convert copy button to Input suffix for cleaner UI design - Add responsive grid layout for balance cards and preset amounts - Mobile (< md): single column layout for better readability - Desktop (>= md): multi-column layout for space efficiency - Implement bottom fixed payment panel on mobile devices - Fixed positioning for easy access to payment options - Includes custom amount input and payment method buttons - Auto-hide on desktop to maintain original layout - Improve mobile payment flow with sticky bottom controls - Add proper spacing to prevent content overlap with fixed elements - Maintain consistent functionality across all breakpoints This update significantly improves the mobile user experience by making payment controls easily accessible without scrolling, while preserving the desktop layout and functionality. --- web/src/components/layout/PageLayout.js | 3 +- web/src/helpers/render.js | 3 +- web/src/i18n/locales/en.json | 2 + web/src/pages/TopUp/index.js | 232 +++++++++++++++--------- 4 files changed, 153 insertions(+), 87 deletions(-) diff --git a/web/src/components/layout/PageLayout.js b/web/src/components/layout/PageLayout.js index 6825595d..8576a4ea 100644 --- a/web/src/components/layout/PageLayout.js +++ b/web/src/components/layout/PageLayout.js @@ -136,9 +136,8 @@ const PageLayout = () => { flex: '1 0 auto', overflowY: styleState.isMobile ? 'visible' : 'auto', WebkitOverflowScrolling: 'touch', - padding: shouldInnerPadding ? '24px' : '0', + padding: shouldInnerPadding ? (styleState.isMobile ? '5px' : '24px') : '0', position: 'relative', - marginTop: styleState.isMobile ? '2px' : '0', }} > diff --git a/web/src/helpers/render.js b/web/src/helpers/render.js index e3ef0878..3d1bca0d 100644 --- a/web/src/helpers/render.js +++ b/web/src/helpers/render.js @@ -46,8 +46,7 @@ import { Gift, User, Settings, - CircleUser, - Users + CircleUser } from 'lucide-react'; // 侧边栏图标颜色映射 diff --git a/web/src/i18n/locales/en.json b/web/src/i18n/locales/en.json index 06cfc8f8..7ee93831 100644 --- a/web/src/i18n/locales/en.json +++ b/web/src/i18n/locales/en.json @@ -971,6 +971,8 @@ "最低": "lowest", "划转额度": "Transfer amount", "邀请链接": "Invitation link", + "划转邀请额度": "Transfer invitation quota", + "可用邀请额度": "Available invitation quota", "更多优惠": "More offers", "企业微信": "Enterprise WeChat", "点击解绑WxPusher": "Click to unbind WxPusher", diff --git a/web/src/pages/TopUp/index.js b/web/src/pages/TopUp/index.js index 893858f7..cb32bca2 100644 --- a/web/src/pages/TopUp/index.js +++ b/web/src/pages/TopUp/index.js @@ -347,7 +347,7 @@ const TopUp = () => { }; return ( -
+
{/* 划转模态框 */} { >
{/* 账户余额信息 */} -
+
{t('当前余额')} @@ -517,7 +517,7 @@ const TopUp = () => { {/* 预设充值额度卡片网格 */}
{t('选择充值额度')} -
+
{presetAmounts.map((preset, index) => ( { ))}
+ {/* 桌面端显示的自定义金额和支付按钮 */} +
+ + {t('或输入自定义金额')} + - - {t('或输入自定义金额')} - - -
-
- {t('充值数量')} - {amountLoading ? ( - - ) : ( - {t('实付金额:') + renderAmount()} - )} +
+
+ {t('充值数量')} + {amountLoading ? ( + + ) : ( + {t('实付金额:') + renderAmount()} + )} +
+ { + if (value && value >= 1) { + setTopUpCount(value); + setSelectedPreset(null); + await getAmount(value); + } + }} + onBlur={(e) => { + const value = parseInt(e.target.value); + if (!value || value < 1) { + setTopUpCount(1); + getAmount(1); + } + }} + size="large" + className="w-full" + formatter={(value) => value ? `${value}` : ''} + parser={(value) => value ? parseInt(value.replace(/[^\d]/g, '')) : 0} + />
- { - if (value && value >= 1) { - setTopUpCount(value); - setSelectedPreset(null); - await getAmount(value); - } - }} - onBlur={(e) => { - const value = parseInt(e.target.value); - if (!value || value < 1) { - setTopUpCount(1); - getAmount(1); - } - }} - size="large" - className="w-full" - formatter={(value) => value ? `${value}` : ''} - parser={(value) => value ? parseInt(value.replace(/[^\d]/g, '')) : 0} - /> -
-
- - +
+ + +
)} @@ -612,7 +614,7 @@ const TopUp = () => { {!enableOnlineTopUp && ( @@ -735,22 +737,21 @@ const TopUp = () => {
{t('邀请链接')} -
- - -
+ } + > + {t('复制')} + + } + />
@@ -781,6 +782,71 @@ const TopUp = () => {
+ + {/* 移动端底部固定的自定义金额和支付区域 */} + {enableOnlineTopUp && ( +
+
+
+
+ {t('充值数量')} + {amountLoading ? ( + + ) : ( + {t('实付金额:') + renderAmount()} + )} +
+ { + if (value && value >= 1) { + setTopUpCount(value); + setSelectedPreset(null); + await getAmount(value); + } + }} + onBlur={(e) => { + const value = parseInt(e.target.value); + if (!value || value < 1) { + setTopUpCount(1); + getAmount(1); + } + }} + className="w-full" + formatter={(value) => value ? `${value}` : ''} + parser={(value) => value ? parseInt(value.replace(/[^\d]/g, '')) : 0} + /> +
+ +
+ + +
+
+
+ )}
); };