fix: 优化小程序原生标题层级

This commit is contained in:
que01 committed 2026-09-19 10:35:43 +08:00
1 parent 990b105086
commit 63e5e3bd7b
4 files changed
+4 -3

No files matched your search

+1 -1
View File
@@ -1,4 +1,4 @@
{
"pages": ["pages/index/index"],
"window": { "navigationBarTitleText": "品牌首页", "navigationBarBackgroundColor": "#ffffff", "navigationBarTextStyle": "black" }
"window": { "navigationBarTitleText": "阿桂的家常小灶", "navigationBarBackgroundColor": "#FBF7F1", "navigationBarTextStyle": "black", "backgroundColor": "#FBF7F1" }
}
+1
View File
@@ -6,6 +6,7 @@ Page({
load() {
this.setData({ loading: true, error: '' });
Promise.all([this.request('/public/brand'), this.request('/public/services')]).then(([brand, services]) => {
wx.setNavigationBarTitle({ title: brand.name || '阿桂的家常小灶' });
this.setData({ brand, services, loading: false });
}).catch(() => this.setData({ loading: false, error: '暂时无法加载内容' }));
},
+1 -1
View File
@@ -1,5 +1,5 @@
<view class="page">
<view class="topbar"><text class="brand-title">{{brand.name || '阿桂的家常小灶'}}</text><text class="brand-subtitle">{{brand.tagline || '现做家常饭,熟客都爱吃'}}</text></view>
<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>
+1 -1
View File
@@ -1 +1 @@
.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}
.page{box-sizing:border-box;padding:8rpx 32rpx 150rpx;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: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}