客製化開運水晶多手串

import React, { useState } from 'react'; import { CreditCard, MessageCircle, Clock, Package, CheckCircle, Sparkles, Gem, Heart, Ruler, Send, Star, Menu, X, Loader2, Wand2 } from 'lucide-react'; const CrystalShop = () => { const [isMenuOpen, setIsMenuOpen] = useState(false); const [isSubmitting, setIsSubmitting] = useState(false); // 新增:表單提交狀態 const [formData, setFormData] = useState({ name: '', contact: '', phone: '', storeName: '', wristSize: '', budget: '', intentions: [], note: '' }); // Oracle State const [oracleInput, setOracleInput] = useState(''); const [oracleResult, setOracleResult] = useState(null); const [isOracleLoading, setIsOracleLoading] = useState(false); const intentionsList = [ { id: 'love', label: '招桃花/人緣', color: 'bg-pink-100 text-pink-600 border-pink-200' }, { id: 'wealth', label: '招財/事業', color: 'bg-yellow-100 text-yellow-600 border-yellow-200' }, { id: 'health', label: '健康/平安', color: 'bg-green-100 text-green-600 border-green-200' }, { id: 'wisdom', label: '智慧/學業', color: 'bg-blue-100 text-blue-600 border-blue-200' }, { id: 'protection', label: '避邪/擋煞', color: 'bg-purple-100 text-purple-600 border-purple-200' }, ]; const handleInputChange = (e) => { const { name, value } = e.target; setFormData(prev => ({ ...prev, [name]: value })); }; const toggleIntention = (id) => { setFormData(prev => { const current = prev.intentions; if (current.includes(id)) { return { ...prev, intentions: current.filter(item => item !== id) }; } else { return { ...prev, intentions: [...current, id] }; } }); }; const handleSubmit = async (e) => { e.preventDefault(); setIsSubmitting(true); // Google Apps Script Web App URL // 步驟說明: // 1. 在 Google Sheet 點擊「擴充功能」>「Apps Script」 // 2. 貼上接收 POST 請求的腳本 (doPost) // 3. 點擊「部署」>「新增部署作業」> 類型選「網頁應用程式」 // 4. 設定為「執行身分:我」、「存取權:任何人」 // 5. 複製生成的網址 (Web App URL) 貼在下方引號中 const SCRIPT_URL = "YOUR_GOOGLE_SCRIPT_URL_HERE"; try { // 為了演示效果,這裡使用 setTimeout 模擬資料傳送過程 // 如果您已經有真實的 URL,請取消下方 fetch 區塊的註解並填入上面的 URL /* const formDataToSend = new FormData(); for (const key in formData) { formDataToSend.append(key, formData[key]); } await fetch(SCRIPT_URL, { method: 'POST', mode: 'no-cors', // 跨域傳送至 Google Script 通常需要 no-cors body: formDataToSend }); */ // 模擬網路傳輸延遲 1.5 秒 await new Promise(resolve => setTimeout(resolve, 1500)); alert('感謝您的填寫!訂單已成功傳送到雲端,小熊老師將盡快與您聯繫。'); // 成功後清空表單 setFormData({ name: '', contact: '', phone: '', storeName: '', wristSize: '', budget: '', intentions: [], note: '' }); } catch (error) { console.error("Submission Error:", error); alert('傳送發生問題,請稍後再試,或直接聯繫小熊老師。'); } finally { setIsSubmitting(false); } }; // Gemini API Integration const askOracle = async () => { if (!oracleInput.trim()) return; setIsOracleLoading(true); setOracleResult(null); try { const apiKey = ""; // The execution environment provides the key at runtime. const prompt = `你是一位溫暖療癒的水晶手作職人「小熊老師」。 使用者目前的狀態或煩惱是:「${oracleInput}」。 請根據這個情況: 1. 推薦 1-2 種適合的水晶。 2. 給予一段簡短、溫柔且充滿能量的祝福語(約 50-80 字)。 3. 語氣要像朋友一樣親切,多使用 emoji ✨。 請直接以繁體中文回答,不需要開頭問候。`; const response = await fetch( `https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-preview-09-2025:generateContent?key=${apiKey}`, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ contents: [{ parts: [{ text: prompt }] }], }), } ); const data = await response.json(); const text = data.candidates?.[0]?.content?.parts?.[0]?.text; setOracleResult(text); } catch (error) { console.error("Oracle error:", error); setOracleResult("抱歉,水晶球現在有點霧霧的,請稍後再試一次~ 🔮"); } finally { setIsOracleLoading(false); } }; const steps = [ { icon: , title: "1. 確定製作匯款", desc: "確認您的需求後進行付款", color: "from-blue-100 to-blue-200" }, { icon: , title: "2. 線上諮詢", desc: "半小時看盤 & 確認設計方向", color: "from-purple-100 to-purple-200" }, { icon: , title: "3. 客製化製作", desc: "精心製作時間約 7~10 天", color: "from-amber-100 to-amber-200" }, { icon: , title: "4. 交貨寄送", desc: "包裝精美並安全寄出", color: "from-cyan-100 to-cyan-200" }, { icon: , title: "5. 確認收到", desc: "收到充滿能量的水晶", color: "from-green-100 to-green-200" } ]; const galleryItems = [ { id: 1, image: '106893_0.jpg', title: '紫韻星辰手串', desc: '紫水晶與黑曜石的神秘結合,帶來智慧與保護。', tags: [ { name: '紫水晶', color: 'bg-purple-100 text-purple-600' }, { name: '黑曜石', color: 'bg-slate-100 text-slate-600' } ] }, { id: 2, image: '106890_0.jpg', title: '大地豐饒手串', desc: '融合大地色系水晶,象徵穩重與財富的積累。', tags: [ { name: '茶晶', color: 'bg-amber-100 text-amber-600' }, { name: '虎眼石', color: 'bg-yellow-100 text-yellow-600' } ] }, { id: 3, image: '106889_0.jpg', title: '五行平衡多寶串', desc: '匯聚多種能量水晶,調節身心靈的平衡。', tags: [ { name: '多寶水晶', color: 'bg-rose-100 text-rose-600' }, { name: '平衡能量', color: 'bg-teal-100 text-teal-600' } ] }, { id: 4, image: '106892_0.jpg', title: '森之精靈雙圈手鍊', desc: '綠色系與深色水晶的雙圈設計,充滿生機與層次感。', tags: [ { name: '綠幽靈', color: 'bg-green-100 text-green-600' }, { name: '設計款', color: 'bg-indigo-100 text-indigo-600' } ] } ]; return (
{/* Navigation */}
小熊老師水晶手作
{/* Mobile Menu Button */} {/* Desktop Menu */}
製作流程 作品欣賞 ✨ 靈感水晶球 立即訂製
{/* Mobile Menu Dropdown */} {isMenuOpen && (
setIsMenuOpen(false)}>製作流程 setIsMenuOpen(false)}>作品欣賞 setIsMenuOpen(false)}>✨ 靈感水晶球 setIsMenuOpen(false)}>立即訂製
)}
{/* Hero Section */}
 
 
 

