feat: 增加小程序品牌首页

This commit is contained in:
que01 committed 2026-09-19 10:14:30 +08:00
1 parent 3b05df6edf
commit 255756c6dd
7 files changed
+36 -2

No files matched your search

+4 -2
View File
@@ -36,6 +36,7 @@
- HTTP 集成测试:公开接口、管理员登录、错误密码、管理员权限边界、客户会话、预约 DTO 校验、创建/取消和状态流转,共 8 项通过。
- OpenAPI 3.1 契约:`docs/openapi.yaml`,覆盖当前公开、客户和管理员接口。
- 类型化 `@personal-brand/api-client`:支持公开内容、客户预约、管理员订单和统一错误处理,并有 2 项客户端测试。
- 已根据 `/home/que01/桌面/个人品牌设计图/` 确认 C 端页面视觉规范:暖白、米黄、砖红、深炭黑,16px 卡片圆角和大字号优先。
- 已执行多轮 Codex 代码审查并修复关键认证和权限问题。
## 最近提交
@@ -53,8 +54,9 @@ b89853b fix: harden api authentication and validation
## 下一步优先级
1. 接入管理后台订单处理页面。
2. 接入小程序品牌展示、服务列表和下单流程。
1. 按设计图补齐小程序服务列表、预约表单和我的订单页面。
2. 接入真实品牌图片、电话和微信配置。
3. 完善管理后台订单处理页面。
## 未决问题
+4
View File
@@ -0,0 +1,4 @@
{
"pages": ["pages/index/index"],
"window": { "navigationBarTitleText": "品牌首页", "navigationBarBackgroundColor": "#ffffff", "navigationBarTextStyle": "black" }
}
+16
View File
@@ -0,0 +1,16 @@
const API_BASE_URL = 'http://localhost:3001';
Page({
data: { loading: true, error: '', brand: {}, services: [] },
onLoad() { this.load(); },
load() {
this.setData({ loading: true, error: '' });
Promise.all([this.request('/public/brand'), this.request('/public/services')]).then(([brand, services]) => {
this.setData({ brand, services, loading: false });
}).catch(() => this.setData({ loading: false, error: '暂时无法加载内容' }));
},
request(path) {
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) }); },
});
+1
View File
@@ -0,0 +1 @@
{ "navigationBarTitleText": "品牌首页" }
+9
View File
@@ -0,0 +1,9 @@
<view class="page">
<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 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>
+1
View File
@@ -0,0 +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}
+1
View File
@@ -10,6 +10,7 @@ export default tseslint.config(
"prototype/**",
"**/prisma/**",
"apps/api/test/**/*.test.js",
"apps/miniapp/pages/**/*.js",
],
},
eslint.configs.recommended,