feat: 新增 Taro 模板双端运行与独立 Web 预览

This commit is contained in:
que01 committed 2026-10-08 15:28:26 +08:00
1 parent f4061a24bd
commit 7e8fc01fba
48 files changed
+11576 -12

No files matched your search

@@ -7,6 +7,19 @@
"template.json",
"miniapp",
"fixtures",
"README.md"
]
"README.md",
"taro"
],
"dependencies": {
"@tarojs/components": "4.3.0",
"@tarojs/taro": "4.3.0",
"react": "18.3.1",
"@personal-brand/types": "workspace:*",
"@tarojs/plugin-platform-weapp": "4.3.0",
"@tarojs/plugin-platform-h5": "4.3.0",
"react-dom": "18.3.1"
},
"devDependencies": {
"@types/react": "18.3.18"
}
}
@@ -0,0 +1,511 @@
import { useState } from "react";
import { View, Text, Image, Button, Input } from "@tarojs/components";
import Taro from "@tarojs/taro";
import type { TemplateProps } from "../../../apps/taro/src/runtime/template";
import { navigate } from "../../../apps/taro/src/runtime/navigation";
import { presentation, offering, slot, text, rows } from "../../../apps/taro/src/runtime/content";
import type { RuntimeWorkspace } from "@personal-brand/types";
import "./style.css";
const asset = (name: string) => `/assets/${name}`;
function Home({ workspace }: { workspace: RuntimeWorkspace }) {
const brand = workspace.brand;
const p = presentation(workspace, "home");
const list = workspace.offerings.map(offering).slice(0, 2);
return (
<View className="food-home">
<View className="page">
<View className="brand-card">
<View className="identity">
{text(brand.avatarUrl) && <Image src={text(brand.avatarUrl)} mode="aspectFill" />}
<View>
<Text className="name">{text(brand.founder)}</Text>
<Text className="title">{text(brand.title)}</Text>
<Text className="slogan">“{text(brand.description)}”</Text>
</View>
</View>
<View className="notice">
<Text className="notice-title">{p.stallTitle || "服务地点"}</Text>
<Text>{text(brand.address)}</Text>
{p.stallTime && <Text className="notice-time">{p.stallTime}</Text>}
</View>
<View className="actions">
<Button onClick={() => navigate("inquiry")}>咨询 / 预订</Button>
<Button className="muted" onClick={() => navigate("offerings")}>
查看餐品
</Button>
</View>
</View>
<View className="scene-wrap">
<View className="section-head">
<Text className="eyebrow">{text(brand.name)}</Text>
</View>
{text(brand.heroImage) && (
<Image
className="scene"
src={text(brand.heroImage)}
mode="aspectFill"
onClick={() => navigate("service")}
/>
)}
</View>
<View className="section-head">
<View>
<Text className="eyebrow">{p.worksEyebrow || "餐品与服务"}</Text>
<Text className="heading">{p.worksTitle || "可选餐品"}</Text>
</View>
<Text className="more" onClick={() => navigate("offerings")}>
查看全部 ›
</Text>
</View>
<View className="dish-grid">
{list.map((item) => (
<View
className="dish"
key={item.id}
onClick={() => navigate("detail", { id: item.id })}
>
<Image src={item.image} mode="aspectFill" />
<View className="dish-copy">
<Text className="dish-name">{item.name}</Text>
<Text className="dish-sub">{item.desc}</Text>
<Text className="price">{item.priceRange}</Text>
</View>
</View>
))}
</View>
<Text className="heading manifesto-heading">{p.manifestoTitle}</Text>
{workspace.trustItems
.filter((item) => ["promise", "case"].includes(item.type))
.map((item) => (
<View className="promise" key={item.id}>
<Text className="eyebrow light">{item.title}</Text>
{item.summary && <Text className="promise-title">{item.summary}</Text>}
<Text className="quote">{item.content}</Text>
</View>
))}
</View>
</View>
);
}
function Service({ workspace }: { workspace: RuntimeWorkspace }) {
const schedule = slot(workspace, "schedule");
const c = slot(workspace, "coverage");
const process = slot(workspace, "process");
const p = presentation(workspace, "service");
const config = schedule?.config || {};
const scheduleRows = [
{
title: text(config.weekdayLabel),
detail: text(config.weekdayDetail),
hours: text(config.weekdayHours),
tag: text(config.weekdayTag),
tone: "orange",
},
{
title: text(config.weekendLabel),
detail: text(config.weekendDetail),
hours: text(config.weekendHours),
tag: text(config.weekendTag),
tone: "blue",
},
].filter((row) => row.title && row.detail);
const steps = rows(process?.config.steps).filter((step) => step.title && step.detail);
return (
<View className="food-service">
<View className="page service-page">
{schedule && scheduleRows.length > 0 && (
<View className="service-card schedule-card">
<View className="card-head">
<View className="head-title">
<Image className="icon" src={asset("service/clock.png")} />
<Text>{schedule.title}</Text>
</View>
{text(config.status) && <Text className="status-pill">{text(config.status)}</Text>}
</View>
{scheduleRows.map((row) => (
<View
key={row.tone}
className={`schedule ${row.tone === "blue" ? "schedule-weekend" : "schedule-primary"}`}
>
<View className="schedule-row-head">
<View className="schedule-title">
<Text className={`dot ${row.tone}`} />
<Text>{row.title}</Text>
</View>
{row.tag && (
<Text
className={`schedule-tag ${row.tone === "blue" ? "blue-tag" : "orange-tag"}`}
>
{row.tag}
</Text>
)}
</View>
<Text className="schedule-line">{row.detail}</Text>
{row.hours && <Text className="schedule-muted">{row.hours}</Text>}
</View>
))}
</View>
)}
{c && text(c.config.pickupDetail) && text(c.config.deliveryDetail) && (
<View className="service-card coverage-card">
<View className="simple-title">
<Image className="icon" src={asset("service/bike.png")} />
<Text>{c.title}</Text>
</View>
<View className="delivery-grid">
{["pickup", "delivery"].map((key) => (
<View className="delivery-item" key={key}>
<View className="delivery-title">
<Image
className="small-icon"
src={asset(
key === "pickup" ? "service/footprints.png" : "service/bike-blue.png",
)}
/>
<Text>{text(c.config[key + "Title"])}</Text>
</View>
<Text>{text(c.config[key + "Detail"])}</Text>
</View>
))}
</View>
</View>
)}
{process && steps.length > 0 && (
<View className="service-card process-card">
<View className="simple-title">
<Image className="icon" src={asset("service/list.png")} />
<Text>{process.title}</Text>
</View>
{text(process.config.intro) && (
<Text className="card-sub">{text(process.config.intro)}</Text>
)}
<View className="steps">
{steps.map((step, index) => (
<View className="step" key={index}>
<Text className="step-no">{index + 1}</Text>
<View>
<Text className="step-title">{step.title}</Text>
<Text>{step.detail}</Text>
</View>
</View>
))}
</View>
<View className="process-foot">
<View>
<Text>{text(process.config.minimumNote)}</Text>
{text(process.config.minimumNote) && text(process.config.refundNote) && (
<Text className="divider">|</Text>
)}
<Text>{text(process.config.refundNote)}</Text>
</View>
<Button onClick={() => navigate("inquiry")}>{p.processAction || "立即咨询"} →</Button>
</View>
</View>
)}
{!scheduleRows.length && !c && !steps.length && (
<View className="empty-state">出摊服务信息正在完善中</View>
)}
</View>
</View>
);
}
function Profile({ workspace }: { workspace: RuntimeWorkspace }) {
const brand = workspace.brand;
const p = presentation(workspace, "profile");
const credentials = workspace.trustItems.filter((item) => item.type === "credential");
return (
<View className="food-profile">
<View className="page">
<View className="profile-card">
<View className="portrait">
{text(brand.avatarUrl) && <Image src={text(brand.avatarUrl)} mode="aspectFill" />}
<View className="identity">
{p.badge && <Text className="badge">{p.badge}</Text>}
<Text className="name">{text(brand.founder) || text(brand.name)}</Text>
{text(brand.title) && <Text className="title">{text(brand.title)}</Text>}
</View>
</View>
<View className="story">
{p.storyLead && <Text className="story-lead">{p.storyLead}</Text>}
{text(brand.description) && <Text className="bio">{text(brand.description)}</Text>}
{credentials.map((item) =>
rows(item.config.standards).length ? (
<View className="standards" key={item.id}>
{rows(item.config.standards).map((standard, index) => (
<View className="standard" key={index}>
<Image
className="standard-icon"
src={asset(
`owner/${["file-check", "shield-check", "sparkles"][index % 3]}.png`,
)}
/>
<Text className="standard-title">{standard.title}</Text>
<Text className="standard-detail">{standard.detail}</Text>
</View>
))}
</View>
) : (
<View className="credential-copy" key={item.id}>
<Text className="credential-title">{item.title}</Text>
{item.summary && <Text className="bio">{item.summary}</Text>}
<Text className="bio">{item.content}</Text>
</View>
),
)}
</View>
</View>
{workspace.trustItems
.filter((item) => item.type === "case")
.map((item) => (
<View className="case-card" key={item.id}>
<View className="section-heading">
<Image className="heading-icon" src={asset("owner/handshake.png")} />
<Text>{item.title}</Text>
</View>
{item.summary && <Text className="summary">{item.summary}</Text>}
{rows(item.config.entries).length ? (
<View className="case-list">
{rows(item.config.entries).map((entry, index) => (
<View className={`case-row tone-${index % 3}`} key={index}>
<View className="case-badge">{entry.badge}</View>
<View className="case-copy">
<Text className="case-title">{entry.title}</Text>
<Text className="case-detail">{entry.detail}</Text>
</View>
{entry.result && <Text className="case-result">{entry.result}</Text>}
</View>
))}
</View>
) : (
<Text className="content">{item.content}</Text>
)}
</View>
))}
{workspace.trustItems
.filter((item) => item.type === "promise")
.map((item) => (
<View className="promise-card" key={item.id}>
<View className="section-heading">
<Image className="promise-icon" src={asset("owner/clock.png")} />
<Text>{item.title}</Text>
</View>
{item.summary && <Text className="summary">{item.summary}</Text>}
{rows(item.config.commitments).length ? (
<View className="commitment-list">
{rows(item.config.commitments).map((entry, index) => (
<View className="commitment" key={index}>
<View className="dot" />
<View className="commitment-copy">
<Text className="commitment-label">{entry.label}:</Text>
<Text>{entry.detail}</Text>
{entry.highlight && <Text className="highlight">{entry.highlight}</Text>}
</View>
</View>
))}
</View>
) : (
<Text className="content">{item.content}</Text>
)}
</View>
))}
<View className="utilities">
<View className="contact-actions">
{text(brand.contactPhone) && (
<Button
onClick={() => void Taro.makePhoneCall({ phoneNumber: text(brand.contactPhone) })}
>
电话联系
</Button>
)}
{text(brand.contactWechat) && (
<Button
onClick={() => void Taro.setClipboardData({ data: text(brand.contactWechat) })}
>
复制微信
</Button>
)}
</View>
<View className="records-entry" onClick={() => navigate("records")}>
<Text>{p.recordsTitle || "我的咨询记录"}</Text>
<Text>查看记录 ›</Text>
</View>
</View>
</View>
</View>
);
}
export function TemplatePage({ workspace, page, children, offeringId }: TemplateProps) {
if (page === "home") return <Home workspace={workspace} />;
if (page === "service") return <Service workspace={workspace} />;
if (page === "profile") return <Profile workspace={workspace} />;
if (page === "offerings") return <OfferingList workspace={workspace} />;
if (page === "detail") return <Detail workspace={workspace} id={offeringId} />;
return <View className="food-forms">{children}</View>;
}
function OfferingList({ workspace }: { workspace: RuntimeWorkspace }) {
const p = presentation(workspace, "offerings");
const [category, setCategory] = useState("all");
const [query, setQuery] = useState("");
const list = workspace.offerings.map(offering);
const categories = [...new Set(list.map((item) => item.category).filter(Boolean))];
const filtered = list.filter(
(item) =>
(category === "all" || item.category === category) &&
[item.name, item.desc, ...item.keywords]
.join(" ")
.toLowerCase()
.includes(query.trim().toLowerCase()),
);
return (
<View className="food-list">
<View className="page">
<View className="filters">
<Button
className={category === "all" ? "filter active" : "filter"}
onClick={() => setCategory("all")}
>
全部餐品({list.length})
</Button>
{categories.map((value) => (
<Button
key={value}
className={category === value ? "filter active" : "filter"}
onClick={() => setCategory(value)}
>
{value}
</Button>
))}
</View>
<View className="menu-head">
<Text className="menu-title">{p.title || "套餐餐品"}</Text>
{p.subtitle && <Text className="subtitle">{p.subtitle}</Text>}
<Input
className="search-input"
value={query}
placeholder="搜索餐品"
onInput={(event) => setQuery(event.detail.value)}
/>
{p.menuTip && <View className="menu-tip">{p.menuTip}</View>}
</View>
<View className="menu-list">
{filtered.length ? (
filtered.map((item) => (
<View
className="offering-card"
key={item.id}
onClick={() => navigate("detail", { id: item.id })}
>
<View className="dish-media">
<Image src={item.image} mode="aspectFill" />
<Text className="dish-tag">{item.category}</Text>
</View>
<View className="offering-copy">
<Text className="dish-name">{item.name}</Text>
<Text className="subtitle">{item.desc}</Text>
<View className="dish-bottom">
<Text className="price">{item.priceRange}</Text>
<Text className="more">{p.detailAction || "查看详情 ›"}</Text>
</View>
</View>
</View>
))
) : (
<View className="empty-state">没有找到相关餐品,换个词试试</View>
)}
</View>
<Button className="menu-cta" onClick={() => navigate("inquiry")}>
咨询 / 预订
</Button>
</View>
</View>
);
}
function Detail({ workspace, id }: { workspace: RuntimeWorkspace; id?: string }) {
const found = workspace.offerings.find((item) => item.id === id);
if (!found)
return (
<View className="runtime-state">
未找到该餐品<Button onClick={() => navigate("offerings")}>查看餐品</Button>
</View>
);
const item = offering(found);
const p = presentation(workspace, "detail");
return (
<View className="food-detail">
<View className="detail">
<View className="hero-wrap">
<Image
className="hero"
src={text(item.presentation.detailHero) || item.image}
mode="aspectFill"
/>
<View className="hero-shade" />
<View className="hero-copy">
<Text>
{item.category} · {item.area}
</Text>
<Text>{item.name}</Text>
<Text>{item.series}</Text>
</View>
</View>
<View className="content">
<View className="price-card">
<View>
<Text>{p.priceLabel || "参考价格"}</Text>
<Text>{item.priceRange}</Text>
</View>
<View>
<Text>{p.spaceLabel}</Text>
<Text>{text(item.presentation.spaceType)}</Text>
</View>
</View>
<View className="detail-section">
<Text className="section-title">{p.backgroundTitle || "餐品说明"}</Text>
<Text className="body">{item.details.background || item.desc}</Text>
</View>
{item.details.designConcept && (
<View className="detail-section">
<Text className="section-title">{p.conceptTitle}</Text>
<Text className="body warm">{item.details.designConcept}</Text>
</View>
)}
{item.details.crafts.length > 0 && (
<View className="detail-section">
<Text className="section-title">{p.craftsTitle}</Text>
{item.details.crafts.map((craft, index) => (
<View className="craft" key={index}>
<Text>0{index + 1}</Text>
<Text>{craft}</Text>
</View>
))}
</View>
)}
{item.details.materialsList.length > 0 && (
<View className="detail-section">
<Text className="section-title">{p.materialsTitle}</Text>
<View className="materials">
{item.details.materialsList.map((material, index) => (
<View key={index}>
<Text>{material.name}</Text>
<Text>{material.spec}</Text>
</View>
))}
</View>
</View>
)}
<View className="chips">
{item.keywords.map((key, index) => (
<Text key={index}>{key}</Text>
))}
</View>
</View>
<View className="bar">
<Button onClick={() => navigate("inquiry", { offeringId: item.id })}>
{p.inquiryAction || "咨询 / 提前预订"}
</Button>
<Text>{p.inquiryHint}</Text>
</View>
</View>
</View>
);
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,4 @@
{
"extends": "../../apps/taro/tsconfig.json",
"include": ["taro"]
}
@@ -6,6 +6,19 @@
"files": [
"template.json",
"miniapp",
"README.md"
]
"README.md",
"taro"
],
"dependencies": {
"@tarojs/components": "4.3.0",
"@tarojs/taro": "4.3.0",
"react": "18.3.1",
"@personal-brand/types": "workspace:*",
"@tarojs/plugin-platform-weapp": "4.3.0",
"@tarojs/plugin-platform-h5": "4.3.0",
"react-dom": "18.3.1"
},
"devDependencies": {
"@types/react": "18.3.18"
}
}
@@ -0,0 +1,338 @@
import { View, Text, Image, Button } from "@tarojs/components";
import Taro from "@tarojs/taro";
import type { RuntimeWorkspace } from "@personal-brand/types";
import type { TemplateProps } from "../../../apps/taro/src/runtime/template";
import { navigate } from "../../../apps/taro/src/runtime/navigation";
import {
object,
offering,
presentation,
slot,
text,
rows,
} from "../../../apps/taro/src/runtime/content";
import "./style.css";
function Home({ workspace }: { workspace: RuntimeWorkspace }) {
const b = workspace.brand;
const p = presentation(workspace, "home");
const hero = object(b.homeHero);
const credential = slot(workspace, "credential");
const t = workspace.trustPresentation;
return (
<View className="editorial-home">
<View className="page">
<View className="founder-card">
{text(b.avatarUrl) && (
<Image className="avatar" src={text(b.avatarUrl)} mode="aspectFill" />
)}
<View className="founder-copy">
<Text className="founder-name">{text(b.founder)}</Text>
<Text className="founder-title">{text(b.title)}</Text>
<Text className="quote">“{text(b.description)}”</Text>
</View>
{p.founderBadge && <Text className="badge">{p.founderBadge}</Text>}
</View>
<View className="hero" onClick={() => navigate("offerings")}>
<Image className="hero-image" src={text(b.heroImage)} mode="aspectFill" />
<View className="hero-shade" />
<View className="hero-copy">
<Text className="eyebrow">{text(hero.eyebrow) || text(b.tagline)}</Text>
<Text className="hero-title">{text(hero.title) || text(b.name)}</Text>
<Text className="hero-slogan">
{text(hero.slogan) ||
text(workspace.templateData.designPhilosophy) ||
text(b.description)}
</Text>
<Text className="hero-button">{text(hero.cta) || "查看作品"}</Text>
</View>
</View>
<View className="intro">
<Text className="eyebrow dark">{p.proofEyebrow}</Text>
<Text className="section-title">{p.proofTitle}</Text>
<Text className="body">{credential?.content}</Text>
<View className="stats">
{t.stats?.map((item, index) => (
<View key={index}>
<Text className="stat-value">{item.value}</Text>
<Text className="stat-label">{item.label}</Text>
<Text className="stat-sub">{item.sub}</Text>
</View>
))}
</View>
</View>
<View className="trust">
<Text className="eyebrow">{p.manifestoEyebrow}</Text>
<Text className="section-title light">{p.manifestoTitle}</Text>
{t.pillars?.map((item, index) => (
<View className="pillar" key={index}>
<Text className="pillar-title">{item.title}</Text>
<Text className="pillar-desc">{item.desc}</Text>
</View>
))}
</View>
<View className="section">
<View className="section-head">
<View>
<Text className="eyebrow dark">{p.worksEyebrow}</Text>
<Text className="section-title">{p.worksTitle}</Text>
</View>
<Text className="more" onClick={() => navigate("offerings")}>
{p.worksAction}
</Text>
</View>
{workspace.offerings.map(offering).map((item) => (
<View
className="work-card"
key={item.id}
onClick={() => navigate("detail", { id: item.id })}
>
<Image src={item.image} mode="aspectFill" />
<View className="work-info">
<Text className="work-category">
{item.category} · {item.area}
</Text>
<Text className="work-name">{item.name}</Text>
<Text className="work-desc">
{[item.series, ...item.keywords.slice(0, 2)].filter(Boolean).join(" · ")}
</Text>
</View>
</View>
))}
</View>
<View className="flow">
<Text className="flow-eyebrow">{p.flowEyebrow}</Text>
<Text className="flow-title">{p.flowTitle}</Text>
<View className="flow-grid">
{t.serviceFlow?.map((step, index) => (
<View className="flow-item" key={index}>
<Text className="flow-step">{step.step}</Text>
<Text className="flow-name">{step.name}</Text>
<Text className="flow-desc">{step.desc}</Text>
</View>
))}
</View>
</View>
</View>
</View>
);
}
function Profile({ workspace }: { workspace: RuntimeWorkspace }) {
const b = workspace.brand;
const p = presentation(workspace, "profile");
const config = object(b.profilePresentation);
return (
<View className="editorial-profile">
<View className="profile">
<View className="founder-card">
<View className="identity">
{text(b.avatarUrl) && (
<Image className="avatar" src={text(b.avatarUrl)} mode="aspectFill" />
)}
<View>
<Text className="founder">{text(b.founder)}</Text>
<Text className="role">{text(b.title)}</Text>
</View>
</View>
<View className="contact-lines">
{text(b.contactPhone) && (
<View className="contact-line">
<Text className="label">{p.phoneLabel || "电话"}</Text>
<View className="contact-action">
<Text className="value">{text(b.contactPhone)}</Text>
<Button
onClick={() => void Taro.makePhoneCall({ phoneNumber: text(b.contactPhone) })}
>
{p.callAction || "呼叫"}
</Button>
</View>
</View>
)}
{text(b.contactWechat) && (
<View className="contact-line">
<Text className="label">{p.wechatLabel || "微信"}</Text>
<View className="contact-action">
<Text className="value accent">{text(b.contactWechat)}</Text>
<Button
onClick={() => void Taro.setClipboardData({ data: text(b.contactWechat) })}
>
{p.copyAction || "复制"}
</Button>
</View>
</View>
)}
{text(b.address) && (
<View className="contact-line address">
<Text className="label">{p.addressLabel || "地址"}</Text>
<Text className="address-value">{text(b.address)}</Text>
</View>
)}
</View>
</View>
<View className="records-card" onClick={() => navigate("records")}>
<View className="entry-copy">
<Text>{p.recordsTitle || "我的咨询记录"}</Text>
<Text>{p.recordsSubtitle}</Text>
</View>
<Text>查看 ›</Text>
</View>
{rows(config.coverage).length > 0 && (
<View className="info-card">
<View className="card-title">{p.coverageTitle}</View>
{rows(config.coverage).map((item, index) => (
<View className="note" key={index}>
<Text className="note-title">{item.title}</Text>
<Text>{item.content}</Text>
</View>
))}
</View>
)}
{Array.isArray(config.warranty) && config.warranty.length > 0 && (
<View className="info-card">
<View className="card-title">{p.warrantyTitle}</View>
{config.warranty.map((item, index) => (
<View className="warranty" key={index}>
<Text className="dot">•</Text>
<Text>{text(item)}</Text>
</View>
))}
</View>
)}
{workspace.trustItems.map((item) => (
<View className="info-card trust-card" key={item.id}>
<View className="card-title">{item.title}</View>
{item.summary && <Text className="trust-summary">{item.summary}</Text>}
<Text>{item.content}</Text>
</View>
))}
</View>
</View>
);
}
function List({ workspace }: { workspace: RuntimeWorkspace }) {
const p = presentation(workspace, "offerings");
return (
<View className="editorial-list">
<View className="page">
<Text className="eyebrow">{p.eyebrow}</Text>
<Text className="section-title">{p.title || "作品与服务"}</Text>
<Text className="subtitle">{p.subtitle}</Text>
{workspace.offerings.map(offering).map((item) => (
<View
className="work-card"
key={item.id}
onClick={() => navigate("detail", { id: item.id })}
>
<Image src={item.image} mode="aspectFill" />
<View className="work-info">
<Text className="work-category">
{item.category} · {item.area}
</Text>
<Text className="work-name">{item.name}</Text>
<Text className="work-desc">{item.desc}</Text>
<Text className="work-price">{item.priceRange}</Text>
<Text className="more">{p.detailAction || "了解详情 →"}</Text>
</View>
</View>
))}
<Text className="subtitle">{p.closingText}</Text>
{p.closingAction && <Button onClick={() => navigate("inquiry")}>{p.closingAction}</Button>}
</View>
</View>
);
}
function Detail({ workspace, id }: { workspace: RuntimeWorkspace; id?: string }) {
const found = workspace.offerings.find((item) => item.id === id);
if (!found)
return (
<View className="runtime-state">
未找到该作品<Button onClick={() => navigate("offerings")}>查看作品</Button>
</View>
);
const item = offering(found);
const p = presentation(workspace, "detail");
return (
<View className="editorial-detail">
<View className="detail">
<View className="hero-wrap">
<Image
className="hero"
src={text(item.presentation.detailHero) || item.image}
mode="aspectFill"
/>
<View className="hero-shade" />
<View className="hero-copy">
<Text>
{item.category} · {item.area}
</Text>
<Text>{item.name}</Text>
<Text>{item.series}</Text>
</View>
</View>
<View className="content">
<View className="price-card">
<View>
<Text>{p.priceLabel}</Text>
<Text>{item.priceRange}</Text>
</View>
<View>
<Text>{p.spaceLabel}</Text>
<Text>{text(item.presentation.spaceType)}</Text>
</View>
</View>
<View className="detail-section">
<Text className="section-title">{p.backgroundTitle}</Text>
<Text className="body">{item.details.background || item.desc}</Text>
</View>
{item.details.designConcept && (
<View className="detail-section">
<Text className="section-title">{p.conceptTitle}</Text>
<Text className="body warm">{item.details.designConcept}</Text>
</View>
)}
{item.details.crafts.length > 0 && (
<View className="detail-section">
<Text className="section-title">{p.craftsTitle}</Text>
{item.details.crafts.map((craft, index) => (
<View className="craft" key={index}>
<Text>0{index + 1}</Text>
<Text>{craft}</Text>
</View>
))}
</View>
)}
{item.details.materialsList.length > 0 && (
<View className="detail-section">
<Text className="section-title">{p.materialsTitle}</Text>
<View className="materials">
{item.details.materialsList.map((material, index) => (
<View key={index}>
<Text>{material.name}</Text>
<Text>{material.spec}</Text>
</View>
))}
</View>
</View>
)}
<View className="chips">
{item.keywords.map((word, index) => (
<Text key={index}>{word}</Text>
))}
</View>
</View>
<View className="bar">
<Button onClick={() => navigate("inquiry", { offeringId: item.id })}>
{p.inquiryAction}
</Button>
<Text>{p.inquiryHint}</Text>
</View>
</View>
</View>
);
}
export function TemplatePage({ workspace, page, children, offeringId }: TemplateProps) {
if (page === "home") return <Home workspace={workspace} />;
if (page === "offerings") return <List workspace={workspace} />;
if (page === "profile" || page === "service") return <Profile workspace={workspace} />;
if (page === "detail") return <Detail workspace={workspace} id={offeringId} />;
return <View className="editorial-forms">{children}</View>;
}
@@ -0,0 +1,707 @@
.editorial-home .page {
background: #f7f5f1;
color: #252525;
padding-bottom: 30px;
}
.editorial-home .founder-card {
position: relative;
display: flex;
gap: 20px;
align-items: flex-start;
margin: 32px 40px 20px;
padding: 28px;
border: 1px solid #e6ded5;
border-radius: 28px;
background: #fff;
}
.editorial-home .avatar {
width: 112px;
height: 112px;
flex: 0 0 112px;
border: 4px solid #d9c8b2;
border-radius: 50%;
}
.editorial-home .founder-copy {
min-width: 0;
padding-right: 78px;
}
.editorial-home .founder-name,
.editorial-home .founder-title,
.editorial-home .quote,
.editorial-home .eyebrow,
.editorial-home .hero-title,
.editorial-home .hero-slogan,
.editorial-home .section-title,
.editorial-home .body,
.editorial-home .stat-value,
.editorial-home .stat-label,
.editorial-home .stat-sub,
.editorial-home .pillar-title,
.editorial-home .pillar-desc,
.editorial-home .work-category,
.editorial-home .work-name,
.editorial-home .work-desc,
.editorial-home .flow-eyebrow,
.editorial-home .flow-title,
.editorial-home .flow-step,
.editorial-home .flow-name,
.editorial-home .flow-desc {
display: block;
}
.editorial-home .founder-name {
font: 30px serif;
}
.editorial-home .founder-title {
margin-top: 6px;
color: #77736b;
font-size: 20px;
}
.editorial-home .quote {
margin-top: 14px;
font: 21px serif;
}
.editorial-home .badge {
position: absolute;
top: 24px;
right: 20px;
padding: 8px 12px;
border-radius: 20px;
background: #f3ede6;
color: #8a6846;
font-size: 18px;
}
.editorial-home .hero {
position: relative;
height: 400px;
margin: 0 40px 42px;
overflow: hidden;
border-radius: 28px;
}
.editorial-home .hero-image {
width: 100%;
height: 100%;
}
.editorial-home .hero-shade {
position: absolute;
inset: 0;
background: linear-gradient(180deg, rgba(20, 22, 21, 0.1), rgba(20, 22, 21, 0.82));
}
.editorial-home .hero-copy {
position: absolute;
right: 28px;
bottom: 28px;
left: 28px;
color: #fff;
}
.editorial-home .eyebrow {
margin-bottom: 14px;
color: #d9c8b2;
font-size: 18px;
letter-spacing: 3px;
}
.editorial-home .dark {
color: #8a6846;
}
.editorial-home .hero-title,
.editorial-home .section-title {
font: 34px serif;
}
.editorial-home .hero-slogan {
margin-top: 10px;
font-size: 21px;
}
.editorial-home .hero-button {
position: absolute;
right: 0;
bottom: 0;
padding: 12px 16px;
border: 1px solid rgba(255, 255, 255, 0.3);
color: #d9c8b2;
font-size: 19px;
}
.editorial-home .intro,
.editorial-home .section {
padding: 0 40px 48px;
}
.editorial-home .body {
color: #77736b;
font-size: 24px;
line-height: 1.8;
}
.editorial-home .stats {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 16px;
margin-top: 22px;
}
.editorial-home .stats view {
padding: 22px;
border: 1px solid #e6ded5;
border-radius: 20px;
background: #fff;
}
.editorial-home .stat-value {
color: #8a6846;
font: 38px serif;
}
.editorial-home .stat-label {
margin-top: 4px;
font-size: 22px;
font-weight: 600;
}
.editorial-home .stat-sub {
margin-top: 6px;
color: #77736b;
font-size: 18px;
line-height: 1.5;
}
.editorial-home .trust {
padding: 42px 40px;
background: #202221;
color: #fff;
}
.editorial-home .light {
color: #fff;
}
.editorial-home .pillar {
margin-top: 24px;
}
.editorial-home .pillar-title {
color: #fff;
font: 28px serif;
}
.editorial-home .pillar-desc {
margin-top: 8px;
color: #c6c2ba;
font-size: 22px;
line-height: 1.65;
}
.editorial-home .section-head {
display: flex;
align-items: end;
justify-content: space-between;
margin-bottom: 22px;
}
.editorial-home .more {
color: #8a6846;
font-size: 21px;
}
.editorial-home .work-card {
margin-bottom: 24px;
overflow: hidden;
border: 1px solid #e6ded5;
border-radius: 28px;
background: #fff;
}
.editorial-home .work-card image {
width: 100%;
height: 300px;
}
.editorial-home .work-info {
padding: 24px;
}
.editorial-home .work-category {
color: #8a6846;
font-size: 19px;
}
.editorial-home .work-name {
margin: 10px 0;
font: 28px serif;
}
.editorial-home .work-desc {
color: #77736b;
font-size: 22px;
line-height: 1.6;
}
.editorial-home .flow {
margin: 0 40px 42px;
padding: 30px 24px;
border: 1px solid #e6ded5;
border-radius: 20px;
background: #efece6;
text-align: center;
}
.editorial-home .flow-eyebrow {
color: #8a6846;
font-size: 18px;
letter-spacing: 2px;
}
.editorial-home .flow-title {
margin-top: 6px;
font: 30px serif;
}
.editorial-home .flow-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 16px;
margin-top: 24px;
text-align: left;
}
.editorial-home .flow-item {
padding: 18px;
border: 1px solid #e6ded5;
border-radius: 14px;
background: #fff;
}
.editorial-home .flow-step {
color: #8a6846;
font-size: 18px;
font-weight: 700;
}
.editorial-home .flow-name {
margin-top: 5px;
font-size: 21px;
font-weight: 600;
}
.editorial-home .flow-desc {
margin-top: 6px;
color: #77736b;
font-size: 17px;
line-height: 1.5;
}
.editorial-profile .profile {
min-height: 100vh;
padding: 0;
background: #f7f5f1;
color: #252525;
}
.editorial-profile .founder-card {
margin: 18px 28px 0;
padding: 34px 30px;
border-radius: 20px;
background: #202221;
color: #fff;
box-shadow: 0 12px 34px rgba(32, 34, 33, 0.12);
}
.editorial-profile .identity {
display: flex;
align-items: center;
gap: 22px;
}
.editorial-profile .avatar {
width: 92px;
height: 92px;
border: 2px solid #8a6846;
border-radius: 50%;
background: #343736;
}
.editorial-profile .founder,
.editorial-profile .role,
.editorial-profile .label,
.editorial-profile .value,
.editorial-profile .address-value,
.editorial-profile .entry-copy text,
.editorial-profile .entry-count text,
.editorial-profile .note-title,
.editorial-profile .note text,
.editorial-profile .warranty text {
display: block;
}
.editorial-profile .founder {
font: 34px serif;
}
.editorial-profile .role {
margin-top: 8px;
color: #d9c8b2;
font-size: 22px;
}
.editorial-profile .contact-lines {
margin-top: 24px;
border-top: 1px solid rgba(255, 255, 255, 0.12);
}
.editorial-profile .contact-line {
display: flex;
align-items: center;
justify-content: space-between;
gap: 20px;
padding-top: 18px;
margin-top: 18px;
border-top: 1px solid rgba(255, 255, 255, 0.1);
font-size: 22px;
}
.editorial-profile .contact-line:first-child {
border-top: 0;
margin-top: 0;
}
.editorial-profile .label {
flex: 0 0 auto;
color: rgba(255, 255, 255, 0.52);
}
.editorial-profile .contact-action {
display: flex;
min-width: 0;
align-items: center;
gap: 12px;
}
.editorial-profile .value {
color: #fff;
font-family: monospace;
white-space: nowrap;
}
.editorial-profile .accent {
color: #d9c8b2;
}
.editorial-profile .contact-action button {
display: flex;
align-items: center;
justify-content: center;
gap: 5px;
min-width: 86px;
height: 46px;
margin: 0;
padding: 0 12px;
border-radius: 9px;
background: rgba(255, 255, 255, 0.1);
color: #d9c8b2;
font-size: 20px;
line-height: 46px;
}
.editorial-profile .address {
align-items: flex-start;
}
.editorial-profile .address-value {
max-width: 410px;
color: rgba(255, 255, 255, 0.82);
line-height: 1.55;
text-align: right;
}
.editorial-profile .records-card,
.editorial-profile .info-card {
margin: 20px 28px 0;
border: 1px solid #e6ded5;
border-radius: 18px;
background: #fff;
box-shadow: 0 10px 30px -12px rgba(32, 34, 33, 0.08);
}
.editorial-profile .records-card {
display: flex;
align-items: center;
gap: 18px;
padding: 26px;
}
.editorial-profile .entry-icon {
display: flex;
align-items: center;
justify-content: center;
width: 66px;
height: 66px;
border-radius: 12px;
background: rgba(138, 104, 70, 0.1);
color: #8a6846;
}
.editorial-profile .entry-copy {
flex: 1;
min-width: 0;
}
.editorial-profile .entry-copy text:first-child {
color: #202221;
font-size: 25px;
font-weight: 600;
}
.editorial-profile .entry-copy text:last-child {
margin-top: 7px;
color: #77736b;
font-size: 20px;
line-height: 1.4;
}
.editorial-profile .entry-count {
display: flex;
align-items: center;
gap: 4px;
flex: 0 0 auto;
color: #8a6846;
font-size: 20px;
}
.editorial-profile .info-card {
padding: 28px;
}
.editorial-profile .card-title {
display: flex;
align-items: center;
gap: 12px;
color: #202221;
font-size: 26px;
font-weight: 700;
}
.editorial-profile .card-title t-icon {
color: #8a6846;
}
.editorial-profile .note {
margin-top: 18px;
padding: 20px;
border: 1px solid #e6ded5;
border-radius: 12px;
background: #f7f5f1;
color: #57534e;
font-size: 23px;
line-height: 1.7;
}
.editorial-profile .note-title {
margin-bottom: 5px;
color: #202221;
font-size: 23px;
font-weight: 700;
}
.editorial-profile .warranty {
display: flex;
gap: 10px;
margin-top: 16px;
color: #77736b;
font-size: 23px;
line-height: 1.65;
}
.editorial-profile .trust-card > text {
display: block;
color: #57534e;
font-size: 23px;
line-height: 1.65;
}
.editorial-profile .trust-card .trust-summary {
margin-bottom: 8px;
color: #202221;
font-weight: 600;
}
.editorial-profile .dot {
flex: 0 0 auto;
color: #8a6846;
}
/* 页面样式由林境模板组件提供。 */
.editorial-detail .detail {
background: #f7f5f1;
min-height: 100vh;
color: #252525;
padding-bottom: 150px;
}
.editorial-detail .hero {
width: 100%;
height: 600px;
display: block;
}
.editorial-detail .hero-wrap {
position: relative;
height: 520px;
overflow: hidden;
background: #202221;
}
.editorial-detail .hero-wrap .hero {
height: 100%;
}
.editorial-detail .hero-shade {
position: absolute;
inset: 0;
background: linear-gradient(180deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.78));
}
.editorial-detail .hero-copy {
position: absolute;
right: 40px;
bottom: 32px;
left: 40px;
color: #fff;
}
.editorial-detail .hero-copy text {
display: block;
}
.editorial-detail .hero-copy text:first-child {
color: #d9c8b2;
font-size: 20px;
}
.editorial-detail .hero-copy text:nth-child(2) {
margin-top: 12px;
font: 38px serif;
}
.editorial-detail .hero-copy text:last-child {
margin-top: 8px;
color: rgba(255, 255, 255, 0.72);
font-size: 23px;
}
.editorial-detail .content {
padding: 42px 40px;
}
.editorial-detail .price-card {
display: flex;
justify-content: space-between;
gap: 24px;
padding: 26px;
border: 1px solid #e6ded5;
border-radius: 16px;
background: #fff;
}
.editorial-detail .price-card view:last-child {
text-align: right;
}
.editorial-detail .price-card text {
display: block;
}
.editorial-detail .price-card text:first-child {
color: #77736b;
font-size: 20px;
}
.editorial-detail .price-card text:last-child {
margin-top: 8px;
color: #8a6846;
font: 25px serif;
}
.editorial-detail .detail-section {
margin-top: 38px;
}
.editorial-detail .section-title {
display: block;
padding-left: 16px;
border-left: 5px solid #8a6846;
color: #202221;
font: 27px serif;
}
.editorial-detail .body {
display: block;
margin-top: 16px;
padding: 24px;
border: 1px solid #e6ded5;
border-radius: 14px;
background: #fff;
color: #252525;
font-size: 23px;
line-height: 1.8;
}
.editorial-detail .warm {
background: #efece6;
}
.editorial-detail .craft {
display: flex;
gap: 18px;
margin-top: 14px;
padding: 20px;
border: 1px solid #e6ded5;
border-radius: 12px;
background: #fff;
color: #252525;
font-size: 22px;
line-height: 1.65;
}
.editorial-detail .craft text:first-child {
flex: 0 0 auto;
color: #8a6846;
font-family: monospace;
font-weight: 700;
}
.editorial-detail .materials {
margin-top: 16px;
overflow: hidden;
border: 1px solid #e6ded5;
border-radius: 12px;
background: #fff;
}
.editorial-detail .materials view {
display: flex;
justify-content: space-between;
gap: 24px;
padding: 20px;
color: #252525;
font-size: 21px;
line-height: 1.5;
}
.editorial-detail .materials view + view {
border-top: 1px solid #e6ded5;
}
.editorial-detail .materials text:first-child {
flex: 0 0 auto;
color: #77736b;
}
.editorial-detail .materials text:last-child {
text-align: right;
}
.editorial-detail .category {
font-size: 21px;
color: #8a6846;
}
.editorial-detail .title {
display: block;
font: 46px serif;
line-height: 1.35;
margin: 18px 0 8px;
}
.editorial-detail .series {
display: block;
color: #77736b;
font-size: 26px;
}
.editorial-detail .price {
display: block;
color: #8a6846;
font-size: 30px;
margin-top: 26px;
}
.editorial-detail .desc {
display: block;
margin-top: 30px;
color: #77736b;
font-size: 27px;
line-height: 1.9;
}
.editorial-detail .chips {
display: flex;
flex-wrap: wrap;
gap: 14px;
margin: 30px 0;
}
.editorial-detail .chips text {
border: 1px solid #c9b7a0;
color: #8a6846;
padding: 10px 18px;
font-size: 22px;
}
.editorial-detail .bar {
position: fixed;
bottom: 0;
left: 0;
right: 0;
padding: 22px 32px;
background: #f7f5f1;
}
.editorial-detail .bar button {
background: #252827;
color: #fff;
border-radius: 0;
}
.editorial-detail .bar text {
display: block;
margin-top: 10px;
color: #77736b;
text-align: center;
font-size: 19px;
}
.editorial-list .work-card {
margin-top: 32px;
background: #fff;
}
.editorial-list .work-card image {
width: 100%;
height: 420px;
}
.editorial-list .work-info {
padding: 28px;
}
.editorial-list .work-name {
display: block;
font-size: 32px;
font-family: serif;
}
.editorial-list .work-category,
.editorial-list .work-desc,
.editorial-list .work-price,
.editorial-list .more,
.editorial-list .subtitle {
display: block;
margin-top: 12px;
font-size: 24px;
color: #8a6846;
}
.editorial-profile .profile {
padding-bottom: 48px;
}
.editorial-profile .trust-card > text {
white-space: pre-wrap;
}
@@ -0,0 +1,4 @@
{
"extends": "../../apps/taro/tsconfig.json",
"include": ["taro"]
}