diff --git a/frontend/mobile-app/lib/features/profile/presentation/pages/profile_page.dart b/frontend/mobile-app/lib/features/profile/presentation/pages/profile_page.dart index 58ba5244..be692b65 100644 --- a/frontend/mobile-app/lib/features/profile/presentation/pages/profile_page.dart +++ b/frontend/mobile-app/lib/features/profile/presentation/pages/profile_page.dart @@ -295,13 +295,28 @@ class _ProfilePageState extends ConsumerState { debugPrint('[ProfilePage] 市公司授权: ${summary.cityCompany != null}'); debugPrint('[ProfilePage] 省公司授权: ${summary.provinceCompany != null}'); + // 获取社区层级数据 + try { + final hierarchy = await authorizationService.getMyCommunityHierarchy(); + if (mounted) { + setState(() { + _parentCommunity = hierarchy.parentCommunity.communityName; + _childCommunity = hierarchy.childCommunityCount > 0 + ? '${hierarchy.childCommunities.first.communityName}${hierarchy.childCommunityCount > 1 ? " 等${hierarchy.childCommunityCount}个" : ""}' + : '--'; + }); + } + debugPrint('[ProfilePage] 社区层级: 上级=${hierarchy.parentCommunity.communityName}, 下级数量=${hierarchy.childCommunityCount}'); + } catch (e) { + debugPrint('[ProfilePage] 获取社区层级失败: $e'); + // 失败时保持默认值 + } + if (mounted) { setState(() { _community = summary.communityName ?? '--'; _cityCompany = summary.cityCompanyName ?? '--'; _provinceCompany = summary.provinceCompanyName ?? '--'; - // 上级社区和下级社区暂时无法从当前API获取 - // 后续需要扩展API或从推荐链中计算 // 更新社区考核数据 if (summary.community != null) {