feat(bazi): 八字页重构——空态示例排盘+字段术语表+文化声明,生辰档案绑定
Publish Mini Program Dev Version / publish (push) Failing after 11s
Build and Publish Server / build (push) Successful in 2m55s

- 八字页:未绑定生辰时展示虚构示例排盘(1990-08-08 10:30男)与15条字段说明,
  附传统文化声明文案;已绑定时支持多档案切换,排盘增强(十神/藏干/纳音/五行配色/命盘概览)
- 个人中心:新增生辰管理卡片,每用户免费绑定3个出生年月;登录改为真实微信登录
- 服务端:新增 BirthProfile 模型与 /api/user/birth-profiles 增删查接口,AutoMigrate 建表
- 前端:新增 birth-profile.js 本地存储优先+登录后云端双向同步
- 修复:个人中心 tabBar 页面入口误用 navigateTo 改为 switchTab
This commit is contained in:
gouki
2026-08-09 23:21:58 +00:00
parent 013e7ab99a
commit 50975e0627
12 changed files with 1068 additions and 196 deletions
+77 -6
View File
@@ -2,14 +2,85 @@
<!-- 用户信息 -->
<view class="card">
<view class="section-title">用户信息</view>
<view class="flex items-center gap-2" wx:if="{{userInfo}}">
<image src="{{userInfo.avatarUrl}}" class="avatar" mode="aspectFill"/>
<view>
<text class="text-base font-medium">{{userInfo.nickName}}</text>
<text class="text-xs text-muted block">已登录</text>
<view class="flex items-center gap-2 justify-between" wx:if="{{loggedIn}}">
<view class="flex items-center gap-2">
<image src="{{userInfo.avatar}}" class="avatar" mode="aspectFill" wx:if="{{userInfo.avatar}}"/>
<view class="avatar avatar-placeholder" wx:else>
<text>客</text>
</view>
<view>
<text class="text-base font-medium">{{userInfo.nickname || '微信用户'}}</text>
<text class="text-xs text-muted block">已登录,档案云端同步</text>
</view>
</view>
<view class="btn-ghost text-muted" bindtap="logout">退出</view>
</view>
<block wx:else>
<view class="text-sm text-muted mb-2">登录后可将生辰档案同步到云端,换设备不丢失</view>
<view class="btn-primary text-center" bindtap="login">{{logging ? '登录中…' : '微信登录'}}</view>
</block>
</view>
<!-- 生辰管理 -->
<view class="card">
<view class="section-title flex justify-between items-center">
<text>生辰管理</text>
<text class="text-xs text-muted">{{profiles.length}}/{{maxFree}}</text>
</view>
<view class="text-xs text-muted mb-2">八字排盘基于生辰信息,每位用户可免费绑定 {{maxFree}} 个出生年月(如本人、家人)。</view>
<view class="profile-list" wx:if="{{profiles.length > 0}}">
<view class="profile-item" wx:for="{{profiles}}" wx:key="id">
<view class="flex justify-between items-center">
<view>
<view class="flex items-center gap-1">
<text class="text-base font-medium">{{item.name}}</text>
<text class="badge badge-lucky" wx:if="{{item.id === activeProfileId}}">使用中</text>
</view>
<text class="text-xs text-muted block">{{item.gender === 'female' ? '女' : '男'}} · {{item.birthday}} {{item.birthTime}}</text>
</view>
<view class="btn-ghost text-unlucky" bindtap="removeProfile" data-id="{{item.id}}">删除</view>
</view>
</view>
</view>
<view class="btn-primary" wx:else bindtap="login">微信登录</view>
<view class="text-center text-muted p-2" wx:else>
<text>暂未绑定生辰,请到下方添加</text>
</view>
<view class="btn-outline text-center mt-2" bindtap="toggleAddForm" wx:if="{{canAdd}}">
{{showAddForm ? '收起' : '+ 添加生辰'}}
</view>
<view class="text-center text-xs text-muted mt-2" wx:else>
免费名额已用完,可删除旧档案后添加
</view>
<!-- 添加表单 -->
<block wx:if="{{showAddForm}}">
<view class="form-item mt-2">
<text class="form-label">备注名(如:本人、爸爸)</text>
<input class="form-input" placeholder="未命名" value="{{formName}}" bindinput="onFormName"/>
</view>
<view class="form-item">
<text class="form-label">性别</text>
<view class="flex gap-2">
<view class="btn-outline {{formGender === 'male' ? 'active' : ''}}" bindtap="setFormGender" data-g="male">男</view>
<view class="btn-outline {{formGender === 'female' ? 'active' : ''}}" bindtap="setFormGender" data-g="female">女</view>
</view>
</view>
<view class="form-item">
<text class="form-label">出生日期(公历)</text>
<picker mode="date" value="{{formDate}}" start="1900-01-01" end="2100-12-31" bindchange="onFormDate">
<view class="picker-input">{{formDate}}</view>
</picker>
</view>
<view class="form-item">
<text class="form-label">出生时间</text>
<picker mode="time" value="{{formTime}}" bindchange="onFormTime">
<view class="picker-input">{{formTime}}</view>
</picker>
</view>
<view class="btn-primary text-center" bindtap="submitProfile">保存生辰</view>
</block>
</view>
<!-- 偏好设置 -->