'use client'; import { useState, useEffect } from 'react'; import { Header } from '../../components/Header'; import { Footer } from '../../components/Footer'; export default function ContactPage() { const [currentLang, setCurrentLang] = useState('zh-CN'); const [isLoading, setIsLoading] = useState(true); const [formData, setFormData] = useState({ name: '', email: '', company: '', message: '', }); useEffect(() => { const detectLanguage = () => { const browserLang = navigator.language || navigator.languages[0]; if (browserLang.startsWith('zh-TW') || browserLang.startsWith('zh-HK')) { setCurrentLang('zh-TW'); } else if (browserLang.startsWith('en')) { setCurrentLang('en'); } else { setCurrentLang('zh-CN'); } setIsLoading(false); }; detectLanguage(); }, []); const content = { 'zh-CN': { title: '联系我们', subtitle: '我们很乐意为您提供帮助和支持', nav: { home: '首页', docs: '文档', about: '关于', contact: '联系我们', }, form: { title: '发送消息', name: '姓名', email: '邮箱', company: '公司', message: '消息', submit: '发送消息', namePlaceholder: '请输入您的姓名', emailPlaceholder: '请输入您的邮箱地址', companyPlaceholder: '请输入您的公司名称(可选)', messagePlaceholder: '请描述您的需求或问题...', }, contact: { title: '联系方式', email: { title: '邮箱', value: 'contact@multisite.com', }, phone: { title: '电话', value: '+86 400-123-4567', }, address: { title: '地址', value: '北京市朝阳区科技园区创新大厦 A 座 1001 室', }, hours: { title: '工作时间', value: '周一至周五 9:00 - 18:00', }, }, support: { title: '技术支持', items: [ { title: '在线文档', description: '查看详细的使用指南和 API 文档', link: '/docs', }, { title: 'GitHub', description: '访问我们的开源项目和代码示例', link: 'https://github.com', }, { title: '社区论坛', description: '与其他开发者交流经验和解决方案', link: '#', }, ], }, }, 'zh-TW': { title: '聯繫我們', subtitle: '我們很樂意為您提供幫助和支援', nav: { home: '首頁', docs: '文檔', about: '關於', contact: '聯繫我們', }, form: { title: '發送消息', name: '姓名', email: '郵箱', company: '公司', message: '消息', submit: '發送消息', namePlaceholder: '請輸入您的姓名', emailPlaceholder: '請輸入您的郵箱地址', companyPlaceholder: '請輸入您的公司名稱(可選)', messagePlaceholder: '請描述您的需求或問題...', }, contact: { title: '聯繫方式', email: { title: '郵箱', value: 'contact@multisite.com', }, phone: { title: '電話', value: '+86 400-123-4567', }, address: { title: '地址', value: '北京市朝陽區科技園區創新大廈 A 座 1001 室', }, hours: { title: '工作時間', value: '週一至週五 9:00 - 18:00', }, }, support: { title: '技術支援', items: [ { title: '在線文檔', description: '查看詳細的使用指南和 API 文檔', link: '/docs', }, { title: 'GitHub', description: '訪問我們的開源項目和代碼示例', link: 'https://github.com', }, { title: '社區論壇', description: '與其他開發者交流經驗和解決方案', link: '#', }, ], }, }, en: { title: 'Contact Us', subtitle: "We'd love to help and support you", nav: { home: 'Home', docs: 'Docs', about: 'About', contact: 'Contact', }, form: { title: 'Send Message', name: 'Name', email: 'Email', company: 'Company', message: 'Message', submit: 'Send Message', namePlaceholder: 'Enter your name', emailPlaceholder: 'Enter your email address', companyPlaceholder: 'Enter your company name (optional)', messagePlaceholder: 'Describe your needs or questions...', }, contact: { title: 'Contact Information', email: { title: 'Email', value: 'contact@multisite.com', }, phone: { title: 'Phone', value: '+86 400-123-4567', }, address: { title: 'Address', value: 'Room 1001, Building A, Innovation Tower, Tech Park, Chaoyang District, Beijing', }, hours: { title: 'Business Hours', value: 'Monday - Friday 9:00 AM - 6:00 PM', }, }, support: { title: 'Technical Support', items: [ { title: 'Documentation', description: 'View detailed usage guides and API documentation', link: '/docs', }, { title: 'GitHub', description: 'Access our open source projects and code examples', link: 'https://github.com', }, { title: 'Community Forum', description: 'Exchange experiences and solutions with other developers', link: '#', }, ], }, }, }; const currentContent = content[currentLang]; const handleInputChange = (e: React.ChangeEvent) => { const { name, value } = e.target; setFormData((prev) => ({ ...prev, [name]: value, })); }; const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); // 这里可以添加表单提交逻辑 console.log('Form submitted:', formData); alert(currentLang === 'en' ? 'Message sent successfully!' : '消息发送成功!'); }; if (isLoading) { return (
); } return (
{/* Hero Section */}

{currentContent.title}

{currentContent.subtitle}

{/* Main Content */}
{/* Contact Form */}

{currentContent.form.title}

{/* Contact Information */}

{currentContent.contact.title}

{currentContent.contact.email.title}

{currentContent.contact.email.value}

{currentContent.contact.phone.title}

{currentContent.contact.phone.value}

{currentContent.contact.address.title}

{currentContent.contact.address.value}

{currentContent.contact.hours.title}

{currentContent.contact.hours.value}

{/* Technical Support */}

{currentContent.support.title}

{currentContent.support.items.map((item, index) => ( ))}
); }