解决card组件废弃属性

This commit is contained in:
Lrd
2026-06-25 17:07:32 +08:00
parent 6da4fe78f3
commit 690d1baba0
24 changed files with 370 additions and 198 deletions
+1 -1
View File
@@ -245,7 +245,7 @@ const AuthorizationPage: React.FC = () => {
return ( return (
<div style={{ minHeight: '94vh' }}> <div style={{ minHeight: '94vh' }}>
<Card bordered={false} style={{ borderRadius: 12, border: '1px solid #f0f0f5' }}> <Card variant="outlined" style={{ borderRadius: 12, border: '1px solid #f0f0f5' }}>
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 16 }}> <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 16 }}>
<Space> <Space>
<LockOutlined style={{ fontSize: 18, color: '#6366f1' }} /> <LockOutlined style={{ fontSize: 18, color: '#6366f1' }} />
+4 -4
View File
@@ -35,10 +35,11 @@ const ConsumePage: React.FC = () => {
useEffect(() => { useEffect(() => {
loadColumns(); loadColumns();
loadData(); loadData();
}, [page, pageSize]); }, [page, pageSize, consumeDateRange]);
const loadData = async () => { const loadData = async () => {
setLoading(true); setLoading(true);
console.log(consumeDateRange);
try { try {
const res = await getMaterialConsumpList({ const res = await getMaterialConsumpList({
advertiser_id: advertiserId || undefined, advertiser_id: advertiserId || undefined,
@@ -47,7 +48,6 @@ const ConsumePage: React.FC = () => {
page, page,
page_size: pageSize, page_size: pageSize,
}); });
console.log(res);
setConsumptionRecords(res.data || []); setConsumptionRecords(res.data || []);
setTotal(res.pagination?.total || 0); setTotal(res.pagination?.total || 0);
} catch (e: any) { } catch (e: any) {
@@ -115,8 +115,8 @@ const ConsumePage: React.FC = () => {
<Card variant="outlined" style={{ borderRadius: 12, border: '1px solid #f0f0f5' }}> <Card variant="outlined" style={{ borderRadius: 12, border: '1px solid #f0f0f5' }}>
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 16 }}> <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 16 }}>
<Space> <Space>
<Button type="text" icon={<ArrowLeftOutlined />} onClick={handleBack} /> {/*<Button type="text" icon={<ArrowLeftOutlined />} onClick={handleBack} />
{/* <Button icon={<ArrowLeftOutlined />} onClick={handleBack}>返回</Button> */} <Button icon={<ArrowLeftOutlined />} onClick={handleBack}>返回</Button> */}
<DollarOutlined style={{ fontSize: 18, color: '#6366f1' }} /> <DollarOutlined style={{ fontSize: 18, color: '#6366f1' }} />
<Typography.Text strong style={{ fontSize: 16 }}></Typography.Text> <Typography.Text strong style={{ fontSize: 16 }}></Typography.Text>
</Space> </Space>
+14 -12
View File
@@ -243,7 +243,7 @@ const AdminCreditRatios: React.FC = () => {
return ( return (
<div style={{ display: 'flex', flexDirection: 'column', gap: 16 }}> <div style={{ display: 'flex', flexDirection: 'column', gap: 16 }}>
{/* Text Credit Rate */} {/* Text Credit Rate */}
<Card bordered={false} style={{ borderRadius: 12, border: '1px solid #f0f0f5' }}> <Card variant="outlined" style={{ borderRadius: 12, border: '1px solid #f0f0f5' }}>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 16 }}> <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 16 }}>
<Space> <Space>
<FontSizeOutlined style={{ fontSize: 18, color: '#f59e0b' }} /> <FontSizeOutlined style={{ fontSize: 18, color: '#f59e0b' }} />
@@ -258,16 +258,18 @@ const AdminCreditRatios: React.FC = () => {
</Typography.Text> </Typography.Text>
<div style={{ display: 'flex', alignItems: 'center', gap: 16 }}> <div style={{ display: 'flex', alignItems: 'center', gap: 16 }}>
<Typography.Text>1000 token消耗积分</Typography.Text> <Typography.Text>1000 token消耗积分</Typography.Text>
<InputNumber <Space.Compact style={{ width: 160 }}>
min={0} <InputNumber
max={1000} min={0}
step={0.01} max={1000}
value={textRate} step={0.01}
onChange={(v) => setTextRate(v || 0)} value={textRate}
size="large" onChange={(v) => setTextRate(v || 0)}
style={{ width: 160 }} size="large"
addonAfter="积分" style={{ width: '100%' }}
/> />
<Typography.Text></Typography.Text>
</Space.Compact>
<Typography.Text type="secondary" style={{ fontSize: 12 }}> <Typography.Text type="secondary" style={{ fontSize: 12 }}>
1000 token = {textRate} 500 token = {(500 * textRate / 1000).toFixed(4)} 1000 token = {textRate} 500 token = {(500 * textRate / 1000).toFixed(4)}
</Typography.Text> </Typography.Text>
@@ -275,7 +277,7 @@ const AdminCreditRatios: React.FC = () => {
</Card> </Card>
{/* Generation Credit Ratios */} {/* Generation Credit Ratios */}
<Card bordered={false} style={{ borderRadius: 12, border: '1px solid #f0f0f5' }}> <Card variant="outlined" style={{ borderRadius: 12, border: '1px solid #f0f0f5' }}>
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 16 }}> <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 16 }}>
<Space> <Space>
<CalculatorOutlined style={{ fontSize: 18, color: '#6366f1' }} /> <CalculatorOutlined style={{ fontSize: 18, color: '#6366f1' }} />
@@ -119,7 +119,7 @@ const AdminCreditRecords: React.FC = () => {
<div> <div>
{/* Summary Cards */} {/* Summary Cards */}
<div style={{ display: 'flex', gap: 16, marginBottom: 16 }}> <div style={{ display: 'flex', gap: 16, marginBottom: 16 }}>
<Card bordered={false} style={{ flex: 1, borderRadius: 12, border: '1px solid #f0f0f5' }}> <Card variant="outlined" style={{ flex: 1, borderRadius: 12, border: '1px solid #f0f0f5' }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 12 }}> <div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
<div style={{ <div style={{
width: 44, height: 44, borderRadius: 10, width: 44, height: 44, borderRadius: 10,
@@ -133,7 +133,7 @@ const AdminCreditRecords: React.FC = () => {
</div> </div>
</div> </div>
</Card> </Card>
<Card bordered={false} style={{ flex: 1, borderRadius: 12, border: '1px solid #f0f0f5' }}> <Card variant="outlined" style={{ flex: 1, borderRadius: 12, border: '1px solid #f0f0f5' }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 12 }}> <div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
<div style={{ <div style={{
width: 44, height: 44, borderRadius: 10, width: 44, height: 44, borderRadius: 10,
@@ -147,7 +147,7 @@ const AdminCreditRecords: React.FC = () => {
</div> </div>
</div> </div>
</Card> </Card>
<Card bordered={false} style={{ flex: 1, borderRadius: 12, border: '1px solid #f0f0f5' }}> <Card variant="outlined" style={{ flex: 1, borderRadius: 12, border: '1px solid #f0f0f5' }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 12 }}> <div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
<div style={{ <div style={{
width: 44, height: 44, borderRadius: 10, width: 44, height: 44, borderRadius: 10,
@@ -163,7 +163,7 @@ const AdminCreditRecords: React.FC = () => {
</Card> </Card>
</div> </div>
<Card bordered={false} style={{ borderRadius: 12, border: '1px solid #f0f0f5' }}> <Card variant="outlined" style={{ borderRadius: 12, border: '1px solid #f0f0f5' }}>
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 16, flexWrap: 'wrap', gap: 12 }}> <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 16, flexWrap: 'wrap', gap: 12 }}>
<Space wrap> <Space wrap>
<Select <Select
@@ -764,7 +764,7 @@ const AdminGenerationAiRecords: React.FC = () => {
return ( return (
<div> <div>
<Card bordered={false} style={{ borderRadius: 12, border: '1px solid #f0f0f5' }}> <Card variant="outlined" style={{ borderRadius: 12, border: '1px solid #f0f0f5' }}>
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 16, flexWrap: 'wrap', gap: 12 }}> <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 16, flexWrap: 'wrap', gap: 12 }}>
<Space> <Space>
<PlayCircleOutlined style={{ fontSize: 18, color: '#6366f1' }} /> <PlayCircleOutlined style={{ fontSize: 18, color: '#6366f1' }} />
@@ -867,7 +867,7 @@ const AdminGenerationRecords: React.FC = () => {
return ( return (
<div> <div>
<Card bordered={false} style={{ borderRadius: 12, border: '1px solid #f0f0f5' }}> <Card variant="outlined" style={{ borderRadius: 12, border: '1px solid #f0f0f5' }}>
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 16, flexWrap: 'wrap', gap: 12 }}> <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 16, flexWrap: 'wrap', gap: 12 }}>
<Space> <Space>
<VideoCameraOutlined style={{ fontSize: 18, color: '#6366f1' }} /> <VideoCameraOutlined style={{ fontSize: 18, color: '#6366f1' }} />
+1 -1
View File
@@ -81,7 +81,7 @@ const AdminLoginPage = () => {
bottom: -100, left: -80, filter: 'blur(50px)', bottom: -100, left: -80, filter: 'blur(50px)',
}} /> }} />
<Card bordered={false} style={{ <Card variant="outlined" style={{
width: 440, width: 440,
borderRadius: 20, borderRadius: 20,
boxShadow: '0 20px 60px rgba(0,0,0,0.08)', boxShadow: '0 20px 60px rgba(0,0,0,0.08)',
@@ -198,7 +198,7 @@ const AdminMenuConfig: React.FC = () => {
return ( return (
<div> <div>
<Card bordered={false} style={{ borderRadius: 12, border: '1px solid #f0f0f5' }}> <Card variant="outlined" style={{ borderRadius: 12, border: '1px solid #f0f0f5' }}>
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 16 }}> <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 16 }}>
<Space> <Space>
<MenuOutlined style={{ fontSize: 18, color: '#6366f1' }} /> <MenuOutlined style={{ fontSize: 18, color: '#6366f1' }} />
+1 -1
View File
@@ -157,7 +157,7 @@ const AdminModels: React.FC = () => {
return ( return (
<div> <div>
<Card bordered={false} style={{ borderRadius: 12, border: '1px solid #f0f0f5' }}> <Card variant="outlined" style={{ borderRadius: 12, border: '1px solid #f0f0f5' }}>
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 16 }}> <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 16 }}>
<Typography.Text type="secondary"> <Typography.Text type="secondary">
{models.length} {models.length}
@@ -166,7 +166,7 @@ const AdminNotificationManager: React.FC = () => {
return ( return (
<div> <div>
<Card bordered={false} style={{ borderRadius: 12, border: '1px solid #f0f0f5' }}> <Card variant="outlined" style={{ borderRadius: 12, border: '1px solid #f0f0f5' }}>
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 16 }}> <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 16 }}>
<Space> <Space>
<BellOutlined style={{ fontSize: 18, color: '#6366f1' }} /> <BellOutlined style={{ fontSize: 18, color: '#6366f1' }} />
@@ -68,7 +68,7 @@ const AdminOperationLogs: React.FC = () => {
return ( return (
<div> <div>
<Card bordered={false} style={{ borderRadius: 12, border: '1px solid #f0f0f5' }}> <Card variant="outlined" style={{ borderRadius: 12, border: '1px solid #f0f0f5' }}>
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 16 }}> <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 16 }}>
<Space> <Space>
<HistoryOutlined style={{ fontSize: 18, color: '#6366f1' }} /> <HistoryOutlined style={{ fontSize: 18, color: '#6366f1' }} />
@@ -1,6 +1,6 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { import {
Button, Card, Form, Input, message, Switch, Typography, InputNumber, Button, Card, Form, Input, message, Switch, Typography, InputNumber, Space,
} from 'antd'; } from 'antd';
import { import {
SaveOutlined, WechatOutlined, AlipayCircleOutlined, DollarOutlined, ClockCircleOutlined, SaveOutlined, WechatOutlined, AlipayCircleOutlined, DollarOutlined, ClockCircleOutlined,
@@ -85,7 +85,7 @@ const AdminPaymentConfig: React.FC = () => {
<div style={{ display: 'flex', gap: 24, flexWrap: 'wrap', marginBottom: 24 }}> <div style={{ display: 'flex', gap: 24, flexWrap: 'wrap', marginBottom: 24 }}>
{/* 通用设置:订单超时时间 */} {/* 通用设置:订单超时时间 */}
<div style={{ flex: '1 1 400px', minWidth: 400 }}> <div style={{ flex: '1 1 400px', minWidth: 400 }}>
<Card bordered={false} style={{ borderRadius: 12, border: '1px solid #f0f0f5' }}> <Card variant="outlined" style={{ borderRadius: 12, border: '1px solid #f0f0f5' }}>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}> <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 12 }}> <div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
<div style={{ <div style={{
@@ -100,14 +100,16 @@ const AdminPaymentConfig: React.FC = () => {
</div> </div>
<Form form={form} layout="inline"> <Form form={form} layout="inline">
<Form.Item name="order_timeout" style={{ margin: 0 }}> <Form.Item name="order_timeout" style={{ margin: 0 }}>
<InputNumber <Space.Compact style={{ width: 140 }}>
min={30} <InputNumber
max={86400} min={30}
placeholder="180" max={86400}
style={{ width: 140 }} placeholder="180"
size="middle" style={{ width: '100%' }}
addonAfter="" size="middle"
/> />
<Typography.Text></Typography.Text>
</Space.Compact>
</Form.Item> </Form.Item>
</Form> </Form>
</div> </div>
@@ -116,7 +118,7 @@ const AdminPaymentConfig: React.FC = () => {
{/* 模拟支付模式 */} {/* 模拟支付模式 */}
<div style={{ flex: '1 1 400px', minWidth: 400 }}> <div style={{ flex: '1 1 400px', minWidth: 400 }}>
<Card bordered={false} style={{ borderRadius: 12, border: '1px solid #f0f0f5', background: mockMode ? '#fff7e6' : '#fafbff' }}> <Card variant="outlined" style={{ borderRadius: 12, border: '1px solid #f0f0f5', background: mockMode ? '#fff7e6' : '#fafbff' }}>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}> <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 12 }}> <div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
<div style={{ <div style={{
@@ -139,7 +141,7 @@ const AdminPaymentConfig: React.FC = () => {
<div style={{ display: 'flex', gap: 24, flexWrap: 'wrap' }}> <div style={{ display: 'flex', gap: 24, flexWrap: 'wrap' }}>
{/* 微信支付 */} {/* 微信支付 */}
<div style={{ flex: '1 1 400px', minWidth: 400 }}> <div style={{ flex: '1 1 400px', minWidth: 400 }}>
<Card bordered={false} style={{ borderRadius: 12, border: '1px solid #f0f0f5' }}> <Card variant="outlined" style={{ borderRadius: 12, border: '1px solid #f0f0f5' }}>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 20 }}> <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 20 }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 12 }}> <div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
<div style={{ <div style={{
@@ -216,7 +218,7 @@ const AdminPaymentConfig: React.FC = () => {
{/* 支付宝 */} {/* 支付宝 */}
<div style={{ flex: '1 1 400px', minWidth: 400 }}> <div style={{ flex: '1 1 400px', minWidth: 400 }}>
<Card bordered={false} style={{ borderRadius: 12, border: '1px solid #f0f0f5' }}> <Card variant="outlined" style={{ borderRadius: 12, border: '1px solid #f0f0f5' }}>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 20 }}> <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 20 }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 12 }}> <div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
<div style={{ <div style={{
@@ -171,7 +171,7 @@ const AdminPaymentStats: React.FC = () => {
{/* Summary cards */} {/* Summary cards */}
<Row gutter={[16, 16]} style={{ marginBottom: 24 }}> <Row gutter={[16, 16]} style={{ marginBottom: 24 }}>
<Col xs={24} sm={12} lg={12}> <Col xs={24} sm={12} lg={12}>
<Card bordered={false} style={{ borderRadius: 12, border: '1px solid #f0f0f5' }}> <Card variant="outlined" style={{ borderRadius: 12, border: '1px solid #f0f0f5' }}>
<Statistic <Statistic
title="今日收入" title="今日收入"
value={stats.today.paidAmount} value={stats.today.paidAmount}
@@ -186,7 +186,7 @@ const AdminPaymentStats: React.FC = () => {
</Card> </Card>
</Col> </Col>
<Col xs={24} sm={12} lg={12}> <Col xs={24} sm={12} lg={12}>
<Card bordered={false} style={{ borderRadius: 12, border: '1px solid #f0f0f5' }}> <Card variant="outlined" style={{ borderRadius: 12, border: '1px solid #f0f0f5' }}>
<Statistic <Statistic
title="本月累计" title="本月累计"
value={monthInfo.paidAmount} value={monthInfo.paidAmount}
@@ -203,7 +203,7 @@ const AdminPaymentStats: React.FC = () => {
</Row> </Row>
{/* Status breakdown */} {/* Status breakdown */}
<Card bordered={false} style={{ borderRadius: 12, border: '1px solid #f0f0f5', marginBottom: 16 }} <Card variant="outlined" style={{ borderRadius: 12, border: '1px solid #f0f0f5', marginBottom: 16 }}
title={<Space><DollarOutlined /></Space>}> title={<Space><DollarOutlined /></Space>}>
<Row gutter={16}> <Row gutter={16}>
{['paid', 'pending', 'cancelled', 'refunded'].map(s => { {['paid', 'pending', 'cancelled', 'refunded'].map(s => {
@@ -177,7 +177,7 @@ const AdminRechargePackages: React.FC = () => {
return ( return (
<div> <div>
<Card bordered={false} style={{ borderRadius: 12, border: '1px solid #f0f0f5' }}> <Card variant="outlined" style={{ borderRadius: 12, border: '1px solid #f0f0f5' }}>
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 16 }}> <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 16 }}>
<Space> <Space>
<GiftOutlined style={{ fontSize: 18, color: '#6366f1' }} /> <GiftOutlined style={{ fontSize: 18, color: '#6366f1' }} />
+2 -2
View File
@@ -237,12 +237,12 @@ const AdminSettings: React.FC = () => {
}; };
if (loading) { if (loading) {
return <Card loading bordered={false} style={{ borderRadius: 12 }} />; return <Card loading variant="outlined" style={{ borderRadius: 12 }} />;
} }
return ( return (
<div style={{ maxWidth: 720 }}> <div style={{ maxWidth: 720 }}>
<Card bordered={false} style={{ borderRadius: 12, border: '1px solid #f0f0f5', marginBottom: 16 }}> <Card variant="outlined" style={{ borderRadius: 12, border: '1px solid #f0f0f5', marginBottom: 16 }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 12, marginBottom: 24 }}> <div style={{ display: 'flex', alignItems: 'center', gap: 12, marginBottom: 24 }}>
<div style={{ <div style={{
width: 44, height: 44, borderRadius: 10, width: 44, height: 44, borderRadius: 10,
+2 -2
View File
@@ -262,7 +262,7 @@ const AdminUsers: React.FC = () => {
return ( return (
<div> <div>
<Card bordered={false} style={{ borderRadius: 12, border: '1px solid #f0f0f5', marginBottom: 16 }}> <Card variant="outlined" style={{ borderRadius: 12, border: '1px solid #f0f0f5', marginBottom: 16 }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 12, marginBottom: 20 }}> <div style={{ display: 'flex', alignItems: 'center', gap: 12, marginBottom: 20 }}>
<div style={{ <div style={{
width: 44, height: 44, borderRadius: 10, width: 44, height: 44, borderRadius: 10,
@@ -316,7 +316,7 @@ const AdminUsers: React.FC = () => {
</Form> </Form>
</Card> </Card>
<Card bordered={false} style={{ borderRadius: 12, border: '1px solid #f0f0f5' }}> <Card variant="outlined" style={{ borderRadius: 12, border: '1px solid #f0f0f5' }}>
{/* Search bar */} {/* Search bar */}
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 16 }}> <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 16 }}>
<div style={{ display: 'flex', gap: 12 }}> <div style={{ display: 'flex', gap: 12 }}>
@@ -161,7 +161,7 @@ const AdminVideoEngines: React.FC = () => {
return ( return (
<div> <div>
<Card bordered={false} style={{ borderRadius: 12, border: '1px solid #f0f0f5' }}> <Card variant="outlined" style={{ borderRadius: 12, border: '1px solid #f0f0f5' }}>
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 16 }}> <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 16 }}>
<Space> <Space>
<PlayCircleOutlined style={{ fontSize: 18, color: '#6366f1' }} /> <PlayCircleOutlined style={{ fontSize: 18, color: '#6366f1' }} />
+5
View File
@@ -12,6 +12,11 @@ node_modules
dist-ssr dist-ssr
*.local *.local
# Environment files
.env
.env.local
.env.*.local
# Editor directories and files # Editor directories and files
.vscode/* .vscode/*
!.vscode/extensions.json !.vscode/extensions.json
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -28,7 +28,7 @@
} }
})(); })();
</script> </script>
<script type="module" crossorigin src="/assets/index-BjRp0K8U.js"></script> <script type="module" crossorigin src="/assets/index-DLfJXBov.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-eLRg4pQk.css"> <link rel="stylesheet" crossorigin href="/assets/index-eLRg4pQk.css">
</head> </head>
<body> <body>
+2
View File
@@ -24,6 +24,7 @@ import RemoveInfo from './pages/RemoveInfo';
import RemoveRw from './pages/RemoveRw'; import RemoveRw from './pages/RemoveRw';
// import RemoveFenbu from './pages/RemoveFenbu'; // import RemoveFenbu from './pages/RemoveFenbu';
import ConsumePage from './pages/ConsumePage'; import ConsumePage from './pages/ConsumePage';
import AuthorizationWaitingPage from './pages/AuthorizationWaitingPage';
import { useAuthStore } from './store/useAuthStore'; import { useAuthStore } from './store/useAuthStore';
const ProtectedRoute = ({ children }: { children: React.ReactNode }) => { const ProtectedRoute = ({ children }: { children: React.ReactNode }) => {
const { user, loading, checkAuth } = useAuthStore(); const { user, loading, checkAuth } = useAuthStore();
@@ -109,6 +110,7 @@ const App = () => {
<Route path="generated" element={<GeneratedRecord />} /> <Route path="generated" element={<GeneratedRecord />} />
<Route path="pretest" element={<PreTest />} /> <Route path="pretest" element={<PreTest />} />
<Route path="authorization" element={<AuthorizationPage />} /> <Route path="authorization" element={<AuthorizationPage />} />
<Route path="authoriza-waiting" element={<AuthorizationWaitingPage />} />
<Route path="materials" element={<MaterialListPage />} /> <Route path="materials" element={<MaterialListPage />} />
<Route path="consume" element={<ConsumePage />} /> <Route path="consume" element={<ConsumePage />} />
</Route> </Route>
+8
View File
@@ -414,11 +414,19 @@ export async function requestOAuth(params: RequestOAuthParams): Promise<any> {
export interface JuliangCallbackParams { export interface JuliangCallbackParams {
auth_code: string; auth_code: string;
state: string; state: string;
app_id?: string;
material_auth_status?: string;
scope?: string;
uid?: string;
} }
export async function juliang_callback(params: JuliangCallbackParams): Promise<any> { export async function juliang_callback(params: JuliangCallbackParams): Promise<any> {
const query = new URLSearchParams(); const query = new URLSearchParams();
query.set('auth_code', params.auth_code); query.set('auth_code', params.auth_code);
query.set('state', params.state); query.set('state', params.state);
if (params.app_id) query.set('app_id', params.app_id);
if (params.material_auth_status) query.set('material_auth_status', params.material_auth_status);
if (params.scope) query.set('scope', params.scope);
if (params.uid) query.set('uid', params.uid);
return api.get(`/user-oauth/juliang_callback?${query.toString()}`); return api.get(`/user-oauth/juliang_callback?${query.toString()}`);
} }
@@ -0,0 +1,153 @@
import React, { useState, useEffect } from 'react';
import { Typography, Spin, Button, App } from 'antd';
import { ClockCircleOutlined, ReloadOutlined } from '@ant-design/icons';
import { useNavigate, useSearchParams } from 'react-router-dom';
import { juliang_callback, getOAuthList } from '../api';
const AuthorizationWaitingPage: React.FC = () => {
const navigate = useNavigate();
const [searchParams] = useSearchParams();
const { message } = App.useApp();
const [countdown, setCountdown] = useState(0);
const [isChecking, setIsChecking] = useState(true);
const [authSuccess, setAuthSuccess] = useState(false);
useEffect(() => {
const authCode = searchParams.get('auth_code');
const state = searchParams.get('state');
if (!authCode || !state) {
setIsChecking(false);
setCountdown(10);
return;
}
const params = {
auth_code: authCode,
state: state,
app_id: searchParams.get('app_id') || undefined,
material_auth_status: searchParams.get('material_auth_status') || undefined,
scope: searchParams.get('scope') || undefined,
uid: searchParams.get('uid') || undefined,
};
const handleCallback = async () => {
try {
await juliang_callback(params);
setAuthSuccess(true);
setIsChecking(false);
message.success('授权成功');
setTimeout(() => {
navigate('/authorization');
}, 1500);
} catch (error) {
console.log('授权回调失败,开始轮询检查...');
}
};
handleCallback();
const checkInterval = setInterval(async () => {
try {
// await getOAuthList({ page: 1, page_size: 1 });
// setAuthSuccess(true);
// setIsChecking(false);
// message.success('授权成功');
// clearInterval(checkInterval);
// setTimeout(() => {
// navigate('/authorization');
// }, 1500);
} catch (error) {
console.log('授权检查中...');
}
}, 2000);
const timer = setInterval(() => {
setCountdown(prev => {
if (prev >= 11) {
clearInterval(checkInterval);
setIsChecking(false);
return prev;
}
return prev + 1;
});
}, 1000);
return () => {
clearInterval(checkInterval);
clearInterval(timer);
};
}, [navigate, searchParams, message]);
const handleRetry = () => {
setCountdown(0);
setIsChecking(true);
setAuthSuccess(false);
window.location.href = '/authorization';
};
if (authSuccess) {
return (
<div style={{ minHeight: '100vh', display: 'flex', justifyContent: 'center', alignItems: 'center', background: 'linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%)' }}>
<div style={{ textAlign: 'center', padding: '60px 80px', background: '#fff', borderRadius: 16, boxShadow: '0 10px 40px rgba(0,0,0,0.1)' }}>
<div style={{ width: 80, height: 80, background: '#dcfce7', borderRadius: '50%', display: 'flex', justifyContent: 'center', alignItems: 'center', margin: '0 auto 24px' }}>
<Typography.Text style={{ fontSize: 40, color: '#22c55e' }}></Typography.Text>
</div>
<Typography.Title level={3} style={{ marginBottom: 16, color: '#1e293b' }}></Typography.Title>
<Typography.Text style={{ color: '#64748b' }}>...</Typography.Text>
</div>
</div>
);
}
return (
<div style={{ minHeight: '100vh', display: 'flex', justifyContent: 'center', alignItems: 'center', background: 'linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%)' }}>
<div style={{ textAlign: 'center', padding: '60px 80px', background: '#fff', borderRadius: 16, boxShadow: '0 10px 40px rgba(0,0,0,0.1)' }}>
<div style={{ width: 80, height: 80, background: 'linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)', borderRadius: '50%', display: 'flex', justifyContent: 'center', alignItems: 'center', margin: '0 auto 24px' }}>
{isChecking && countdown < 10 ? (
<Spin size="large" tip="加载中" style={{ color: '#fff' }} />
) : (
<ClockCircleOutlined style={{ fontSize: 40, color: '#fff' }} />
)}
</div>
{countdown >= 10 ? (
<>
<Typography.Title level={3} style={{ marginBottom: 16, color: '#ef4444' }}></Typography.Title>
<Typography.Text style={{ color: '#64748b', marginBottom: 24, display: 'block' }}></Typography.Text>
<Button
type="primary"
size="large"
icon={<ReloadOutlined />}
onClick={handleRetry}
style={{
borderRadius: 8,
background: 'linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)',
border: 'none',
fontWeight: 600,
padding: '12px 32px',
}}
>
</Button>
</>
) : (
<>
<Typography.Title level={3} style={{ marginBottom: 16, color: '#1e293b' }}></Typography.Title>
<Typography.Text style={{ color: '#64748b', marginBottom: 24, display: 'block' }}>
</Typography.Text>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 8 }}>
<ClockCircleOutlined style={{ color: '#6366f1' }} />
<Typography.Text style={{ color: '#6366f1', fontWeight: 500, fontSize: 16 }}>
{countdown}s
</Typography.Text>
</div>
</>
)}
</div>
</div>
);
};
export default AuthorizationWaitingPage;
+1 -1
View File
@@ -436,7 +436,7 @@ const PreTest: React.FC = () => {
<div style={{ minHeight: 'calc(100vh - 80px)' }}> <div style={{ minHeight: 'calc(100vh - 80px)' }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 8, marginBottom: 12 }}> <div style={{ display: 'flex', alignItems: 'center', gap: 8, marginBottom: 12 }}>
<FileTextOutlined style={{ color: '#6366f1', fontSize: 16 }} /> <FileTextOutlined style={{ color: '#6366f1', fontSize: 16 }} />
<Typography.Text strong style={{ fontSize: 16 }}></Typography.Text> <Typography.Text strong style={{ fontSize: 16 }}></Typography.Text>
</div> </div>
<div style={{ display: 'flex', justifyContent: 'flex-end', gap: 12, marginBottom: 16 }}> <div style={{ display: 'flex', justifyContent: 'flex-end', gap: 12, marginBottom: 16 }}>
<Button <Button