diff --git a/src/api/home.ts b/src/api/home.ts index cd39740..fac6bc8 100644 --- a/src/api/home.ts +++ b/src/api/home.ts @@ -1,19 +1,15 @@ import { request } from '@/http' // 家庭圈接口(apifox 2026-09-11 文档版) -// 响应 Content 字段文档未给出(ResponseData 泛型占位),类型按命名推断,联调时逐个修正 +// 列表字段已按 2026-09-17 联调实测修正 export interface HomeInfo { homeId: string - homeName: string - ownerUserId: string + name: string + address: string | null memberCount: number - // 以下为列表卡展示推断字段,联调确认 - careName?: string // 关爱对象名(caredLabel) - careCount?: number // 关爱对象数(上限校验用) - address?: string - deviceCount?: number - role?: string // 当前用户角色(群主/成员) + careMemberCount: number + deviceCount: number } export interface HomeMember { diff --git a/src/components/family-card/index.module.scss b/src/components/family-card/index.module.scss index e8abbf0..476e1bf 100644 --- a/src/components/family-card/index.module.scss +++ b/src/components/family-card/index.module.scss @@ -71,18 +71,6 @@ white-space: nowrap; } -// 角色徽标:白底胶囊,紧贴名称右侧 -.roleBadge { - flex-shrink: 0; - margin-left: 12px; - padding: 4px 14px; - background: $color-bg-white; - border: 1px solid $color-primary-light-border; - border-radius: $radius-pill; - font-size: 22px; - color: $color-primary-deep; -} - // 成员/设备合并为头部副标题,避免与下方信息行重复占行 .subCount { margin-top: 10px; diff --git a/src/components/family-card/index.tsx b/src/components/family-card/index.tsx index c15c322..0ada2a4 100644 --- a/src/components/family-card/index.tsx +++ b/src/components/family-card/index.tsx @@ -8,7 +8,7 @@ interface Props { } export function FamilyCard({ family, onClick }: Props) { - const first = family.homeName.slice(0, 1) + const first = family.name.slice(0, 1) return ( - {family.homeName} - {family.role && {family.role}} + {family.name} - {family.memberCount} 位成员 · {family.deviceCount ?? 0} 台设备 + {family.memberCount} 位成员 · {family.deviceCount} 台设备 关爱对象 - {family.careName || '--'} + {family.careMemberCount > 0 ? `${family.careMemberCount} 人` : '--'} 关爱地址 diff --git a/src/pages/device/index.module.scss b/src/pages/device/index.module.scss index 48c6cc4..3929aee 100644 --- a/src/pages/device/index.module.scss +++ b/src/pages/device/index.module.scss @@ -208,25 +208,6 @@ margin-right: 16px; } -.sheetRole { - padding: 4px 12px; - background: $color-bg-disabled; - border-radius: $radius-sm; -} - -.sheetRoleText { - font-size: 22px; - color: $color-text-secondary; -} - -.sheetItemActive .sheetRole { - background: $color-bg-white; -} - -.sheetItemActive .sheetRoleText { - color: $color-primary-deep; -} - .sheetMeta { display: flex; justify-content: space-between; diff --git a/src/pages/device/index.tsx b/src/pages/device/index.tsx index 97b193e..74dd6d7 100644 --- a/src/pages/device/index.tsx +++ b/src/pages/device/index.tsx @@ -93,11 +93,13 @@ export default function DeviceList() { 设备应用家庭 - {currentFamily?.homeName ?? scene?.name ?? '未选择'} + {currentFamily?.name ?? scene?.name ?? '未选择'} 关爱对象 - {currentFamily?.careName ?? '--'} + + {currentFamily ? (currentFamily.careMemberCount > 0 ? `${currentFamily.careMemberCount} 人` : '--') : '--'} + 关爱地址 @@ -158,16 +160,13 @@ export default function DeviceList() { onClick={() => setPendingFamily(family)} > - {family.homeName} - {family.role && ( - - {family.role} - - )} + {family.name} - 关爱对象 {family.careName || '--'} - 设备数量 {family.deviceCount ?? 0}台 + + 关爱对象 {family.careMemberCount > 0 ? `${family.careMemberCount} 人` : '--'} + + 设备数量 {family.deviceCount}台 ) diff --git a/src/pages/family/detail.tsx b/src/pages/family/detail.tsx index daf1761..1672744 100644 --- a/src/pages/family/detail.tsx +++ b/src/pages/family/detail.tsx @@ -31,7 +31,7 @@ export default function FamilyDetail() { ]) setFamily(home) setMembers(memberList) - setCaredCount(home.careCount ?? 0) + setCaredCount(home.careMemberCount) } catch { setFamily(null) } finally {