fix: 修复TypeScript类型错误
- 移除未使用的导入 - 修复产品详情页面的description类型错误 - 修复服务详情页面的description类型错误 - 修复联系表单API的类型错误 - 添加Award图标的导入
This commit is contained in:
@@ -13,13 +13,36 @@ export default function ContactPage() {
|
||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||
const [isSubmitted, setIsSubmitted] = useState(false);
|
||||
|
||||
async function handleSubmit(_formData: FormData) {
|
||||
async function handleSubmit(formData: FormData) {
|
||||
setIsSubmitting(true);
|
||||
|
||||
await new Promise(resolve => setTimeout(resolve, 1500));
|
||||
|
||||
setIsSubmitting(false);
|
||||
setIsSubmitted(true);
|
||||
try {
|
||||
const response = await fetch('/api/contact', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
name: formData.get('name'),
|
||||
phone: formData.get('phone'),
|
||||
email: formData.get('email'),
|
||||
subject: formData.get('subject'),
|
||||
message: formData.get('message'),
|
||||
}),
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const errorData = await response.json();
|
||||
throw new Error(errorData.error || '发送失败,请稍后再试');
|
||||
}
|
||||
|
||||
setIsSubmitted(true);
|
||||
} catch (error) {
|
||||
console.error('Form submission error:', error);
|
||||
alert(error instanceof Error ? error.message : '发送失败,请稍后再试');
|
||||
} finally {
|
||||
setIsSubmitting(false);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -3,7 +3,7 @@ import { PRODUCTS, COMPANY_INFO } from '@/lib/constants';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { ArrowRight, Check, TrendingUp, Code, Cloud, Database, Server, Briefcase, Target, Users, Award } from 'lucide-react';
|
||||
import { ArrowRight, Check, TrendingUp, Code, Cloud, Database, Server, Target, Users } from 'lucide-react';
|
||||
|
||||
interface ProductDetailPageProps {
|
||||
params: Promise<{ id: string }>;
|
||||
@@ -22,7 +22,7 @@ export async function generateMetadata({ params }: ProductDetailPageProps) {
|
||||
|
||||
return {
|
||||
title: `${product.title} - ${COMPANY_INFO.name}`,
|
||||
description: product.fullDescription || product.description,
|
||||
description: product.fullDescription,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { SERVICES, COMPANY_INFO } from '@/lib/constants';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { ArrowRight, Check, Target, Users, Award, Briefcase, CheckCircle, FileText, Shield, TrendingUp } from 'lucide-react';
|
||||
import { ArrowRight, CheckCircle, FileText, Award } from 'lucide-react';
|
||||
|
||||
interface ServiceDetailPageProps {
|
||||
params: Promise<{ id: string }>;
|
||||
@@ -22,7 +22,7 @@ export async function generateMetadata({ params }: ServiceDetailPageProps) {
|
||||
|
||||
return {
|
||||
title: `${service.title} - ${COMPANY_INFO.name}`,
|
||||
description: service.fullDescription || service.description,
|
||||
description: service.fullDescription,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user