merge: 同步 origin/ui-optimization(d224d5b6),保留 weiyuan 功能与 Semi 迁移
- 冲突以 weiyuan 功能(小程序登录、i18n 文案)为准,并保留远端 lint 重构与依赖收敛 - 删除 weiyuan 已移除、远端仅做 lint 修正的 3 个图片相关文件 - 适配远端零警告 ESLint:Monitoring/Subscription 改用 useEffectEvent,EditChannelModal 注明 t 依赖 - effect-events 单测补充 react-i18next mock - 对合并后仍不符合 Prettier 的文件做纯格式化
This commit is contained in:
@@ -28,12 +28,7 @@ import {
|
||||
Spin,
|
||||
Tooltip,
|
||||
} from '@/components/ui';
|
||||
import {
|
||||
CreditCard,
|
||||
Coins,
|
||||
Wallet,
|
||||
Receipt,
|
||||
} from 'lucide-react';
|
||||
import { CreditCard, Coins, Wallet, Receipt } from 'lucide-react';
|
||||
import {
|
||||
AlipayBrandIcon,
|
||||
WechatBrandIcon,
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { useEffectEvent } from '../../hooks/common/useEffectEvent';
|
||||
import React, { useEffect, useState, useContext, useRef } from 'react';
|
||||
import {
|
||||
API,
|
||||
@@ -471,12 +472,13 @@ const TopUp = () => {
|
||||
else showError(t('复制失败,请手动复制'));
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const onMount = useEffectEvent(() => {
|
||||
if (!userState?.user?.id) {
|
||||
getUserQuota().then();
|
||||
}
|
||||
setTransferAmount(getQuotaPerUnit());
|
||||
}, []);
|
||||
});
|
||||
useEffect(() => onMount(), [onMount]);
|
||||
|
||||
useEffect(() => {
|
||||
if (affFetchedRef.current) return;
|
||||
@@ -485,9 +487,10 @@ const TopUp = () => {
|
||||
}, []);
|
||||
|
||||
// 在 statusState 可用时获取充值信息
|
||||
useEffect(() => {
|
||||
const onMount2 = useEffectEvent(() => {
|
||||
getTopupInfo().then();
|
||||
}, []);
|
||||
});
|
||||
useEffect(() => onMount2(), [onMount2]);
|
||||
|
||||
useEffect(() => {
|
||||
if (statusState?.status) {
|
||||
|
||||
@@ -16,6 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import { useEffectEvent } from '../../../hooks/common/useEffectEvent';
|
||||
import React, { useState, useEffect, useMemo } from 'react';
|
||||
import {
|
||||
Modal,
|
||||
@@ -112,11 +113,15 @@ const TopupHistoryModal = ({ visible, onCancel, t }) => {
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const onVisibilityChange = useEffectEvent(() => {
|
||||
if (visible) {
|
||||
loadTopups(page, pageSize);
|
||||
}
|
||||
}, [visible, page, pageSize, keyword]);
|
||||
});
|
||||
useEffect(
|
||||
() => onVisibilityChange(),
|
||||
[onVisibilityChange, visible, page, pageSize, keyword],
|
||||
);
|
||||
|
||||
const handlePageChange = (currentPage) => {
|
||||
setPage(currentPage);
|
||||
@@ -187,7 +192,7 @@ const TopupHistoryModal = ({ visible, onCancel, t }) => {
|
||||
// 检查是否为管理员
|
||||
const userIsAdmin = useMemo(() => isAdmin(), []);
|
||||
|
||||
const columns = useMemo(() => {
|
||||
const columns = (() => {
|
||||
const baseColumns = [
|
||||
{
|
||||
title: t('订单号'),
|
||||
@@ -273,7 +278,7 @@ const TopupHistoryModal = ({ visible, onCancel, t }) => {
|
||||
});
|
||||
|
||||
return baseColumns;
|
||||
}, [t, userIsAdmin]);
|
||||
})();
|
||||
|
||||
return (
|
||||
<Modal
|
||||
|
||||
@@ -17,15 +17,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { useEffectEvent } from '../../../hooks/common/useEffectEvent';
|
||||
import React, { useState, useEffect, useRef } from 'react';
|
||||
import {
|
||||
Modal,
|
||||
Button,
|
||||
Spin,
|
||||
Typography,
|
||||
Space,
|
||||
Toast,
|
||||
} from '@/components/ui';
|
||||
import { Modal, Button, Spin, Typography, Space, Toast } from '@/components/ui';
|
||||
import { IconRefresh, IconClose } from '@/components/ui/icons';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import QRCode from 'qrcode';
|
||||
@@ -46,7 +40,7 @@ const WechatQRModal = ({ visible, onClose, orderData, pollFn }) => {
|
||||
const errorCountRef = useRef(0); // 错误计数
|
||||
|
||||
// 生成二维码
|
||||
useEffect(() => {
|
||||
const onVisibilityChange = useEffectEvent(() => {
|
||||
if (visible && orderData && orderData.code_url) {
|
||||
// 【Bug#5修复】重置过期状态,避免上一个过期订单影响新订单的展示
|
||||
setExpired(false);
|
||||
@@ -60,7 +54,11 @@ const WechatQRModal = ({ visible, onClose, orderData, pollFn }) => {
|
||||
stopPolling();
|
||||
stopExpireTimer();
|
||||
};
|
||||
}, [visible, orderData]);
|
||||
});
|
||||
useEffect(
|
||||
() => onVisibilityChange(),
|
||||
[onVisibilityChange, visible, orderData],
|
||||
);
|
||||
|
||||
const generateQRCode = async (url) => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user