feat: 按设计图重做小程序首页

This commit is contained in:
que01 committed 2026-09-19 10:32:27 +08:00
1 parent 255756c6dd
commit 990b105086
3 files changed
+11 -3

No files matched your search

+3
View File
@@ -13,4 +13,7 @@ Page({
return new Promise((resolve, reject) => wx.request({ url: API_BASE_URL + path, success: (res) => res.statusCode < 400 ? resolve(res.data) : reject(res), fail: reject }));
},
selectService(event) { wx.navigateTo({ url: '/pages/booking/index?serviceId=' + encodeURIComponent(event.currentTarget.dataset.id) }); },
goServices() { wx.navigateTo({ url: '/pages/services/index' }); },
goPrivateChef() { wx.navigateTo({ url: '/pages/booking/index?type=private_chef' }); },
goBookings() { wx.navigateTo({ url: '/pages/bookings/index' }); },
});
+7 -2
View File
@@ -1,9 +1,14 @@
<view class="page">
<view class="topbar"><text class="brand-title">{{brand.name || '阿桂的家常小灶'}}</text><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="brand"><text class="name">{{brand.name}}</text><text class="tagline">{{brand.tagline}}</text><text>{{brand.description}}</text></view>
<view class="section-title">服务</view>
<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>今天吃什么</text><text>现做家常饭</text></view></view>
<view class="intro"><text class="section-title">品牌简介</text><text class="intro-copy">{{brand.description || '个人经营的家常小灶,套餐现做,也可预约小型聚餐和私厨定制。'}}</text></view>
<view class="info-card"><view><text class="info-label">营业时间</text><text>{{brand.hours || '11:00—20:00'}}</text></view><text class="chevron">›</text><view><text class="info-label">摊位地址</text><text>{{brand.address || '校园路社区便民点 12 号'}}</text></view><view class="line"></view><view><text class="info-label">配送说明</text><text>{{brand.deliveryNote || '满 30 元周边配送,也可自取'}}</text></view></view>
<view class="actions"><button class="primary" bindtap="goServices">预约套餐</button><button class="secondary" bindtap="goPrivateChef">咨询私厨</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="tabbar"><view class="tab active">⌂<text>首页</text></view><view class="tab" bindtap="goServices">▦<text>服务</text></view><view class="tab" bindtap="goBookings">▤<text>预约</text></view><view class="tab">♙<text>我的</text></view></view>
</view>
+1 -1
View File
@@ -1 +1 @@
.page{padding:32rpx;background:#FBF7F1;min-height:100vh;color:#2B2B2B}.brand{padding:40rpx 32rpx;background:#F4EBD9;border-radius:32rpx}.name{display:block;font-size:44rpx;font-weight:700}.tagline,.description{display:block;color:#7A4A2B;margin-top:12rpx}.section-title{font-size:36rpx;font-weight:700;margin:36rpx 0 16rpx}.service{display:flex;justify-content:space-between;gap:20rpx;margin-bottom:16rpx;padding:28rpx 24rpx;background:#fff;border-radius:32rpx}.service-name{display:block;font-size:32rpx;font-weight:600}.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:24rpx}
.page{box-sizing:border-box;padding:28rpx 32rpx 150rpx;background:#FBF7F1;min-height:100vh;color:#2B2B2B}.topbar{text-align:center;padding:12rpx 0 28rpx}.brand-title{display:block;font-size:42rpx;font-weight:700}.brand-subtitle{display:block;margin-top:8rpx;color:#7A4A2B;font-size:28rpx}.hero{position:relative;height:410rpx;overflow:hidden;border-radius:32rpx;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:24rpx;padding:30rpx;background:#F4EBD9;border-radius:28rpx}.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:22rpx;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:20rpx;margin-top:28rpx}.actions button{flex:1;border-radius:48rpx;font-size:34rpx;color:#fff}.primary{background:#B54A2C}.secondary{background:#7A4A2B}.services-title{margin:38rpx 0 18rpx}.service{display:flex;justify-content:space-between;gap:20rpx;margin-bottom:16rpx;padding:28rpx 24rpx;background:#fff;border-radius:28rpx}.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:24rpx}.tabbar{position:fixed;bottom:0;left:0;right:0;display:flex;justify-content:space-around;padding:18rpx 0 28rpx;background:#fff;border-top:1rpx solid #eee}.tab{display:flex;flex-direction:column;align-items:center;color:#7A4A2B;font-size:42rpx}.tab text{font-size:24rpx;margin-top:5rpx}.tab.active{color:#B54A2C}