From 34603aac8eecc716cb5b3c59f345aae5b56d5a86 Mon Sep 17 00:00:00 2001 From: hailin Date: Thu, 5 Mar 2026 09:17:53 -0800 Subject: [PATCH] =?UTF-8?q?fix(security):=20=E4=BF=AE=E5=A4=8D=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E7=99=BB=E5=BD=95=E5=AF=86=E7=A0=81=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E5=A4=B1=E8=B4=A5=E6=97=B6=E9=9D=99=E9=BB=98?= =?UTF-8?q?=E9=99=8D=E7=BA=A7=E7=9A=84=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 与 change_payment_password_page 同款问题:加载失败时原本默默设为 hasPassword=true(注册时必须设置的假设),改为显示错误状态+重试按钮。 Co-Authored-By: Claude Sonnet 4.6 --- .../pages/change_password_page.dart | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/frontend/mobile-app/lib/features/security/presentation/pages/change_password_page.dart b/frontend/mobile-app/lib/features/security/presentation/pages/change_password_page.dart index 01c15f65..783f3281 100644 --- a/frontend/mobile-app/lib/features/security/presentation/pages/change_password_page.dart +++ b/frontend/mobile-app/lib/features/security/presentation/pages/change_password_page.dart @@ -40,6 +40,9 @@ class _ChangePasswordPageState extends ConsumerState { /// 是否正在加载 bool _isLoading = true; + /// 加载状态是否出错 + bool _isLoadError = false; + @override void initState() { super.initState(); @@ -58,6 +61,7 @@ class _ChangePasswordPageState extends ConsumerState { Future _loadPasswordStatus() async { setState(() { _isLoading = true; + _isLoadError = false; }); try { @@ -73,8 +77,7 @@ class _ChangePasswordPageState extends ConsumerState { } catch (e) { if (mounted) { setState(() { - // 出错时默认已设置密码(注册时必须设置) - _hasPassword = true; + _isLoadError = true; _isLoading = false; }); } @@ -221,7 +224,24 @@ class _ChangePasswordPageState extends ConsumerState { valueColor: AlwaysStoppedAnimation(Color(0xFFD4AF37)), ), ) - : SingleChildScrollView( + : _isLoadError + ? Center( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + const Icon(Icons.error_outline, color: Colors.red, size: 48), + const SizedBox(height: 12), + const Text('加载失败,请重试', style: TextStyle(color: Colors.red)), + const SizedBox(height: 16), + ElevatedButton( + onPressed: _loadPasswordStatus, + style: ElevatedButton.styleFrom(backgroundColor: const Color(0xFFD4AF37)), + child: const Text('重试', style: TextStyle(color: Colors.white)), + ), + ], + ), + ) + : SingleChildScrollView( padding: const EdgeInsets.all(16), child: Column( crossAxisAlignment: CrossAxisAlignment.start,