refactor: 重构模板叠加式编译产物
This commit is contained in:
1 parent
c46297b13b
commit
25d1fe983c
93 files changed
+870
-2467
No files matched your search
@@ -1,13 +1,15 @@
|
||||
const runtimeConfig = require("../runtime-config");
|
||||
|
||||
const app = getApp();
|
||||
|
||||
module.exports = {
|
||||
get apiBaseUrl() {
|
||||
return app.globalData.apiBaseUrl;
|
||||
return app.globalData.apiBaseUrl || runtimeConfig.apiBaseUrl;
|
||||
},
|
||||
get brand() {
|
||||
return app.globalData.brand || {};
|
||||
},
|
||||
get brandSlug() {
|
||||
return wx.getStorageSync("brandSlug") || app.globalData.brandSlug || "default-brand";
|
||||
return app.globalData.brandSlug || runtimeConfig.brandSlug;
|
||||
},
|
||||
};
|
||||
@@ -90,10 +90,6 @@ 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,
|
||||
@@ -110,7 +106,6 @@ function resolveRuntime(workspace) {
|
||||
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,78 +0,0 @@
|
||||
const TEMPLATES = {
|
||||
food: {
|
||||
modeLabels: { pickup: "自取", delivery: "配送" },
|
||||
contactLabel: "联系摊主",
|
||||
cancelLabel: "取消预约",
|
||||
cancelNote: "取消后请及时告知摊主,避免食材浪费。",
|
||||
hero: "今天吃什么",
|
||||
heroSub: "现做家常饭",
|
||||
about: "品牌简介",
|
||||
description: "个人经营的家常小灶,套餐现做,也可预约小型聚餐和私厨定制。",
|
||||
primary: "预约套餐",
|
||||
secondary: "咨询私厨",
|
||||
timeLabel: "营业时间",
|
||||
time: "11:00—20:00",
|
||||
addressLabel: "摊位地址",
|
||||
address: "校园路社区便民点 12 号",
|
||||
noteLabel: "配送说明",
|
||||
note: "满 30 元周边配送,也可自取",
|
||||
serviceSub: "今日可订",
|
||||
first: "普通套餐",
|
||||
firstSub: "日常家常饭",
|
||||
second: "私厨服务",
|
||||
secondSub: "聚餐定制",
|
||||
available: "今日可订",
|
||||
unavailable: "暂不可订",
|
||||
empty: "暂无可订服务",
|
||||
bookingTitle: "预约套餐",
|
||||
requestType: "package",
|
||||
modeLabel: "取餐方式",
|
||||
modeA: "自取",
|
||||
modeB: "配送",
|
||||
locationLabel: "配送地址",
|
||||
locationPlaceholder: "请输入配送地址",
|
||||
notePlaceholder: "口味、餐具或其他说明",
|
||||
submitNotice: "提交后由摊主人工确认,确认后再安排制作。",
|
||||
submitLabel: "提交预约",
|
||||
},
|
||||
personal: {
|
||||
modeLabels: { pickup: "线上沟通", delivery: "线下沟通" },
|
||||
contactLabel: "联系品牌方",
|
||||
cancelLabel: "取消申请",
|
||||
cancelNote: "如需调整,请尽早联系品牌方。",
|
||||
hero: "个人品牌",
|
||||
heroSub: "把专业能力,变成值得信赖的体验",
|
||||
about: "关于我",
|
||||
description: "这里展示你的专业背景、工作方式与品牌理念。",
|
||||
primary: "查看服务",
|
||||
secondary: "发起咨询",
|
||||
timeLabel: "服务时间",
|
||||
time: "工作日 10:00—18:00",
|
||||
addressLabel: "所在位置",
|
||||
address: "线上 / 线下均可沟通",
|
||||
noteLabel: "合作说明",
|
||||
note: "提交需求后,我会尽快与你联系",
|
||||
serviceSub: "可咨询",
|
||||
first: "标准服务",
|
||||
firstSub: "清晰的服务方案",
|
||||
second: "定制合作",
|
||||
secondSub: "按需求沟通",
|
||||
available: "可咨询",
|
||||
unavailable: "暂不可用",
|
||||
empty: "暂无可咨询服务",
|
||||
bookingTitle: "合作咨询",
|
||||
requestType: "inquiry",
|
||||
modeLabel: "沟通方式",
|
||||
modeA: "线上沟通",
|
||||
modeB: "线下沟通",
|
||||
locationLabel: "沟通方式或地点",
|
||||
locationPlaceholder: "请输入会议方式、地点或链接",
|
||||
notePlaceholder: "请介绍你的需求、预算或期待结果",
|
||||
submitNotice: "提交后品牌方会与你确认需求、时间和合作方式。",
|
||||
submitLabel: "提交需求",
|
||||
},
|
||||
};
|
||||
function getTemplate(key) {
|
||||
return TEMPLATES[key] || TEMPLATES.personal;
|
||||
}
|
||||
module.exports = { getTemplate, TEMPLATES };
|
||||
Reference in new issue
Block a user