|
|
@@ -3,7 +3,7 @@ import { publicTemplateClient } from '@/client/api';
|
|
|
import { Card, CardContent, CardHeader, CardTitle } from '@/client/components/ui/card';
|
|
|
import { Button } from '@/client/components/ui/button';
|
|
|
import { Badge } from '@/client/components/ui/badge';
|
|
|
-import { Loader2, Download, Eye, AlertCircle } from 'lucide-react';
|
|
|
+import { Loader2, Download, AlertCircle } from 'lucide-react';
|
|
|
import { toast } from 'sonner';
|
|
|
import { useAuth } from '@/client/home/hooks/AuthProvider';
|
|
|
import { useNavigate } from 'react-router-dom';
|
|
|
@@ -53,7 +53,7 @@ const FilePreview: React.FC<FilePreviewProps> = ({ templateId, onClose }) => {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- if (!template.isFree && !user.membership) {
|
|
|
+ if (!template.isFree && user?.userType !== 'premium') {
|
|
|
toast.error('需要购买会员才能下载');
|
|
|
navigate('/pricing');
|
|
|
return;
|
|
|
@@ -80,20 +80,6 @@ const FilePreview: React.FC<FilePreviewProps> = ({ templateId, onClose }) => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- const getFileIcon = (fileType: string) => {
|
|
|
- switch (fileType) {
|
|
|
- case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
|
|
|
- return '📝';
|
|
|
- case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
|
|
|
- return '📊';
|
|
|
- case 'application/vnd.openxmlformats-officedocument.presentationml.presentation':
|
|
|
- return '📊';
|
|
|
- case 'application/pdf':
|
|
|
- return '📄';
|
|
|
- default:
|
|
|
- return '📁';
|
|
|
- }
|
|
|
- };
|
|
|
|
|
|
const renderPreview = () => {
|
|
|
if (!previewUrl) {
|
|
|
@@ -215,7 +201,7 @@ const FilePreview: React.FC<FilePreviewProps> = ({ templateId, onClose }) => {
|
|
|
</Button>
|
|
|
<Button
|
|
|
onClick={handleDownload}
|
|
|
- disabled={!template.isFree && !user?.membership}
|
|
|
+ disabled={!template.isFree && user?.userType !== 'premium'}
|
|
|
>
|
|
|
<Download className="w-4 h-4 mr-2" />
|
|
|
{template.isFree ? '免费下载' : '会员下载'}
|