fix(family): 列表字段按联调实测修正(name/careMemberCount),修复卡片渲染空白
This commit is contained in:
parent
e70aa7e3e6
commit
83a211ebd6
|
|
@ -1,19 +1,15 @@
|
||||||
import { request } from '@/http'
|
import { request } from '@/http'
|
||||||
|
|
||||||
// 家庭圈接口(apifox 2026-09-11 文档版)
|
// 家庭圈接口(apifox 2026-09-11 文档版)
|
||||||
// 响应 Content 字段文档未给出(ResponseData 泛型占位),类型按命名推断,联调时逐个修正
|
// 列表字段已按 2026-09-17 联调实测修正
|
||||||
|
|
||||||
export interface HomeInfo {
|
export interface HomeInfo {
|
||||||
homeId: string
|
homeId: string
|
||||||
homeName: string
|
name: string
|
||||||
ownerUserId: string
|
address: string | null
|
||||||
memberCount: number
|
memberCount: number
|
||||||
// 以下为列表卡展示推断字段,联调确认
|
careMemberCount: number
|
||||||
careName?: string // 关爱对象名(caredLabel)
|
deviceCount: number
|
||||||
careCount?: number // 关爱对象数(上限校验用)
|
|
||||||
address?: string
|
|
||||||
deviceCount?: number
|
|
||||||
role?: string // 当前用户角色(群主/成员)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface HomeMember {
|
export interface HomeMember {
|
||||||
|
|
|
||||||
|
|
@ -71,18 +71,6 @@
|
||||||
white-space: nowrap;
|
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 {
|
.subCount {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ interface Props {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function FamilyCard({ family, onClick }: Props) {
|
export function FamilyCard({ family, onClick }: Props) {
|
||||||
const first = family.homeName.slice(0, 1)
|
const first = family.name.slice(0, 1)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
|
|
@ -24,17 +24,16 @@ export function FamilyCard({ family, onClick }: Props) {
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.headMain}>
|
<View className={styles.headMain}>
|
||||||
<View className={styles.nameRow}>
|
<View className={styles.nameRow}>
|
||||||
<Text className={styles.name}>{family.homeName}</Text>
|
<Text className={styles.name}>{family.name}</Text>
|
||||||
{family.role && <Text className={styles.roleBadge}>{family.role}</Text>}
|
|
||||||
</View>
|
</View>
|
||||||
<Text className={styles.subCount}>
|
<Text className={styles.subCount}>
|
||||||
{family.memberCount} 位成员 · {family.deviceCount ?? 0} 台设备
|
{family.memberCount} 位成员 · {family.deviceCount} 台设备
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.rows}>
|
<View className={styles.rows}>
|
||||||
<Text className={styles.rowLabel}>关爱对象</Text>
|
<Text className={styles.rowLabel}>关爱对象</Text>
|
||||||
<Text className={styles.rowValue}>{family.careName || '--'}</Text>
|
<Text className={styles.rowValue}>{family.careMemberCount > 0 ? `${family.careMemberCount} 人` : '--'}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.rows}>
|
<View className={styles.rows}>
|
||||||
<Text className={styles.rowLabel}>关爱地址</Text>
|
<Text className={styles.rowLabel}>关爱地址</Text>
|
||||||
|
|
|
||||||
|
|
@ -208,25 +208,6 @@
|
||||||
margin-right: 16px;
|
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 {
|
.sheetMeta {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|
|
||||||
|
|
@ -93,11 +93,13 @@ export default function DeviceList() {
|
||||||
<View className={styles.familyCard}>
|
<View className={styles.familyCard}>
|
||||||
<View className={styles.familyRow}>
|
<View className={styles.familyRow}>
|
||||||
<Text className={styles.familyLabel}>设备应用家庭</Text>
|
<Text className={styles.familyLabel}>设备应用家庭</Text>
|
||||||
<Text className={styles.familyValue}>{currentFamily?.homeName ?? scene?.name ?? '未选择'}</Text>
|
<Text className={styles.familyValue}>{currentFamily?.name ?? scene?.name ?? '未选择'}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.familyRow}>
|
<View className={styles.familyRow}>
|
||||||
<Text className={styles.familyLabel}>关爱对象</Text>
|
<Text className={styles.familyLabel}>关爱对象</Text>
|
||||||
<Text className={styles.familyValue}>{currentFamily?.careName ?? '--'}</Text>
|
<Text className={styles.familyValue}>
|
||||||
|
{currentFamily ? (currentFamily.careMemberCount > 0 ? `${currentFamily.careMemberCount} 人` : '--') : '--'}
|
||||||
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.familyRow}>
|
<View className={styles.familyRow}>
|
||||||
<Text className={styles.familyLabel}>关爱地址</Text>
|
<Text className={styles.familyLabel}>关爱地址</Text>
|
||||||
|
|
@ -158,16 +160,13 @@ export default function DeviceList() {
|
||||||
onClick={() => setPendingFamily(family)}
|
onClick={() => setPendingFamily(family)}
|
||||||
>
|
>
|
||||||
<View className={styles.sheetHead}>
|
<View className={styles.sheetHead}>
|
||||||
<Text className={styles.sheetName}>{family.homeName}</Text>
|
<Text className={styles.sheetName}>{family.name}</Text>
|
||||||
{family.role && (
|
|
||||||
<View className={styles.sheetRole}>
|
|
||||||
<Text className={styles.sheetRoleText}>{family.role}</Text>
|
|
||||||
</View>
|
|
||||||
)}
|
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.sheetMeta}>
|
<View className={styles.sheetMeta}>
|
||||||
<Text className={styles.sheetMetaItem}>关爱对象 {family.careName || '--'}</Text>
|
<Text className={styles.sheetMetaItem}>
|
||||||
<Text className={styles.sheetMetaItem}>设备数量 {family.deviceCount ?? 0}台</Text>
|
关爱对象 {family.careMemberCount > 0 ? `${family.careMemberCount} 人` : '--'}
|
||||||
|
</Text>
|
||||||
|
<Text className={styles.sheetMetaItem}>设备数量 {family.deviceCount}台</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ export default function FamilyDetail() {
|
||||||
])
|
])
|
||||||
setFamily(home)
|
setFamily(home)
|
||||||
setMembers(memberList)
|
setMembers(memberList)
|
||||||
setCaredCount(home.careCount ?? 0)
|
setCaredCount(home.careMemberCount)
|
||||||
} catch {
|
} catch {
|
||||||
setFamily(null)
|
setFamily(null)
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue