提取 calcOfficialEquiv 为公共工具函数,7 个 Home 模板和 Packages 页面共用,自动选择折扣比例最大的模型展示等价额度。 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2 lines
8.7 KiB
JavaScript
2 lines
8.7 KiB
JavaScript
import{u as j,a as g,r as c,f as v,l as f,j as e,L as a,Q as N}from"./index-ClhW4pXr.js";import{c as w}from"./officialEquiv-COyn5GUF.js";import{C as x}from"./CountUp-DKNTcuWU.js";import{F as n}from"./FadeContent-Cswq021Y.js";import{u as y}from"./useTranslation-Pq_l7wMn.js";function L(){const{t}=y(),{user:o}=j(),{site:d}=g(),[u,b]=c.useState([]),[m,p]=c.useState([]);c.useEffect(()=>{v().then(s=>{s.data.success&&b(s.data.data||[])}).catch(()=>{}),f().then(s=>{s.data.success&&p(s.data.data||[])}).catch(()=>{})},[]);const r=u.filter(s=>s.enabled!==!1);return e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:e.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 w-[900px] h-[500px] bg-gradient-radial from-brand-600/15 to-transparent blur-3xl opacity-60"})}),e.jsxs("section",{className:"relative max-w-5xl mx-auto px-6 pt-32 pb-20",children:[e.jsx(n,{blur:!0,duration:800,delay:100,children:e.jsxs("div",{className:"text-center max-w-3xl mx-auto",children:[e.jsx("p",{className:"text-sm font-medium text-brand-400 mb-4 tracking-wide uppercase",children:t("home.heroTagline")||"AI API Platform"}),e.jsx("h1",{className:"text-5xl md:text-6xl font-heading font-bold text-white leading-[1.1] tracking-tight",children:(d==null?void 0:d.name)||t("home.defaultHeroTitle")}),e.jsx("p",{className:"text-lg text-neutral-400 mt-6 leading-relaxed max-w-xl mx-auto",children:t("home.heroSubtitle")}),e.jsx("div",{className:"flex items-center justify-center gap-4 mt-10",children:o?e.jsxs(a,{to:"/dashboard",className:"px-7 py-3 rounded-xl bg-brand-600 text-white font-medium text-sm hover:bg-brand-500 transition-colors shadow-lg shadow-brand-600/20",children:[t("home.goToDashboard")," →"]}):e.jsxs(e.Fragment,{children:[e.jsx(a,{to:"/register",className:"px-7 py-3 rounded-xl bg-brand-600 text-white font-medium text-sm hover:bg-brand-500 transition-colors shadow-lg shadow-brand-600/20",children:t("home.getStarted")}),e.jsxs(a,{to:"/pricing",className:"px-7 py-3 text-neutral-400 font-medium text-sm hover:text-white transition-colors",children:[t("home.viewPricing")," →"]})]})})]})}),e.jsx(n,{blur:!0,duration:800,delay:400,children:e.jsxs("div",{className:"grid grid-cols-3 gap-8 max-w-lg mx-auto mt-20 pt-10 border-t border-neutral-800/60",children:[e.jsxs("div",{className:"text-center",children:[e.jsxs("div",{className:"text-2xl font-bold text-white",children:[e.jsx(x,{from:0,to:r.length||50,duration:2}),"+"]}),e.jsx("p",{className:"text-sm text-neutral-500 mt-0.5",children:t("home.aiModels")})]}),e.jsxs("div",{className:"text-center",children:[e.jsxs("div",{className:"text-2xl font-bold text-white",children:[e.jsx(x,{from:0,to:99.9,duration:2.5}),"%"]}),e.jsx("p",{className:"text-sm text-neutral-500 mt-0.5",children:t("home.uptime")})]}),e.jsxs("div",{className:"text-center",children:[e.jsxs("div",{className:"text-2xl font-bold text-white",children:["<",e.jsx(x,{from:200,to:50,duration:2,direction:"down"}),"ms"]}),e.jsx("p",{className:"text-sm text-neutral-500 mt-0.5",children:t("home.latency")})]})]})})]}),e.jsx("section",{className:"max-w-5xl mx-auto px-6 py-20",children:e.jsxs(n,{blur:!0,duration:800,delay:100,children:[e.jsxs("div",{className:"text-center mb-14",children:[e.jsx("h2",{className:"text-2xl font-heading font-bold text-white mb-3",children:t("home.whyChooseUs")}),e.jsx("p",{className:"text-neutral-500",children:t("home.whyChooseUsDesc")})]}),e.jsx("div",{className:"grid md:grid-cols-3 gap-5",children:[{title:t("home.lightningFast"),desc:t("home.lightningFastDesc"),icon:e.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M13 10V3L4 14h7v7l9-11h-7z"})})},{title:t("home.securePrivate"),desc:t("home.securePrivateDesc"),icon:e.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})})},{title:t("home.payAsYouGo"),desc:t("home.payAsYouGoDesc"),icon:e.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}].map((s,l)=>e.jsxs("div",{className:"p-6 rounded-xl border border-neutral-800/60 hover:border-brand-500/25 transition-colors group",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-brand-500/10 text-brand-400 flex items-center justify-center mb-4",children:s.icon}),e.jsx("h3",{className:"text-base font-semibold text-white mb-2",children:s.title}),e.jsx("p",{className:"text-sm text-neutral-400 leading-relaxed",children:s.desc})]},l))})]})}),r.length>0&&e.jsx("section",{className:"max-w-5xl mx-auto px-6 py-20",children:e.jsxs(n,{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-white mb-2",children:t("home.availableModels")}),e.jsx("p",{className:"text-neutral-500",children:t("home.availableModelsDesc",{count:r.length})})]}),r.length>8&&e.jsxs(a,{to:"/pricing",className:"text-sm text-brand-400 hover:text-brand-300 transition-colors",children:[t("home.viewAllModels",{count:r.length})," →"]})]}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:r.slice(0,8).map((s,l)=>e.jsx("div",{className:"px-4 py-3 rounded-lg border border-neutral-800/60 hover:border-neutral-700 transition-colors",children:e.jsx("span",{className:"text-sm text-neutral-300 font-mono",children:s.display_name||s.model_name})},s.id||l))})]})}),m.length>0&&e.jsx("section",{className:"max-w-5xl mx-auto px-6 py-20",children:e.jsxs(n,{blur:!0,duration:800,delay:100,children:[e.jsx("h2",{className:"text-2xl font-heading font-bold text-white mb-2",children:t("home.plansPackages")}),e.jsx("p",{className:"text-neutral-500 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,l)=>{const h=s.quota_amount>0?s.quota_amount/N:0,i=w(r,h);return e.jsxs("div",{className:`rounded-xl p-6 flex flex-col border transition-colors ${l===1?"border-brand-500/30 bg-brand-500/[0.04]":"border-neutral-800/60 hover:border-neutral-700"}`,children:[l===1&&e.jsx("span",{className:"text-xs text-brand-400 font-medium mb-2 uppercase tracking-wider",children:t("home.popular")||"Popular"}),e.jsx("h3",{className:"text-base font-semibold text-white",children:s.name}),s.description&&e.jsx("p",{className:"text-sm text-neutral-500 mt-1",children:s.description}),e.jsxs("div",{className:"mt-auto pt-6",children:[e.jsxs("span",{className:"text-3xl font-bold text-white",children:["$",s.price]}),s.original_price>s.price&&e.jsxs("span",{className:"text-sm text-neutral-600 line-through ml-2",children:["$",s.original_price]}),s.duration>0&&e.jsx("p",{className:"text-xs text-neutral-600 mt-1",children:t("home.days",{count:s.duration})})]}),i&&i.equivDollars>h&&e.jsxs("p",{className:"text-xs text-amber-300/80 mt-2",children:["🔥 ",t("packages.officialEquiv",{model:i.label,amount:Math.round(i.equivDollars)})]}),e.jsx(a,{to:o?"/packages":"/register",className:`mt-4 py-2.5 rounded-lg font-medium text-sm text-center transition-colors ${l===1?"bg-brand-600 text-white hover:bg-brand-500":"bg-neutral-800 text-white hover:bg-neutral-700"}`,children:t(o?"home.subscribe":"home.getStarted")})]},s.id)})})]})}),e.jsx("section",{className:"max-w-5xl mx-auto px-6 py-24",children:e.jsx(n,{blur:!0,duration:800,delay:100,children:e.jsxs("div",{className:"border-t border-neutral-800 pt-16 text-center",children:[e.jsx("h2",{className:"text-2xl font-heading font-bold text-white mb-3",children:t("home.readyToStart")}),e.jsx("p",{className:"text-neutral-500 mb-8 max-w-md mx-auto",children:t("home.readyToStartDesc")}),e.jsx("div",{className:"flex items-center justify-center gap-4",children:o?e.jsxs(a,{to:"/dashboard",className:"px-7 py-3 rounded-xl bg-brand-600 text-white font-medium text-sm hover:bg-brand-500 transition-colors shadow-lg shadow-brand-600/20",children:[t("home.goToDashboard")," →"]}):e.jsxs(e.Fragment,{children:[e.jsxs(a,{to:"/register",className:"px-7 py-3 rounded-xl bg-brand-600 text-white font-medium text-sm hover:bg-brand-500 transition-colors shadow-lg shadow-brand-600/20",children:[t("home.createFreeAccount")," →"]}),e.jsx(a,{to:"/login",className:"px-7 py-3 text-neutral-400 font-medium text-sm hover:text-white transition-colors",children:t("home.signIn")})]})})]})})})]})}export{L as default};
|