feat: 收口多品牌与模板构建基础
This commit is contained in:
1 parent
0425a1c672
commit
77224ea51f
317 files changed
+11290
-1158
No files matched your search
@@ -1,31 +0,0 @@
|
||||
const doorFallback = require("./linjing-data");
|
||||
|
||||
const base = (name, tagline) => ({
|
||||
schemaVersion: "fallback-1.0",
|
||||
brand: {
|
||||
id: "fallback",
|
||||
name,
|
||||
tagline,
|
||||
description: "以专业经验建立长期信任。",
|
||||
contactPhone: "",
|
||||
contactWechat: "",
|
||||
},
|
||||
offerings: [],
|
||||
trustContent: [],
|
||||
fields: [],
|
||||
modules: [],
|
||||
capabilities: [],
|
||||
theme: {},
|
||||
});
|
||||
|
||||
const fallbacks = {
|
||||
doors: { ...doorFallback, schemaVersion: "fallback-doors-1.0", template: { key: "doors" } },
|
||||
food: base("个人品牌", "私房菜与定制服务"),
|
||||
personal: base("个人品牌", "专业经验与可信赖的合作方式"),
|
||||
};
|
||||
|
||||
function getFallbackWorkspace(templateKey) {
|
||||
return fallbacks[templateKey] || fallbacks.personal;
|
||||
}
|
||||
|
||||
module.exports = { getFallbackWorkspace };
|
||||
@@ -1,201 +0,0 @@
|
||||
const brand = {
|
||||
name: "林境门作",
|
||||
tagline: "私享定制",
|
||||
founder: "梅记兵",
|
||||
title: "高端门系统建筑研造主理人",
|
||||
slogan: "为当代别墅空间,定制有秩序感与呼吸感的门",
|
||||
bio: "国家注册高级室内建筑师,专注高定大门及私宅空间门类系统研发 14 年。拒绝建材量产拼装,以“门与空间同构”之建筑理念,亲自主理选材、构造深化与落地试装。",
|
||||
experienceYears: 14,
|
||||
completedProjects: "260+",
|
||||
coverageArea: "长三角、珠三角核心别墅群及全国私家庄园",
|
||||
phone: "153-7712-8361",
|
||||
wechat: "LIN-ATELIER-2024",
|
||||
studioAddress: "上海市 · 林境门作私享工坊",
|
||||
studioAddress: "上海市静安区威海路设计中心 A 座 / 杭州良渚研造工坊",
|
||||
};
|
||||
const trustContent = {
|
||||
stats: [
|
||||
{ value: "14年", label: "高端门系深化经验", sub: "历经百项严苛私宅考验" },
|
||||
{ value: "260+", label: "落地庄园实景案例", sub: "全实景图库,可预约探访" },
|
||||
{ value: "100%", label: "主理人全案跟进", sub: "量房 / 出图 / 选料 / 试装" },
|
||||
{ value: "10年", label: "结构主轴质保承诺", sub: "终生五金润滑维保机制" },
|
||||
],
|
||||
pillars: [
|
||||
{
|
||||
icon: "tree",
|
||||
title: "天然厚板与古铜锻打",
|
||||
desc: "精选 300 年北美黑胡桃、缅甸柚木直拼大板,搭配手工冷锻紫铜及意大利防爆钢核。",
|
||||
},
|
||||
{
|
||||
icon: "ruler",
|
||||
title: "微米级红外高精量房",
|
||||
desc: "德国进口 3D 空间激光扫描,精准捕捉门洞沉降公差与建筑墙体垂直度,杜绝返工。",
|
||||
},
|
||||
{
|
||||
icon: "shield",
|
||||
title: "隐匿式重型五金系统",
|
||||
desc: "自主研发三维可调静音承重铰链,单扇承载 450kg,开合轻盈如羽,静如深山。",
|
||||
},
|
||||
],
|
||||
serviceFlow: [
|
||||
{ step: "01", name: "私享沟通", desc: "勘定建筑图纸与设计意图,厘清生活动线与风候环境" },
|
||||
{ step: "02", name: "上门实测", desc: "主理人携激光雷达亲赴现场,复核门洞公差与地平基准" },
|
||||
{ step: "03", name: "构造出图", desc: "输出 1:1 断面结构图、五金受力分析与材质节点方案" },
|
||||
{ step: "04", name: "实样工坊确认", desc: "寄送天然木样、锻铜样块及密封胶条试样实物封样" },
|
||||
{ step: "05", name: "工坊试装交付", desc: "原厂精密试装调试无误后专车直运现场,技师组装" },
|
||||
{ step: "06", name: "终生私属维护", desc: "建立一门一档数字化档案,首年两次免维保巡检" },
|
||||
],
|
||||
};
|
||||
const offerings = [
|
||||
{
|
||||
id: "entrance_door",
|
||||
category: "入户大门",
|
||||
name: "当代铸铜木核防暴装甲门",
|
||||
series: "「万籁」重型天地轴入户系统",
|
||||
tag: "主理人年度代表作",
|
||||
image:
|
||||
"https://images.unsplash.com/photo-1513694203232-719a280e022f?auto=format&fit=crop&w=900&q=80",
|
||||
detailHero:
|
||||
"https://images.unsplash.com/photo-1513694203232-719a280e022f?auto=format&fit=crop&w=1000&q=85",
|
||||
priceRange: "¥38,000 - ¥85,000 / 樘",
|
||||
desc: "天然厚板、锻铜与隐匿式重型五金,为别墅入口建立沉稳仪式感。",
|
||||
woodMaterial: "60mm 北美特级黑胡桃整板 + 航空蜂窝铝芯",
|
||||
hardware: "德国 dormakaba 重型地弹簧 + 自主定制实心锻铜一体式长执手(高 2400mm)",
|
||||
spaceType: "独栋别墅建筑主入口 / 挑高大厅玄关",
|
||||
keywords: ["厚重大气", "隐式天地轴", "隔音 42dB", "抗暴防撬"],
|
||||
area: "浙江 · 莫干山私家山庄",
|
||||
enabled: true,
|
||||
details: {
|
||||
background:
|
||||
"项目位于浙北山间独栋庄园,常年多雨潮湿,且冬季山风冷峻。业主期望一扇既有古典厚重仪式感,又能抵御风雨、长久耐候的当代东方大门。",
|
||||
designConcept:
|
||||
"打破繁复雕花的欧式门逻辑,提炼江南屋檐与青砖比例。以暗调冷锻手工铜板包裹耐候钢核,内衬大厚度吸音绝热芯,门体内嵌隐藏式天地承重轴,推拉阻尼丝滑沉稳。",
|
||||
crafts: [
|
||||
"无缝冷锻铜边框,经自然氧化着色,泛深幽青褐金属光泽",
|
||||
"双道三元乙丙航天级发泡密封胶条,气密性达国标 8 级最高标准",
|
||||
"指纹识别模组完全隐于天然胡桃木纹理深处,不露丝毫电子廉价感",
|
||||
],
|
||||
materialsList: [
|
||||
{ name: "门扇主体", spec: "航空铝蜂窝 + 防暴钢板 + 黑胡桃" },
|
||||
{ name: "承重结构", spec: "不锈钢重型天地偏心轴(承重 600KG)" },
|
||||
{ name: "五金执手", spec: "实心黄铜拉丝防指纹覆膜,重 7.2kg" },
|
||||
{ name: "锁具系统", spec: "C 级多向防暴机械锁芯 + 隐匿式生物辨识" },
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "courtyard_door",
|
||||
category: "庭院围墙门",
|
||||
name: "悬挑风琴式耐候双开院门",
|
||||
series: "「虚实」透光私家庭院门",
|
||||
tag: "建筑级耐候工艺",
|
||||
image:
|
||||
"https://images.unsplash.com/photo-1541123437800-1bb1317badc2?auto=format&fit=crop&w=900&q=80",
|
||||
detailHero:
|
||||
"https://images.unsplash.com/photo-1541123437800-1bb1317badc2?auto=format&fit=crop&w=1000&q=85",
|
||||
priceRange: "¥42,000 - ¥98,000 / 樘",
|
||||
desc: "以格栅光影平衡私密与通透,让院门成为建筑与自然的过渡。",
|
||||
woodMaterial: "深浸缅甸柚木条格栅 + 氟碳喷涂耐候钢",
|
||||
hardware: "意大利全隐形地埋式液压自闭器 + 静音电控锁",
|
||||
spaceType: "私家庭院入口 / 围墙园林玄关",
|
||||
keywords: ["园林意境", "格栅光影", "耐候耐蚀", "智能对讲协同"],
|
||||
area: "上海 · 佘山高尔夫别墅",
|
||||
enabled: true,
|
||||
details: {
|
||||
background:
|
||||
"庭院门直面自然日晒雨淋,普通木门极易开裂变形,普通铁艺门几年内斑驳锈蚀。本案要求 20 年免维护的高级自然质感。",
|
||||
designConcept:
|
||||
"利用竖向错落的柚木条构建视线遮蔽与透光的微妙平衡,外部无法看穿内部庭院,内部向外望去则如薄纱透竹。",
|
||||
crafts: [
|
||||
"微隙热胀冷缩结构槽设计,预留木材季候伸缩呼吸余量",
|
||||
"隐蔽式水路导流坡口,雨水冲刷即自然滑落不积水",
|
||||
"院墙铰链锚栓深入混凝土柱芯 300mm,经历 14 级台风无晃动",
|
||||
],
|
||||
materialsList: [
|
||||
{ name: "户外木种", spec: "高油脂老料缅甸柚木,经过 180 天自然风干" },
|
||||
{ name: "骨架型材", spec: "4mm 高强度航空铝镁合金,耐盐雾防腐" },
|
||||
{ name: "智能五金", spec: "隐藏式地下闭门轴,支持业主手机远程授权开门" },
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "interior_door",
|
||||
category: "室内户内门",
|
||||
name: "通顶极窄边框实木室内门",
|
||||
series: "「空灵」2.8m-3.2m 满高通顶系统",
|
||||
tag: "极简建筑平直感",
|
||||
image:
|
||||
"https://images.unsplash.com/photo-1505691938895-1758d7feb511?auto=format&fit=crop&w=900&q=80",
|
||||
detailHero:
|
||||
"https://images.unsplash.com/photo-1505691938895-1758d7feb511?auto=format&fit=crop&w=1000&q=85",
|
||||
priceRange: "¥7,800 - ¥16,000 / 樘",
|
||||
desc: "门与护墙板同色同构,通顶尺度让室内空间保持完整的建筑感。",
|
||||
woodMaterial: "天然白栓木拉丝烟熏木饰面 + 磁吸阻尼降噪",
|
||||
hardware: "意大利 AGB 磁吸静音门锁 + 隐藏式暗铰链",
|
||||
spaceType: "别墅主卧套房 / 私人藏书阁 / 视听室",
|
||||
keywords: ["满高通顶", "磁吸静音", "极窄边框", "与木作同色"],
|
||||
area: "江苏 · 苏州金鸡湖独栋",
|
||||
enabled: true,
|
||||
details: {
|
||||
background:
|
||||
"室内多道门如果尺寸矮小杂乱,会彻底切割私宅的建筑开阔感。业主希望整个二层主卧区实现门与护墙板毫无色差、绝对平齐的极致纯粹度。",
|
||||
designConcept:
|
||||
"做到门扇高 3.1 米一通到顶,无传统上门套与压边。门扇内嵌双向碳纤维抗弯龙骨,保证高纬度温差下永不变形扭曲。",
|
||||
crafts: [
|
||||
"门框与墙体批荡层彻底融为一体的无框反装工艺",
|
||||
"关门瞬间磁力吸舌弹出,落锁轻无声息,静音等级达书店级",
|
||||
"木皮精选同批原木切片,拼花纹理与旁边护墙板自然连贯",
|
||||
],
|
||||
materialsList: [
|
||||
{ name: "抗弯核心", spec: "双组份碳纤维预应力防变形拉力杆" },
|
||||
{ name: "吸音内衬", spec: "德国原装绍尔兰特均质空心桥洞力学板" },
|
||||
{ name: "隐形铰链", spec: "德国 KRONA 三维可调隐形铰链" },
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "stealth_door",
|
||||
category: "装饰隐形门",
|
||||
name: "石材及皮质背景墙一体门",
|
||||
series: "「无垠」密室及背景墙融合门",
|
||||
tag: "精密收口工程",
|
||||
image:
|
||||
"https://images.unsplash.com/photo-1600210492486-724fe5c67fb0?auto=format&fit=crop&w=900&q=80",
|
||||
detailHero:
|
||||
"https://images.unsplash.com/photo-1600210492486-724fe5c67fb0?auto=format&fit=crop&w=1000&q=85",
|
||||
priceRange: "¥18,000 - ¥36,000 / 樘",
|
||||
desc: "以毫厘对缝将门融入背景墙,保留空间完整秩序与隐藏仪式感。",
|
||||
woodMaterial: "3mm 超薄大理石复合蜂窝板 / 进口鞍革手工双缝线",
|
||||
hardware: "感应式电动自开闭装置或碰珠反弹器",
|
||||
spaceType: "雪茄室 / 私人金库 / 地下酒窖 / 视听隐藏储物区",
|
||||
keywords: ["视线隐形", "超薄岩板", "毫厘对缝", "无门把设计"],
|
||||
area: "广东 · 深圳香蜜湖一号",
|
||||
enabled: true,
|
||||
details: {
|
||||
background:
|
||||
"客厅背景墙长达 9 米,中间有一道通往主人密闭酒窖的通道,若突兀开门将完全破坏整面奢石的连贯韵律。",
|
||||
designConcept:
|
||||
"将奢石切割对纹直接复合于高刚性合金门扇表面,缝隙控制在严苛的 1.5mm 以内,未触发开关时完全是一整面天然水墨石壁。",
|
||||
crafts: [
|
||||
"石材水刀无应力薄切与航空蜂窝背栓复合",
|
||||
"脚踏地砖预埋重力复位转轴,避免墙面任何外露开孔",
|
||||
"支持指纹电控联动隐藏灯带变色,开门仪式感强烈",
|
||||
],
|
||||
materialsList: [
|
||||
{ name: "表面饰材", spec: "意大利顶级雪山银狐超薄天然大理石" },
|
||||
{ name: "驱动系统", spec: "低噪步进电机伺服闭门器,运行分贝低于 20dB" },
|
||||
],
|
||||
},
|
||||
},
|
||||
];
|
||||
offerings.forEach((item) => {
|
||||
item.woodMaterial = item.woodMaterial || "天然厚板 / 手工锻铜 / 岩板饰面";
|
||||
item.hardware = item.hardware || "隐匿式重型天地轴五金系统";
|
||||
item.spaceType = item.spaceType || "私家别墅 / 高端私宅";
|
||||
item.details = item.details || {
|
||||
background: item.desc + " 项目位于" + item.area + ",由主理人全程跟进。",
|
||||
designConcept: "以建筑尺度为起点,让门成为空间秩序与生活气息之间的自然过渡。",
|
||||
crafts: "毫米级门洞复核、结构深化与多次现场试装,确保开合、隔音与收口长期稳定。",
|
||||
};
|
||||
});
|
||||
module.exports = { brand, trustContent, offerings };
|
||||
@@ -58,11 +58,14 @@ function resolveManifest(workspace) {
|
||||
if (!manifest || !Array.isArray(manifest.pages)) return null;
|
||||
const pages = {};
|
||||
for (const page of manifest.pages) {
|
||||
pages[page.key] = (page.modules || []).map((module) => ({
|
||||
...module,
|
||||
type: MANIFEST_TYPE_ALIASES[module.type] || module.type,
|
||||
variant: module.variant || "default",
|
||||
}));
|
||||
pages[page.key] = {
|
||||
...page,
|
||||
modules: (page.modules || []).map((module) => ({
|
||||
...module,
|
||||
type: MANIFEST_TYPE_ALIASES[module.type] || module.type,
|
||||
variant: module.variant || "default",
|
||||
})),
|
||||
};
|
||||
}
|
||||
return { ...manifest, pages };
|
||||
}
|
||||
@@ -70,7 +73,7 @@ function resolveManifest(workspace) {
|
||||
function resolveRuntime(workspace) {
|
||||
const modules = Array.isArray(workspace && workspace.modules) ? workspace.modules : [];
|
||||
const manifest = resolveManifest(workspace);
|
||||
const manifestHome = manifest && manifest.pages.home;
|
||||
const manifestHome = manifest && manifest.pages.home?.modules;
|
||||
const manifestModules = manifestHome || [];
|
||||
const resolved = modules.map(resolveModule);
|
||||
const resolvedTypes = new Set(resolved.map((item) => item.type));
|
||||
@@ -87,11 +90,28 @@ function resolveRuntime(workspace) {
|
||||
: resolved.map((item) => item.type);
|
||||
const moduleVariants = {};
|
||||
for (const item of manifestHome || []) moduleVariants[item.type] = item.variant;
|
||||
const pageRenderers = {};
|
||||
for (const page of Object.values(manifest?.pages || {})) {
|
||||
if (page.renderer) pageRenderers[page.key] = page.renderer;
|
||||
}
|
||||
const navigation = Array.isArray(manifest?.navigation)
|
||||
? manifest.navigation.map((item) => ({
|
||||
...item,
|
||||
page:
|
||||
typeof item.page === "string" && manifest.entrypoints?.[item.page]
|
||||
? manifest.entrypoints[item.page]
|
||||
: item.page,
|
||||
}))
|
||||
: Array.isArray(workspace?.navigation)
|
||||
? workspace.navigation
|
||||
: [];
|
||||
return {
|
||||
theme: manifest?.tokens || (workspace && workspace.theme ? workspace.theme : FALLBACK_THEME),
|
||||
modules: resolved,
|
||||
layout: { home: home.filter((key) => resolved.some((item) => item.type === key)) },
|
||||
moduleVariants,
|
||||
pageRenderers,
|
||||
navigation,
|
||||
visualManifest: manifest,
|
||||
capabilities: workspace && Array.isArray(workspace.capabilities) ? workspace.capabilities : [],
|
||||
};
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
const config = require("./config");
|
||||
|
||||
function withBrandContext(path, options) {
|
||||
if (options.includeBrand === false || !path.startsWith("/public/")) return path;
|
||||
const requiresBrandContext =
|
||||
path.startsWith("/public/") || path.startsWith("/customer/session/wechat");
|
||||
if (options.includeBrand === false || !requiresBrandContext) return path;
|
||||
const separator = path.includes("?") ? "&" : "?";
|
||||
return path + separator + "brandSlug=" + encodeURIComponent(config.brandSlug);
|
||||
}
|
||||
|
||||
function customerTokenKey() {
|
||||
return "customerToken:" + config.brandSlug;
|
||||
}
|
||||
|
||||
function request(path, options = {}) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const requestPath = withBrandContext(path, options);
|
||||
@@ -25,11 +31,11 @@ function request(path, options = {}) {
|
||||
}
|
||||
|
||||
function customerRequest(path, options = {}) {
|
||||
const token = wx.getStorageSync("customerToken");
|
||||
const token = wx.getStorageSync(customerTokenKey());
|
||||
return request(path, {
|
||||
...options,
|
||||
header: { ...(options.header || {}), Authorization: "Bearer " + token },
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = { request, customerRequest };
|
||||
module.exports = { request, customerRequest, customerTokenKey };
|
||||
@@ -1,47 +1,59 @@
|
||||
const { request } = require("./request");
|
||||
const { getFallbackWorkspace } = require("./fallback-workspaces");
|
||||
const { resolveRuntime } = require("./module-registry");
|
||||
|
||||
function toOffering(item) {
|
||||
const config = item && item.config && typeof item.config === "object" ? item.config : {};
|
||||
const presentation =
|
||||
item && item.presentation && typeof item.presentation === "object" ? item.presentation : {};
|
||||
const details =
|
||||
presentation.details && typeof presentation.details === "object" ? presentation.details : {};
|
||||
return {
|
||||
...item,
|
||||
id: item.id,
|
||||
category: item.category || item.kind || "业务提供项",
|
||||
category: presentation.categoryLabel || "业务提供项",
|
||||
name: item.name,
|
||||
desc: item.summary || item.description || "",
|
||||
image: item.coverUrl || item.image || "",
|
||||
desc: item.summary || "",
|
||||
image: presentation.heroImage || item.coverUrl || "",
|
||||
priceRange: item.priceText || "沟通报价",
|
||||
keywords: Array.isArray(config.keywords) ? config.keywords : [],
|
||||
keywords: Array.isArray(presentation.keywords) ? presentation.keywords : [],
|
||||
details: {
|
||||
background: typeof details.background === "string" ? details.background : "",
|
||||
designConcept: typeof details.designConcept === "string" ? details.designConcept : "",
|
||||
crafts: Array.isArray(details.crafts) ? details.crafts : [],
|
||||
materialsList: Array.isArray(details.materialsList) ? details.materialsList : [],
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function normalizeWorkspace(workspace) {
|
||||
const brand = workspace && workspace.brand ? workspace.brand : {};
|
||||
const offerings = Array.isArray(workspace && workspace.offerings)
|
||||
? workspace.offerings.map(toOffering)
|
||||
: [];
|
||||
const trustContent =
|
||||
workspace && workspace.trustPresentation && typeof workspace.trustPresentation === "object"
|
||||
? workspace.trustPresentation
|
||||
: {};
|
||||
return {
|
||||
...workspace,
|
||||
...resolveRuntime(workspace),
|
||||
brand,
|
||||
offerings,
|
||||
trustContent,
|
||||
plugins: Array.isArray(workspace.plugins) ? workspace.plugins : [],
|
||||
};
|
||||
}
|
||||
|
||||
function loadWorkspace() {
|
||||
return request("/public/workspace").then((workspace) => {
|
||||
const fallback = getFallbackWorkspace(
|
||||
workspace && workspace.template && workspace.template.key,
|
||||
);
|
||||
const brand = workspace && workspace.brand ? workspace.brand : fallback.brand;
|
||||
const offerings = Array.isArray(workspace && workspace.offerings)
|
||||
? workspace.offerings.map(toOffering)
|
||||
: fallback.offerings;
|
||||
const trustContent =
|
||||
Array.isArray(workspace && workspace.trustContent) && workspace.trustContent.length
|
||||
? workspace.trustContent
|
||||
: fallback.trustContent;
|
||||
return {
|
||||
...workspace,
|
||||
...resolveRuntime(workspace),
|
||||
brand,
|
||||
offerings,
|
||||
trustContent,
|
||||
plugins: Array.isArray(workspace.plugins) ? workspace.plugins : [],
|
||||
};
|
||||
if (workspace?.publication?.status !== "published") {
|
||||
throw new Error("品牌尚未发布");
|
||||
}
|
||||
return normalizeWorkspace(workspace);
|
||||
});
|
||||
}
|
||||
|
||||
function loadWorkspaceWithFallback() {
|
||||
return loadWorkspace().catch(() => getFallbackWorkspace("personal"));
|
||||
return loadWorkspace();
|
||||
}
|
||||
|
||||
module.exports = { loadWorkspaceWithFallback };
|
||||
Reference in new issue
Block a user