style: 统一全仓代码格式

This commit is contained in:
que01 committed 2026-09-19 18:46:26 +08:00
1 parent d811478d0f
commit 8033cabff9
30 files changed
+1183 -187

No files matched your search

+41 -18
View File
@@ -1,23 +1,46 @@
const { request } = require('../../utils/request');
const config = require('../../utils/config');
const { getTemplate } = require('../../utils/templates');
const { request } = require("../../utils/request");
const config = require("../../utils/config");
const { getTemplate } = require("../../utils/templates");
Page({
data: { loading: true, error: '', brand: {}, services: [], copy: {} },
onLoad() { this.load(); },
data: { loading: true, error: "", brand: {}, services: [], copy: {} },
onLoad() {
this.load();
},
load() {
this.setData({ loading: true, error: '' });
Promise.all([request('/public/brand'), request('/public/services')]).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: '暂时无法加载内容' }));
this.setData({ loading: true, error: "" });
Promise.all([request("/public/brand"), request("/public/services")])
.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?serviceId=" + 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" });
},
selectService(event) { wx.navigateTo({ url: '/pages/booking/index?serviceId=' + 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' }); },
});
+161 -1
View File
@@ -1 +1,161 @@
.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 {
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;
}