feat: 按林境门作原型完善静态小程序
This commit is contained in:
1 parent
4afb6bbbe8
commit
8489c8ca79
26 files changed
+92
-964
No files matched your search
@@ -1,46 +1,9 @@
|
||||
const { request } = require("../../utils/request");
|
||||
const config = require("../../utils/config");
|
||||
const { getTemplate } = require("../../utils/templates");
|
||||
|
||||
const { brand, trustContent, offerings } = require("../../utils/linjing-data");
|
||||
Page({
|
||||
data: { loading: true, error: "", brand: {}, services: [], copy: {} },
|
||||
onLoad() {
|
||||
this.load();
|
||||
},
|
||||
load() {
|
||||
this.setData({ loading: true, error: "" });
|
||||
Promise.all([request("/public/brand"), request("/public/offerings")])
|
||||
.then(([brand, services]) => {
|
||||
getApp().globalData.brand = brand;
|
||||
wx.setNavigationBarTitle({ title: brand.name || "个人品牌" });
|
||||
const copy = getTemplate(brand.templateKey);
|
||||
this.setData({
|
||||
brand: { ...brand, coverUrl: brand.coverUrl || "/assets/brand/home-hero.jpg" },
|
||||
services,
|
||||
copy,
|
||||
loading: false,
|
||||
});
|
||||
})
|
||||
.catch(() => this.setData({ loading: false, error: "暂时无法加载内容" }));
|
||||
},
|
||||
selectService(event) {
|
||||
wx.navigateTo({
|
||||
url: "/pages/booking/index?offeringId=" + encodeURIComponent(event.currentTarget.dataset.id),
|
||||
});
|
||||
},
|
||||
goServices() {
|
||||
wx.switchTab({ url: "/pages/services/index" });
|
||||
},
|
||||
goPrivateChef() {
|
||||
wx.navigateTo({ url: "/pages/booking/index?type=private_chef" });
|
||||
},
|
||||
goBooking() {
|
||||
wx.navigateTo({ url: "/pages/booking/index" });
|
||||
},
|
||||
goBookings() {
|
||||
wx.switchTab({ url: "/pages/bookings/index" });
|
||||
},
|
||||
goHome() {
|
||||
wx.switchTab({ url: "/pages/index/index" });
|
||||
},
|
||||
data: { brand, trustContent, offerings, loading: false },
|
||||
onLoad() { wx.setNavigationBarTitle({ title: brand.name }); },
|
||||
selectOffering(e) { wx.navigateTo({ url: "/pages/offering/detail?id=" + e.currentTarget.dataset.id }); },
|
||||
goWorks() { wx.switchTab({ url: "/pages/services/index" }); },
|
||||
goInquiry() { wx.navigateTo({ url: "/pages/inquiry/index" }); },
|
||||
goProfile() { wx.switchTab({ url: "/pages/bookings/index" }); },
|
||||
});
|
||||
@@ -1,13 +1,7 @@
|
||||
<view class="page">
|
||||
<view class="topbar"><text class="brand-subtitle">{{brand.tagline || '现做家常饭,熟客都爱吃'}}</text></view>
|
||||
<view wx:if="{{loading}}" class="state">加载中...</view>
|
||||
<view wx:elif="{{error}}" class="state error">{{error}}<button bindtap="load">重试</button></view>
|
||||
<block wx:else>
|
||||
<view class="hero"><image wx:if="{{brand.coverUrl}}" src="{{brand.coverUrl}}" mode="aspectFill"/><view wx:else class="hero-placeholder"></view><view class="hero-copy"><text>{{copy.hero}}</text><text>{{copy.heroSub}}</text></view></view>
|
||||
<view class="intro"><text class="section-title">{{copy.about}}</text><text class="intro-copy">{{brand.description || copy.description}}</text></view>
|
||||
<view class="info-card"><view><text class="info-label">{{copy.timeLabel}}</text><text>{{brand.hours || copy.time}}</text></view><text class="chevron">›</text><view><text class="info-label">{{copy.addressLabel}}</text><text>{{brand.address || copy.address}}</text></view><view class="line"></view><view><text class="info-label">{{copy.noteLabel}}</text><text>{{brand.deliveryNote || copy.note}}</text></view></view>
|
||||
<view class="actions"><button class="primary" bindtap="goServices">{{copy.primary}}</button><button class="secondary" bindtap="goPrivateChef">{{copy.secondary}}</button></view>
|
||||
<view class="section-title services-title">今日服务</view>
|
||||
<view wx:for="{{services}}" wx:key="id" class="service" data-id="{{item.id}}" bindtap="selectService"><view><text class="service-name">{{item.name}}</text><text class="description">{{item.description}}</text></view><text class="price">{{item.priceText}}</text></view>
|
||||
</block>
|
||||
<view class="founder"><image class="avatar" src="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="hero"><image class="hero-image" src="https://images.unsplash.com/photo-1600585154340-be6161a56a0c?auto=format&fit=crop&w=900&q=80" mode="aspectFill"/><view class="hero-shade"/><view class="hero-copy"><text class="eyebrow">年度落成实景 · 莫干山庄园</text><text class="hero-title">万籁系列 · 铸铜冷锻双轴入户门</text><text class="hero-slogan">门高 3.4m · 德国静音地轴</text><button class="hero-button" bindtap="goWorks">探索全系作品 →</button></view></view>
|
||||
<view class="intro"><text class="eyebrow dark">主理人工艺与信任凭证</text><text class="section-title">14 年,只做门与空间的关系</text><text class="body">{{brand.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="body">{{item.sub}}</text></view></view></view>
|
||||
<view class="trust"><text class="eyebrow">林境门作品质宣言</text><text class="section-title light">拒绝流水线拼装</text><view wx:for="{{trustContent.pillars}}" wx:key="title"><text class="work-name light">{{item.title}}</text><text class="body light-body">{{item.desc}}</text></view></view>
|
||||
<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="goWorks">查看全部 →</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>
|
||||
@@ -1,161 +1 @@
|
||||
.page {
|
||||
box-sizing: border-box;
|
||||
padding: 8rpx 32rpx 170rpx;
|
||||
background: #fbf7f1;
|
||||
min-height: 100vh;
|
||||
color: #2b2b2b;
|
||||
}
|
||||
.topbar {
|
||||
text-align: center;
|
||||
padding: 2rpx 0 24rpx;
|
||||
}
|
||||
.brand-subtitle {
|
||||
display: block;
|
||||
color: #7a4a2b;
|
||||
font-size: 28rpx;
|
||||
line-height: 1.4;
|
||||
}
|
||||
.hero {
|
||||
position: relative;
|
||||
height: 410rpx;
|
||||
overflow: hidden;
|
||||
border-radius: 24rpx;
|
||||
background: #7a4a2b;
|
||||
}
|
||||
.hero image,
|
||||
.hero-placeholder {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
background: linear-gradient(135deg, #7a4a2b, #2b2b2b);
|
||||
}
|
||||
.hero-copy {
|
||||
position: absolute;
|
||||
left: 34rpx;
|
||||
top: 36rpx;
|
||||
color: #fff;
|
||||
font-size: 42rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
.hero-copy text {
|
||||
display: block;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
.intro,
|
||||
.info-card {
|
||||
margin-top: 20rpx;
|
||||
padding: 28rpx;
|
||||
background: #f4ebd9;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
.section-title {
|
||||
font-size: 36rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
.intro-copy {
|
||||
display: block;
|
||||
margin-top: 18rpx;
|
||||
font-size: 30rpx;
|
||||
line-height: 1.55;
|
||||
}
|
||||
.info-card {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr auto;
|
||||
gap: 20rpx;
|
||||
font-size: 29rpx;
|
||||
}
|
||||
.info-label {
|
||||
font-weight: 700;
|
||||
margin-right: 24rpx;
|
||||
}
|
||||
.chevron {
|
||||
font-size: 50rpx;
|
||||
}
|
||||
.line {
|
||||
grid-column: 1 / -1;
|
||||
border-top: 1rpx solid #d8c9af;
|
||||
}
|
||||
.actions {
|
||||
display: flex;
|
||||
gap: 16rpx;
|
||||
margin-top: 24rpx;
|
||||
}
|
||||
.actions button {
|
||||
flex: 1;
|
||||
border-radius: 12rpx;
|
||||
font-size: 34rpx;
|
||||
color: #fff;
|
||||
}
|
||||
.primary {
|
||||
background: #b54a2c;
|
||||
}
|
||||
.secondary {
|
||||
background: #7a4a2b;
|
||||
}
|
||||
.services-title {
|
||||
margin: 34rpx 0 16rpx;
|
||||
}
|
||||
.service {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 20rpx;
|
||||
margin-bottom: 12rpx;
|
||||
padding: 26rpx 22rpx;
|
||||
background: #fff;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
.service-name {
|
||||
display: block;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
.description {
|
||||
display: block;
|
||||
color: #7a4a2b;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
.price {
|
||||
white-space: nowrap;
|
||||
color: #b54a2c;
|
||||
font-size: 34rpx;
|
||||
}
|
||||
.state {
|
||||
padding: 80rpx 20rpx;
|
||||
text-align: center;
|
||||
}
|
||||
.error {
|
||||
color: #b54a2c;
|
||||
}
|
||||
.state button {
|
||||
margin-top: 24rpx;
|
||||
background: #b54a2c;
|
||||
color: #fff;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
.tabbar {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
padding: 18rpx 0 34rpx;
|
||||
background: #fff;
|
||||
border-top: 1rpx solid #eee;
|
||||
z-index: 10;
|
||||
}
|
||||
.tab {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
color: #7a4a2b;
|
||||
font-size: 42rpx;
|
||||
min-width: 100rpx;
|
||||
}
|
||||
.tab text {
|
||||
font-size: 24rpx;
|
||||
margin-top: 5rpx;
|
||||
}
|
||||
.tab.active {
|
||||
color: #b54a2c;
|
||||
}
|
||||
.page{background:#f7f5f1;color:#252525;min-height:100vh;padding-bottom:30rpx}.founder{margin:32rpx 40rpx 20rpx;padding:28rpx;background:#fff;border:1px solid #e6ded5;border-radius:28rpx;display:flex;gap:20rpx;align-items:flex-start;position:relative}.avatar{width:112rpx;height:112rpx;border-radius:50%;border:4rpx solid #d9c8b2}.founder-name{display:block;font-family:serif;font-size:30rpx}.founder-title{display:block;color:#77736b;font-size:20rpx;margin-top:6rpx}.quote{display:block;font-family:serif;font-size:21rpx;margin-top:14rpx}.badge{position:absolute;right:20rpx;top:24rpx;color:#8a6846;background:#f3ede6;padding:8rpx 12rpx;border-radius:20rpx;font-size:18rpx}.hero{margin:0 40rpx 42rpx;height:400rpx;position:relative;border-radius:28rpx;overflow:hidden}.hero-image{width:100%;height:100%}.hero-shade{position:absolute;inset:0;background:linear-gradient(180deg,rgba(20,22,21,.1),rgba(20,22,21,.82))}.hero-copy{position:absolute;left:28rpx;right:28rpx;bottom:28rpx;color:#fff}.eyebrow{display:block;font-size:18rpx;letter-spacing:3rpx;color:#d9c8b2;margin-bottom:14rpx}.eyebrow.dark{color:#8a6846}.hero-title{display:block;font-size:34rpx;font-family:serif}.hero-slogan{display:block;font-size:21rpx;margin-top:10rpx}.hero-button{position:absolute;right:0;bottom:0;background:rgba(255,255,255,.12);color:#d9c8b2;border:1px solid rgba(255,255,255,.3);font-size:19rpx;height:54rpx;line-height:54rpx;margin:0}.intro,.section{padding:0 40rpx 48rpx}.section-title{display:block;font-size:34rpx;font-family:serif;margin-bottom:16rpx}.body{display:block;color:#77736b;line-height:1.8;font-size:24rpx}.stats{display:grid;grid-template-columns:1fr 1fr;gap:16rpx;margin-top:22rpx}.stats view{background:#fff;border:1px solid #e6ded5;border-radius:20rpx;padding:22rpx}.stat-value{display:block;font-size:38rpx;color:#8a6846;font-family:serif}.stat-label{display:block;font-size:22rpx;font-weight:600;margin-top:4rpx}.section-head{display:flex;justify-content:space-between;align-items:end;margin-bottom:22rpx}.more{font-size:21rpx;color:#8a6846}.work-card{background:#fff;border:1px solid #e6ded5;border-radius:28rpx;overflow:hidden;margin-bottom:24rpx}.work-card image{width:100%;height:300rpx;display:block}.work-info{padding:24rpx}.work-category{font-size:19rpx;color:#8a6846}.work-name{display:block;font-family:serif;font-size:28rpx;margin:10rpx 0}.work-desc{font-size:22rpx;color:#77736b;line-height:1.6}.trust{margin-top:10rpx;background:#202221;color:#fff;padding:42rpx 40rpx}.light{color:#fff}.light-body{color:#c6c2ba;margin-bottom:26rpx}.outline-button{margin:0;background:transparent;border:1px solid #d9c8b2;color:#d9c8b2;border-radius:0;font-size:24rpx;height:72rpx;line-height:72rpx}
|
||||
Reference in new issue
Block a user