From 59097203ae51ef1a34328a7f993f10804e2eb837 Mon Sep 17 00:00:00 2001 From: hailin Date: Wed, 4 Mar 2026 07:03:59 -0800 Subject: [PATCH] =?UTF-8?q?fix(app):=20=E9=A2=84=E7=A7=8D=E8=AE=A1?= =?UTF-8?q?=E5=88=92=E5=85=A5=E5=8F=A3=E7=A7=BB=E8=87=B3=E8=87=AA=E5=8A=A9?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=E6=8E=88=E6=9D=83=E9=A1=B5=E5=B8=82=E5=9B=A2?= =?UTF-8?q?=E9=98=9F=E4=B8=8B=E6=96=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 问题 上一版错误将「申请预种计划」入口放在「我」页面主区域, 实际需求是放在「自助申请授权」页的「申请市团队」卡片下方。 ## 改动内容 ### authorization_apply_page.dart - import route_paths.dart - `_buildAuthorizationTypes()` 将 `.map()` 展开为 for 循环, 在 AuthorizationType.cityTeam item 渲染完后插入 `_buildPrePlantingEntry()` - 新增 `_buildPrePlantingEntry()` 方法: · 样式:金色(0xFFD4AF37)卡片,左侧图标圆角背景 + 右侧箭头, 副标题「购买预种份额 · 查看明细 · 团队预种统计」 · 点击跳转 RoutePaths.prePlantingHub(预种计划 Hub 页) ### profile_page.dart(撤销上一版在主页的改动) - 移除 `bool _isPrePlantingActive` 状态变量 - 移除 `_loadPrePlantingConfig()` 方法及 initState 调用 - 移除布局中的预种入口按钮区块 - 移除 `_buildPrePlantingEntryButton()` 方法 Hub 页面(pre_planting_hub_page.dart)和路由定义保持不变, 入口位置从「我」主页改为自助申请授权页的市团队下方。 Co-Authored-By: Claude Sonnet 4.6 --- .../pages/authorization_apply_page.dart | 78 ++++++++++++++++++- .../presentation/pages/profile_page.dart | 62 --------------- 2 files changed, 77 insertions(+), 63 deletions(-) diff --git a/frontend/mobile-app/lib/features/authorization/presentation/pages/authorization_apply_page.dart b/frontend/mobile-app/lib/features/authorization/presentation/pages/authorization_apply_page.dart index d042849d..b95d6f7a 100644 --- a/frontend/mobile-app/lib/features/authorization/presentation/pages/authorization_apply_page.dart +++ b/frontend/mobile-app/lib/features/authorization/presentation/pages/authorization_apply_page.dart @@ -7,6 +7,7 @@ import 'package:city_pickers/city_pickers.dart'; import '../../../../core/di/injection_container.dart'; import '../../../../core/storage/storage_keys.dart'; import '../../../../core/services/authorization_service.dart'; +import '../../../../routes/route_paths.dart'; /// 授权类型枚举 enum AuthorizationType { @@ -874,11 +875,86 @@ class _AuthorizationApplyPageState ), const SizedBox(height: 12), // 原代码: ...AuthorizationType.values.map((type) => _buildTypeItem(type)), - ...availableTypes.map((type) => _buildTypeItem(type)), + for (final type in availableTypes) ...[ + _buildTypeItem(type), + // [2026-03-04] 市团队下方插入「申请预种计划」入口 + if (type == AuthorizationType.cityTeam) + _buildPrePlantingEntry(), + ], ], ); } + /// [2026-03-04] 申请预种计划入口(位于市团队申请卡片下方) + /// + /// 点击后跳转至预种计划 Hub 页(预种购买 / 预种明细 / 团队预种) + Widget _buildPrePlantingEntry() { + return GestureDetector( + onTap: () => context.push(RoutePaths.prePlantingHub), + child: Container( + width: double.infinity, + margin: const EdgeInsets.only(bottom: 12), + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14), + decoration: BoxDecoration( + color: const Color(0xFFD4AF37).withValues(alpha: 0.08), + borderRadius: BorderRadius.circular(12), + border: Border.all( + color: const Color(0xFFD4AF37).withValues(alpha: 0.35), + width: 1, + ), + ), + child: Row( + children: [ + Container( + width: 40, + height: 40, + decoration: BoxDecoration( + color: const Color(0xFFD4AF37).withValues(alpha: 0.15), + borderRadius: BorderRadius.circular(10), + ), + child: const Icon( + Icons.eco_outlined, + color: Color(0xFFD4AF37), + size: 22, + ), + ), + const SizedBox(width: 12), + const Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '申请预种计划', + style: TextStyle( + fontSize: 15, + fontFamily: 'Inter', + fontWeight: FontWeight.w600, + color: Color(0xFFD4AF37), + ), + ), + SizedBox(height: 2), + Text( + '购买预种份额 · 查看明细 · 团队预种统计', + style: TextStyle( + fontSize: 12, + fontFamily: 'Inter', + color: Color(0xFF8D6E63), + ), + ), + ], + ), + ), + const Icon( + Icons.chevron_right, + color: Color(0xFFD4AF37), + size: 20, + ), + ], + ), + ), + ); + } + /// 构建授权类型项 Widget _buildTypeItem(AuthorizationType type) { final isSelected = _selectedType == type; 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 1ddfd497..7ef885b5 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 @@ -192,9 +192,6 @@ class _ProfilePageState extends ConsumerState { Timer? _walletDebounceTimer; static const int _debounceDelayMs = 300; // 300ms 防抖延迟 - // 预种计划开关状态(后台管理端控制) - bool _isPrePlantingActive = false; - // 隐藏"我的团队"功能的秘密点击计数器 int _teamPlantingTapCount = 0; DateTime? _lastTeamPlantingTapTime; @@ -216,8 +213,6 @@ class _ProfilePageState extends ConsumerState { }); // 启动定时刷新(可见区域的数据) _startAutoRefreshTimer(); - // 加载预种开关状态(控制预种按钮显隐) - _loadPrePlantingConfig(); } /// 加载应用信息 @@ -1342,20 +1337,6 @@ class _ProfilePageState extends ConsumerState { context.push(RoutePaths.plantingQuantity); } - /// 加载预种开关配置(控制预种按钮显隐) - Future _loadPrePlantingConfig() async { - try { - final prePlantingService = ref.read(prePlantingServiceProvider); - final config = await prePlantingService.getConfig(); - if (mounted) { - setState(() => _isPrePlantingActive = config.isActive); - } - } catch (e) { - debugPrint('[ProfilePage] 加载预种配置失败: $e'); - // 失败时保持 false,不显示预种按钮 - } - } - /// 谷歌验证器 void _goToGoogleAuth() { context.push(RoutePaths.googleAuth); @@ -1541,12 +1522,6 @@ class _ProfilePageState extends ConsumerState { // 认种按钮 _buildPlantingButton(), const SizedBox(height: 8), - // [2026-03-04] 预种计划入口(三功能合并为单按钮) - // 仅在后台管理端预种开关开启时显示 - if (_isPrePlantingActive) ...[ - _buildPrePlantingEntryButton(), - const SizedBox(height: 8), - ], const SizedBox(height: 16), // 主要内容卡片(懒加载:收益数据) VisibilityDetector( @@ -2031,43 +2006,6 @@ class _ProfilePageState extends ConsumerState { ); } - /// [2026-03-04] 构建预种计划入口按钮(原三按钮合并为一个) - Widget _buildPrePlantingEntryButton() { - return GestureDetector( - onTap: () => context.push(RoutePaths.prePlantingHub), - child: Container( - width: double.infinity, - height: 48, - decoration: BoxDecoration( - color: const Color(0xFFD4AF37).withValues(alpha: 0.15), - borderRadius: BorderRadius.circular(8), - border: Border.all( - color: const Color(0xFFD4AF37).withValues(alpha: 0.4), - width: 1, - ), - ), - child: const Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon(Icons.eco_outlined, color: Color(0xFFD4AF37), size: 20), - SizedBox(width: 8), - Text( - '申请预种计划', - style: TextStyle( - fontSize: 15, - fontFamily: 'Inter', - fontWeight: FontWeight.w600, - color: Color(0xFFD4AF37), - ), - ), - SizedBox(width: 4), - Icon(Icons.chevron_right, color: Color(0xFFD4AF37), size: 18), - ], - ), - ), - ); - } - /// 构建主要内容卡片 Widget _buildMainContentCard() { // Widget 结构始终保持,数据值根据状态显示 "0" 或实际值