feat: 收口多品牌与模板构建基础
This commit is contained in:
1 parent
0425a1c672
commit
77224ea51f
317 files changed
+11290
-1158
No files matched your search
+1
-1
@@ -1,4 +1,4 @@
|
||||
const DEFAULT_API_BASE_URL = "http://172.16.6.123:3001";
|
||||
const DEFAULT_API_BASE_URL = "http://localhost:3001";
|
||||
const DEFAULT_BRAND_SLUG = "default-brand";
|
||||
|
||||
App({
|
||||
|
||||
+1
-26
@@ -2,6 +2,7 @@
|
||||
"pages": [
|
||||
"pages/index/index",
|
||||
"pages/services/index",
|
||||
"pages/stall-service/index",
|
||||
"pages/booking/index",
|
||||
"pages/bookings/index",
|
||||
"pages/offering/detail",
|
||||
@@ -14,31 +15,5 @@
|
||||
"navigationBarBackgroundColor": "#FBF7F1",
|
||||
"navigationBarTextStyle": "black",
|
||||
"backgroundColor": "#FBF7F1"
|
||||
},
|
||||
"tabBar": {
|
||||
"color": "#7A4A2B",
|
||||
"selectedColor": "#B54A2C",
|
||||
"backgroundColor": "#FFFFFF",
|
||||
"borderStyle": "white",
|
||||
"list": [
|
||||
{
|
||||
"pagePath": "pages/index/index",
|
||||
"text": "首页",
|
||||
"iconPath": "assets/tab/home.png",
|
||||
"selectedIconPath": "assets/tab/home-selected.png"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/services/index",
|
||||
"text": "案例与体系",
|
||||
"iconPath": "assets/tab/briefcase.png",
|
||||
"selectedIconPath": "assets/tab/briefcase-selected.png"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/bookings/index",
|
||||
"text": "主理人与我",
|
||||
"iconPath": "assets/tab/user.png",
|
||||
"selectedIconPath": "assets/tab/user-selected.png"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,7 @@
|
||||
Component({
|
||||
properties: { brand: { type: Object, value: {} }, variant: { type: String, value: "default" } },
|
||||
properties: {
|
||||
brand: { type: Object, value: {} },
|
||||
presentation: { type: Object, value: {} },
|
||||
variant: { type: String, value: "default" },
|
||||
},
|
||||
});
|
||||
@@ -1 +1 @@
|
||||
<view class="founder"><image class="avatar" src="{{brand.avatarUrl || 'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?auto=format&fit=crop&w=240&h=240&q=80'}}"/><view><text class="founder-name">{{brand.founder}}</text><text class="founder-title">{{brand.title}}</text><text class="quote">“{{brand.slogan}}”</text></view><text class="badge">亲自主理量房</text></view>
|
||||
<view class="founder"><image wx:if="{{brand.avatarUrl}}" class="avatar" src="{{brand.avatarUrl}}"/><view wx:else class="avatar avatar-placeholder">{{brand.founder}}</view><view><text class="founder-name">{{brand.founder}}</text><text class="founder-title">{{brand.title}}</text><text class="quote">“{{brand.slogan}}”</text></view><text wx:if="{{presentation.founderBadge}}" class="badge">{{presentation.founderBadge}}</text></view>
|
||||
@@ -12,6 +12,15 @@
|
||||
border-radius: 50%;
|
||||
object-fit: cover;
|
||||
}
|
||||
.avatar-placeholder {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
background: #eee;
|
||||
color: #777;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.founder-name {
|
||||
display: block;
|
||||
font: 34rpx serif;
|
||||
|
||||
@@ -12,7 +12,7 @@ Component({
|
||||
choose(e) {
|
||||
const field = this.data.fields.find((item) => item.key === e.currentTarget.dataset.key);
|
||||
const option = field?.options?.[e.detail.value];
|
||||
if (option) this.triggerEvent("input", { key: field.key, value: option.value });
|
||||
if (option) this.triggerEvent("input", { key: field.key, value: option.value ?? option });
|
||||
},
|
||||
dateChange(e) {
|
||||
this.triggerEvent("input", { key: e.currentTarget.dataset.key, value: e.detail.value });
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
Component({
|
||||
properties: { item: { type: Object, value: {} } },
|
||||
properties: {
|
||||
item: { type: Object, value: {} },
|
||||
presentation: { type: Object, value: {} },
|
||||
},
|
||||
methods: {
|
||||
inquire() {
|
||||
this.triggerEvent("inquire");
|
||||
|
||||
@@ -1 +1 @@
|
||||
<view class="detail"><image class="hero" src="{{item.image}}" mode="aspectFill"/><view class="content"><text class="category">{{item.category}} · {{item.tag}}</text><text class="title">{{item.name}}</text><text class="series">{{item.series}}</text><text class="price">{{item.priceRange}}</text><text class="desc">{{item.desc}}</text><view class="chips"><text wx:for="{{item.keywords}}" wx:key="*this">{{item}}</text></view></view><view class="bar"><button bindtap="inquire">预约测量 / 获取方案</button></view></view>
|
||||
<view class="detail"><view class="hero-wrap"><image class="hero" src="{{item.detailHero || item.image}}" mode="aspectFill"/><view class="hero-shade"></view><view class="hero-copy"><text>{{item.category}} · {{item.area}}</text><text>{{item.name}}</text><text>{{item.series}}</text></view></view><view class="content"><view class="price-card"><view><text>{{presentation.priceLabel}}</text><text>{{item.priceRange}}</text></view><view><text>{{presentation.spaceLabel}}</text><text>{{item.spaceType}}</text></view></view><view class="detail-section"><text class="section-title">{{presentation.backgroundTitle}}</text><text class="body">{{item.details.background || item.desc}}</text></view><view wx:if="{{item.details.designConcept}}" class="detail-section"><text class="section-title">{{presentation.conceptTitle}}</text><text class="body warm">{{item.details.designConcept}}</text></view><view wx:if="{{item.details.crafts.length}}" class="detail-section"><text class="section-title">{{presentation.craftsTitle}}</text><view wx:for="{{item.details.crafts}}" wx:key="*this" class="craft"><text>0{{index + 1}}</text><text>{{item}}</text></view></view><view wx:if="{{item.details.materialsList.length}}" class="detail-section"><text class="section-title">{{presentation.materialsTitle}}</text><view class="materials"><view wx:for="{{item.details.materialsList}}" wx:key="name"><text>{{item.name}}</text><text>{{item.spec}}</text></view></view></view><view class="chips"><text wx:for="{{item.keywords}}" wx:key="*this">{{item}}</text></view></view><view class="bar"><button bindtap="inquire">{{presentation.inquiryAction}}</button><text>{{presentation.inquiryHint}}</text></view></view>
|
||||
@@ -9,9 +9,138 @@
|
||||
height: 600rpx;
|
||||
display: block;
|
||||
}
|
||||
.hero-wrap {
|
||||
position: relative;
|
||||
height: 520rpx;
|
||||
overflow: hidden;
|
||||
background: #202221;
|
||||
}
|
||||
.hero-wrap .hero {
|
||||
height: 100%;
|
||||
}
|
||||
.hero-shade {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: linear-gradient(180deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.78));
|
||||
}
|
||||
.hero-copy {
|
||||
position: absolute;
|
||||
right: 40rpx;
|
||||
bottom: 32rpx;
|
||||
left: 40rpx;
|
||||
color: #fff;
|
||||
}
|
||||
.hero-copy text {
|
||||
display: block;
|
||||
}
|
||||
.hero-copy text:first-child {
|
||||
color: #d9c8b2;
|
||||
font-size: 20rpx;
|
||||
}
|
||||
.hero-copy text:nth-child(2) {
|
||||
margin-top: 12rpx;
|
||||
font: 38rpx serif;
|
||||
}
|
||||
.hero-copy text:last-child {
|
||||
margin-top: 8rpx;
|
||||
color: rgba(255, 255, 255, 0.72);
|
||||
font-size: 23rpx;
|
||||
}
|
||||
.content {
|
||||
padding: 42rpx 40rpx;
|
||||
}
|
||||
.price-card {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 24rpx;
|
||||
padding: 26rpx;
|
||||
border: 1rpx solid #e6ded5;
|
||||
border-radius: 16rpx;
|
||||
background: #fff;
|
||||
}
|
||||
.price-card view:last-child {
|
||||
text-align: right;
|
||||
}
|
||||
.price-card text {
|
||||
display: block;
|
||||
}
|
||||
.price-card text:first-child {
|
||||
color: #77736b;
|
||||
font-size: 20rpx;
|
||||
}
|
||||
.price-card text:last-child {
|
||||
margin-top: 8rpx;
|
||||
color: #8a6846;
|
||||
font: 25rpx serif;
|
||||
}
|
||||
.detail-section {
|
||||
margin-top: 38rpx;
|
||||
}
|
||||
.section-title {
|
||||
display: block;
|
||||
padding-left: 16rpx;
|
||||
border-left: 5rpx solid #8a6846;
|
||||
color: #202221;
|
||||
font: 27rpx serif;
|
||||
}
|
||||
.body {
|
||||
display: block;
|
||||
margin-top: 16rpx;
|
||||
padding: 24rpx;
|
||||
border: 1rpx solid #e6ded5;
|
||||
border-radius: 14rpx;
|
||||
background: #fff;
|
||||
color: #252525;
|
||||
font-size: 23rpx;
|
||||
line-height: 1.8;
|
||||
}
|
||||
.warm {
|
||||
background: #efece6;
|
||||
}
|
||||
.craft {
|
||||
display: flex;
|
||||
gap: 18rpx;
|
||||
margin-top: 14rpx;
|
||||
padding: 20rpx;
|
||||
border: 1rpx solid #e6ded5;
|
||||
border-radius: 12rpx;
|
||||
background: #fff;
|
||||
color: #252525;
|
||||
font-size: 22rpx;
|
||||
line-height: 1.65;
|
||||
}
|
||||
.craft text:first-child {
|
||||
flex: 0 0 auto;
|
||||
color: #8a6846;
|
||||
font-family: monospace;
|
||||
font-weight: 700;
|
||||
}
|
||||
.materials {
|
||||
margin-top: 16rpx;
|
||||
overflow: hidden;
|
||||
border: 1rpx solid #e6ded5;
|
||||
border-radius: 12rpx;
|
||||
background: #fff;
|
||||
}
|
||||
.materials view {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 24rpx;
|
||||
padding: 20rpx;
|
||||
color: #252525;
|
||||
font-size: 21rpx;
|
||||
line-height: 1.5;
|
||||
}
|
||||
.materials view + view {
|
||||
border-top: 1rpx solid #e6ded5;
|
||||
}
|
||||
.materials text:first-child {
|
||||
flex: 0 0 auto;
|
||||
color: #77736b;
|
||||
}
|
||||
.materials text:last-child {
|
||||
text-align: right;
|
||||
}
|
||||
.category {
|
||||
font-size: 21rpx;
|
||||
color: #8a6846;
|
||||
@@ -65,3 +194,10 @@
|
||||
color: #fff;
|
||||
border-radius: 0;
|
||||
}
|
||||
.bar text {
|
||||
display: block;
|
||||
margin-top: 10rpx;
|
||||
color: #77736b;
|
||||
text-align: center;
|
||||
font-size: 19rpx;
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
Component({
|
||||
properties: {
|
||||
offerings: { type: Array, value: [] },
|
||||
presentation: { type: Object, value: {} },
|
||||
variant: { type: String, value: "default" },
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -1 +1 @@
|
||||
<view class="section"><view class="section-head"><view><text class="eyebrow dark">SELECTED WORKS</text><text class="section-title">精选门系统作品</text></view><text class="more" bindtap="more">查看全部 →</text></view><view wx:for="{{offerings}}" wx:key="id" class="work-card" data-id="{{item.id}}" bindtap="open"><image src="{{item.image}}" mode="aspectFill"/><view class="work-info"><text class="work-category">{{item.category}} · {{item.area}}</text><text class="work-name">{{item.name}}</text><text class="work-desc">{{item.series}} · {{item.keywords[0]}} · {{item.keywords[1]}}</text></view></view></view>
|
||||
<view class="section"><view class="section-head"><view><text class="eyebrow dark">{{presentation.worksEyebrow}}</text><text class="section-title">{{presentation.worksTitle}}</text></view><text class="more" bindtap="more">{{presentation.worksAction}}</text></view><view wx:for="{{offerings}}" wx:key="id" class="work-card" data-id="{{item.id}}" bindtap="open"><image src="{{item.image}}" mode="aspectFill"/><view class="work-info"><text class="work-category">{{item.category}} · {{item.area}}</text><text class="work-name">{{item.name}}</text><text class="work-desc">{{item.series}} · {{item.keywords[0]}} · {{item.keywords[1]}}</text></view></view></view>
|
||||
@@ -1,5 +1,9 @@
|
||||
Component({
|
||||
properties: { brand: { type: Object, value: {} }, recordsCount: { type: Number, value: 0 } },
|
||||
properties: {
|
||||
brand: { type: Object, value: {} },
|
||||
presentation: { type: Object, value: {} },
|
||||
recordsCount: { type: Number, value: 0 },
|
||||
},
|
||||
methods: {
|
||||
call() {
|
||||
this.triggerEvent("call");
|
||||
|
||||
@@ -1 +1 @@
|
||||
<view class="profile"><view class="contact-card"><view class="identity"><view class="avatar">林</view><view><text class="founder">{{brand.founder}}</text><text class="role">{{brand.title}}</text></view></view><view class="line"><text>专线电话</text><view><text>{{brand.phone}}</text><button bindtap="call">呼叫</button></view></view><view class="line"><text>工作室微信</text><view><text>{{brand.wechat}}</text><button bindtap="copy">复制</button></view></view><view class="line"><text>实体工坊</text><text>{{brand.studioAddress}}</text></view></view><view class="entry" bindtap="records"><text>我的量房与定制咨询</text><text>{{recordsCount}} 条记录 ›</text></view></view>
|
||||
<view class="profile"><view class="contact-card"><view class="identity"><image wx:if="{{brand.avatarUrl}}" class="avatar" src="{{brand.avatarUrl}}" mode="aspectFill"/><view wx:else class="avatar">{{brand.founder}}</view><view><text class="founder">{{brand.founder}}</text><text class="role">{{brand.title}}</text></view></view><view class="line"><text>{{presentation.phoneLabel || '联系电话'}}</text><view><text>{{brand.phone}}</text><button bindtap="call">{{presentation.callAction || '呼叫'}}</button></view></view><view class="line"><text>{{presentation.wechatLabel || '微信'}}</text><view><text>{{brand.wechat}}</text><button bindtap="copy">{{presentation.copyAction || '复制'}}</button></view></view><view class="line"><text>{{presentation.addressLabel || '工作地址'}}</text><text>{{brand.studioAddress}}</text></view></view><view class="entry" bindtap="records"><text>{{presentation.recordsTitle || '我的咨询记录'}}</text><text>{{recordsCount}} {{presentation.recordsCountUnit || '条记录'}} ›</text></view></view>
|
||||
@@ -1,5 +1,8 @@
|
||||
Component({
|
||||
properties: { records: { type: Array, value: [] } },
|
||||
properties: {
|
||||
records: { type: Array, value: [] },
|
||||
presentation: { type: Object, value: {} },
|
||||
},
|
||||
methods: {
|
||||
create() {
|
||||
this.triggerEvent("create");
|
||||
|
||||
@@ -1 +1 @@
|
||||
<view class="records"><view wx:if="{{!records.length}}" class="empty"><text class="empty-title">还没有咨询记录</text><text>预约一次私享沟通,让我们从你的空间开始。</text><button bindtap="create">开始咨询</button></view><view wx:else><view class="record" wx:for="{{records}}" wx:key="id"><view class="record-head"><text>{{item.type}}</text><text class="status">{{item.status}}</text></view><text class="project">{{item.project}} · {{item.offeringName}}</text><text class="meta">档案编号 {{item.id}} {{item.createdAt}}</text><view wx:if="{{item.timeline.length}}" class="timeline"><view wx:for="{{item.timeline}}" wx:key="createdAt" class="timeline-item"><text class="timeline-dot">●</text><text>{{item.status}} · {{item.createdAt}}</text></view></view></view></view></view>
|
||||
<view class="records"><view wx:if="{{!records.length}}" class="empty"><text class="empty-title">{{presentation.emptyTitle}}</text><text>{{presentation.emptyDescription}}</text><button bindtap="create">{{presentation.emptyAction}}</button></view><view wx:else><view class="record" wx:for="{{records}}" wx:key="id"><view class="record-head"><text>{{item.type}}</text><text class="status">{{item.status}}</text></view><text class="project">{{item.project}} · {{item.offeringName}}</text><text class="meta">档案编号 {{item.id}} {{item.createdAt}}</text><view wx:if="{{item.timeline.length}}" class="timeline"><view wx:for="{{item.timeline}}" wx:key="createdAt" class="timeline-item"><text class="timeline-dot">●</text><text>{{item.status}} · {{item.createdAt}}</text></view></view></view></view></view>
|
||||
@@ -1,5 +1,8 @@
|
||||
Component({
|
||||
properties: { record: { type: Object, value: {} } },
|
||||
properties: {
|
||||
record: { type: Object, value: {} },
|
||||
presentation: { type: Object, value: {} },
|
||||
},
|
||||
methods: {
|
||||
records() {
|
||||
this.triggerEvent("records");
|
||||
|
||||
@@ -1 +1 @@
|
||||
<view class="success"><view class="mark">✓</view><text class="eyebrow">PRIVATE CONSULTATION</text><text class="title">已收到你的咨询</text><text class="intro">主理人会根据你的项目资料,整理初步判断并在 1 个工作日内与你联系。</text><view class="summary"><view><text>档案编号</text><text>{{record.id}}</text></view><view><text>定制类型</text><text>{{record.type}}</text></view><view><text>当前状态</text><text>{{record.status}}</text></view></view><button bindtap="records">查看咨询记录</button><button class="secondary" bindtap="home">返回首页</button></view>
|
||||
<view class="success"><view class="mark">✓</view><text class="eyebrow">{{presentation.eyebrow}}</text><text class="title">{{presentation.title}}</text><text class="intro">{{presentation.intro}}</text><view class="summary"><view><text>档案编号</text><text>{{record.id}}</text></view><view><text>定制类型</text><text>{{record.type}}</text></view><view><text>当前状态</text><text>{{record.status}}</text></view></view><button bindtap="records">{{presentation.recordsAction}}</button><button class="secondary" bindtap="home">{{presentation.homeAction}}</button></view>
|
||||
@@ -1,3 +1,7 @@
|
||||
Component({
|
||||
properties: { content: { type: Object, value: {} }, variant: { type: String, value: "default" } },
|
||||
properties: {
|
||||
content: { type: Object, value: {} },
|
||||
presentation: { type: Object, value: {} },
|
||||
variant: { type: String, value: "default" },
|
||||
},
|
||||
});
|
||||
@@ -1 +1 @@
|
||||
<view class="trust"><text class="eyebrow">林境门作品质宣言</text><text class="section-title light">拒绝流水线拼装</text><view wx:for="{{content.pillars}}" wx:key="title"><text class="work-name light">{{item.title}}</text><text class="body light-body">{{item.desc}}</text></view></view>
|
||||
<view class="trust"><text class="eyebrow">{{presentation.manifestoEyebrow}}</text><text class="section-title light">{{presentation.manifestoTitle}}</text><view wx:for="{{content.pillars}}" wx:key="title"><text class="work-name light">{{item.title}}</text><text class="body light-body">{{item.desc}}</text></view></view>
|
||||
@@ -1,3 +1,7 @@
|
||||
Component({
|
||||
properties: { content: { type: Object, value: {} }, variant: { type: String, value: "default" } },
|
||||
properties: {
|
||||
content: { type: Object, value: {} },
|
||||
presentation: { type: Object, value: {} },
|
||||
variant: { type: String, value: "default" },
|
||||
},
|
||||
});
|
||||
@@ -1 +1,11 @@
|
||||
<view class="intro"><text class="eyebrow dark">主理人工艺与信任凭证</text><text class="section-title">14 年,只做门与空间的关系</text><text class="body">{{content.bio}}</text><view class="stats"><view wx:for="{{content.stats}}" wx:key="value"><text class="stat-value">{{item.value}}</text><text class="stat-label">{{item.label}}</text><text class="body">{{item.sub}}</text></view></view></view>
|
||||
<view class="trust-section">
|
||||
<view class="trust-head"><text class="eyebrow">{{presentation.proofEyebrow || '信任凭证'}}</text></view>
|
||||
<view class="stats">
|
||||
<view wx:for="{{content.stats}}" wx:key="value" class="stat-card"><text class="stat-value">{{item.value}}</text><text class="stat-label">{{item.label}}</text><text class="stat-sub">{{item.sub}}</text></view>
|
||||
</view>
|
||||
<view class="manifesto">
|
||||
<view class="manifesto-head"><text>{{presentation.manifestoEyebrow}}</text><text>{{presentation.manifestoTitle}}</text></view>
|
||||
<view wx:for="{{content.pillars}}" wx:key="title" class="pillar"><view class="pillar-icon">{{item.icon === 'tree' ? '木' : item.icon === 'ruler' ? '尺' : '盾'}}</view><view><text class="pillar-title">{{item.title}}</text><text class="pillar-desc">{{item.desc}}</text></view></view>
|
||||
</view>
|
||||
<view class="flow-card"><text class="flow-eyebrow">{{presentation.flowEyebrow}}</text><text class="flow-title">{{presentation.flowTitle}}</text><view class="flow-grid"><view wx:for="{{content.serviceFlow}}" wx:key="step" class="flow-item"><text class="flow-step">{{item.step}}</text><text class="flow-name">{{item.name}}</text><text class="flow-desc">{{item.desc}}</text></view></view></view>
|
||||
</view>
|
||||
@@ -1,7 +1,11 @@
|
||||
.intro {
|
||||
margin-top: 22rpx;
|
||||
padding: 28rpx;
|
||||
background: #fff;
|
||||
.trust-section {
|
||||
padding: 0 40rpx 42rpx;
|
||||
}
|
||||
.trust-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
.eyebrow {
|
||||
display: block;
|
||||
@@ -9,26 +13,21 @@
|
||||
font-size: 20rpx;
|
||||
letter-spacing: 3rpx;
|
||||
}
|
||||
.section-title {
|
||||
display: block;
|
||||
margin-top: 12rpx;
|
||||
font: 40rpx serif;
|
||||
}
|
||||
.body {
|
||||
display: block;
|
||||
margin-top: 12rpx;
|
||||
color: #77736b;
|
||||
font-size: 25rpx;
|
||||
line-height: 1.7;
|
||||
.trust-link {
|
||||
color: #8a6846;
|
||||
font-size: 21rpx;
|
||||
}
|
||||
.stats {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
margin-top: 24rpx;
|
||||
gap: 16rpx;
|
||||
margin-bottom: 18rpx;
|
||||
}
|
||||
.stats view {
|
||||
padding: 16rpx 0;
|
||||
border-top: 1rpx solid #e6ded5;
|
||||
.stat-card {
|
||||
padding: 22rpx;
|
||||
background: #fff;
|
||||
border: 1rpx solid #e6ded5;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
.stat-value {
|
||||
display: block;
|
||||
@@ -38,4 +37,123 @@
|
||||
.stat-label {
|
||||
display: block;
|
||||
font-size: 22rpx;
|
||||
margin-top: 4rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
.stat-sub {
|
||||
display: block;
|
||||
margin-top: 6rpx;
|
||||
color: #77736b;
|
||||
font-size: 18rpx;
|
||||
line-height: 1.5;
|
||||
}
|
||||
.manifesto {
|
||||
padding: 28rpx;
|
||||
border-radius: 20rpx;
|
||||
background: #202221;
|
||||
color: #fff;
|
||||
}
|
||||
.manifesto-head {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding-bottom: 18rpx;
|
||||
margin-bottom: 20rpx;
|
||||
border-bottom: 1rpx solid rgba(255, 255, 255, 0.12);
|
||||
color: #d9c8b2;
|
||||
font-size: 20rpx;
|
||||
}
|
||||
.manifesto-head text:last-child {
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
font-size: 18rpx;
|
||||
}
|
||||
.pillar {
|
||||
display: flex;
|
||||
gap: 16rpx;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
.pillar-icon {
|
||||
width: 44rpx;
|
||||
height: 44rpx;
|
||||
flex: 0 0 44rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 8rpx;
|
||||
background: rgba(138, 104, 70, 0.3);
|
||||
color: #d9c8b2;
|
||||
font-size: 18rpx;
|
||||
}
|
||||
.pillar-title,
|
||||
.pillar-desc {
|
||||
display: block;
|
||||
}
|
||||
.pillar-title {
|
||||
font-size: 22rpx;
|
||||
}
|
||||
.pillar-desc {
|
||||
margin-top: 5rpx;
|
||||
color: rgba(255, 255, 255, 0.62);
|
||||
font-size: 18rpx;
|
||||
line-height: 1.55;
|
||||
}
|
||||
.flow-card {
|
||||
margin-top: 22rpx;
|
||||
padding: 32rpx 24rpx;
|
||||
border: 1rpx solid #e6ded5;
|
||||
border-radius: 20rpx;
|
||||
background: #efece6;
|
||||
text-align: center;
|
||||
}
|
||||
.flow-eyebrow,
|
||||
.flow-title,
|
||||
.flow-sub {
|
||||
display: block;
|
||||
}
|
||||
.flow-eyebrow {
|
||||
color: #8a6846;
|
||||
font-size: 18rpx;
|
||||
letter-spacing: 2rpx;
|
||||
}
|
||||
.flow-title {
|
||||
margin-top: 6rpx;
|
||||
font: 30rpx serif;
|
||||
}
|
||||
.flow-sub {
|
||||
margin-top: 8rpx;
|
||||
color: #77736b;
|
||||
font-size: 18rpx;
|
||||
}
|
||||
.flow-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 16rpx;
|
||||
margin-top: 26rpx;
|
||||
text-align: left;
|
||||
}
|
||||
.flow-item {
|
||||
padding: 18rpx;
|
||||
border: 1rpx solid #e6ded5;
|
||||
border-radius: 14rpx;
|
||||
background: #fff;
|
||||
}
|
||||
.flow-step,
|
||||
.flow-name,
|
||||
.flow-desc {
|
||||
display: block;
|
||||
}
|
||||
.flow-step {
|
||||
color: #8a6846;
|
||||
font-size: 18rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
.flow-name {
|
||||
margin-top: 5rpx;
|
||||
font-size: 21rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
.flow-desc {
|
||||
margin-top: 6rpx;
|
||||
color: #77736b;
|
||||
font-size: 17rpx;
|
||||
line-height: 1.5;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
Component({
|
||||
properties: {
|
||||
active: { type: String, value: "home" },
|
||||
navigation: { type: Array, value: [] },
|
||||
},
|
||||
data: {
|
||||
tabs: [],
|
||||
},
|
||||
methods: {
|
||||
navigate(e) {
|
||||
const tab = e.currentTarget.dataset.tab;
|
||||
if (!tab || tab.key === this.data.active) return;
|
||||
wx.navigateTo({ url: tab.page });
|
||||
},
|
||||
},
|
||||
observers: {
|
||||
navigation(navigation) {
|
||||
this.setData({
|
||||
tabs: Array.isArray(navigation)
|
||||
? navigation.map((item) => ({
|
||||
...item,
|
||||
page: item.page && item.page.startsWith("/") ? item.page : `/${item.page || ""}`,
|
||||
}))
|
||||
: [],
|
||||
});
|
||||
},
|
||||
},
|
||||
lifetimes: {
|
||||
attached() {
|
||||
this.setData({ tabs: this.data.navigation || [] });
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
{ "component": true }
|
||||
@@ -0,0 +1 @@
|
||||
<view class="runtime-tab-bar"><view wx:for="{{tabs}}" wx:key="key" class="tab {{active === item.key ? 'active' : ''}}" data-tab="{{item}}" bindtap="navigate"><text class="icon">{{item.key === 'home' ? '⌂' : item.key === 'dishes' ? '♨' : item.key === 'service' ? '⌖' : item.key === 'owner' ? '♙' : item.key === 'booking' ? '✉' : '◈'}}</text><text>{{item.label}}</text></view></view>
|
||||
@@ -0,0 +1,32 @@
|
||||
.runtime-tab-bar {
|
||||
position: fixed;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: 20;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
padding: 10rpx 6rpx calc(10rpx + env(safe-area-inset-bottom));
|
||||
border-top: 1rpx solid #eee5dc;
|
||||
background: rgba(255, 255, 255, 0.97);
|
||||
box-shadow: 0 -8rpx 24rpx rgba(48, 32, 20, 0.08);
|
||||
}
|
||||
.tab {
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 4rpx;
|
||||
color: #9a8d83;
|
||||
font-size: 19rpx;
|
||||
}
|
||||
.icon {
|
||||
height: 34rpx;
|
||||
font-size: 31rpx;
|
||||
line-height: 34rpx;
|
||||
}
|
||||
.tab.active {
|
||||
color: #e87532;
|
||||
font-weight: 700;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
Component({
|
||||
properties: {
|
||||
brand: { type: Object, value: {} },
|
||||
presentation: { type: Object, value: {} },
|
||||
trustContent: { type: Object, value: {} },
|
||||
offerings: { type: Array, value: [] },
|
||||
},
|
||||
methods: {
|
||||
openOffering(e) {
|
||||
this.triggerEvent("select", { id: e.currentTarget.dataset.id });
|
||||
},
|
||||
openInquiry() {
|
||||
this.triggerEvent("inquiry");
|
||||
},
|
||||
openOfferings() {
|
||||
this.triggerEvent("offerings");
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
{ "component": true }
|
||||
@@ -0,0 +1 @@
|
||||
<view class="page"><view class="brand-card"><view class="identity"><image src="{{brand.avatarUrl}}" mode="aspectFill"/><view><text class="name">{{brand.founder}}</text><text class="title">{{brand.title}}</text><text class="slogan">“{{brand.slogan}}”</text></view></view><view class="notice"><text class="notice-title">{{presentation.stallTitle || '今日出摊点'}}</text><text>{{brand.studioAddress || brand.address}}</text><text class="notice-time">{{presentation.stallTime || '今日营业中'}}</text></view><view class="actions"><button bindtap="openInquiry">预约 / 定制</button><button class="muted" bindtap="openOfferings">今日菜单</button></view></view><view class="section-head"><view><text class="eyebrow">{{presentation.worksEyebrow || '本周学生票选招牌'}}</text><text class="heading">{{presentation.worksTitle || '现做现吃,认真管饱'}}</text></view><text class="more" bindtap="openOfferings">全部餐品 ›</text></view><view class="dish-grid"><view wx:for="{{offerings}}" wx:key="id" class="dish" data-id="{{item.id}}" bindtap="openOffering"><image src="{{item.image}}" mode="aspectFill"/><view class="dish-copy"><text class="dish-name">{{item.name}}</text><text class="dish-sub">{{item.desc}}</text><text class="price">{{item.priceRange}}</text></view></view></view><view class="promise"><text class="eyebrow light">{{presentation.manifestoEyebrow || '阿成的开档底线'}}</text><text class="promise-title">{{presentation.manifestoTitle || '真材实料,当天现做'}}</text><view wx:for="{{trustContent.pillars}}" wx:key="title" class="promise-item"><text>✓</text><text>{{item.title}}</text></view></view></view>
|
||||
@@ -0,0 +1,177 @@
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
padding: 20rpx 28rpx 48rpx;
|
||||
background: #fff8f0;
|
||||
color: #29231f;
|
||||
}
|
||||
.brand-card {
|
||||
padding: 28rpx;
|
||||
border: 1rpx solid #f2d9c6;
|
||||
border-radius: 28rpx;
|
||||
background: #fff;
|
||||
box-shadow: 0 12rpx 30rpx rgba(145, 75, 33, 0.08);
|
||||
}
|
||||
.identity {
|
||||
display: flex;
|
||||
gap: 20rpx;
|
||||
align-items: center;
|
||||
}
|
||||
.identity image {
|
||||
width: 96rpx;
|
||||
height: 96rpx;
|
||||
border: 4rpx solid #ffd9bb;
|
||||
border-radius: 50%;
|
||||
background: #fff1e5;
|
||||
}
|
||||
.name,
|
||||
.title,
|
||||
.slogan,
|
||||
.notice-title,
|
||||
.notice text,
|
||||
.eyebrow,
|
||||
.heading,
|
||||
.more,
|
||||
.dish-name,
|
||||
.dish-sub,
|
||||
.price,
|
||||
.promise-title,
|
||||
.promise-item text {
|
||||
display: block;
|
||||
}
|
||||
.name {
|
||||
font-size: 32rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
.title {
|
||||
margin-top: 6rpx;
|
||||
color: #a2613b;
|
||||
font-size: 21rpx;
|
||||
}
|
||||
.slogan {
|
||||
margin-top: 10rpx;
|
||||
color: #7a6a60;
|
||||
font-size: 21rpx;
|
||||
}
|
||||
.notice {
|
||||
position: relative;
|
||||
margin-top: 24rpx;
|
||||
padding: 20rpx;
|
||||
border: 1rpx solid #f8d7b4;
|
||||
border-radius: 20rpx;
|
||||
background: #fff7df;
|
||||
color: #6b4a35;
|
||||
font-size: 22rpx;
|
||||
line-height: 1.6;
|
||||
}
|
||||
.notice-title {
|
||||
font-weight: 700;
|
||||
color: #4f3020;
|
||||
}
|
||||
.notice-time {
|
||||
position: absolute;
|
||||
right: 18rpx;
|
||||
top: 18rpx;
|
||||
color: #c65c28;
|
||||
font-size: 19rpx;
|
||||
}
|
||||
.actions {
|
||||
display: flex;
|
||||
gap: 14rpx;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
.actions button {
|
||||
flex: 1;
|
||||
height: 76rpx;
|
||||
border-radius: 20rpx;
|
||||
background: #e87532;
|
||||
color: #fff;
|
||||
font-size: 24rpx;
|
||||
line-height: 76rpx;
|
||||
}
|
||||
.actions .muted {
|
||||
background: #fff0e5;
|
||||
color: #b85e2c;
|
||||
}
|
||||
.section-head {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: end;
|
||||
margin: 34rpx 4rpx 18rpx;
|
||||
}
|
||||
.eyebrow {
|
||||
color: #d2652b;
|
||||
font-size: 19rpx;
|
||||
letter-spacing: 2rpx;
|
||||
}
|
||||
.heading {
|
||||
margin-top: 8rpx;
|
||||
font-size: 34rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
.more {
|
||||
color: #d2652b;
|
||||
font-size: 21rpx;
|
||||
}
|
||||
.dish-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 16rpx;
|
||||
}
|
||||
.dish {
|
||||
overflow: hidden;
|
||||
border: 1rpx solid #f2e2d6;
|
||||
border-radius: 22rpx;
|
||||
background: #fff;
|
||||
}
|
||||
.dish image {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 220rpx;
|
||||
background: #f3e7de;
|
||||
}
|
||||
.dish-copy {
|
||||
padding: 18rpx;
|
||||
}
|
||||
.dish-name {
|
||||
font-size: 24rpx;
|
||||
font-weight: 700;
|
||||
line-height: 1.4;
|
||||
}
|
||||
.dish-sub {
|
||||
margin-top: 6rpx;
|
||||
color: #8c7b70;
|
||||
font-size: 19rpx;
|
||||
line-height: 1.4;
|
||||
}
|
||||
.price {
|
||||
margin-top: 14rpx;
|
||||
color: #dc6429;
|
||||
font-size: 24rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
.promise {
|
||||
margin-top: 28rpx;
|
||||
padding: 28rpx;
|
||||
border-radius: 24rpx;
|
||||
background: #3b2118;
|
||||
color: #fff;
|
||||
}
|
||||
.light {
|
||||
color: #ffc79f;
|
||||
}
|
||||
.promise-title {
|
||||
margin-top: 8rpx;
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
.promise-item {
|
||||
display: flex;
|
||||
gap: 12rpx;
|
||||
margin-top: 18rpx;
|
||||
color: #ffe5d2;
|
||||
font-size: 21rpx;
|
||||
}
|
||||
.promise-item text:first-child {
|
||||
color: #ff9a5a;
|
||||
font-weight: 700;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
Component({
|
||||
properties: {
|
||||
brand: { type: Object, value: {} },
|
||||
presentation: { type: Object, value: {} },
|
||||
offerings: { type: Array, value: [] },
|
||||
},
|
||||
methods: {
|
||||
open(e) {
|
||||
this.triggerEvent("open", { id: e.currentTarget.dataset.id });
|
||||
},
|
||||
inquire() {
|
||||
this.triggerEvent("inquire");
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
{ "component": true }
|
||||
@@ -0,0 +1 @@
|
||||
<view class="page"><view class="head"><text class="eyebrow">{{brand.name}}</text><text class="title">{{presentation.title || '今日菜单'}}</text><text class="subtitle">{{presentation.subtitle || '现做现吃,支持提前预留和团体定制'}}</text></view><view class="tip">米饭免费续,口味和忌口都可以在预约时备注</view><view class="list"><view wx:for="{{offerings}}" wx:key="id" class="dish" data-id="{{item.id}}" bindtap="open"><image src="{{item.image}}" mode="aspectFill"/><view class="copy"><text class="name">{{item.name}}</text><text class="desc">{{item.desc}}</text><view class="bottom"><text class="price">{{item.priceRange}}</text><text class="action">查看详情 ›</text></view></view></view></view><button class="cta" bindtap="inquire">团体活动 / 定制餐咨询</button></view>
|
||||
@@ -0,0 +1,93 @@
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
padding: 28rpx;
|
||||
background: #fff8f0;
|
||||
color: #29231f;
|
||||
}
|
||||
.eyebrow {
|
||||
display: block;
|
||||
color: #d2652b;
|
||||
font-size: 19rpx;
|
||||
letter-spacing: 2rpx;
|
||||
}
|
||||
.title {
|
||||
display: block;
|
||||
margin-top: 8rpx;
|
||||
font-size: 42rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
.subtitle {
|
||||
display: block;
|
||||
margin-top: 8rpx;
|
||||
color: #8c7b70;
|
||||
font-size: 22rpx;
|
||||
}
|
||||
.tip {
|
||||
margin-top: 22rpx;
|
||||
padding: 18rpx 20rpx;
|
||||
border: 1rpx solid #f8d7b4;
|
||||
border-radius: 18rpx;
|
||||
background: #fff7df;
|
||||
color: #8c5c39;
|
||||
font-size: 21rpx;
|
||||
}
|
||||
.list {
|
||||
margin-top: 18rpx;
|
||||
}
|
||||
.dish {
|
||||
display: flex;
|
||||
gap: 18rpx;
|
||||
margin-bottom: 16rpx;
|
||||
padding: 14rpx;
|
||||
border: 1rpx solid #f2e2d6;
|
||||
border-radius: 22rpx;
|
||||
background: #fff;
|
||||
}
|
||||
.dish image {
|
||||
width: 196rpx;
|
||||
height: 196rpx;
|
||||
flex: none;
|
||||
border-radius: 16rpx;
|
||||
background: #f3e7de;
|
||||
}
|
||||
.copy {
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
}
|
||||
.name {
|
||||
font-size: 26rpx;
|
||||
font-weight: 700;
|
||||
line-height: 1.45;
|
||||
}
|
||||
.desc {
|
||||
margin-top: 10rpx;
|
||||
color: #8c7b70;
|
||||
font-size: 20rpx;
|
||||
line-height: 1.5;
|
||||
}
|
||||
.bottom {
|
||||
display: flex;
|
||||
align-items: end;
|
||||
justify-content: space-between;
|
||||
margin-top: auto;
|
||||
}
|
||||
.price {
|
||||
color: #dc6429;
|
||||
font-size: 25rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
.action {
|
||||
color: #d2652b;
|
||||
font-size: 20rpx;
|
||||
}
|
||||
.cta {
|
||||
margin: 22rpx 0 0;
|
||||
height: 76rpx;
|
||||
border-radius: 20rpx;
|
||||
background: #e87532;
|
||||
color: #fff;
|
||||
font-size: 24rpx;
|
||||
line-height: 76rpx;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
Component({
|
||||
properties: {
|
||||
brand: { type: Object, value: {} },
|
||||
presentation: { type: Object, value: {} },
|
||||
recordsCount: { type: Number, value: 0 },
|
||||
},
|
||||
methods: {
|
||||
call() {
|
||||
this.triggerEvent("call");
|
||||
},
|
||||
copy() {
|
||||
this.triggerEvent("copy");
|
||||
},
|
||||
records() {
|
||||
this.triggerEvent("records");
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
{ "component": true }
|
||||
@@ -0,0 +1 @@
|
||||
<view class="page"><view class="profile-card"><image src="{{brand.avatarUrl}}" mode="aspectFill"/><text class="name">{{brand.founder}}</text><text class="title">{{brand.title}}</text><text class="bio">{{brand.slogan}}</text><view class="contact"><button bindtap="call">电话联系</button><button bindtap="copy">复制微信</button></view></view><view class="card"><text class="card-title">{{presentation.coverageTitle || '出摊与配送'}}</text><text>{{brand.studioAddress || brand.address}}</text><text>{{presentation.coverageContent || '支持校园摊位自取、宿舍配送和班级活动定制。'}}</text></view><view class="card" bindtap="records"><text class="card-title">我的预约记录</text><text>{{recordsCount}} 条记录 ›</text></view></view>
|
||||
@@ -0,0 +1,72 @@
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
padding: 28rpx;
|
||||
background: #fff8f0;
|
||||
color: #29231f;
|
||||
}
|
||||
.profile-card {
|
||||
padding: 36rpx 28rpx;
|
||||
text-align: center;
|
||||
border-radius: 28rpx;
|
||||
background: #3b2118;
|
||||
color: #fff;
|
||||
}
|
||||
.profile-card image {
|
||||
width: 132rpx;
|
||||
height: 132rpx;
|
||||
border: 5rpx solid #ffbd8e;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.name,
|
||||
.title,
|
||||
.bio,
|
||||
.card-title,
|
||||
.card text {
|
||||
display: block;
|
||||
}
|
||||
.name {
|
||||
margin-top: 18rpx;
|
||||
font-size: 36rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
.title {
|
||||
margin-top: 6rpx;
|
||||
color: #ffc79f;
|
||||
font-size: 22rpx;
|
||||
}
|
||||
.bio {
|
||||
margin-top: 16rpx;
|
||||
color: #ffe5d2;
|
||||
font-size: 23rpx;
|
||||
line-height: 1.6;
|
||||
}
|
||||
.contact {
|
||||
display: flex;
|
||||
gap: 14rpx;
|
||||
margin-top: 24rpx;
|
||||
}
|
||||
.contact button {
|
||||
flex: 1;
|
||||
height: 70rpx;
|
||||
border-radius: 18rpx;
|
||||
background: #e87532;
|
||||
color: #fff;
|
||||
font-size: 22rpx;
|
||||
line-height: 70rpx;
|
||||
}
|
||||
.card {
|
||||
margin-top: 18rpx;
|
||||
padding: 26rpx;
|
||||
border: 1rpx solid #f2d9c6;
|
||||
border-radius: 22rpx;
|
||||
background: #fff;
|
||||
color: #7a6a60;
|
||||
font-size: 22rpx;
|
||||
line-height: 1.7;
|
||||
}
|
||||
.card-title {
|
||||
margin-bottom: 10rpx;
|
||||
color: #4b2b1d;
|
||||
font-size: 27rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
Component({
|
||||
properties: {
|
||||
brand: { type: Object, value: {} },
|
||||
presentation: { type: Object, value: {} },
|
||||
hero: { type: Object, value: {} },
|
||||
trustContent: { type: Object, value: {} },
|
||||
offerings: { type: Array, value: [] },
|
||||
},
|
||||
methods: {
|
||||
selectOffering(event) {
|
||||
this.triggerEvent("select", { id: event.currentTarget.dataset.id });
|
||||
},
|
||||
goWorks() {
|
||||
this.triggerEvent("works");
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
{ "component": true }
|
||||
@@ -0,0 +1,8 @@
|
||||
<view class="page">
|
||||
<view class="founder-card"><image class="avatar" src="{{brand.avatarUrl}}" mode="aspectFill"/><view class="founder-copy"><text class="founder-name">{{brand.founder}}</text><text class="founder-title">{{brand.title}}</text><text class="quote">“{{brand.slogan}}”</text></view><text class="badge">{{presentation.founderBadge}}</text></view>
|
||||
<view class="hero" bindtap="goWorks"><image class="hero-image" src="{{brand.heroImage}}" mode="aspectFill"/><view class="hero-shade"/><view class="hero-copy"><text class="eyebrow">{{hero.eyebrow}}</text><text class="hero-title">{{hero.title}}</text><text class="hero-slogan">{{hero.slogan}}</text><text class="hero-button">{{hero.cta}}</text></view></view>
|
||||
<view class="intro"><text class="eyebrow dark">{{presentation.proofEyebrow}}</text><text class="section-title">{{presentation.proofTitle}}</text><text class="body">{{trustContent.bio}}</text><view class="stats"><view wx:for="{{trustContent.stats}}" wx:key="value"><text class="stat-value">{{item.value}}</text><text class="stat-label">{{item.label}}</text><text class="stat-sub">{{item.sub}}</text></view></view></view>
|
||||
<view class="trust"><text class="eyebrow">{{presentation.manifestoEyebrow}}</text><text class="section-title light">{{presentation.manifestoTitle}}</text><view wx:for="{{trustContent.pillars}}" wx:key="title" class="pillar"><text class="pillar-title">{{item.title}}</text><text class="pillar-desc">{{item.desc}}</text></view></view>
|
||||
<view class="section"><view class="section-head"><view><text class="eyebrow dark">{{presentation.worksEyebrow}}</text><text class="section-title">{{presentation.worksTitle}}</text></view><text class="more" bindtap="goWorks">{{presentation.worksAction}}</text></view><view wx:for="{{offerings}}" wx:key="id" class="work-card" data-id="{{item.id}}" bindtap="selectOffering"><image src="{{item.image}}" mode="aspectFill"/><view class="work-info"><text class="work-category">{{item.category}} · {{item.area}}</text><text class="work-name">{{item.name}}</text><text class="work-desc">{{item.series}} · {{item.keywords[0]}} · {{item.keywords[1]}}</text></view></view></view>
|
||||
<view class="flow"><text class="flow-eyebrow">{{presentation.flowEyebrow}}</text><text class="flow-title">{{presentation.flowTitle}}</text><view class="flow-grid"><view wx:for="{{trustContent.serviceFlow}}" wx:key="step" class="flow-item"><text class="flow-step">{{item.step}}</text><text class="flow-name">{{item.name}}</text><text class="flow-desc">{{item.desc}}</text></view></view></view>
|
||||
</view>
|
||||
@@ -0,0 +1,261 @@
|
||||
.page {
|
||||
background: #f7f5f1;
|
||||
color: #252525;
|
||||
padding-bottom: 30rpx;
|
||||
}
|
||||
.founder-card {
|
||||
position: relative;
|
||||
display: flex;
|
||||
gap: 20rpx;
|
||||
align-items: flex-start;
|
||||
margin: 32rpx 40rpx 20rpx;
|
||||
padding: 28rpx;
|
||||
border: 1rpx solid #e6ded5;
|
||||
border-radius: 28rpx;
|
||||
background: #fff;
|
||||
}
|
||||
.avatar {
|
||||
width: 112rpx;
|
||||
height: 112rpx;
|
||||
flex: 0 0 112rpx;
|
||||
border: 4rpx solid #d9c8b2;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.founder-copy {
|
||||
min-width: 0;
|
||||
padding-right: 78rpx;
|
||||
}
|
||||
.founder-name,
|
||||
.founder-title,
|
||||
.quote,
|
||||
.eyebrow,
|
||||
.hero-title,
|
||||
.hero-slogan,
|
||||
.section-title,
|
||||
.body,
|
||||
.stat-value,
|
||||
.stat-label,
|
||||
.stat-sub,
|
||||
.pillar-title,
|
||||
.pillar-desc,
|
||||
.work-category,
|
||||
.work-name,
|
||||
.work-desc,
|
||||
.flow-eyebrow,
|
||||
.flow-title,
|
||||
.flow-step,
|
||||
.flow-name,
|
||||
.flow-desc {
|
||||
display: block;
|
||||
}
|
||||
.founder-name {
|
||||
font: 30rpx serif;
|
||||
}
|
||||
.founder-title {
|
||||
margin-top: 6rpx;
|
||||
color: #77736b;
|
||||
font-size: 20rpx;
|
||||
}
|
||||
.quote {
|
||||
margin-top: 14rpx;
|
||||
font: 21rpx serif;
|
||||
}
|
||||
.badge {
|
||||
position: absolute;
|
||||
top: 24rpx;
|
||||
right: 20rpx;
|
||||
padding: 8rpx 12rpx;
|
||||
border-radius: 20rpx;
|
||||
background: #f3ede6;
|
||||
color: #8a6846;
|
||||
font-size: 18rpx;
|
||||
}
|
||||
.hero {
|
||||
position: relative;
|
||||
height: 400rpx;
|
||||
margin: 0 40rpx 42rpx;
|
||||
overflow: hidden;
|
||||
border-radius: 28rpx;
|
||||
}
|
||||
.hero-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.hero-shade {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: linear-gradient(180deg, rgba(20, 22, 21, 0.1), rgba(20, 22, 21, 0.82));
|
||||
}
|
||||
.hero-copy {
|
||||
position: absolute;
|
||||
right: 28rpx;
|
||||
bottom: 28rpx;
|
||||
left: 28rpx;
|
||||
color: #fff;
|
||||
}
|
||||
.eyebrow {
|
||||
margin-bottom: 14rpx;
|
||||
color: #d9c8b2;
|
||||
font-size: 18rpx;
|
||||
letter-spacing: 3rpx;
|
||||
}
|
||||
.dark {
|
||||
color: #8a6846;
|
||||
}
|
||||
.hero-title,
|
||||
.section-title {
|
||||
font: 34rpx serif;
|
||||
}
|
||||
.hero-slogan {
|
||||
margin-top: 10rpx;
|
||||
font-size: 21rpx;
|
||||
}
|
||||
.hero-button {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
padding: 12rpx 16rpx;
|
||||
border: 1rpx solid rgba(255, 255, 255, 0.3);
|
||||
color: #d9c8b2;
|
||||
font-size: 19rpx;
|
||||
}
|
||||
.intro,
|
||||
.section {
|
||||
padding: 0 40rpx 48rpx;
|
||||
}
|
||||
.body {
|
||||
color: #77736b;
|
||||
font-size: 24rpx;
|
||||
line-height: 1.8;
|
||||
}
|
||||
.stats {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 16rpx;
|
||||
margin-top: 22rpx;
|
||||
}
|
||||
.stats view {
|
||||
padding: 22rpx;
|
||||
border: 1rpx solid #e6ded5;
|
||||
border-radius: 20rpx;
|
||||
background: #fff;
|
||||
}
|
||||
.stat-value {
|
||||
color: #8a6846;
|
||||
font: 38rpx serif;
|
||||
}
|
||||
.stat-label {
|
||||
margin-top: 4rpx;
|
||||
font-size: 22rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
.stat-sub {
|
||||
margin-top: 6rpx;
|
||||
color: #77736b;
|
||||
font-size: 18rpx;
|
||||
line-height: 1.5;
|
||||
}
|
||||
.trust {
|
||||
padding: 42rpx 40rpx;
|
||||
background: #202221;
|
||||
color: #fff;
|
||||
}
|
||||
.light {
|
||||
color: #fff;
|
||||
}
|
||||
.pillar {
|
||||
margin-top: 24rpx;
|
||||
}
|
||||
.pillar-title {
|
||||
color: #fff;
|
||||
font: 28rpx serif;
|
||||
}
|
||||
.pillar-desc {
|
||||
margin-top: 8rpx;
|
||||
color: #c6c2ba;
|
||||
font-size: 22rpx;
|
||||
line-height: 1.65;
|
||||
}
|
||||
.section-head {
|
||||
display: flex;
|
||||
align-items: end;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 22rpx;
|
||||
}
|
||||
.more {
|
||||
color: #8a6846;
|
||||
font-size: 21rpx;
|
||||
}
|
||||
.work-card {
|
||||
margin-bottom: 24rpx;
|
||||
overflow: hidden;
|
||||
border: 1rpx solid #e6ded5;
|
||||
border-radius: 28rpx;
|
||||
background: #fff;
|
||||
}
|
||||
.work-card image {
|
||||
width: 100%;
|
||||
height: 300rpx;
|
||||
}
|
||||
.work-info {
|
||||
padding: 24rpx;
|
||||
}
|
||||
.work-category {
|
||||
color: #8a6846;
|
||||
font-size: 19rpx;
|
||||
}
|
||||
.work-name {
|
||||
margin: 10rpx 0;
|
||||
font: 28rpx serif;
|
||||
}
|
||||
.work-desc {
|
||||
color: #77736b;
|
||||
font-size: 22rpx;
|
||||
line-height: 1.6;
|
||||
}
|
||||
.flow {
|
||||
margin: 0 40rpx 42rpx;
|
||||
padding: 30rpx 24rpx;
|
||||
border: 1rpx solid #e6ded5;
|
||||
border-radius: 20rpx;
|
||||
background: #efece6;
|
||||
text-align: center;
|
||||
}
|
||||
.flow-eyebrow {
|
||||
color: #8a6846;
|
||||
font-size: 18rpx;
|
||||
letter-spacing: 2rpx;
|
||||
}
|
||||
.flow-title {
|
||||
margin-top: 6rpx;
|
||||
font: 30rpx serif;
|
||||
}
|
||||
.flow-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 16rpx;
|
||||
margin-top: 24rpx;
|
||||
text-align: left;
|
||||
}
|
||||
.flow-item {
|
||||
padding: 18rpx;
|
||||
border: 1rpx solid #e6ded5;
|
||||
border-radius: 14rpx;
|
||||
background: #fff;
|
||||
}
|
||||
.flow-step {
|
||||
color: #8a6846;
|
||||
font-size: 18rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
.flow-name {
|
||||
margin-top: 5rpx;
|
||||
font-size: 21rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
.flow-desc {
|
||||
margin-top: 6rpx;
|
||||
color: #77736b;
|
||||
font-size: 17rpx;
|
||||
line-height: 1.5;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
Component({
|
||||
properties: {
|
||||
brand: { type: Object, value: {} },
|
||||
presentation: { type: Object, value: {} },
|
||||
recordsCount: { type: Number, value: 0 },
|
||||
},
|
||||
methods: {
|
||||
call() {
|
||||
this.triggerEvent("call");
|
||||
},
|
||||
copy() {
|
||||
this.triggerEvent("copy");
|
||||
},
|
||||
records() {
|
||||
this.triggerEvent("records");
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"t-icon": "/miniprogram_npm/tdesign-miniprogram/icon/icon"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<view class="profile">
|
||||
<view class="founder-card">
|
||||
<view class="identity">
|
||||
<image class="avatar" src="{{brand.avatarUrl}}" mode="aspectFill" />
|
||||
<view><text class="founder">{{brand.founder}}</text><text class="role">{{brand.title}}</text></view>
|
||||
</view>
|
||||
<view class="contact-lines">
|
||||
<view class="contact-line"><text class="label">{{presentation.phoneLabel}}</text><view class="contact-action"><text class="value">{{brand.phone}}</text><button bindtap="call"><t-icon name="call" size="24rpx" />{{presentation.callAction}}</button></view></view>
|
||||
<view class="contact-line"><text class="label">{{presentation.wechatLabel}}</text><view class="contact-action"><text class="value accent">{{brand.wechat}}</text><button bindtap="copy"><t-icon name="file-copy" size="24rpx" />{{presentation.copyAction}}</button></view></view>
|
||||
<view class="contact-line address"><text class="label">{{presentation.addressLabel}}</text><text class="address-value">{{brand.studioAddress}}</text></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="records-card" bindtap="records">
|
||||
<view class="entry-icon"><t-icon name="logo-notion" size="34rpx" /></view>
|
||||
<view class="entry-copy"><text>{{presentation.recordsTitle}}</text><text>{{presentation.recordsSubtitle}}</text></view>
|
||||
<view class="entry-count"><text>{{recordsCount}} {{presentation.recordsCountUnit}}</text><t-icon name="chevron-right" size="30rpx" /></view>
|
||||
</view>
|
||||
<view class="info-card">
|
||||
<view class="card-title"><t-icon name="map" size="32rpx" /><text>{{presentation.coverageTitle}}</text></view>
|
||||
<view wx:for="{{brand.profilePresentation.coverage}}" wx:key="title" class="note"><text class="note-title">{{item.title}}</text><text>{{item.content}}</text></view>
|
||||
</view>
|
||||
<view class="info-card">
|
||||
<view class="card-title"><t-icon name="secured" size="32rpx" /><text>{{presentation.warrantyTitle}}</text></view>
|
||||
<view wx:for="{{brand.profilePresentation.warranty}}" wx:key="*this" class="warranty"><text class="dot">•</text><text>{{item}}</text></view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -0,0 +1,194 @@
|
||||
.profile {
|
||||
min-height: 100vh;
|
||||
padding: 28rpx 32rpx 56rpx;
|
||||
background: #f7f5f1;
|
||||
color: #252525;
|
||||
}
|
||||
.founder-card {
|
||||
padding: 34rpx 30rpx;
|
||||
border-radius: 20rpx;
|
||||
background: #202221;
|
||||
color: #fff;
|
||||
box-shadow: 0 12rpx 34rpx rgba(32, 34, 33, 0.12);
|
||||
}
|
||||
.identity {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 22rpx;
|
||||
}
|
||||
.avatar {
|
||||
width: 92rpx;
|
||||
height: 92rpx;
|
||||
border: 2rpx solid #8a6846;
|
||||
border-radius: 50%;
|
||||
background: #343736;
|
||||
}
|
||||
.founder,
|
||||
.role,
|
||||
.label,
|
||||
.value,
|
||||
.address-value,
|
||||
.entry-copy text,
|
||||
.entry-count text,
|
||||
.note-title,
|
||||
.note text,
|
||||
.warranty text {
|
||||
display: block;
|
||||
}
|
||||
.founder {
|
||||
font: 34rpx serif;
|
||||
}
|
||||
.role {
|
||||
margin-top: 8rpx;
|
||||
color: #d9c8b2;
|
||||
font-size: 22rpx;
|
||||
}
|
||||
.contact-lines {
|
||||
margin-top: 24rpx;
|
||||
border-top: 1rpx solid rgba(255, 255, 255, 0.12);
|
||||
}
|
||||
.contact-line {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 20rpx;
|
||||
padding-top: 18rpx;
|
||||
margin-top: 18rpx;
|
||||
border-top: 1rpx solid rgba(255, 255, 255, 0.1);
|
||||
font-size: 22rpx;
|
||||
}
|
||||
.contact-line:first-child {
|
||||
border-top: 0;
|
||||
margin-top: 0;
|
||||
}
|
||||
.label {
|
||||
flex: 0 0 auto;
|
||||
color: rgba(255, 255, 255, 0.52);
|
||||
}
|
||||
.contact-action {
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
}
|
||||
.value {
|
||||
color: #fff;
|
||||
font-family: monospace;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.accent {
|
||||
color: #d9c8b2;
|
||||
}
|
||||
.contact-action button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 5rpx;
|
||||
min-width: 86rpx;
|
||||
height: 46rpx;
|
||||
margin: 0;
|
||||
padding: 0 12rpx;
|
||||
border-radius: 9rpx;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
color: #d9c8b2;
|
||||
font-size: 20rpx;
|
||||
line-height: 46rpx;
|
||||
}
|
||||
.address {
|
||||
align-items: flex-start;
|
||||
}
|
||||
.address-value {
|
||||
max-width: 410rpx;
|
||||
color: rgba(255, 255, 255, 0.82);
|
||||
line-height: 1.55;
|
||||
text-align: right;
|
||||
}
|
||||
.records-card,
|
||||
.info-card {
|
||||
margin-top: 20rpx;
|
||||
border: 1rpx solid #e6ded5;
|
||||
border-radius: 18rpx;
|
||||
background: #fff;
|
||||
box-shadow: 0 10rpx 30rpx -12rpx rgba(32, 34, 33, 0.08);
|
||||
}
|
||||
.records-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 18rpx;
|
||||
padding: 26rpx;
|
||||
}
|
||||
.entry-icon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 66rpx;
|
||||
height: 66rpx;
|
||||
border-radius: 12rpx;
|
||||
background: rgba(138, 104, 70, 0.1);
|
||||
color: #8a6846;
|
||||
}
|
||||
.entry-copy {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
.entry-copy text:first-child {
|
||||
color: #202221;
|
||||
font-size: 25rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
.entry-copy text:last-child {
|
||||
margin-top: 7rpx;
|
||||
color: #77736b;
|
||||
font-size: 20rpx;
|
||||
line-height: 1.4;
|
||||
}
|
||||
.entry-count {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4rpx;
|
||||
flex: 0 0 auto;
|
||||
color: #8a6846;
|
||||
font-size: 20rpx;
|
||||
}
|
||||
.info-card {
|
||||
padding: 28rpx;
|
||||
}
|
||||
.card-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
color: #202221;
|
||||
font-size: 26rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
.card-title t-icon {
|
||||
color: #8a6846;
|
||||
}
|
||||
.note {
|
||||
margin-top: 18rpx;
|
||||
padding: 20rpx;
|
||||
border: 1rpx solid #e6ded5;
|
||||
border-radius: 12rpx;
|
||||
background: #f7f5f1;
|
||||
color: #57534e;
|
||||
font-size: 23rpx;
|
||||
line-height: 1.7;
|
||||
}
|
||||
.note-title {
|
||||
margin-bottom: 5rpx;
|
||||
color: #202221;
|
||||
font-size: 23rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
.warranty {
|
||||
display: flex;
|
||||
gap: 10rpx;
|
||||
margin-top: 16rpx;
|
||||
color: #77736b;
|
||||
font-size: 23rpx;
|
||||
line-height: 1.65;
|
||||
}
|
||||
.dot {
|
||||
flex: 0 0 auto;
|
||||
color: #8a6846;
|
||||
}
|
||||
@@ -8,7 +8,7 @@
|
||||
"tdesign-miniprogram": "^1.16.1"
|
||||
},
|
||||
"scripts": {
|
||||
"test:fixture": "node test/validate-fixture.cjs",
|
||||
"test:fixture": "node test/validate-fixture.cjs && node --test test/runtime-workspace.test.cjs",
|
||||
"test:visual-fixture": "node test/validate-visual-fixture.cjs",
|
||||
"lint": "eslint src --ext .ts",
|
||||
"typecheck": "tsc -p tsconfig.json --noEmit",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const { request, customerRequest } = require("../../utils/request");
|
||||
const { request, customerRequest, customerTokenKey } = require("../../utils/request");
|
||||
const { getTemplate } = require("../../utils/templates");
|
||||
Page({
|
||||
data: {
|
||||
@@ -70,13 +70,13 @@ Page({
|
||||
this.setData({ submitting: false });
|
||||
wx.showToast({ title: error.message || "提交失败", icon: "none" });
|
||||
});
|
||||
const token = wx.getStorageSync("customerToken");
|
||||
const token = wx.getStorageSync(customerTokenKey());
|
||||
if (token) return send();
|
||||
wx.login({
|
||||
success: (login) =>
|
||||
request("/customer/session/wechat", { method: "POST", data: { code: login.code } })
|
||||
.then((result) => {
|
||||
wx.setStorageSync("customerToken", result.token);
|
||||
wx.setStorageSync(customerTokenKey(), result.token);
|
||||
send();
|
||||
})
|
||||
.catch((error) => {
|
||||
|
||||
@@ -1,28 +1,49 @@
|
||||
const { loadWorkspaceWithFallback } = require("../../utils/runtime-workspace");
|
||||
const { customerRequest, customerTokenKey } = require("../../utils/request");
|
||||
Page({
|
||||
data: {
|
||||
brand: {},
|
||||
trustContent: [],
|
||||
records: [],
|
||||
pageRenderer: "",
|
||||
error: "",
|
||||
templateKey: "",
|
||||
navigation: [],
|
||||
},
|
||||
onLoad() {
|
||||
loadWorkspaceWithFallback().then((workspace) =>
|
||||
this.setData({
|
||||
brand: workspace.brand || {},
|
||||
trustContent: workspace.trustContent || [],
|
||||
records: wx.getStorageSync("linjingInquiryRecords") || [],
|
||||
}),
|
||||
);
|
||||
loadWorkspaceWithFallback()
|
||||
.then((workspace) =>
|
||||
this.setData({
|
||||
brand: workspace.brand || {},
|
||||
trustContent: workspace.trustContent || [],
|
||||
pageRenderer: workspace.pageRenderers?.profile || "",
|
||||
records: [],
|
||||
templateKey: workspace.visualTemplate?.key || "",
|
||||
navigation: workspace.navigation || [],
|
||||
}),
|
||||
)
|
||||
.catch((error) => this.setData({ error: error.message }));
|
||||
},
|
||||
onShow() {
|
||||
this.setData({ records: wx.getStorageSync("linjingInquiryRecords") || [] });
|
||||
this.loadRecords();
|
||||
},
|
||||
loadRecords() {
|
||||
if (!wx.getStorageSync(customerTokenKey())) return this.setData({ records: [] });
|
||||
customerRequest("/customer/inquiry-submissions")
|
||||
.then((records) => this.setData({ records: Array.isArray(records) ? records : [] }))
|
||||
.catch(() => this.setData({ records: [] }));
|
||||
},
|
||||
call() {
|
||||
wx.makePhoneCall({ phoneNumber: (this.data.brand.contactPhone || "").replace(/[^0-9-]/g, "") });
|
||||
wx.makePhoneCall({
|
||||
phoneNumber: (this.data.brand.phone || this.data.brand.contactPhone || "").replace(
|
||||
/[^0-9-]/g,
|
||||
"",
|
||||
),
|
||||
});
|
||||
},
|
||||
copyWechat() {
|
||||
wx.setClipboardData({
|
||||
data: this.data.brand.contactWechat || "",
|
||||
data: this.data.brand.wechat || this.data.brand.contactWechat || "",
|
||||
success: () => wx.showToast({ title: "微信号已复制", icon: "none" }),
|
||||
});
|
||||
},
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
"navigationBarTextStyle": "black",
|
||||
"usingComponents": {
|
||||
"t-icon": "/miniprogram_npm/tdesign-miniprogram/icon/icon",
|
||||
"profile-module": "/components/modules/profile/profile"
|
||||
"profile-module": "/components/modules/profile/profile",
|
||||
"linjing-profile": "/components/templates/linjing-profile/linjing-profile",
|
||||
"acheng-profile": "/components/templates/acheng-profile/acheng-profile",
|
||||
"runtime-tab-bar": "/components/runtime-tab-bar/runtime-tab-bar"
|
||||
}
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
<view class="page"><profile-module brand="{{brand}}" records-count="{{records.length}}" bind:call="call" bind:copy="copyWechat" bind:records="recordsPage" /><view class="info-card"><view class="card-title"><t-icon name="map" size="34rpx"/> <text>直派服务区域与履约说明</text></view><view class="note"><text class="note-title">直派核心圈:</text><text>上海、杭州、宁波、苏州、无锡、南京及深圳、广州。主理人及资深装配总工亲赴现场。</text></view><view class="note"><text class="note-title">全国其他城市私邸:</text><text>接受建筑设计师联合委托,安排远程 3D 激光测绘支持与专用物流直运安装。</text></view></view><view class="info-card"><view class="card-title"><t-icon name="secured" size="34rpx"/> <text>一门一档 · 终生质保规约</text></view><text class="bullet">门体内部防变形航空合金骨架承诺 10 年结构质保;</text><text class="bullet">重型天地轴、进口地弹簧及磁吸五金 5 年免费维护;</text><text class="bullet">每樘门出厂前进行 5000 次启闭校正;</text><text class="bullet">原木天然肌理享有首年 2 次木蜡油保养服务。</text></view></view>
|
||||
<view class="page"><view wx:if="{{error}}" class="runtime-error">{{error}}</view><block wx:else><acheng-profile wx:if="{{pageRenderer === 'acheng-profile'}}" brand="{{brand}}" presentation="{{brand.visualPresentation.profile}}" records-count="{{records.length}}" bind:call="call" bind:copy="copyWechat" bind:records="recordsPage" /><linjing-profile wx:elif="{{pageRenderer === 'linjing-profile'}}" brand="{{brand}}" presentation="{{brand.visualPresentation.profile}}" records-count="{{records.length}}" bind:call="call" bind:copy="copyWechat" bind:records="recordsPage" /><block wx:else><profile-module brand="{{brand}}" presentation="{{brand.visualPresentation.profile}}" records-count="{{records.length}}" bind:call="call" bind:copy="copyWechat" bind:records="recordsPage" /></block><runtime-tab-bar template-key="{{templateKey}}" active="owner" /></block></view>
|
||||
@@ -1,9 +1,19 @@
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
padding: 28rpx 32rpx 56rpx;
|
||||
padding: 0;
|
||||
background: #f7f5f1;
|
||||
color: #252525;
|
||||
}
|
||||
.runtime-error {
|
||||
margin: 48rpx 0;
|
||||
padding: 28rpx;
|
||||
border: 1rpx solid #e6ded5;
|
||||
border-radius: 14rpx;
|
||||
background: #fff;
|
||||
color: #8a6846;
|
||||
font-size: 25rpx;
|
||||
line-height: 1.6;
|
||||
}
|
||||
.contact-card {
|
||||
padding: 34rpx 30rpx;
|
||||
background: #202221;
|
||||
@@ -151,3 +161,6 @@
|
||||
display: inline-flex;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.page {
|
||||
padding-bottom: 150rpx;
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
const { loadWorkspaceWithFallback } = require("../../utils/runtime-workspace");
|
||||
const config = require("../../utils/config");
|
||||
Page({
|
||||
data: {
|
||||
brand: {},
|
||||
@@ -6,50 +7,66 @@ Page({
|
||||
offerings: [],
|
||||
modules: [],
|
||||
moduleVariants: {},
|
||||
pageRenderer: "",
|
||||
layout: [],
|
||||
theme: {},
|
||||
hero: {
|
||||
image:
|
||||
"https://images.unsplash.com/photo-1600585154340-be6161a56a0c?auto=format&fit=crop&w=900&q=80",
|
||||
eyebrow: "",
|
||||
title: "",
|
||||
slogan: "",
|
||||
cta: "了解业务与服务 →",
|
||||
},
|
||||
hero: { image: "", eyebrow: "", title: "", slogan: "", cta: "" },
|
||||
loading: false,
|
||||
loadedBrandSlug: "",
|
||||
templateKey: "",
|
||||
navigation: [],
|
||||
},
|
||||
onLoad() {
|
||||
this.loadWorkspace();
|
||||
},
|
||||
onShow() {
|
||||
if (this.data.loadedBrandSlug && this.data.loadedBrandSlug !== config.brandSlug) {
|
||||
this.loadWorkspace();
|
||||
}
|
||||
},
|
||||
loadWorkspace() {
|
||||
this.setData({ loading: true });
|
||||
loadWorkspaceWithFallback().then((workspace) => {
|
||||
const activeBrand = workspace.brand || {};
|
||||
const activeOfferings = workspace.offerings || [];
|
||||
const layout = workspace.layout?.home || [
|
||||
"founder-card",
|
||||
"brand-hero",
|
||||
"trust-proof",
|
||||
"trust-manifesto",
|
||||
"offering-list",
|
||||
];
|
||||
const firstOffering = activeOfferings[0] || {};
|
||||
this.setData({
|
||||
brand: activeBrand,
|
||||
trustContent: workspace.trustContent || [],
|
||||
offerings: activeOfferings,
|
||||
modules: workspace.modules || [],
|
||||
moduleVariants: workspace.moduleVariants || {},
|
||||
layout,
|
||||
theme: workspace.theme || {},
|
||||
hero: {
|
||||
...this.data.hero,
|
||||
image: activeBrand.heroImage || this.data.hero.image,
|
||||
eyebrow: activeBrand.tagline || activeBrand.name,
|
||||
title: firstOffering.name || activeBrand.name,
|
||||
slogan: activeBrand.description || "以专业经验建立长期信任",
|
||||
},
|
||||
loading: false,
|
||||
});
|
||||
wx.setNavigationBarTitle({ title: activeBrand.name || "个人品牌" });
|
||||
});
|
||||
loadWorkspaceWithFallback()
|
||||
.then((workspace) => {
|
||||
const activeBrand = workspace.brand || {};
|
||||
const activeOfferings = workspace.offerings || [];
|
||||
const layout = workspace.layout?.home || [
|
||||
"founder-card",
|
||||
"brand-hero",
|
||||
"trust-proof",
|
||||
"trust-manifesto",
|
||||
"offering-list",
|
||||
];
|
||||
const firstOffering = activeOfferings[0] || {};
|
||||
const configuredHero =
|
||||
activeBrand.homeHero && typeof activeBrand.homeHero === "object"
|
||||
? activeBrand.homeHero
|
||||
: {};
|
||||
this.setData({
|
||||
brand: activeBrand,
|
||||
trustContent: workspace.trustContent || [],
|
||||
offerings: activeOfferings,
|
||||
modules: workspace.modules || [],
|
||||
moduleVariants: workspace.moduleVariants || {},
|
||||
pageRenderer: workspace.pageRenderers?.home || "",
|
||||
layout,
|
||||
theme: workspace.theme || {},
|
||||
hero: {
|
||||
...this.data.hero,
|
||||
image: activeBrand.heroImage || this.data.hero.image,
|
||||
eyebrow: activeBrand.tagline || activeBrand.name,
|
||||
title: firstOffering.name || activeBrand.name,
|
||||
slogan: activeBrand.description || "",
|
||||
...configuredHero,
|
||||
},
|
||||
loading: false,
|
||||
loadedBrandSlug: config.brandSlug,
|
||||
templateKey: workspace.visualTemplate?.key || "",
|
||||
navigation: workspace.navigation || [],
|
||||
});
|
||||
wx.setNavigationBarTitle({ title: activeBrand.name || "个人品牌" });
|
||||
})
|
||||
.catch((error) => this.setData({ error: error.message, loading: false }));
|
||||
},
|
||||
showModule(e) {
|
||||
return this.data.layout.includes(e);
|
||||
@@ -65,6 +82,6 @@ Page({
|
||||
wx.navigateTo({ url: "/pages/inquiry/index" });
|
||||
},
|
||||
goProfile() {
|
||||
wx.switchTab({ url: "/pages/bookings/index" });
|
||||
wx.navigateTo({ url: "/pages/bookings/index" });
|
||||
},
|
||||
});
|
||||
@@ -1,10 +1,13 @@
|
||||
{
|
||||
"navigationBarTitleText": "品牌首页",
|
||||
"usingComponents": {
|
||||
"linjing-home": "/components/templates/linjing-home/linjing-home",
|
||||
"acheng-home": "/components/templates/acheng-home/acheng-home",
|
||||
"founder-card": "/components/modules/founder-card/founder-card",
|
||||
"brand-hero": "/components/modules/brand-hero/brand-hero",
|
||||
"trust-proof": "/components/modules/trust-proof/trust-proof",
|
||||
"trust-manifesto": "/components/modules/trust-manifesto/trust-manifesto",
|
||||
"offering-list": "/components/modules/offering-list/offering-list"
|
||||
"offering-list": "/components/modules/offering-list/offering-list",
|
||||
"runtime-tab-bar": "/components/runtime-tab-bar/runtime-tab-bar"
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,17 @@
|
||||
<view class="page">
|
||||
<view wx:if="{{error}}" class="runtime-error">{{error}}</view>
|
||||
<block wx:else>
|
||||
<linjing-home wx:if="{{pageRenderer === 'linjing-home'}}" brand="{{brand}}" presentation="{{brand.visualPresentation.home}}" hero="{{hero}}" trust-content="{{trustContent}}" offerings="{{offerings}}" bind:select="selectOffering" bind:works="goWorks" />
|
||||
<acheng-home wx:elif="{{pageRenderer === 'acheng-home'}}" brand="{{brand}}" presentation="{{brand.visualPresentation.home}}" trust-content="{{trustContent}}" offerings="{{offerings}}" bind:select="selectOffering" bind:inquiry="goInquiry" bind:offerings="goWorks" />
|
||||
<block wx:else>
|
||||
<block wx:for="{{layout}}" wx:key="*this" wx:for-item="moduleKey">
|
||||
<founder-card wx:if="{{moduleKey === 'founder-card'}}" brand="{{brand}}" variant="{{moduleVariants[moduleKey]}}" />
|
||||
<founder-card wx:if="{{moduleKey === 'founder-card'}}" brand="{{brand}}" presentation="{{brand.visualPresentation.home}}" variant="{{moduleVariants[moduleKey]}}" />
|
||||
<brand-hero wx:if="{{moduleKey === 'brand-hero'}}" hero="{{hero}}" variant="{{moduleVariants[moduleKey]}}" bind:explore="goWorks" />
|
||||
<trust-proof wx:if="{{moduleKey === 'trust-proof'}}" content="{{trustContent}}" variant="{{moduleVariants[moduleKey]}}" />
|
||||
<trust-manifesto wx:if="{{moduleKey === 'trust-manifesto'}}" content="{{trustContent}}" variant="{{moduleVariants[moduleKey]}}" />
|
||||
<offering-list wx:if="{{moduleKey === 'offering-list'}}" offerings="{{offerings}}" variant="{{moduleVariants[moduleKey]}}" bind:open="selectOffering" bind:more="goWorks" />
|
||||
<trust-proof wx:if="{{moduleKey === 'trust-proof'}}" content="{{trustContent}}" presentation="{{brand.visualPresentation.home}}" variant="{{moduleVariants[moduleKey]}}" />
|
||||
<trust-manifesto wx:if="{{moduleKey === 'trust-manifesto'}}" content="{{trustContent}}" presentation="{{brand.visualPresentation.home}}" variant="{{moduleVariants[moduleKey]}}" />
|
||||
<offering-list wx:if="{{moduleKey === 'offering-list'}}" offerings="{{offerings}}" presentation="{{brand.visualPresentation.home}}" variant="{{moduleVariants[moduleKey]}}" bind:open="selectOffering" bind:more="goWorks" />
|
||||
</block>
|
||||
</block>
|
||||
</block>
|
||||
</view>
|
||||
<runtime-tab-bar template-key="{{templateKey}}" active="home" />
|
||||
@@ -4,6 +4,16 @@
|
||||
min-height: 100vh;
|
||||
padding-bottom: 30rpx;
|
||||
}
|
||||
.runtime-error {
|
||||
margin: 48rpx 32rpx;
|
||||
padding: 28rpx;
|
||||
border: 1rpx solid #e6ded5;
|
||||
border-radius: 14rpx;
|
||||
background: #fff;
|
||||
color: #8a6846;
|
||||
font-size: 25rpx;
|
||||
line-height: 1.6;
|
||||
}
|
||||
.founder {
|
||||
margin: 32rpx 40rpx 20rpx;
|
||||
padding: 28rpx;
|
||||
@@ -206,3 +216,6 @@
|
||||
height: 72rpx;
|
||||
line-height: 72rpx;
|
||||
}
|
||||
.page {
|
||||
padding-bottom: 150rpx;
|
||||
}
|
||||
@@ -1,11 +1,17 @@
|
||||
const { customerRequest } = require("../../utils/request");
|
||||
const { customerRequest, customerTokenKey } = require("../../utils/request");
|
||||
const { loadWorkspaceWithFallback } = require("../../utils/runtime-workspace");
|
||||
|
||||
Page({
|
||||
data: { record: {} },
|
||||
data: { record: {}, presentation: {} },
|
||||
onLoad(options) {
|
||||
loadWorkspaceWithFallback()
|
||||
.then((workspace) =>
|
||||
this.setData({ presentation: workspace.brand?.visualPresentation?.success || {} }),
|
||||
)
|
||||
.catch(() => {});
|
||||
const record = wx.getStorageSync("latestInquirySubmission") || {};
|
||||
if (record.id === options.id) this.setData({ record });
|
||||
if (options.id && wx.getStorageSync("customerToken")) {
|
||||
if (options.id && wx.getStorageSync(customerTokenKey())) {
|
||||
customerRequest("/customer/inquiry-submissions/" + encodeURIComponent(options.id))
|
||||
.then((submission) =>
|
||||
this.setData({
|
||||
@@ -25,6 +31,6 @@ Page({
|
||||
wx.redirectTo({ url: "/pages/records/index" });
|
||||
},
|
||||
home() {
|
||||
wx.switchTab({ url: "/pages/index/index" });
|
||||
wx.navigateTo({ url: "/pages/index/index" });
|
||||
},
|
||||
});
|
||||
@@ -1 +1 @@
|
||||
<success-summary record="{{record}}" bind:records="viewRecords" bind:home="home" />
|
||||
<success-summary record="{{record}}" presentation="{{presentation}}" bind:records="viewRecords" bind:home="home" />
|
||||
@@ -1,5 +1,5 @@
|
||||
const { loadWorkspaceWithFallback } = require("../../utils/runtime-workspace");
|
||||
const { request, customerRequest } = require("../../utils/request");
|
||||
const { request, customerRequest, customerTokenKey } = require("../../utils/request");
|
||||
Page({
|
||||
data: {
|
||||
offering: null,
|
||||
@@ -8,31 +8,42 @@ Page({
|
||||
title: "需求咨询",
|
||||
subtitle: "提交信息后由主理人与你联系",
|
||||
submitLabel: "提交需求",
|
||||
presentation: {},
|
||||
values: {},
|
||||
fields: [],
|
||||
formId: "",
|
||||
error: "",
|
||||
templateKey: "",
|
||||
navigation: [],
|
||||
},
|
||||
onLoad(options) {
|
||||
loadWorkspaceWithFallback().then((workspace) => {
|
||||
const offering =
|
||||
(workspace.offerings || []).find((item) => item.id === options.offeringId) || null;
|
||||
const forms = workspace.inquiryForms || [];
|
||||
const form =
|
||||
forms.find((item) => item.targetId && item.targetId === options.offeringId) ||
|
||||
forms.find((item) => item.target === "brand") ||
|
||||
forms[0];
|
||||
const isQuote =
|
||||
form?.purpose === "quote-request" ||
|
||||
(workspace.plugins || []).some((plugin) => plugin.key === "quote-request");
|
||||
this.setData({
|
||||
offering,
|
||||
fields: form?.fields || workspace.fields || [],
|
||||
formId: form?.key || form?.id || "",
|
||||
title: isQuote ? "获取报价方案" : "需求咨询",
|
||||
eyebrow: isQuote ? "QUOTE REQUEST" : "CONSULTATION",
|
||||
submitLabel: isQuote ? "提交报价需求" : "提交需求",
|
||||
});
|
||||
});
|
||||
loadWorkspaceWithFallback()
|
||||
.then((workspace) => {
|
||||
const offering =
|
||||
(workspace.offerings || []).find((item) => item.id === options.offeringId) || null;
|
||||
const forms = workspace.inquiryForms || [];
|
||||
const form =
|
||||
forms.find((item) => item.targetId && item.targetId === options.offeringId) ||
|
||||
forms.find((item) => item.target === "brand") ||
|
||||
forms[0];
|
||||
const isQuote =
|
||||
form?.purpose === "quote-request" ||
|
||||
(workspace.plugins || []).some((plugin) => plugin.key === "quote-request");
|
||||
const presentation = workspace.brand?.visualPresentation?.inquiry || {};
|
||||
this.setData({
|
||||
offering,
|
||||
fields: form?.fields || workspace.fields || [],
|
||||
formId: form?.key || form?.id || "",
|
||||
title: isQuote ? "获取报价方案" : presentation.title || "需求咨询",
|
||||
eyebrow: isQuote ? "QUOTE REQUEST" : presentation.eyebrow || "CONSULTATION",
|
||||
subtitle: presentation.subtitle || "提交信息后由主理人与你联系",
|
||||
submitLabel: isQuote ? "提交报价需求" : presentation.submitLabel || "提交需求",
|
||||
presentation,
|
||||
templateKey: workspace.visualTemplate?.key || "",
|
||||
navigation: workspace.navigation || [],
|
||||
});
|
||||
})
|
||||
.catch((error) => this.setData({ error: error.message }));
|
||||
},
|
||||
onInput(e) {
|
||||
this.setData({ ["values." + e.currentTarget.dataset.key]: e.detail.value });
|
||||
@@ -69,12 +80,12 @@ Page({
|
||||
this.setData({ submitting: false });
|
||||
wx.showToast({ title: error.message || "提交失败,请重试", icon: "none" });
|
||||
};
|
||||
if (wx.getStorageSync("customerToken")) return send().catch(fail);
|
||||
if (wx.getStorageSync(customerTokenKey())) return send().catch(fail);
|
||||
wx.login({
|
||||
success: (login) =>
|
||||
request("/customer/session/wechat", { method: "POST", data: { code: login.code } })
|
||||
.then((result) => {
|
||||
wx.setStorageSync("customerToken", result.token);
|
||||
wx.setStorageSync(customerTokenKey(), result.token);
|
||||
return send();
|
||||
})
|
||||
.catch(fail),
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
"brand-field": "/components/ui/brand-field/brand-field",
|
||||
"brand-loading": "/components/ui/brand-loading/brand-loading",
|
||||
"brand-empty": "/components/ui/brand-empty/brand-empty",
|
||||
"inquiry-form": "/components/modules/inquiry-form/inquiry-form"
|
||||
"inquiry-form": "/components/modules/inquiry-form/inquiry-form",
|
||||
"runtime-tab-bar": "/components/runtime-tab-bar/runtime-tab-bar"
|
||||
}
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
<view class="page"><view class="head"><text class="eyebrow">{{eyebrow}}</text><text class="title">{{title}}</text><text class="sub">{{offering ? offering.name : subtitle}}</text></view><inquiry-form fields="{{fields}}" values="{{values}}" submitting="{{submitting}}" submit-label="{{submitLabel}}" bind:input="onComponentInput" bind:submit="submit" /></view>
|
||||
<view class="page"><view wx:if="{{error}}" class="runtime-error">{{error}}</view><block wx:else><view class="head"><text class="eyebrow">{{eyebrow}}</text><text class="title">{{title}}</text><text class="sub">{{offering ? offering.name : subtitle}}</text></view><view wx:if="{{presentation.note}}" class="booking-note"><text>{{presentation.note}}</text></view><view class="form-panel"><inquiry-form fields="{{fields}}" values="{{values}}" submitting="{{submitting}}" submit-label="{{submitLabel}}" bind:input="onComponentInput" bind:submit="submit" /></view></block></view>
|
||||
@@ -3,6 +3,91 @@
|
||||
background: #f7f5f1;
|
||||
color: #252525;
|
||||
}
|
||||
.page {
|
||||
padding-bottom: 150rpx;
|
||||
}
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
background: #fff8f0;
|
||||
color: #29231f;
|
||||
}
|
||||
.booking-hero {
|
||||
padding: 52rpx 32rpx 30rpx;
|
||||
background: linear-gradient(180deg, #fff1df, #fff8f0);
|
||||
}
|
||||
.booking-hero .eyebrow {
|
||||
display: block;
|
||||
color: #c65c28;
|
||||
font-size: 22rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
.booking-hero .title {
|
||||
display: block;
|
||||
margin-top: 14rpx;
|
||||
font-size: 44rpx;
|
||||
font-weight: 800;
|
||||
line-height: 1.2;
|
||||
}
|
||||
.booking-hero .sub {
|
||||
display: block;
|
||||
margin-top: 14rpx;
|
||||
color: #7a6a60;
|
||||
font-size: 24rpx;
|
||||
line-height: 1.7;
|
||||
}
|
||||
.booking-note {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin: 0 32rpx 20rpx;
|
||||
padding: 20rpx 22rpx;
|
||||
border: 1rpx solid #f3d1b2;
|
||||
border-radius: 20rpx;
|
||||
background: #fff;
|
||||
color: #a4562d;
|
||||
font-size: 21rpx;
|
||||
}
|
||||
.form-panel {
|
||||
margin: 0 24rpx;
|
||||
padding: 10rpx 8rpx 24rpx;
|
||||
border: 1rpx solid #f1e1d5;
|
||||
border-radius: 28rpx;
|
||||
background: #fff;
|
||||
box-shadow: 0 12rpx 28rpx rgba(145, 75, 33, 0.06);
|
||||
}
|
||||
.form-panel .form {
|
||||
padding: 20rpx;
|
||||
}
|
||||
.form-panel .field {
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
.form-panel .label {
|
||||
color: #4f3020;
|
||||
font-weight: 700;
|
||||
}
|
||||
.form-panel input,
|
||||
.form-panel textarea,
|
||||
.form-panel .picker-value {
|
||||
border: 1rpx solid #eaded5;
|
||||
border-radius: 16rpx;
|
||||
background: #fffaf6;
|
||||
}
|
||||
.form-panel .submit {
|
||||
height: 82rpx;
|
||||
border-radius: 20rpx;
|
||||
background: #e87532;
|
||||
color: #fff;
|
||||
line-height: 82rpx;
|
||||
}
|
||||
.runtime-error {
|
||||
margin: 48rpx 32rpx;
|
||||
padding: 28rpx;
|
||||
border: 1rpx solid #e6ded5;
|
||||
border-radius: 14rpx;
|
||||
background: #fff;
|
||||
color: #8a6846;
|
||||
font-size: 25rpx;
|
||||
line-height: 1.6;
|
||||
}
|
||||
.head {
|
||||
background: #252827;
|
||||
color: #fff;
|
||||
@@ -65,3 +150,6 @@
|
||||
font-size: 20rpx;
|
||||
margin-top: 26rpx;
|
||||
}
|
||||
.page {
|
||||
padding-bottom: 150rpx;
|
||||
}
|
||||
@@ -1,14 +1,20 @@
|
||||
const { loadWorkspaceWithFallback } = require("../../utils/runtime-workspace");
|
||||
Page({
|
||||
data: { item: null, loading: true },
|
||||
data: { item: null, loading: true, error: "", presentation: {} },
|
||||
onLoad(options) {
|
||||
loadWorkspaceWithFallback().then((workspace) => {
|
||||
const offerings = workspace.offerings || [];
|
||||
const item = offerings.find((entry) => entry.id === options.id) || offerings[0];
|
||||
if (!item) return this.setData({ loading: false });
|
||||
this.setData({ item, loading: false });
|
||||
wx.setNavigationBarTitle({ title: item.category || item.name });
|
||||
});
|
||||
loadWorkspaceWithFallback()
|
||||
.then((workspace) => {
|
||||
const offerings = workspace.offerings || [];
|
||||
const item = offerings.find((entry) => entry.id === options.id) || offerings[0];
|
||||
if (!item) return this.setData({ loading: false, error: "未找到可展示的业务提供项" });
|
||||
this.setData({
|
||||
item,
|
||||
loading: false,
|
||||
presentation: workspace.brand?.visualPresentation?.detail || {},
|
||||
});
|
||||
wx.setNavigationBarTitle({ title: item.category || item.name });
|
||||
})
|
||||
.catch((error) => this.setData({ loading: false, error: error.message }));
|
||||
},
|
||||
inquire() {
|
||||
wx.navigateTo({ url: "/pages/inquiry/index?offeringId=" + this.data.item.id });
|
||||
|
||||
@@ -1 +1 @@
|
||||
<offering-detail wx:if="{{item}}" item="{{item}}" bind:inquire="inquire" />
|
||||
<view wx:if="{{error}}" class="runtime-error">{{error}}</view><offering-detail wx:elif="{{item}}" item="{{item}}" presentation="{{presentation}}" bind:inquire="inquire" />
|
||||
@@ -4,6 +4,16 @@
|
||||
color: #252525;
|
||||
padding-bottom: 150rpx;
|
||||
}
|
||||
.runtime-error {
|
||||
margin: 48rpx 32rpx;
|
||||
padding: 28rpx;
|
||||
border: 1rpx solid #e6ded5;
|
||||
border-radius: 14rpx;
|
||||
background: #fff;
|
||||
color: #8a6846;
|
||||
font-size: 25rpx;
|
||||
line-height: 1.6;
|
||||
}
|
||||
.hero {
|
||||
width: 100%;
|
||||
height: 600rpx;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
const { customerRequest } = require("../../utils/request");
|
||||
const { customerRequest, customerTokenKey } = require("../../utils/request");
|
||||
const { loadWorkspaceWithFallback } = require("../../utils/runtime-workspace");
|
||||
|
||||
const statusLabels = {
|
||||
new: "待处理",
|
||||
@@ -10,9 +11,16 @@ const statusLabels = {
|
||||
};
|
||||
|
||||
Page({
|
||||
data: { records: [], loading: false },
|
||||
data: { records: [], loading: false, presentation: {} },
|
||||
onLoad() {
|
||||
loadWorkspaceWithFallback()
|
||||
.then((workspace) =>
|
||||
this.setData({ presentation: workspace.brand?.visualPresentation?.records || {} }),
|
||||
)
|
||||
.catch(() => {});
|
||||
},
|
||||
onShow() {
|
||||
if (!wx.getStorageSync("customerToken")) return this.setData({ records: [] });
|
||||
if (!wx.getStorageSync(customerTokenKey())) return this.setData({ records: [] });
|
||||
this.setData({ loading: true });
|
||||
customerRequest("/customer/inquiry-submissions")
|
||||
.then((items) =>
|
||||
|
||||
@@ -1 +1 @@
|
||||
<view class="page"><view class="head"><text class="title">我的咨询记录</text><button bindtap="inquire">+ 新增预约</button></view><records-module records="{{records}}" bind:create="inquire" /></view>
|
||||
<view class="page"><view class="head"><text class="title">{{presentation.title}}</text><button bindtap="inquire">{{presentation.createAction}}</button></view><records-module records="{{records}}" presentation="{{presentation}}" bind:create="inquire" /></view>
|
||||
@@ -1,4 +1,5 @@
|
||||
const { loadWorkspaceWithFallback } = require("../../utils/runtime-workspace");
|
||||
const config = require("../../utils/config");
|
||||
Page({
|
||||
data: {
|
||||
loading: false,
|
||||
@@ -7,28 +8,64 @@ Page({
|
||||
filtered: [],
|
||||
modules: [],
|
||||
theme: {},
|
||||
category: "全部",
|
||||
brand: {},
|
||||
presentation: {},
|
||||
category: "all",
|
||||
categories: [],
|
||||
pageRenderer: "",
|
||||
loadedBrandSlug: "",
|
||||
templateKey: "",
|
||||
navigation: [],
|
||||
},
|
||||
onLoad() {
|
||||
loadWorkspaceWithFallback().then((workspace) => {
|
||||
const items = workspace.offerings || [];
|
||||
this.setData({
|
||||
offerings: items,
|
||||
filtered: items,
|
||||
modules: workspace.modules || [],
|
||||
theme: workspace.theme || {},
|
||||
});
|
||||
});
|
||||
this.loadWorkspace();
|
||||
},
|
||||
onShow() {
|
||||
if (this.data.loadedBrandSlug && this.data.loadedBrandSlug !== config.brandSlug) {
|
||||
this.loadWorkspace();
|
||||
}
|
||||
},
|
||||
loadWorkspace() {
|
||||
loadWorkspaceWithFallback()
|
||||
.then((workspace) => {
|
||||
const items = workspace.offerings || [];
|
||||
this.setData({
|
||||
offerings: items,
|
||||
filtered: items,
|
||||
categories: [
|
||||
{ key: "all", label: "全部" },
|
||||
...Array.from(new Set(items.map((item) => item.category).filter(Boolean))).map(
|
||||
(key) => ({
|
||||
key,
|
||||
label: key,
|
||||
}),
|
||||
),
|
||||
],
|
||||
modules: workspace.modules || [],
|
||||
theme: workspace.theme || {},
|
||||
brand: workspace.brand || {},
|
||||
presentation: workspace.brand?.visualPresentation?.offerings || {},
|
||||
brand: workspace.brand || {},
|
||||
pageRenderer: workspace.pageRenderers?.offerings || "",
|
||||
loadedBrandSlug: config.brandSlug,
|
||||
templateKey: workspace.visualTemplate?.key || "",
|
||||
navigation: workspace.navigation || [],
|
||||
});
|
||||
})
|
||||
.catch((error) => this.setData({ error: error.message }));
|
||||
},
|
||||
switchCategory(e) {
|
||||
const category = e.currentTarget.dataset.category;
|
||||
const items = this.data.offerings || [];
|
||||
this.setData({
|
||||
category,
|
||||
filtered: category === "全部" ? items : items.filter((item) => item.category === category),
|
||||
filtered: category === "all" ? items : items.filter((item) => item.category === category),
|
||||
});
|
||||
},
|
||||
open(e) {
|
||||
wx.navigateTo({ url: "/pages/offering/detail?id=" + e.currentTarget.dataset.id });
|
||||
},
|
||||
inquire() {
|
||||
wx.navigateTo({ url: "/pages/inquiry/index" });
|
||||
},
|
||||
});
|
||||
@@ -3,7 +3,10 @@
|
||||
"navigationBarBackgroundColor": "#FBF7F1",
|
||||
"navigationBarTextStyle": "black",
|
||||
"usingComponents": {
|
||||
"acheng-offerings": "/components/templates/acheng-offerings/acheng-offerings",
|
||||
"linjing-offerings": "/components/templates/linjing-offerings/linjing-offerings",
|
||||
"brand-loading": "/components/ui/brand-loading/brand-loading",
|
||||
"brand-empty": "/components/ui/brand-empty/brand-empty"
|
||||
"brand-empty": "/components/ui/brand-empty/brand-empty",
|
||||
"runtime-tab-bar": "/components/runtime-tab-bar/runtime-tab-bar"
|
||||
}
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
<view class="page"><view class="head"><text class="eyebrow">LINJING ATELIER</text><text class="title">作品与系统</text><text class="sub">每一扇门,都是建筑秩序的一部分。</text></view><scroll-view scroll-x class="tabs"><text wx:for="{{['全部','入户大门','庭院围墙门','室内户内门','装饰隐形门']}}" wx:key="*this" class="tab {{category===item?'active':''}}" data-category="{{item}}" bindtap="switchCategory">{{item}}</text></scroll-view><view class="list"><view wx:for="{{filtered}}" wx:key="id" class="card" data-id="{{item.id}}" bindtap="open"><image src="{{item.image}}" mode="aspectFill"/><view class="card-body"><text class="category">{{item.category}} · {{item.tag}}</text><text class="name">{{item.name}}</text><text class="series">{{item.series}}</text><text class="desc">{{item.desc}}</text><view class="foot"><text>{{item.area}}</text><text class="arrow">查看详情 →</text></view></view></view></view></view>
|
||||
<view class="page"><view wx:if="{{error}}" class="runtime-error">{{error}}</view><block wx:else><acheng-offerings wx:if="{{pageRenderer === 'acheng-offerings'}}" brand="{{brand}}" presentation="{{presentation}}" offerings="{{filtered}}" bind:open="open" bind:inquire="inquire" /><block wx:else><view class="head"><text class="eyebrow">{{brand.name}}</text><text class="title">{{presentation.title}}</text><text class="sub">{{presentation.subtitle}}</text></view><scroll-view scroll-x class="tabs"><text wx:for="{{categories}}" wx:key="key" class="tab {{category===item.key?'active':''}}" data-category="{{item.key}}" bindtap="switchCategory">{{item.label}}</text></scroll-view><view class="list"><view wx:for="{{filtered}}" wx:key="id" class="card"><view class="media" data-id="{{item.id}}" bindtap="open"><image src="{{item.image}}" mode="aspectFill"/><text class="media-category">{{item.category}}</text><text wx:if="{{item.tag}}" class="media-tag">{{item.tag}}</text><view wx:if="{{item.area || item.spaceType}}" class="media-meta"><text>{{item.area}}</text><text>{{item.spaceType}}</text></view></view><view class="card-body"><text class="name" data-id="{{item.id}}" bindtap="open">{{item.name}}</text><text class="series">{{item.series}}</text><view wx:if="{{item.woodMaterial || item.hardware}}" class="specs"><view wx:if="{{item.woodMaterial}}"><text>{{presentation.materialLabel}}</text><text>{{item.woodMaterial}}</text></view><view wx:if="{{item.hardware}}"><text>{{presentation.hardwareLabel}}</text><text>{{item.hardware}}</text></view></view><view class="actions"><button class="detail" data-id="{{item.id}}" bindtap="open">{{presentation.detailAction}}</button><button class="inquire" data-id="{{item.id}}" bindtap="open">{{presentation.inquiryAction}}</button></view></view></view></view></block></block><runtime-tab-bar template-key="{{templateKey}}" active="dishes" /></view>
|
||||
@@ -3,6 +3,16 @@
|
||||
min-height: 100vh;
|
||||
color: #252525;
|
||||
}
|
||||
.runtime-error {
|
||||
margin: 48rpx 32rpx;
|
||||
padding: 28rpx;
|
||||
border: 1rpx solid #e6ded5;
|
||||
border-radius: 14rpx;
|
||||
background: #fff;
|
||||
color: #8a6846;
|
||||
font-size: 25rpx;
|
||||
line-height: 1.6;
|
||||
}
|
||||
.head {
|
||||
background: #252827;
|
||||
color: #fff;
|
||||
@@ -48,12 +58,64 @@
|
||||
.card {
|
||||
background: #fff;
|
||||
margin-bottom: 30rpx;
|
||||
overflow: hidden;
|
||||
border: 1rpx solid #e6ded5;
|
||||
border-radius: 18rpx;
|
||||
box-shadow: 0 10rpx 30rpx -12rpx rgba(32, 34, 33, 0.08);
|
||||
}
|
||||
.media {
|
||||
position: relative;
|
||||
height: 380rpx;
|
||||
background: #202221;
|
||||
}
|
||||
.card image {
|
||||
width: 100%;
|
||||
height: 380rpx;
|
||||
height: 100%;
|
||||
display: block;
|
||||
}
|
||||
.media-category,
|
||||
.media-tag,
|
||||
.media-meta {
|
||||
position: absolute;
|
||||
color: #fff;
|
||||
font-size: 20rpx;
|
||||
}
|
||||
.media-category {
|
||||
top: 20rpx;
|
||||
left: 20rpx;
|
||||
padding: 8rpx 14rpx;
|
||||
border: 1rpx solid rgba(255, 255, 255, 0.15);
|
||||
border-radius: 8rpx;
|
||||
background: rgba(32, 34, 33, 0.76);
|
||||
color: #d9c8b2;
|
||||
}
|
||||
.media-tag {
|
||||
top: 20rpx;
|
||||
right: 20rpx;
|
||||
padding: 8rpx 14rpx;
|
||||
border-radius: 6rpx;
|
||||
background: #8a6846;
|
||||
}
|
||||
.media-meta {
|
||||
right: 20rpx;
|
||||
bottom: 20rpx;
|
||||
left: 20rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 20rpx;
|
||||
padding: 10rpx 14rpx;
|
||||
border: 1rpx solid rgba(255, 255, 255, 0.12);
|
||||
border-radius: 10rpx;
|
||||
background: rgba(0, 0, 0, 0.4);
|
||||
color: rgba(255, 255, 255, 0.9);
|
||||
font-size: 19rpx;
|
||||
}
|
||||
.media-meta text:last-child {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
color: #d9c8b2;
|
||||
}
|
||||
.card-body {
|
||||
padding: 28rpx;
|
||||
}
|
||||
@@ -80,6 +142,49 @@
|
||||
line-height: 1.7;
|
||||
margin-top: 18rpx;
|
||||
}
|
||||
.specs {
|
||||
margin-top: 20rpx;
|
||||
padding: 18rpx;
|
||||
border: 1rpx solid #e6ded5;
|
||||
border-radius: 12rpx;
|
||||
background: #f7f5f1;
|
||||
color: #252525;
|
||||
font-size: 20rpx;
|
||||
line-height: 1.55;
|
||||
}
|
||||
.specs view {
|
||||
display: flex;
|
||||
gap: 8rpx;
|
||||
}
|
||||
.specs view + view {
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
.specs text:first-child {
|
||||
flex: 0 0 auto;
|
||||
color: #77736b;
|
||||
}
|
||||
.actions {
|
||||
display: flex;
|
||||
gap: 14rpx;
|
||||
margin-top: 22rpx;
|
||||
}
|
||||
.actions button {
|
||||
flex: 1;
|
||||
height: 70rpx;
|
||||
margin: 0;
|
||||
border-radius: 12rpx;
|
||||
font-size: 21rpx;
|
||||
line-height: 70rpx;
|
||||
}
|
||||
.detail {
|
||||
border: 1rpx solid #202221;
|
||||
background: #fff;
|
||||
color: #202221;
|
||||
}
|
||||
.inquire {
|
||||
background: #8a6846;
|
||||
color: #fff;
|
||||
}
|
||||
.foot {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
@@ -92,3 +197,6 @@
|
||||
.arrow {
|
||||
color: #8a6846;
|
||||
}
|
||||
.page {
|
||||
padding-bottom: 150rpx;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
const { loadWorkspaceWithFallback } = require("../../utils/runtime-workspace");
|
||||
Page({
|
||||
data: { brand: {}, templateKey: "", presentation: {}, navigation: [], loading: true },
|
||||
onLoad() {
|
||||
loadWorkspaceWithFallback()
|
||||
.then((workspace) =>
|
||||
this.setData({
|
||||
brand: workspace.brand || {},
|
||||
templateKey: workspace.visualTemplate?.key || "",
|
||||
presentation: workspace.brand?.visualPresentation?.home || {},
|
||||
navigation: workspace.navigation || [],
|
||||
loading: false,
|
||||
}),
|
||||
)
|
||||
.catch(() => this.setData({ loading: false }));
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"navigationBarTitleText": "出摊服务",
|
||||
"usingComponents": { "runtime-tab-bar": "/components/runtime-tab-bar/runtime-tab-bar" }
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<view class="page"><view class="head"><text class="eyebrow">出摊与服务</text><text class="title">今天在哪里,怎么取餐</text><text class="sub">{{brand.hours || '营业时间以当天通知为准'}}</text></view><view class="card"><text class="card-title">固定出摊与取餐</text><text>{{brand.studioAddress || brand.address || '校园生活区附近'}}</text><text>支持摊位自取、校内配送,以及班级和社团活动定制。</text></view><view class="card"><text class="card-title">定制餐品流程</text><text>1. 提交人数、时间和口味需求</text><text>2. 主理人确认菜单与取餐方式</text><text>3. 当天现做并按约定时间交付</text></view><runtime-tab-bar template-key="{{templateKey}}" active="service" /></view>
|
||||
@@ -0,0 +1,42 @@
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
padding: 28rpx 32rpx 150rpx;
|
||||
background: #fff8f0;
|
||||
color: #29231f;
|
||||
}
|
||||
.head {
|
||||
padding: 38rpx 4rpx 28rpx;
|
||||
}
|
||||
.eyebrow {
|
||||
display: block;
|
||||
color: #c65c28;
|
||||
font-size: 22rpx;
|
||||
}
|
||||
.title {
|
||||
display: block;
|
||||
margin-top: 12rpx;
|
||||
font-size: 42rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
.sub {
|
||||
display: block;
|
||||
margin-top: 12rpx;
|
||||
color: #7a6a60;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 14rpx;
|
||||
margin-bottom: 22rpx;
|
||||
padding: 28rpx;
|
||||
border: 1rpx solid #f2d9c6;
|
||||
border-radius: 24rpx;
|
||||
background: #fff;
|
||||
line-height: 1.7;
|
||||
}
|
||||
.card-title {
|
||||
color: #4f3020;
|
||||
font-size: 29rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"templateKey": "acheng-campus-food",
|
||||
"viewport": { "width": 375, "height": 812 },
|
||||
"states": {
|
||||
"home": {
|
||||
"page": "pages/index/index",
|
||||
"anchors": ["acheng-home", "brand-card", "今日菜单", "现做现吃"]
|
||||
},
|
||||
"offerings": {
|
||||
"page": "pages/services/index",
|
||||
"anchors": ["acheng-offerings", "今日菜单", "团体活动"]
|
||||
},
|
||||
"detail": { "page": "pages/offering/detail", "anchors": ["inquire"] },
|
||||
"inquiry": { "page": "pages/inquiry/index", "anchors": ["提交"] },
|
||||
"success": {
|
||||
"page": "pages/inquiry-success/index",
|
||||
"anchors": ["presentation.title"]
|
||||
},
|
||||
"records": {
|
||||
"page": "pages/records/index",
|
||||
"anchors": ["presentation.title"]
|
||||
},
|
||||
"profile": {
|
||||
"page": "pages/bookings/index",
|
||||
"anchors": ["acheng-profile", "出摊与配送"]
|
||||
}
|
||||
}
|
||||
}
|
||||
+20
-5
@@ -6,11 +6,26 @@
|
||||
"page": "pages/index/index",
|
||||
"anchors": ["founder-card", "brand-hero", "trust-proof", "offering-list"]
|
||||
},
|
||||
"offerings": { "page": "pages/services/index", "anchors": ["作品与系统", "查看详情"] },
|
||||
"detail": { "page": "pages/offering/detail", "anchors": ["预约测量"] },
|
||||
"offerings": {
|
||||
"page": "pages/services/index",
|
||||
"anchors": ["presentation.title", "presentation.detailAction", "presentation.inquiryAction"]
|
||||
},
|
||||
"detail": {
|
||||
"page": "pages/offering/detail",
|
||||
"anchors": ["presentation.craftsTitle", "presentation.inquiryAction"]
|
||||
},
|
||||
"inquiry": { "page": "pages/inquiry/index", "anchors": ["提交"] },
|
||||
"success": { "page": "pages/inquiry-success/index", "anchors": ["已收到", "查看"] },
|
||||
"records": { "page": "pages/records/index", "anchors": ["咨询记录", "咨询"] },
|
||||
"profile": { "page": "pages/bookings/index", "anchors": ["直派服务区域与履约说明", "一门一档"] }
|
||||
"success": {
|
||||
"page": "pages/inquiry-success/index",
|
||||
"anchors": ["presentation.title", "presentation.recordsAction"]
|
||||
},
|
||||
"records": {
|
||||
"page": "pages/records/index",
|
||||
"anchors": ["presentation.title", "presentation.createAction"]
|
||||
},
|
||||
"profile": {
|
||||
"page": "pages/bookings/index",
|
||||
"anchors": ["presentation.coverageTitle", "presentation.warrantyTitle"]
|
||||
}
|
||||
}
|
||||
}
|
||||
+26
-6
@@ -4,13 +4,33 @@
|
||||
"states": {
|
||||
"home": {
|
||||
"page": "pages/index/index",
|
||||
"anchors": ["founder-card", "brand-hero", "trust-proof", "trust-manifesto", "offering-list"]
|
||||
"anchors": [
|
||||
"linjing-home",
|
||||
"presentation.founderBadge",
|
||||
"presentation.manifestoEyebrow",
|
||||
"presentation.flowTitle"
|
||||
]
|
||||
},
|
||||
"offerings": {
|
||||
"page": "pages/services/index",
|
||||
"anchors": ["presentation.title", "presentation.detailAction", "presentation.inquiryAction"]
|
||||
},
|
||||
"detail": {
|
||||
"page": "pages/offering/detail",
|
||||
"anchors": ["presentation.craftsTitle", "presentation.inquiryAction"]
|
||||
},
|
||||
"offerings": { "page": "pages/services/index", "anchors": ["作品与系统", "查看详情"] },
|
||||
"detail": { "page": "pages/offering/detail", "anchors": ["预约测量"] },
|
||||
"inquiry": { "page": "pages/inquiry/index", "anchors": ["提交"] },
|
||||
"success": { "page": "pages/inquiry-success/index", "anchors": ["已收到", "查看"] },
|
||||
"records-empty": { "page": "pages/records/index", "anchors": ["咨询记录", "咨询"] },
|
||||
"profile": { "page": "pages/bookings/index", "anchors": ["直派服务区域与履约说明", "一门一档"] }
|
||||
"success": {
|
||||
"page": "pages/inquiry-success/index",
|
||||
"anchors": ["presentation.title", "presentation.recordsAction"]
|
||||
},
|
||||
"records-empty": {
|
||||
"page": "pages/records/index",
|
||||
"anchors": ["presentation.title", "presentation.createAction"]
|
||||
},
|
||||
"profile": {
|
||||
"page": "pages/bookings/index",
|
||||
"anchors": ["presentation.coverageTitle", "presentation.warrantyTitle"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
{
|
||||
"templateKey": "personal+minimal-neutral",
|
||||
"viewport": { "width": 375, "height": 812 },
|
||||
"states": {
|
||||
"home": {
|
||||
"page": "pages/index/index",
|
||||
"anchors": ["brand-hero", "founder-card", "offering-list", "trust-proof"]
|
||||
},
|
||||
"offerings": { "page": "pages/services/index", "anchors": ["作品与系统", "查看详情"] },
|
||||
"detail": { "page": "pages/offering/detail", "anchors": ["预约测量"] },
|
||||
"inquiry": { "page": "pages/inquiry/index", "anchors": ["提交"] },
|
||||
"success": { "page": "pages/inquiry-success/index", "anchors": ["已收到", "查看"] },
|
||||
"records-empty": { "page": "pages/records/index", "anchors": ["咨询记录", "咨询"] },
|
||||
"profile": { "page": "pages/bookings/index", "anchors": ["直派服务区域与履约说明", "一门一档"] }
|
||||
}
|
||||
}
|
||||
-23
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"templateKey": "personal+minimal-neutral",
|
||||
"version": "1.0.0",
|
||||
"pages": ["home", "offerings", "detail", "inquiry", "success", "records", "profile"],
|
||||
"layout": {
|
||||
"home": ["brand-hero", "founder-card", "offering-list", "trust-proof"],
|
||||
"offerings": ["offering-list"],
|
||||
"detail": ["offering-detail"],
|
||||
"profile": ["profile"]
|
||||
},
|
||||
"requiredModules": [
|
||||
"brand-hero",
|
||||
"founder-card",
|
||||
"trust-proof",
|
||||
"offering-list",
|
||||
"offering-detail",
|
||||
"inquiry-form",
|
||||
"records",
|
||||
"profile",
|
||||
"success-summary"
|
||||
],
|
||||
"visualAnchors": { "home": ["brand-hero", "founder-card", "offering-list", "trust-proof"] }
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
const assert = require("node:assert/strict");
|
||||
const fs = require("node:fs");
|
||||
const path = require("node:path");
|
||||
const test = require("node:test");
|
||||
const vm = require("node:vm");
|
||||
|
||||
const source = fs.readFileSync(path.join(__dirname, "../utils/runtime-workspace.js"), "utf8");
|
||||
|
||||
function loadWithResponse(response) {
|
||||
const module = { exports: {} };
|
||||
const storage = {
|
||||
getStorageSync() {
|
||||
throw new Error("不应读取旧缓存");
|
||||
},
|
||||
setStorageSync() {
|
||||
throw new Error("不应缓存公开内容");
|
||||
},
|
||||
};
|
||||
vm.runInNewContext(source, {
|
||||
module,
|
||||
wx: storage,
|
||||
require(id) {
|
||||
if (id === "./request") return { request: () => Promise.resolve(response) };
|
||||
if (id === "./module-registry") return { resolveRuntime: () => ({}) };
|
||||
throw new Error(`意外依赖:${id}`);
|
||||
},
|
||||
});
|
||||
return module.exports.loadWorkspaceWithFallback();
|
||||
}
|
||||
|
||||
test("未发布品牌不会使用旧 workspace 缓存", async () => {
|
||||
await assert.rejects(
|
||||
loadWithResponse({ publication: { status: "unpublished" }, brand: null }),
|
||||
/品牌尚未发布/,
|
||||
);
|
||||
});
|
||||
|
||||
test("已发布 workspace 正常返回", async () => {
|
||||
const workspace = await loadWithResponse({
|
||||
publication: { status: "published" },
|
||||
brand: { name: "测试品牌" },
|
||||
offerings: [],
|
||||
});
|
||||
assert.equal(workspace.brand.name, "测试品牌");
|
||||
});
|
||||
@@ -3,6 +3,8 @@ const path = require("node:path");
|
||||
const root = path.resolve(__dirname, "..");
|
||||
const requestSource = fs.readFileSync(path.join(root, "utils/request.js"), "utf8");
|
||||
const configSource = fs.readFileSync(path.join(root, "utils/config.js"), "utf8");
|
||||
const moduleRegistrySource = fs.readFileSync(path.join(root, "utils/module-registry.js"), "utf8");
|
||||
const runtimeRequestSource = fs.readFileSync(path.join(root, "utils/request.js"), "utf8");
|
||||
if (
|
||||
!requestSource.includes('path.startsWith("/public/")') ||
|
||||
!requestSource.includes("brandSlug") ||
|
||||
@@ -11,7 +13,37 @@ if (
|
||||
console.error("miniapp: public requests must carry the configured brand slug");
|
||||
process.exit(1);
|
||||
}
|
||||
const fixtureFiles = ["linjing-door.json", "minimal-neutral.json", "doors-industry.json"];
|
||||
if (!moduleRegistrySource.includes("Object.values(manifest?.pages || {})")) {
|
||||
console.error("miniapp: visual page renderers must resolve from the manifest");
|
||||
process.exit(1);
|
||||
}
|
||||
if (
|
||||
!runtimeRequestSource.includes('path.startsWith("/customer/session/wechat")') ||
|
||||
!runtimeRequestSource.includes('"customerToken:" + config.brandSlug')
|
||||
) {
|
||||
console.error("miniapp: customer sessions must be brand-scoped");
|
||||
process.exit(1);
|
||||
}
|
||||
const productionRoots = ["components/modules", "components/templates", "pages"];
|
||||
const productionSources = [];
|
||||
function collectSources(directory) {
|
||||
const current = path.join(root, directory);
|
||||
for (const item of fs.readdirSync(current, { withFileTypes: true })) {
|
||||
const itemPath = path.join(current, item.name);
|
||||
if (item.isDirectory()) collectSources(path.relative(root, itemPath));
|
||||
else if (itemPath.endsWith(".js") || itemPath.endsWith(".wxml"))
|
||||
productionSources.push({ file: itemPath, content: fs.readFileSync(itemPath, "utf8") });
|
||||
}
|
||||
}
|
||||
productionRoots.forEach(collectSources);
|
||||
for (const term of ["林境门", "亲自主理量房", "拒绝流水线拼装", "linjingInquiryRecords"]) {
|
||||
const leak = productionSources.find(({ content }) => content.includes(term));
|
||||
if (leak) {
|
||||
console.error(`miniapp: static business term ${term} leaked into ${leak.file}`);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
const fixtureFiles = ["linjing-door.json", "doors-industry.json"];
|
||||
const fixtures = fixtureFiles.map((file) =>
|
||||
JSON.parse(fs.readFileSync(path.join(__dirname, "fixtures", file), "utf8")),
|
||||
);
|
||||
|
||||
@@ -3,8 +3,8 @@ const path = require("node:path");
|
||||
const root = path.resolve(__dirname, "..");
|
||||
const fixtureFiles = [
|
||||
"linjing-door-visual.json",
|
||||
"minimal-neutral-visual.json",
|
||||
"doors-visual.json",
|
||||
"acheng-campus-food-visual.json",
|
||||
];
|
||||
const fixtures = fixtureFiles.map((file) =>
|
||||
JSON.parse(fs.readFileSync(path.join(__dirname, "fixtures", file), "utf8")),
|
||||
@@ -22,8 +22,10 @@ for (const fixture of fixtures) {
|
||||
.map((match) => match[1])
|
||||
.filter((name) => name.includes("-"));
|
||||
for (const ref of componentRefs) {
|
||||
const candidate = path.join(root, "components/modules", ref, `${ref}.wxml`);
|
||||
if (fs.existsSync(candidate)) content += fs.readFileSync(candidate, "utf8");
|
||||
for (const componentRoot of ["components/modules", "components/templates"]) {
|
||||
const candidate = path.join(root, componentRoot, ref, `${ref}.wxml`);
|
||||
if (fs.existsSync(candidate)) content += fs.readFileSync(candidate, "utf8");
|
||||
}
|
||||
}
|
||||
for (const anchor of definition.anchors)
|
||||
if (!content.includes(anchor)) failures.push(`${state}: missing anchor ${anchor}`);
|
||||
|
||||
@@ -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