Files
chuanggao-website/client/dist/assets/HomeView-CIqPOPFz.js
2026-05-12 16:53:18 +08:00

2 lines
15 KiB
JavaScript

import{c as H,o as z,a as j,r as k,d as x,b,e,n as O,t as h,f as S,g as v,_ as E,F as B,h as M,i as P,j as V,u as w,k as C,l as N,m as T,p}from"./index-eVF4AHSu.js";import{m as U,f as D}from"./case-C97jSxNP.js";import{m as K,f as Q}from"./product-xndN8QNU.js";import{r as I}from"./media-BgGGvhcR.js";import"./pagination-BgSlm-mj.js";const q=H();function G(t){const s=t.imagePc??t.image??t.coverUrl??t.cover??t.coverImage;if(s==null)return null;const o=String(s).trim();return o.length?o:null}function J(t){return{id:Number(t.id??0),imagePc:G(t),titleZh:t.titleZh===void 0?null:String(t.titleZh),titleEn:t.titleEn===void 0?null:String(t.titleEn),subtitleZh:t.subtitleZh===void 0?null:String(t.subtitleZh),subtitleEn:t.subtitleEn===void 0?null:String(t.subtitleEn),btnTextZh:t.btnTextZh===void 0?null:String(t.btnTextZh),btnTextEn:t.btnTextEn===void 0?null:String(t.btnTextEn),btnLink:t.btnLink===void 0?null:String(t.btnLink)}}function W(t){if(!t||typeof t!="object")return;const s={};for(const[o,i]of Object.entries(t))typeof i=="string"?s[o]=i:typeof i=="number"||typeof i=="boolean"?s[o]=String(i):s[o]=void 0;return Object.keys(s).length?s:void 0}function X(t){const s=t.metric??t.value??t.titleMetric??t.number??t.count??"",o=t.title??t.label??t.desc??t.subtitle??"",i=typeof s=="string"?s.trim():String(s).trim(),u=typeof o=="string"?o.trim():String(o).trim();return!i||!u?null:{metric:i,title:u}}function A(t){if(!t||typeof t!="object")return null;const s=t,o=s.items??s.cards??s.metrics??s.list;let i;return Array.isArray(o)&&(i=o.map(u=>u&&typeof u=="object"?X(u):null).filter(Boolean),i.length||(i=void 0)),{eyebrowZh:typeof s.eyebrowZh=="string"?s.eyebrowZh:void 0,titleZh:typeof s.titleZh=="string"?s.titleZh:typeof s.title=="string"?s.title:void 0,subtitleZh:typeof s.subtitleZh=="string"?s.subtitleZh:void 0,items:i}}function Y(t){var r;let s=t.banners??t.carousel??t.homeBanners??t.bannerList??[];Array.isArray(s)||(s=[]);const o=s.map(l=>J(l&&typeof l=="object"?l:{})).filter(Boolean),i=t.pageBlocks??t.blocks??t.page_block,u=W(i);let g;const c=t.hotProducts??t.recommendProducts??t.hot_products;Array.isArray(c)&&(g=c.map(l=>K(l&&typeof l=="object"?l:{})));let a;const n=t.recommendCases??t.recommendedCases??t.recommend_cases;Array.isArray(n)&&(a=n.map(l=>U(l&&typeof l=="object"?l:{})));let d=A(t.brandStrength)??A(t.brand_strength);d=d&&((((r=d.items)==null?void 0:r.length)??0)>0||(d.titleZh??d.eyebrowZh??d.subtitleZh))?d:null;const m=typeof t.heroTitleZh=="string"?t.heroTitleZh:void 0,f=typeof t.heroSubtitleZh=="string"?t.heroSubtitleZh:void 0,y=typeof t.heroTitleEn=="string"?t.heroTitleEn:void 0,$=typeof t.heroSubtitleEn=="string"?t.heroSubtitleEn:void 0;return{banners:o.length?o:[{id:1,imagePc:null,titleZh:m??null,subtitleZh:f??null,titleEn:y??null,subtitleEn:$??null,btnLink:"/products"}],pageBlocks:u,hotProducts:g,recommendCases:a,brandStrength:d,heroTitleZh:m,heroSubtitleZh:f,heroTitleEn:y,heroSubtitleEn:$}}const tt={banners:[{id:1,imagePc:null,titleZh:"设计驱动的高端定制交付",titleEn:"Design-led tailoring & delivery",subtitleZh:"客厅 / 餐厨 / 睡眠 / 收纳 / 工装 · 占位文案,可由后台 Banner 接管",subtitleEn:"Living · dining · sleep · storage · commercial — placeholder managed by CMS later.",btnTextZh:"进入产品中心",btnTextEn:"Explore products",btnLink:"/products"},{id:2,imagePc:null,titleZh:"工程与渠道协同的一站式服务",titleEn:"Engineering-ready programs",subtitleZh:"项目打样 · 选型清单 · 安装协同 · (占位说明)",subtitleEn:"Sampling · BOQ coordination · installation support — placeholder narrative.",btnTextZh:"查看案例展示",btnTextEn:"View cases",btnLink:"/cases"}],brandStrength:{eyebrowZh:"交付与质量体系",titleZh:"品牌可信度指标(占位卡片)",subtitleZh:"* 以上为示例字段,请以企业真实统计数据为准。",items:[{metric:"20+",title:"年行业积累(占位)"},{metric:"50000㎡+",title:"现代化制造与仓储(占位)"},{metric:"1000+",title:"项目与私人客户触点(占位)"}]}};async function et(){try{const t=await q.get("/portal/home/data");return Y(t&&typeof t=="object"?t:{})}catch(t){return console.warn("[portal/home/data] fallback to mock:",t),tt}}function L(t,s="animate-visible",o=.1){const i=k(null);z(()=>{const u=t.value;u&&(i.value=new IntersectionObserver(g=>{g.forEach(c=>{var a;c.isIntersecting&&(c.target.classList.add(s),(a=i.value)==null||a.unobserve(c.target))})},{threshold:o}),i.value.observe(u))}),j(()=>{var u;(u=i.value)==null||u.disconnect()})}const st={class:"hero"},nt={class:"container hero-split"},ot={class:"hero-cover"},it={class:"hero-cover__toolbar"},rt={class:"hero-copy"},lt={class:"kicker-en"},ct={class:"title-lg"},at={class:"muted"},dt={class:"hero-cta"},ut=x({__name:"HomeHeroBanner",props:{slides:{},heroIdx:{},eyebrow:{},headlineFallback:{},subtitleFallback:{},bannerPrimaryFallback:{},bannerSecondaryLabel:{}},emits:["seek","bannerCta","contactCta"],setup(t,{emit:s}){const o=t,i=s,u=S(()=>o.slides.length?(o.heroIdx%o.slides.length+o.slides.length)%o.slides.length:0),g=S(()=>o.slides.length?o.slides[u.value]:void 0),c=S(()=>{var m;const n=I(((m=g.value)==null?void 0:m.imagePc)??void 0),d="radial-gradient(700px 220px at 20% -10%, rgba(201, 169, 98, 0.26), transparent 60%), linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(0, 0, 0, 0.45)), repeating-linear-gradient(-35deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 12px)";return n?{backgroundImage:`linear-gradient(120deg, rgba(11,13,18,0.25), rgba(11,13,18,0.88)), url(${n}), ${d}`,backgroundSize:"cover, cover, auto",backgroundPosition:"center, center, 0 0"}:{backgroundImage:d}});function a(){var d,m;const n=(m=(d=g.value)==null?void 0:d.btnLink)==null?void 0:m.trim();i("bannerCta",n!=null&&n.length?n:void 0)}return(n,d)=>{var m,f,y;return v(),b("section",st,[e("div",nt,[e("div",ot,[e("div",{class:"hero-cover__shade",style:O(c.value)},null,4),e("div",it,[e("button",{type:"button",class:"circle-btn","aria-label":"prev",onClick:d[0]||(d[0]=$=>i("seek",-1))},"⟨"),e("button",{type:"button",class:"circle-btn","aria-label":"next",onClick:d[1]||(d[1]=$=>i("seek",1))},"⟩")])]),e("div",rt,[e("div",lt,h(t.eyebrow),1),e("h1",ct,h(((m=g.value)==null?void 0:m.titleZh)??t.headlineFallback),1),e("p",at,h(((f=g.value)==null?void 0:f.subtitleZh)??t.subtitleFallback),1),e("div",dt,[e("button",{type:"button",class:"btn-primary",onClick:a},h(((y=g.value)==null?void 0:y.btnTextZh)??t.bannerPrimaryFallback),1),e("button",{type:"button",class:"btn-ghost",onClick:d[2]||(d[2]=$=>i("contactCta"))},h(t.bannerSecondaryLabel),1)])])])])}}}),ht=E(ut,[["__scopeId","data-v-d211a3ed"]]),bt={class:"container"},vt={class:"section-header"},gt={class:"title-lg"},mt={class:"muted section-subtitle"},_t={class:"service-grid"},pt=["onClick"],ft={class:"service-icon-wrap"},kt={class:"service-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},yt=["d"],$t={class:"service-title"},St={class:"service-desc muted"},Zt=x({__name:"ServiceSection",props:{title:{},subtitle:{},services:{default:()=>[{icon:"M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6",title:"全屋定制",description:"从客厅到卧室,从厨房到书房,一站式全屋定制解决方案",path:"/products?category=1"},{icon:"M5 3v4M3 5h4M6 17v4m-2-2h4m5-16l2.286 6.857L21 12l-5.714 2.143L13 21l-2.286-6.857L5 12l5.714-2.143L13 3z",title:"成品家具",description:"精选全球优质原材料,打造舒适耐用的高端家具产品",path:"/products"},{icon:"M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4",title:"工程项目",description:"酒店、办公、精装房等专业工程家具配套服务",path:"/cases"}]}},setup(t){const s=w(),o=k(null);L(o,"animate-visible");function i(u){s.push(u)}return(u,g)=>(v(),b("section",{ref_key:"rootRef",ref:o,class:"service-section"},[e("div",bt,[e("div",vt,[g[0]||(g[0]=e("span",{class:"kicker-en"},"CORE BUSINESS",-1)),e("h2",gt,h(t.title),1),e("p",mt,h(t.subtitle),1)]),e("div",_t,[(v(!0),b(B,null,M(t.services,(c,a)=>(v(),b("div",{key:a,class:P(["service-card surface",`delay-${a*150}`]),onClick:n=>i(c.path)},[e("div",ft,[(v(),b("svg",kt,[e("path",{d:c.icon},null,8,yt)]))]),e("h3",$t,h(c.title),1),e("p",St,h(c.description),1),g[1]||(g[1]=e("span",{class:"service-link"},[V(" 了解更多 "),e("svg",{class:"arrow-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M5 12h14M12 5l7 7-7 7"})])],-1))],10,pt))),128))])])],512))}}),Ct=E(Zt,[["__scopeId","data-v-0d95ec49"]]),xt={class:"container"},Et={class:"section-header"},Tt={class:"title-lg"},Bt={class:"muted section-subtitle"},Mt={class:"product-grid"},Pt=["onClick"],wt={class:"product-card__image"},Lt=["src","alt"],It={key:1,class:"placeholder-cover"},Rt={class:"product-card__info"},At={class:"product-card__name"},zt={key:0,class:"product-card__summary muted"},Ft={key:1,class:"product-card__price"},Ht=x({__name:"ProductSection",props:{title:{},subtitle:{},products:{}},setup(t){const s=w(),o=k(null);L(o,"animate-visible");function i(c){return I(c.mainImage??void 0)}function u(c){s.push(`/products/${c}`)}function g(){s.push("/products")}return(c,a)=>(v(),b("section",{ref_key:"rootRef",ref:o,class:"product-section"},[e("div",xt,[e("div",Et,[a[0]||(a[0]=e("span",{class:"kicker-en"},"HOT PRODUCTS",-1)),e("h2",Tt,h(t.title),1),e("p",Bt,h(t.subtitle),1)]),e("div",Mt,[(v(!0),b(B,null,M(t.products.slice(0,8),(n,d)=>(v(),b("div",{key:n.id,class:P(["product-card",`delay-${d%4*100}`]),onClick:m=>u(n.id)},[e("div",wt,[i(n)?(v(),b("img",{key:0,src:i(n),alt:n.nameZh,loading:"lazy"},null,8,Lt)):(v(),b("div",It)),a[1]||(a[1]=e("div",{class:"product-card__overlay"},[e("span",{class:"product-card__view"},"查看详情")],-1))]),e("div",Rt,[e("h3",At,h(n.nameZh),1),n.summaryZh?(v(),b("p",zt,h(n.summaryZh),1)):C("",!0),n.isShowPrice&&n.priceMin?(v(),b("div",Ft," ¥"+h(n.priceMin.toLocaleString())+h(n.priceMax?` - ¥${n.priceMax.toLocaleString()}`:""),1)):C("",!0)])],10,Pt))),128))]),e("div",{class:"section-footer"},[e("button",{class:"btn-outline",onClick:g},[...a[2]||(a[2]=[e("span",null,"查看全部产品",-1),e("svg",{class:"btn-arrow",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M5 12h14M12 5l7 7-7 7"})],-1)])])])])],512))}}),jt=E(Ht,[["__scopeId","data-v-cfe795d4"]]),Ot={class:"container"},Vt={class:"section-header"},Nt={class:"title-lg"},Ut={class:"muted section-subtitle"},Dt={class:"case-grid"},Kt=["onClick"],Qt={class:"case-card__image"},qt=["src","alt"],Gt={key:1,class:"placeholder-cover"},Jt={class:"case-card__overlay"},Wt={class:"case-card__meta"},Xt={key:0,class:"case-card__tag"},Yt={key:1,class:"case-card__location"},te={class:"case-card__slide"},ee={class:"case-card__title"},se={key:0,class:"case-card__subtitle"},ne=x({__name:"CaseSection",props:{title:{},subtitle:{},cases:{}},setup(t){const s=w(),o=k(null);L(o,"animate-visible");function i(c){return I(c.coverImage??void 0)}function u(c){s.push(`/cases/${c}`)}function g(){s.push("/cases")}return(c,a)=>(v(),b("section",{ref_key:"rootRef",ref:o,class:"case-section"},[e("div",Ot,[e("div",Vt,[a[0]||(a[0]=e("span",{class:"kicker-en"},"REFERENCE CASES",-1)),e("h2",Nt,h(t.title),1),e("p",Ut,h(t.subtitle),1)]),e("div",Dt,[(v(!0),b(B,null,M(t.cases.slice(0,6),(n,d)=>(v(),b("div",{key:n.id,class:P(["case-card",`delay-${d%3*150}`]),onClick:m=>u(n.id)},[e("div",Qt,[i(n)?(v(),b("img",{key:0,src:i(n),alt:n.titleZh,loading:"lazy"},null,8,qt)):(v(),b("div",Gt)),e("div",Jt,[e("div",Wt,[n.categoryLabelZh?(v(),b("span",Xt,h(n.categoryLabelZh),1)):C("",!0),n.locationZh?(v(),b("span",Yt,h(n.locationZh),1)):C("",!0)]),e("div",te,[e("h3",ee,h(n.titleZh),1),n.subtitleZh?(v(),b("p",se,h(n.subtitleZh),1)):C("",!0),a[1]||(a[1]=e("span",{class:"case-card__enter"},"查看案例",-1))])])])],10,Kt))),128))]),e("div",{class:"section-footer"},[e("button",{class:"btn-outline",onClick:g},[...a[2]||(a[2]=[e("span",null,"查看全部案例",-1),e("svg",{class:"btn-arrow",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M5 12h14M12 5l7 7-7 7"})],-1)])])])])],512))}}),oe=E(ne,[["__scopeId","data-v-d846fd6d"]]),ie={class:"home"},re={class:"container"},le={class:"section-header"},ce={class:"kicker-en"},ae={class:"title-lg"},de={class:"muted section-subtitle"},ue={class:"strength-grid"},he={class:"strength-number"},be={class:"strength-label"},ve={class:"section-footer"},ge=x({__name:"HomeView",setup(t){const{t:s}=N(),o=w(),i=k(null),u=k([]),g=k([]),c=k(0),a=k(null);L(a,"animate-visible");const n=S(()=>{var r;return((r=i.value)==null?void 0:r.banners)??[]}),d=S(()=>{var r;return((r=i.value)==null?void 0:r.pageBlocks)??{}});function m(r,...l){var Z;const _=(r??"").trim();if(_)return _;for(const F of l){const R=(Z=d.value[F])==null?void 0:Z.trim();if(R)return R}return""}const f=S(()=>{var l,_;const r=(l=i.value)==null?void 0:l.brandStrength;return{eyebrow:(r==null?void 0:r.eyebrowZh)||s("home.strengthsEyebrow"),title:(r==null?void 0:r.titleZh)||m(void 0,"strength_super_title_zh","strength_title_zh")||s("home.strengthsTitle"),note:(r==null?void 0:r.subtitleZh)||s("home.strengthsNote"),items:(_=r==null?void 0:r.items)!=null&&_.length?r.items:[{metric:s("home.strength1Metric"),title:s("home.strength1Title")},{metric:s("home.strength2Metric"),title:s("home.strength2Title")},{metric:s("home.strength3Metric"),title:s("home.strength3Title")},{metric:s("home.strength4Metric"),title:s("home.strength4Title")}]}});function y(r){const l=n.value;l.length&&(c.value=(c.value+r+l.length)%l.length)}function $(r){o.push(r&&r.length?r:"/products")}return z(async()=>{var l,_;const r=await et();i.value=r,u.value=(l=r.hotProducts)!=null&&l.length?r.hotProducts:await Q(),g.value=(_=r.recommendCases)!=null&&_.length?r.recommendCases:await D()}),(r,l)=>(v(),b("div",ie,[T(ht,{slides:n.value,"hero-idx":c.value,eyebrow:p(s)("home.heroEyebrow"),"headline-fallback":p(s)("brand"),"subtitle-fallback":p(s)("home.heroSubtitleFallback"),"banner-primary-fallback":p(s)("nav.products"),"banner-secondary-label":p(s)("nav.contact"),onSeek:y,onBannerCta:l[0]||(l[0]=_=>$(_)),onContactCta:l[1]||(l[1]=()=>p(o).push("/contact"))},null,8,["slides","hero-idx","eyebrow","headline-fallback","subtitle-fallback","banner-primary-fallback","banner-secondary-label"]),T(Ct,{title:p(s)("home.servicesTitle"),subtitle:p(s)("home.servicesSubtitle")},null,8,["title","subtitle"]),T(jt,{title:p(s)("home.productsSectionTitle"),subtitle:p(s)("home.productsSectionSubtitle"),products:u.value},null,8,["title","subtitle","products"]),T(oe,{title:p(s)("home.casesSectionTitle"),subtitle:p(s)("home.casesSectionSubtitle"),cases:g.value},null,8,["title","subtitle","cases"]),e("section",{ref_key:"strengthRef",ref:a,class:"strength-section"},[e("div",re,[e("div",le,[e("span",ce,h(f.value.eyebrow),1),e("h2",ae,h(f.value.title),1),e("p",de,h(f.value.note),1)]),e("div",ue,[(v(!0),b(B,null,M(f.value.items,(_,Z)=>(v(),b("div",{key:Z,class:P(["strength-card",`delay-${Z*150}`])},[e("div",he,h(_.metric),1),e("div",be,h(_.title),1)],2))),128))]),e("div",ve,[e("button",{class:"btn-outline",onClick:l[2]||(l[2]=_=>p(o).push("/about"))},[...l[3]||(l[3]=[e("span",null,"了解更多品牌实力",-1),e("svg",{class:"btn-arrow",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M5 12h14M12 5l7 7-7 7"})],-1)])])])])],512)]))}}),ye=E(ge,[["__scopeId","data-v-0f1e7eed"]]);export{ye as default};