提取 calcOfficialEquiv 为公共工具函数,7 个 Home 模板和 Packages 页面共用,自动选择折扣比例最大的模型展示等价额度。 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2 lines
7.3 KiB
JavaScript
2 lines
7.3 KiB
JavaScript
import{u as b,a as D,r as c,f as g,l as f,j as e,L as l,Q as N}from"./index-ClhW4pXr.js";import{c as v}from"./officialEquiv-COyn5GUF.js";import{C as x}from"./CountUp-DKNTcuWU.js";import{F as r}from"./FadeContent-Cswq021Y.js";import{u as y}from"./useTranslation-Pq_l7wMn.js";function S(){const{t}=y(),{user:i}=b(),{site:d}=D(),[u,p]=c.useState([]),[m,j]=c.useState([]);c.useEffect(()=>{g().then(s=>{s.data.success&&p(s.data.data||[])}).catch(()=>{}),f().then(s=>{s.data.success&&j(s.data.data||[])}).catch(()=>{})},[]);const o=u.filter(s=>s.enabled!==!1);return e.jsxs("div",{children:[e.jsxs("section",{className:"max-w-5xl mx-auto px-6 pt-32 pb-20",children:[e.jsx(r,{blur:!0,duration:800,delay:100,children:e.jsxs("div",{className:"max-w-3xl",children:[e.jsx("h1",{className:"text-5xl md:text-6xl font-heading font-bold text-[#3D3024] leading-[1.1] tracking-tight",children:(d==null?void 0:d.name)||t("home.defaultHeroTitle")}),e.jsx("p",{className:"text-lg text-[#6B5D4F] mt-6 leading-relaxed max-w-xl",children:t("home.heroSubtitle")}),e.jsx("div",{className:"flex items-center gap-4 mt-10",children:i?e.jsxs(l,{to:"/dashboard",className:"px-7 py-3 rounded-full bg-[#D97757] text-white font-medium text-sm hover:bg-[#C4613F] transition-colors",children:[t("home.goToDashboard")," →"]}):e.jsxs(e.Fragment,{children:[e.jsx(l,{to:"/register",className:"px-7 py-3 rounded-full bg-[#D97757] text-white font-medium text-sm hover:bg-[#C4613F] transition-colors",children:t("home.getStarted")}),e.jsxs(l,{to:"/pricing",className:"px-7 py-3 text-[#8B7D6E] font-medium text-sm hover:text-[#3D3024] transition-colors",children:[t("home.viewPricing")," →"]})]})})]})}),e.jsx(r,{blur:!0,duration:800,delay:400,children:e.jsxs("div",{className:"flex items-center gap-12 mt-20 pt-10 border-t border-[#E8DDD0]",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"text-2xl font-bold text-[#3D3024]",children:[e.jsx(x,{from:0,to:o.length||50,duration:2}),"+"]}),e.jsx("p",{className:"text-sm text-[#8B7D6E] mt-0.5",children:t("home.aiModels")})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"text-2xl font-bold text-[#3D3024]",children:[e.jsx(x,{from:0,to:99.9,duration:2.5}),"%"]}),e.jsx("p",{className:"text-sm text-[#8B7D6E] mt-0.5",children:t("home.uptime")})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"text-2xl font-bold text-[#3D3024]",children:["<",e.jsx(x,{from:200,to:50,duration:2,direction:"down"}),"ms"]}),e.jsx("p",{className:"text-sm text-[#8B7D6E] mt-0.5",children:t("home.latency")})]})]})})]}),e.jsx("section",{className:"bg-[#F5EEE6]",children:e.jsx("div",{className:"max-w-5xl mx-auto px-6 py-20",children:e.jsxs(r,{blur:!0,duration:800,delay:100,children:[e.jsx("h2",{className:"text-2xl font-heading font-bold text-[#3D3024] mb-2",children:t("home.whyChooseUs")}),e.jsx("p",{className:"text-[#8B7D6E] mb-10",children:t("home.whyChooseUsDesc")}),e.jsx("div",{className:"space-y-0",children:[{title:t("home.lightningFast"),desc:t("home.lightningFastDesc")},{title:t("home.securePrivate"),desc:t("home.securePrivateDesc")},{title:t("home.payAsYouGo"),desc:t("home.payAsYouGoDesc")}].map((s,a)=>e.jsxs("div",{className:"flex gap-6 items-start py-6 border-b border-[#E8DDD0] last:border-0 group",children:[e.jsxs("span",{className:"text-sm font-mono text-[#D97757]/50 mt-0.5",children:["0",a+1]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-semibold text-[#3D3024] mb-1 group-hover:text-[#D97757] transition-colors",children:s.title}),e.jsx("p",{className:"text-sm text-[#6B5D4F] leading-relaxed max-w-lg",children:s.desc})]})]},a))})]})})}),o.length>0&&e.jsx("section",{className:"max-w-5xl mx-auto px-6 py-20",children:e.jsxs(r,{blur:!0,duration:800,delay:100,children:[e.jsxs("div",{className:"flex items-end justify-between mb-8",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-heading font-bold text-[#3D3024] mb-2",children:t("home.availableModels")}),e.jsx("p",{className:"text-[#8B7D6E]",children:t("home.availableModelsDesc",{count:o.length})})]}),o.length>8&&e.jsxs(l,{to:"/pricing",className:"text-sm text-[#D97757] hover:text-[#C4613F] transition-colors",children:[t("home.viewAllModels",{count:o.length})," →"]})]}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:o.slice(0,8).map((s,a)=>e.jsx("div",{className:"px-4 py-3 rounded-lg border border-[#E8DDD0] hover:border-[#D9C5B2] transition-colors",children:e.jsx("span",{className:"text-sm text-[#6B5D4F] font-mono",children:s.display_name||s.model_name})},s.id||a))})]})}),m.length>0&&e.jsx("section",{className:"max-w-5xl mx-auto px-6 py-20",children:e.jsxs(r,{blur:!0,duration:800,delay:100,children:[e.jsx("h2",{className:"text-2xl font-heading font-bold text-[#3D3024] mb-2",children:t("home.plansPackages")}),e.jsx("p",{className:"text-[#8B7D6E] mb-10",children:t("home.choosePlan")}),e.jsx("div",{className:"grid md:grid-cols-3 gap-4 max-w-4xl",children:m.filter(s=>s.enabled).slice(0,3).map((s,a)=>{const h=s.quota_amount>0?s.quota_amount/N:0,n=v(o,h);return e.jsxs("div",{className:`rounded-xl p-6 flex flex-col border transition-all ${a===1?"border-[#D97757]/30 bg-[#D97757]/[0.04]":"border-[#E8DDD0] hover:border-[#D9C5B2]"}`,children:[a===1&&e.jsx("span",{className:"text-xs text-[#D97757] font-medium mb-2 uppercase tracking-wider",children:t("home.popular")||"Popular"}),e.jsx("h3",{className:"text-base font-semibold text-[#3D3024]",children:s.name}),s.description&&e.jsx("p",{className:"text-sm text-[#8B7D6E] mt-1",children:s.description}),e.jsxs("div",{className:"mt-auto pt-6",children:[e.jsxs("span",{className:"text-3xl font-bold text-[#3D3024]",children:["$",s.price]}),s.original_price>s.price&&e.jsxs("span",{className:"text-sm text-[#8B7D6E] line-through ml-2",children:["$",s.original_price]}),s.duration>0&&e.jsx("p",{className:"text-xs text-[#8B7D6E] mt-1",children:t("home.days",{count:s.duration})})]}),n&&n.equivDollars>h&&e.jsxs("p",{className:"text-xs text-[#D97757] mt-2",children:["🔥 ",t("packages.officialEquiv",{model:n.label,amount:Math.round(n.equivDollars)})]}),e.jsx(l,{to:i?"/packages":"/register",className:`mt-4 py-2.5 rounded-full font-medium text-sm text-center transition-colors ${a===1?"bg-[#D97757] text-white hover:bg-[#C4613F]":"bg-[#E8DDD0] text-[#3D3024] hover:bg-[#D9C5B2]"}`,children:t(i?"home.subscribe":"home.getStarted")})]},s.id)})})]})}),e.jsx("section",{className:"max-w-5xl mx-auto px-6 py-24",children:e.jsx(r,{blur:!0,duration:800,delay:100,children:e.jsxs("div",{className:"border-t border-[#E8DDD0] pt-16 text-center",children:[e.jsx("h2",{className:"text-2xl font-heading font-bold text-[#3D3024] mb-3",children:t("home.readyToStart")}),e.jsx("p",{className:"text-[#8B7D6E] mb-8 max-w-md mx-auto",children:t("home.readyToStartDesc")}),e.jsx("div",{className:"flex items-center justify-center gap-4",children:i?e.jsxs(l,{to:"/dashboard",className:"px-7 py-3 rounded-full bg-[#D97757] text-white font-medium text-sm hover:bg-[#C4613F] transition-colors",children:[t("home.goToDashboard")," →"]}):e.jsxs(e.Fragment,{children:[e.jsxs(l,{to:"/register",className:"px-7 py-3 rounded-full bg-[#D97757] text-white font-medium text-sm hover:bg-[#C4613F] transition-colors",children:[t("home.createFreeAccount")," →"]}),e.jsx(l,{to:"/login",className:"px-7 py-3 text-[#8B7D6E] font-medium text-sm hover:text-[#3D3024] transition-colors",children:t("home.signIn")})]})})]})})})]})}export{S as default};
|