Initial import of weiyuan frontend
This commit is contained in:
@@ -0,0 +1,704 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import {
|
||||
Modal,
|
||||
Button,
|
||||
Typography,
|
||||
Tabs,
|
||||
TabPane,
|
||||
Input,
|
||||
Tag,
|
||||
} from '@douyinfe/semi-ui';
|
||||
import { QRCodeCanvas } from 'qrcode.react';
|
||||
import {
|
||||
Download,
|
||||
Copy,
|
||||
Share2,
|
||||
Smartphone,
|
||||
Monitor,
|
||||
Gift,
|
||||
Users,
|
||||
Sparkles,
|
||||
ChevronRight,
|
||||
CheckCircle,
|
||||
Coins,
|
||||
TrendingUp,
|
||||
} from 'lucide-react';
|
||||
import { API, showError, showSuccess, copy } from '../../helpers';
|
||||
|
||||
const { Text } = Typography;
|
||||
|
||||
// 默认海报模板配置
|
||||
const DEFAULT_TEMPLATES = [
|
||||
{
|
||||
id: 'blue',
|
||||
name: '科技蓝',
|
||||
bgGradient: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
|
||||
textColor: '#ffffff',
|
||||
},
|
||||
{
|
||||
id: 'orange',
|
||||
name: '活力橙',
|
||||
bgGradient: 'linear-gradient(135deg, #f093fb 0%, #f5576c 100%)',
|
||||
textColor: '#ffffff',
|
||||
},
|
||||
{
|
||||
id: 'green',
|
||||
name: '清新绿',
|
||||
bgGradient: 'linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)',
|
||||
textColor: '#ffffff',
|
||||
},
|
||||
{
|
||||
id: 'dark',
|
||||
name: '暗夜黑',
|
||||
bgGradient: 'linear-gradient(135deg, #232526 0%, #414345 100%)',
|
||||
textColor: '#ffffff',
|
||||
},
|
||||
];
|
||||
|
||||
const PromotionPosterModal = ({ visible, onClose }) => {
|
||||
const { t } = useTranslation();
|
||||
const navigate = useNavigate();
|
||||
const canvasRef = useRef(null);
|
||||
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [affCode, setAffCode] = useState('');
|
||||
const [affLink, setAffLink] = useState('');
|
||||
const [systemName, setSystemName] = useState('');
|
||||
const [selectedTemplate, setSelectedTemplate] = useState(
|
||||
DEFAULT_TEMPLATES[0],
|
||||
);
|
||||
const [downloading, setDownloading] = useState(false);
|
||||
const [posterConfig, setPosterConfig] = useState(null);
|
||||
const [activeTab, setActiveTab] = useState('link');
|
||||
|
||||
// 获取邀请码
|
||||
const fetchAffCode = async () => {
|
||||
try {
|
||||
const res = await API.get('/api/user/aff');
|
||||
if (res.data.success) {
|
||||
const code = res.data.data;
|
||||
setAffCode(code);
|
||||
const link =
|
||||
typeof code === 'string' && code.startsWith('http')
|
||||
? code
|
||||
: `${window.location.origin}/register?aff=${code}`;
|
||||
setAffLink(link);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取邀请码失败:', error);
|
||||
}
|
||||
};
|
||||
|
||||
// 获取系统名称
|
||||
const fetchSystemName = async () => {
|
||||
try {
|
||||
const res = await API.get('/api/status');
|
||||
if (res.data.success) {
|
||||
setSystemName(res.data.data.system_name || 'AI Platform');
|
||||
}
|
||||
} catch {
|
||||
setSystemName('AI Platform');
|
||||
}
|
||||
};
|
||||
|
||||
// 获取海报配置
|
||||
const fetchPosterConfig = async () => {
|
||||
try {
|
||||
const res = await API.get('/api/poster/config');
|
||||
if (res.data.success && res.data.data) {
|
||||
setPosterConfig(res.data.data);
|
||||
}
|
||||
} catch {
|
||||
// 使用默认配置
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (visible) {
|
||||
setLoading(true);
|
||||
Promise.all([
|
||||
fetchAffCode(),
|
||||
fetchSystemName(),
|
||||
fetchPosterConfig(),
|
||||
]).finally(() => {
|
||||
setLoading(false);
|
||||
});
|
||||
}
|
||||
}, [visible]);
|
||||
|
||||
// 绘制海报内容
|
||||
const drawContent = useCallback(
|
||||
(ctx, width, height) => {
|
||||
const textColor = selectedTemplate.textColor;
|
||||
|
||||
ctx.fillStyle = textColor;
|
||||
ctx.font =
|
||||
'bold 28px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
|
||||
ctx.textAlign = 'center';
|
||||
ctx.fillText(
|
||||
posterConfig?.slogan || t('邀请好友,共享AI'),
|
||||
width / 2,
|
||||
80,
|
||||
);
|
||||
|
||||
ctx.font =
|
||||
'16px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
|
||||
ctx.fillText(
|
||||
posterConfig?.sub_slogan || t('注册即可获得免费额度'),
|
||||
width / 2,
|
||||
115,
|
||||
);
|
||||
|
||||
ctx.font =
|
||||
'bold 24px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
|
||||
ctx.fillText(systemName, width / 2, 180);
|
||||
|
||||
const qrSize = 180;
|
||||
const qrX = (width - qrSize - 20) / 2;
|
||||
const qrY = 230;
|
||||
|
||||
ctx.fillStyle = '#ffffff';
|
||||
ctx.beginPath();
|
||||
ctx.roundRect(qrX, qrY, qrSize + 20, qrSize + 20, 12);
|
||||
ctx.fill();
|
||||
|
||||
const qrCanvas = document.getElementById('poster-qrcode');
|
||||
if (qrCanvas) {
|
||||
ctx.drawImage(qrCanvas, qrX + 10, qrY + 10, qrSize, qrSize);
|
||||
}
|
||||
|
||||
ctx.fillStyle = textColor;
|
||||
ctx.font =
|
||||
'14px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
|
||||
ctx.fillText(t('扫码注册'), width / 2, qrY + qrSize + 55);
|
||||
|
||||
ctx.font =
|
||||
'bold 18px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
|
||||
ctx.fillText(`${t('邀请码')}: ${affCode}`, width / 2, qrY + qrSize + 85);
|
||||
|
||||
ctx.strokeStyle = 'rgba(255,255,255,0.3)';
|
||||
ctx.lineWidth = 1;
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(50, height - 80);
|
||||
ctx.lineTo(width - 50, height - 80);
|
||||
ctx.stroke();
|
||||
|
||||
ctx.fillStyle = 'rgba(255,255,255,0.8)';
|
||||
ctx.font =
|
||||
'12px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
|
||||
ctx.fillText(
|
||||
posterConfig?.footer_text || t('长按识别二维码,立即体验AI'),
|
||||
width / 2,
|
||||
height - 45,
|
||||
);
|
||||
},
|
||||
[selectedTemplate, posterConfig, systemName, affCode, t],
|
||||
);
|
||||
|
||||
// 绘制海报到 Canvas
|
||||
const drawPoster = useCallback(() => {
|
||||
const canvas = canvasRef.current;
|
||||
if (!canvas || !affLink) return null;
|
||||
|
||||
const ctx = canvas.getContext('2d');
|
||||
const width = 375;
|
||||
const height = 667;
|
||||
|
||||
canvas.width = width * 2;
|
||||
canvas.height = height * 2;
|
||||
ctx.scale(2, 2);
|
||||
|
||||
const gradient = ctx.createLinearGradient(0, 0, width, height);
|
||||
if (selectedTemplate.id === 'blue') {
|
||||
gradient.addColorStop(0, '#667eea');
|
||||
gradient.addColorStop(1, '#764ba2');
|
||||
} else if (selectedTemplate.id === 'orange') {
|
||||
gradient.addColorStop(0, '#f093fb');
|
||||
gradient.addColorStop(1, '#f5576c');
|
||||
} else if (selectedTemplate.id === 'green') {
|
||||
gradient.addColorStop(0, '#4facfe');
|
||||
gradient.addColorStop(1, '#00f2fe');
|
||||
} else {
|
||||
gradient.addColorStop(0, '#232526');
|
||||
gradient.addColorStop(1, '#414345');
|
||||
}
|
||||
ctx.fillStyle = gradient;
|
||||
ctx.fillRect(0, 0, width, height);
|
||||
drawContent(ctx, width, height);
|
||||
|
||||
return canvas;
|
||||
}, [affLink, selectedTemplate, drawContent]);
|
||||
|
||||
// 下载海报
|
||||
const handleDownload = async () => {
|
||||
if (!affLink) {
|
||||
showError(t('邀请链接获取中,请稍后'));
|
||||
return;
|
||||
}
|
||||
|
||||
setDownloading(true);
|
||||
try {
|
||||
await new Promise((resolve) => setTimeout(resolve, 100));
|
||||
|
||||
const canvas = drawPoster();
|
||||
if (!canvas) {
|
||||
showError(t('海报生成失败'));
|
||||
return;
|
||||
}
|
||||
|
||||
await new Promise((resolve) => setTimeout(resolve, 200));
|
||||
|
||||
const link = document.createElement('a');
|
||||
link.download = `promotion-poster-${affCode}.png`;
|
||||
link.href = canvas.toDataURL('image/png');
|
||||
link.click();
|
||||
showSuccess(t('海报下载成功'));
|
||||
} catch (error) {
|
||||
showError(t('下载失败') + ': ' + error.message);
|
||||
} finally {
|
||||
setDownloading(false);
|
||||
}
|
||||
};
|
||||
|
||||
// 复制邀请链接
|
||||
const handleCopyLink = () => {
|
||||
if (!affLink) {
|
||||
showError(t('邀请链接获取中,请稍后'));
|
||||
return;
|
||||
}
|
||||
copy(affLink, t('邀请链接'));
|
||||
};
|
||||
|
||||
// 复制邀请码
|
||||
const handleCopyCode = () => {
|
||||
if (!affCode) {
|
||||
showError(t('邀请码获取中,请稍后'));
|
||||
return;
|
||||
}
|
||||
copy(affCode, t('邀请码'));
|
||||
};
|
||||
|
||||
// 链接分享模式 - PC友好
|
||||
const renderLinkMode = () => (
|
||||
<div className='flex flex-col items-center w-full'>
|
||||
{/* 分享卡片 */}
|
||||
<div
|
||||
className='w-full rounded-2xl p-6 mb-6 relative overflow-hidden'
|
||||
style={{ background: selectedTemplate.bgGradient }}
|
||||
>
|
||||
{/* 装饰元素 */}
|
||||
<div className='absolute top-0 right-0 w-32 h-32 bg-white/10 rounded-full -translate-y-1/2 translate-x-1/2' />
|
||||
<div className='absolute bottom-0 left-0 w-24 h-24 bg-white/10 rounded-full translate-y-1/2 -translate-x-1/2' />
|
||||
<div className='absolute top-1/2 right-4 w-16 h-16 bg-white/5 rounded-full' />
|
||||
|
||||
<div className='relative z-10'>
|
||||
{/* 平台信息 */}
|
||||
<div className='flex items-center gap-3 mb-4'>
|
||||
<div className='w-12 h-12 bg-white/20 backdrop-blur-sm rounded-xl flex items-center justify-center shadow-lg'>
|
||||
<Sparkles size={24} className='text-white' />
|
||||
</div>
|
||||
<div>
|
||||
<h3 className='text-white font-bold text-lg drop-shadow-sm'>
|
||||
{systemName}
|
||||
</h3>
|
||||
<p className='text-white/80 text-sm'>
|
||||
{posterConfig?.slogan || t('邀请好友,共享AI')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 福利说明 */}
|
||||
<div className='flex gap-4 mb-5'>
|
||||
<div className='flex items-center gap-2 text-white/90 text-sm bg-white/10 backdrop-blur-sm px-3 py-1.5 rounded-full'>
|
||||
<Gift size={14} />
|
||||
<span>{t('注册即送额度')}</span>
|
||||
</div>
|
||||
<div className='flex items-center gap-2 text-white/90 text-sm bg-white/10 backdrop-blur-sm px-3 py-1.5 rounded-full'>
|
||||
<Users size={14} />
|
||||
<span>{t('消费返佣')}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 二维码(小尺寸) */}
|
||||
<div className='flex items-center gap-4'>
|
||||
<div className='bg-white rounded-xl p-2.5 shadow-xl'>
|
||||
<QRCodeCanvas
|
||||
id='link-mode-qrcode'
|
||||
value={affLink || 'https://example.com'}
|
||||
size={80}
|
||||
level='M'
|
||||
includeMargin={false}
|
||||
/>
|
||||
</div>
|
||||
<div className='flex-1'>
|
||||
<p className='text-white/70 text-xs mb-1'>{t('手机扫码注册')}</p>
|
||||
<p className='text-white font-mono text-sm'>
|
||||
{t('邀请码')}:{' '}
|
||||
<span className='font-bold bg-white/20 px-2 py-0.5 rounded'>
|
||||
{affCode}
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 链接输入框 */}
|
||||
<div className='w-full mb-4'>
|
||||
<Text className='text-sm text-gray-500 dark:text-gray-400 mb-2 block font-medium'>
|
||||
{t('邀请链接')}
|
||||
</Text>
|
||||
<div className='relative group'>
|
||||
<div className='absolute -inset-0.5 bg-gradient-to-r from-brand-from/30 to-brand-to/30 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity duration-300 blur-sm' />
|
||||
<Input
|
||||
value={affLink}
|
||||
readOnly
|
||||
size='large'
|
||||
className='!rounded-xl'
|
||||
suffix={
|
||||
<Button
|
||||
theme='solid'
|
||||
type='primary'
|
||||
size='small'
|
||||
icon={<Copy size={14} />}
|
||||
onClick={handleCopyLink}
|
||||
className='!bg-gradient-to-r !from-brand-from !to-brand-to !border-0 !rounded-lg'
|
||||
>
|
||||
{t('复制')}
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 邀请码 */}
|
||||
<div className='w-full mb-4'>
|
||||
<Text className='text-sm text-gray-500 dark:text-gray-400 mb-2 block font-medium'>
|
||||
{t('邀请码')}
|
||||
</Text>
|
||||
<div className='flex items-center gap-3'>
|
||||
<div className='relative'>
|
||||
<div className='absolute -inset-1 bg-gradient-to-r from-blue-500/20 to-brand-to/20 rounded-lg blur-sm' />
|
||||
<Tag
|
||||
size='large'
|
||||
color='blue'
|
||||
className='!text-lg !px-5 !py-2.5 !rounded-xl !font-bold relative'
|
||||
>
|
||||
{affCode}
|
||||
</Tag>
|
||||
</div>
|
||||
<Button
|
||||
theme='light'
|
||||
type='tertiary'
|
||||
icon={<Copy size={14} />}
|
||||
onClick={handleCopyCode}
|
||||
className='!rounded-lg'
|
||||
>
|
||||
{t('复制')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 使用说明 */}
|
||||
<div className='w-full p-4 bg-gradient-to-r from-blue-50 to-brand-to/5 dark:from-blue-900/20 dark:to-brand-to/20 rounded-xl border border-blue-100 dark:border-blue-800/30'>
|
||||
<div className='flex items-start gap-2'>
|
||||
<CheckCircle
|
||||
size={16}
|
||||
className='text-blue-500 mt-0.5 flex-shrink-0'
|
||||
/>
|
||||
<Text className='text-sm text-blue-700 dark:text-blue-300'>
|
||||
{t(
|
||||
'将链接发送给好友,好友点击即可注册。支持微信、QQ、邮件等任意方式分享。',
|
||||
)}
|
||||
</Text>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
// 海报模式 - 移动端友好
|
||||
const renderPosterMode = () => (
|
||||
<div className='flex flex-col items-center'>
|
||||
{/* 模板选择 */}
|
||||
<div className='w-full mb-4'>
|
||||
<Text className='text-sm text-gray-500 dark:text-gray-400 mb-2 block font-medium'>
|
||||
{t('选择模板')}
|
||||
</Text>
|
||||
<div className='flex gap-3 flex-wrap'>
|
||||
{DEFAULT_TEMPLATES.map((template) => (
|
||||
<button
|
||||
key={template.id}
|
||||
onClick={() => setSelectedTemplate(template)}
|
||||
className={`relative w-14 h-14 rounded-xl border-2 transition-all duration-300 overflow-hidden ${
|
||||
selectedTemplate.id === template.id
|
||||
? 'border-brand scale-110 shadow-lg shadow-brand/30'
|
||||
: 'border-transparent hover:border-gray-300 hover:scale-105'
|
||||
}`}
|
||||
style={{ background: template.bgGradient }}
|
||||
title={template.name}
|
||||
>
|
||||
{selectedTemplate.id === template.id && (
|
||||
<div className='absolute inset-0 flex items-center justify-center bg-black/20'>
|
||||
<CheckCircle size={20} className='text-white' />
|
||||
</div>
|
||||
)}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 海报预览 */}
|
||||
<div
|
||||
className='relative rounded-2xl overflow-hidden shadow-2xl'
|
||||
style={{
|
||||
width: 280,
|
||||
height: 497,
|
||||
background: selectedTemplate.bgGradient,
|
||||
}}
|
||||
>
|
||||
{/* 装饰元素 */}
|
||||
<div className='absolute top-0 right-0 w-24 h-24 bg-white/10 rounded-full -translate-y-1/2 translate-x-1/2' />
|
||||
<div className='absolute bottom-20 left-0 w-16 h-16 bg-white/10 rounded-full -translate-x-1/2' />
|
||||
|
||||
<div className='absolute inset-0 flex flex-col items-center pt-10 px-5'>
|
||||
<h2
|
||||
className='text-xl font-bold mb-2 text-center drop-shadow-sm'
|
||||
style={{ color: selectedTemplate.textColor }}
|
||||
>
|
||||
{posterConfig?.slogan || t('邀请好友,共享AI')}
|
||||
</h2>
|
||||
<p
|
||||
className='text-xs mb-5 opacity-90'
|
||||
style={{ color: selectedTemplate.textColor }}
|
||||
>
|
||||
{posterConfig?.sub_slogan || t('注册即可获得免费额度')}
|
||||
</p>
|
||||
|
||||
<h3
|
||||
className='text-lg font-bold mb-6 drop-shadow-sm'
|
||||
style={{ color: selectedTemplate.textColor }}
|
||||
>
|
||||
{systemName}
|
||||
</h3>
|
||||
|
||||
<div className='bg-white rounded-xl p-3 shadow-2xl'>
|
||||
<QRCodeCanvas
|
||||
id='poster-qrcode'
|
||||
value={affLink || 'https://example.com'}
|
||||
size={130}
|
||||
level='H'
|
||||
includeMargin={false}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<p
|
||||
className='text-xs mt-3 opacity-90'
|
||||
style={{ color: selectedTemplate.textColor }}
|
||||
>
|
||||
{t('扫码注册')}
|
||||
</p>
|
||||
|
||||
<div
|
||||
className='mt-2 px-4 py-1.5 rounded-full'
|
||||
style={{ backgroundColor: 'rgba(255,255,255,0.2)' }}
|
||||
>
|
||||
<p
|
||||
className='text-sm font-bold'
|
||||
style={{ color: selectedTemplate.textColor }}
|
||||
>
|
||||
{t('邀请码')}: {affCode}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className='absolute bottom-6 left-0 right-0 text-center'>
|
||||
<div
|
||||
className='h-px mx-6 mb-3 opacity-30'
|
||||
style={{ backgroundColor: selectedTemplate.textColor }}
|
||||
/>
|
||||
<p
|
||||
className='text-xs opacity-80'
|
||||
style={{ color: selectedTemplate.textColor }}
|
||||
>
|
||||
{posterConfig?.footer_text || t('长按识别二维码,立即体验AI')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 隐藏的 canvas 用于导出 */}
|
||||
<canvas ref={canvasRef} style={{ display: 'none' }} />
|
||||
|
||||
{/* 操作按钮 */}
|
||||
<div className='flex gap-3 mt-5 w-full'>
|
||||
<Button
|
||||
theme='solid'
|
||||
type='primary'
|
||||
icon={<Download size={16} />}
|
||||
onClick={handleDownload}
|
||||
loading={downloading}
|
||||
className='flex-1 !bg-gradient-to-r !from-brand-from !to-brand-to !border-0 !rounded-xl !h-10'
|
||||
>
|
||||
{t('下载海报')}
|
||||
</Button>
|
||||
<Button
|
||||
theme='light'
|
||||
type='tertiary'
|
||||
icon={<Copy size={16} />}
|
||||
onClick={handleCopyLink}
|
||||
className='flex-1 !rounded-xl !h-10'
|
||||
>
|
||||
{t('复制链接')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
return (
|
||||
<Modal
|
||||
title={
|
||||
<div className='flex items-center gap-2'>
|
||||
<div className='w-8 h-8 rounded-lg bg-gradient-to-br from-brand-from to-brand-to flex items-center justify-center shadow-lg shadow-brand/30'>
|
||||
<Share2 size={16} className='text-white' />
|
||||
</div>
|
||||
<span className='font-bold text-lg'>{t('推广分享')}</span>
|
||||
</div>
|
||||
}
|
||||
visible={visible}
|
||||
onCancel={onClose}
|
||||
footer={null}
|
||||
width={520}
|
||||
centered
|
||||
className='promotion-modal'
|
||||
bodyStyle={{ padding: '0 24px 24px' }}
|
||||
>
|
||||
<div style={{ minHeight: 540 }}>
|
||||
{loading ? (
|
||||
<div
|
||||
className='flex flex-col justify-center items-center'
|
||||
style={{ height: 540 }}
|
||||
>
|
||||
<div className='relative'>
|
||||
<div className='w-16 h-16 rounded-full border-4 border-brand/10 dark:border-brand-deep' />
|
||||
<div className='absolute inset-0 w-16 h-16 rounded-full border-4 border-brand border-t-transparent animate-spin' />
|
||||
</div>
|
||||
<span className='mt-4 text-gray-500 dark:text-gray-400'>
|
||||
{t('加载中...')}
|
||||
</span>
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
{/* 查看邀请奖励规则 - 顶部显眼横幅 */}
|
||||
<div
|
||||
className='group mb-5 p-4 rounded-2xl cursor-pointer transition-all duration-300 hover:scale-[1.02] hover:shadow-xl relative overflow-hidden'
|
||||
style={{
|
||||
background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
|
||||
}}
|
||||
onClick={() => {
|
||||
onClose();
|
||||
navigate('/user-center/invite');
|
||||
}}
|
||||
>
|
||||
{/* 装饰元素 */}
|
||||
<div className='absolute top-0 right-0 w-20 h-20 bg-white/10 rounded-full -translate-y-1/2 translate-x-1/2' />
|
||||
<div className='absolute bottom-0 left-1/2 w-32 h-32 bg-white/5 rounded-full translate-y-1/2' />
|
||||
|
||||
{/* 动态光效 */}
|
||||
<div className='absolute inset-0 bg-gradient-to-r from-transparent via-white/10 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-1000' />
|
||||
|
||||
<div className='relative flex items-center justify-between'>
|
||||
<div className='flex items-center gap-3'>
|
||||
<div className='w-12 h-12 bg-white/20 backdrop-blur-sm rounded-xl flex items-center justify-center shadow-lg'>
|
||||
<Gift size={22} className='text-white' />
|
||||
</div>
|
||||
<div>
|
||||
<div className='text-white font-bold text-base flex items-center gap-2'>
|
||||
{t('查看邀请奖励规则')}
|
||||
<Sparkles
|
||||
size={14}
|
||||
className='text-amber-300 animate-pulse'
|
||||
/>
|
||||
</div>
|
||||
<div className='text-white/80 text-sm mt-0.5'>
|
||||
{t('了解返佣比例和奖励详情')}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className='flex items-center gap-1 text-white/90 group-hover:translate-x-1 transition-transform'>
|
||||
<span className='text-xs font-medium hidden sm:block'>
|
||||
{t('立即查看')}
|
||||
</span>
|
||||
<ChevronRight size={20} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 底部小标签 */}
|
||||
<div className='flex gap-2 mt-3'>
|
||||
<span className='text-xs bg-white/20 backdrop-blur-sm text-white px-2 py-1 rounded-full flex items-center gap-1'>
|
||||
<Coins size={12} />
|
||||
{t('消费返佣')}
|
||||
</span>
|
||||
<span className='text-xs bg-white/20 backdrop-blur-sm text-white px-2 py-1 rounded-full flex items-center gap-1'>
|
||||
<TrendingUp size={12} />
|
||||
{t('额度奖励')}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Tab 导航 */}
|
||||
<Tabs
|
||||
activeKey={activeTab}
|
||||
onChange={setActiveTab}
|
||||
className='promotion-tabs'
|
||||
>
|
||||
<TabPane
|
||||
tab={
|
||||
<span className='flex items-center gap-2 px-2'>
|
||||
<Monitor size={16} />
|
||||
<span className='font-medium'>{t('链接分享')}</span>
|
||||
</span>
|
||||
}
|
||||
itemKey='link'
|
||||
>
|
||||
<div className='pt-4'>{renderLinkMode()}</div>
|
||||
</TabPane>
|
||||
<TabPane
|
||||
tab={
|
||||
<span className='flex items-center gap-2 px-2'>
|
||||
<Smartphone size={16} />
|
||||
<span className='font-medium'>{t('海报分享')}</span>
|
||||
</span>
|
||||
}
|
||||
itemKey='poster'
|
||||
>
|
||||
<div className='pt-4'>{renderPosterMode()}</div>
|
||||
</TabPane>
|
||||
</Tabs>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
|
||||
export default PromotionPosterModal;
|
||||
Reference in New Issue
Block a user