Files
chinese-family-tree-2/测试家族树下拉框.md
T
freedakgmail e92884ae53 0.0.1.0
2025-11-23 03:07:39 +08:00

105 lines
2.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 🔍 测试家族树下拉框
## 问题排查
### 1. 确认登录状态
家族树下拉框**只在登录后**显示。
**检查方法**
- 查看右上角是否有用户头像
- 如果显示"登录"按钮,说明未登录
### 2. 登录步骤
1. 访问:http://localhost:3000/auth/signin
2. 使用测试账号:
- 邮箱:`test@example.com`
- 密码:`password123`
3. 点击"登录"
### 3. 刷新页面
登录后,**硬刷新**页面:
- Mac: `Cmd + Shift + R`
- Windows/Linux: `Ctrl + Shift + R`
### 4. 预期显示
登录后,Header 应该显示:
```
[📖 华夏谱] [李氏家族 ▼] 总览 族谱 成员 大事记
```
点击 `[李氏家族 ▼]` 会显示下拉菜单:
```
┌─────────────────────────┐
│ 我的家族树 │
├─────────────────────────┤
│ 李氏家族 ✓ │
│ 测试家族树 │
├─────────────────────────┤
│ + 创建新家族树 │
└─────────────────────────┘
```
## 🐛 如果还是看不到
### 可能原因 1:浏览器缓存
**解决方法**
1. 清除浏览器缓存
2. 或使用无痕模式访问
### 可能原因 2:没有家族树
**解决方法**
运行脚本创建家族树:
```bash
./create-test-tree.sh
```
### 可能原因 3Session 过期
**解决方法**
1. 退出登录
2. 重新登录
## ✅ 验证数据
检查是否有家族树:
```bash
psql -d chinese_family_tree -c "
SELECT name FROM \"FamilyTree\"
WHERE \"ownerId\" = (
SELECT id FROM \"User\" WHERE email = 'test@example.com'
);"
```
应该显示:
```
name
---------------
李氏家族
测试家族树
```
## 📝 代码位置
家族树下拉框代码在:
- 文件:`components/site-header.tsx`
- 行数:104-140
显示条件:
```typescript
{session && familyTrees.length > 0 && (
// 下拉框代码
)}
```
必须同时满足:
1. ✅ 已登录 (`session` 存在)
2. ✅ 有家族树 (`familyTrees.length > 0`)