diff --git a/src/app/(marketing)/contact/page.tsx b/src/app/(marketing)/contact/page.tsx index 9c570ed..9214d53 100644 --- a/src/app/(marketing)/contact/page.tsx +++ b/src/app/(marketing)/contact/page.tsx @@ -50,7 +50,6 @@ function ContactFormContent() { }); const [errors, setErrors] = useState({}); const sectionRef = useRef(null); - const hasProcessedSuccess = useRef(isSuccessFromRedirect); useEffect(() => { requestAnimationFrame(() => { @@ -58,13 +57,6 @@ function ContactFormContent() { }); }, []); - useEffect(() => { - if (isSuccessFromRedirect && !hasProcessedSuccess.current) { - hasProcessedSuccess.current = true; - window.history.replaceState({}, '', '/contact'); - } - }, [isSuccessFromRedirect]); - const validateField = (field: keyof ContactFormData, value: string) => { try { contactFormSchema.shape[field].parse(value); @@ -106,8 +98,9 @@ function ContactFormContent() { } setIsSubmitting(true); + try { - const formEndpoint = `https://formsubmit.co/${COMPANY_INFO.email}`; + const formEndpoint = `https://formsubmit.co/ajax/${COMPANY_INFO.email}`; const formBody = new URLSearchParams(); formBody.append('name', formData.name); formBody.append('phone', formData.phone); @@ -117,31 +110,30 @@ function ContactFormContent() { formBody.append('_subject', `网站留言: ${formData.subject}`); formBody.append('_captcha', 'false'); formBody.append('_template', 'table'); - formBody.append('_next', `${window.location.origin}/contact?success=true`); - + const response = await fetch(formEndpoint, { method: 'POST', headers: { 'Accept': 'application/json' }, body: formBody, }); - + const data = await response.json(); - - if (response.ok && data.success === 'true') { - setIsSubmitted(true); + + if (response.ok && (data.success === 'true' || data.success === true)) { setToastMessage('表单提交成功!我们会尽快与您联系。'); setToastType('success'); setShowToast(true); + setIsSubmitted(true); setFormData({ name: '', phone: '', email: '', subject: '', message: '' }); + setErrors({}); } else { const errorMsg = data.message || '提交失败,请稍后重试或直接发送邮件联系我们。'; if (errorMsg.includes('HTML files') || errorMsg.includes('web server')) { setToastMessage('表单服务需要在生产环境激活。部署后首次提交会发送确认邮件到 ' + COMPANY_INFO.email); - setToastType('error'); } else { setToastMessage(errorMsg); - setToastType('error'); } + setToastType('error'); setShowToast(true); } } catch { @@ -180,7 +172,7 @@ function ContactFormContent() { 联系我们

- 开启 合作 + 开启 合作

无论您有任何问题或合作意向,我们都很乐意与您交流 diff --git a/src/app/(marketing)/home-content.tsx b/src/app/(marketing)/home-content.tsx index 54aa852..f088f0d 100644 --- a/src/app/(marketing)/home-content.tsx +++ b/src/app/(marketing)/home-content.tsx @@ -51,17 +51,31 @@ function HomeContent() { useEffect(() => { const section = searchParams.get('section'); - if (section) { - const timer = setTimeout(() => { - const targetElement = document.getElementById(section); - if (targetElement) { - targetElement.scrollIntoView({ behavior: 'smooth', block: 'start' }); - } - }, 100); - - return () => clearTimeout(timer); - } - return undefined; + if (!section) {return;} + + const maxAttempts = 50; + const interval = 100; + let attempts = 0; + + const scrollToSection = () => { + const targetElement = document.getElementById(section); + if (targetElement) { + targetElement.scrollIntoView({ behavior: 'smooth', block: 'start' }); + return true; + } + return false; + }; + + if (scrollToSection()) {return;} + + const timer = setInterval(() => { + attempts++; + if (scrollToSection() || attempts >= maxAttempts) { + clearInterval(timer); + } + }, interval); + + return () => clearInterval(timer); }, [searchParams]); return ( diff --git a/src/app/fonts/AoyagiReisho.ttf b/src/app/fonts/AoyagiReisho.ttf new file mode 100644 index 0000000..738dc99 Binary files /dev/null and b/src/app/fonts/AoyagiReisho.ttf differ diff --git a/src/app/globals.css b/src/app/globals.css index a680c1e..6a77cd6 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -19,6 +19,10 @@ font-family: 'Aoyagi Reisho', 'STKaiti', 'KaiTi', serif; } +.font-calligraphy { + font-family: var(--font-aoyagi-reisho), 'STKaiti', 'KaiTi', serif !important; +} + @theme inline { --font-sans: var(--font-geist-sans); --font-mono: var(--font-geist-mono); diff --git a/src/app/layout.tsx b/src/app/layout.tsx index bf8f61c..bad7024 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,5 +1,6 @@ import type { Metadata, Viewport } from "next"; import { Geist, Geist_Mono, Noto_Sans_SC, Ma_Shan_Zheng, Long_Cang } from "next/font/google"; +import localFont from "next/font/local"; import "./globals.css"; import { ThemeProvider } from "@/contexts/theme-context"; import { GoogleAnalytics } from "@/components/analytics/GoogleAnalytics"; @@ -47,6 +48,13 @@ const longCang = Long_Cang({ preload: false, }); +const aoyagiReisho = localFont({ + src: "./fonts/AoyagiReisho.ttf", + variable: "--font-aoyagi-reisho", + display: "swap", + preload: true, +}); + export const metadata: Metadata = { title: { default: "四川睿新致远科技有限公司 - 企业数字化转型服务商", @@ -130,7 +138,7 @@ export default function RootLayout({ diff --git a/src/components/sections/cases-section.tsx b/src/components/sections/cases-section.tsx index f092511..91af57c 100644 --- a/src/components/sections/cases-section.tsx +++ b/src/components/sections/cases-section.tsx @@ -28,7 +28,7 @@ export function CasesSection() { className="text-center max-w-3xl mx-auto mb-16" >

- 与谁同行,决定能走多远 + 与谁同行,决定能走多远

我们与优秀的企业同行,共同成长,共创未来 diff --git a/src/components/sections/news-section.tsx b/src/components/sections/news-section.tsx index 7757a7f..d6b1f3a 100644 --- a/src/components/sections/news-section.tsx +++ b/src/components/sections/news-section.tsx @@ -26,7 +26,7 @@ export function NewsSection() { className="text-center max-w-3xl mx-auto mb-16" >

- 最新资讯 + 最新资讯

了解公司最新动态、行业资讯和技术分享 diff --git a/src/components/sections/products-section.tsx b/src/components/sections/products-section.tsx index 1b76928..930a68f 100644 --- a/src/components/sections/products-section.tsx +++ b/src/components/sections/products-section.tsx @@ -26,7 +26,7 @@ export function ProductsSection() { className="text-center max-w-3xl mx-auto mb-16" >

- 我们的产品 + 我们的产品

自主研发的企业级产品,助力企业高效运营,实现数字化转型 diff --git a/src/components/sections/services-section.tsx b/src/components/sections/services-section.tsx index c0f71b0..4b0e63b 100644 --- a/src/components/sections/services-section.tsx +++ b/src/components/sections/services-section.tsx @@ -33,7 +33,7 @@ export function ServicesSection() { className="text-center max-w-3xl mx-auto mb-16" >

- 我们的 核心业务 + 我们的 核心业务

专业技术团队,为您提供全方位的数字化解决方案