feat: 按林境门作原型完善静态小程序

This commit is contained in:
que01 committed 2026-09-22 16:43:29 +08:00
1 parent 4afb6bbbe8
commit 8489c8ca79
26 files changed
+92 -964

No files matched your search

+4 -31
View File
@@ -1,33 +1,6 @@
const { request } = require("../../utils/request");
const { offerings } = require("../../utils/linjing-data");
Page({
data: { loading: true, error: "", item: null },
onLoad(options) {
request("/public/offerings/" + encodeURIComponent(options.id))
.then((item) => this.setData({ item, loading: false }))
.catch(() => this.setData({ loading: false, error: "详情加载失败" }));
},
submit() {
const cta = this.data.item?.cta || {};
const form = this.data.item?.inquiryForms?.[0];
if (cta.type === "inquiry" || form?.submissionAction === "create-inquiry") {
const formId = form?.id || cta.config?.formId;
return wx.navigateTo({
url: "/pages/inquiry/index" + (formId ? "?formId=" + encodeURIComponent(formId) : ""),
});
}
if (form?.submissionAction === "create-booking" || cta.type === "booking") {
return wx.navigateTo({
url: "/pages/booking/index?offeringId=" + encodeURIComponent(this.data.item?.id || ""),
});
}
if (cta.type === "external-link") {
return wx.showToast({ title: "请在支持外链的环境打开", icon: "none" });
}
if (cta.type === "contact") {
return wx.showToast({ title: "请从品牌主页查看联系方式", icon: "none" });
}
wx.navigateTo({
url: "/pages/booking/index?offeringId=" + encodeURIComponent(this.data.item?.id || ""),
});
},
data: { item: null, loading: true },
onLoad(options) { const item = offerings.find((entry) => entry.id === options.id) || offerings[0]; this.setData({ item, loading: false }); wx.setNavigationBarTitle({ title: item.category }); },
inquire() { wx.navigateTo({ url: "/pages/inquiry/index?offeringId=" + this.data.item.id }); },
});
+1 -1
View File
@@ -1 +1 @@
<view class="page"><view wx:if="{{loading}}" class="state">加载中...</view><view wx:elif="{{error}}" class="state">{{error}}</view><view wx:else><image wx:if="{{item.coverUrl}}" class="cover" src="{{item.coverUrl}}" mode="aspectFill"/><view class="title">{{item.name}}</view><view class="summary">{{item.summary}}</view><view class="price">{{item.priceText || '沟通报价'}}</view><view wx:for="{{item.sections}}" wx:for-item="section" wx:key="title" class="section"><view class="section-title">{{section.title}}</view><view class="section-content">{{section.content}}</view><view wx:for="{{section.items}}" wx:for-item="sectionItem" wx:key="*this" class="section-item">{{sectionItem}}</view></view><button class="cta" bindtap="submit">{{item.cta.label || '立即咨询'}}</button></view></view>
<view class="page" wx:if="{{item}}"><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><view class="rule"/><text class="label">项目摘要</text><text class="desc">{{item.desc}} 本案位于{{item.area}},从建筑入口、材质触感到五金开合,均由主理人亲自参与深化。</text><view class="chips"><text wx:for="{{item.keywords}}" wx:key="*this">{{item}}</text></view><view class="section"><text class="label">定制流程</text><text class="body">私享沟通 → 上门实测 → 构造出图 → 实样确认 → 工坊试装 → 终生维护</text></view></view><view class="bar"><button bindtap="inquire">预约测量 / 获取方案</button></view></view>
+1 -55
View File
@@ -1,55 +1 @@
.page {
min-height: 100vh;
padding: 32rpx;
background: #fbf7f1;
color: #2b2b2b;
}
.cover {
width: 100%;
height: 360rpx;
border-radius: 20rpx;
}
.title {
margin-top: 28rpx;
font-size: 48rpx;
font-weight: 700;
}
.summary {
margin-top: 14rpx;
color: #7a4a2b;
font-size: 30rpx;
}
.price {
margin-top: 20rpx;
color: #b54a2c;
font-size: 38rpx;
font-weight: 700;
}
.section {
margin-top: 28rpx;
padding: 24rpx;
background: #fff;
border-radius: 16rpx;
}
.section-title {
font-size: 34rpx;
font-weight: 700;
}
.section-content {
margin-top: 14rpx;
line-height: 1.7;
}
.section-item {
margin-top: 10rpx;
}
.cta {
margin-top: 36rpx;
background: #b54a2c;
color: #fff;
border-radius: 40rpx;
}
.state {
text-align: center;
padding: 120rpx;
color: #7a4a2b;
}
.page{background:#f7f5f1;min-height:100vh;color:#252525;padding-bottom:150rpx}.hero{width:100%;height:600rpx;display:block}.content{padding:42rpx 40rpx}.category,.label{font-size:21rpx;color:#8a6846;display:block;letter-spacing:1rpx}.title{display:block;font-size:46rpx;font-family:serif;line-height:1.35;margin:18rpx 0 8rpx}.series{display:block;color:#77736b;font-size:26rpx}.price{display:block;color:#8a6846;font-size:30rpx;margin-top:26rpx}.rule{height:1px;background:#ddd5cb;margin:38rpx 0}.desc,.body{display:block;color:#77736b;font-size:27rpx;line-height:1.9;margin-top:16rpx}.chips{display:flex;flex-wrap:wrap;gap:14rpx;margin:30rpx 0}.chips text{border:1px solid #c9b7a0;color:#8a6846;padding:10rpx 18rpx;font-size:22rpx}.section{border-top:1px solid #ddd5cb;padding-top:30rpx;margin-top:28rpx}.bar{position:fixed;bottom:0;left:0;right:0;background:#f7f5f1;padding:22rpx 32rpx calc(22rpx + env(safe-area-inset-bottom));box-shadow:0 -4rpx 18rpx rgba(37,40,39,.08)}.bar button{background:#252827;color:#fff;border-radius:0;height:86rpx;line-height:86rpx;font-size:28rpx}