專屬於你的靈魂水晶

透過生命靈數與能量感應,小熊老師為您量身打造獨一無二的多寶水晶手串。 每一顆水晶,都是宇宙給您的溫柔祝福。

開啟您的水晶之旅
{/* Process Section */}

🐻 小熊老師 水晶製作流程

 
 
{steps.map((step, index) => (
{step.icon}

{step.title}

{step.desc}

{index < steps.length - 1 && (
▼
)}
))}
{/* Gallery Section */}
 
 
 

作品欣賞

每一串都是獨一無二的故事,等待與你相遇。

{galleryItems.map((item) => (
 
{item.title} { e.target.onerror = null; e.target.src = 'https://via.placeholder.com/400x400?text=水晶手串'; }} />
 

{item.title}

{item.desc}

{item.tags.map((tag, index) => ( {tag.name} ))}
))}
{/* NEW: Oracle Section (Gemini API Feature) */}
{/* Background Effects */}
 
 

✨ 小熊老師的靈感水晶球 ✨

心中有迷惘嗎?告訴小熊老師你最近的心情或煩惱, 讓 AI 魔法為您感應專屬於您的能量指引。

{/* Footer */}

小熊老師水晶手作

讓水晶的能量,溫暖你的每一天。

Instagram Facebook Line@
© 2024 Bear Crystal Studio. All rights reserved.
); }; export default CrystalShop;