From 6426d6200de416de503b2ffdbbb018205573a239 Mon Sep 17 00:00:00 2001 From: lxm <1274844347@qq.com> Date: Mon, 19 Jan 2026 10:05:37 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E7=99=BB=E5=BD=95):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E7=A4=BE=E4=BA=A4=E7=99=BB=E5=BD=95=E5=92=8C=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E7=A0=81=E7=99=BB=E5=BD=95=E7=9A=84=E9=80=BB=E8=BE=91=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 同步登录类型判断逻辑到各登录相关方法 修改登录按钮调用方式以支持社交登录参数 更新版本号至1.0.21+72 --- lib/modules/login/controllers/login_controller.dart | 12 +++++++++++- lib/modules/login/views/login_view.dart | 4 ++-- pubspec.yaml | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/modules/login/controllers/login_controller.dart b/lib/modules/login/controllers/login_controller.dart index 6a2f51a31..967a3d4bc 100644 --- a/lib/modules/login/controllers/login_controller.dart +++ b/lib/modules/login/controllers/login_controller.dart @@ -256,8 +256,13 @@ class LoginController extends GetxController { _countdownSeconds.value = 0; } + void _syncContactLoginType() { + loginType = _selectedCountryCode.value.isEmpty ? 0 : 1; + } + // 获取验证码 void getVerificationCode() { + _syncContactLoginType(); if (contactController.text.isEmpty) { Get.snackbar( 'tip'.tr, //提示 @@ -311,6 +316,7 @@ class LoginController extends GetxController { // 切换到验证码页面 void showVerificationView() { + _syncContactLoginType(); if (contactController.text.isEmpty) { Get.snackbar( 'tip'.tr, @@ -402,6 +408,7 @@ class LoginController extends GetxController { // 重新发送验证码 void resendVerificationCode() { + _syncContactLoginType(); if (_countdownSeconds.value > 0) return; _startCountdown(); _sendVerificationCode(); @@ -467,7 +474,10 @@ class LoginController extends GetxController { } // 登录 - Future login() async { + Future login({bool fromSocial = false}) async { + if (!fromSocial) { + _syncContactLoginType(); + } // 添加基础验证 if (loginType == 0 || loginType == 1) { // 邮箱或手机号登录 diff --git a/lib/modules/login/views/login_view.dart b/lib/modules/login/views/login_view.dart index 87165d0b0..99ac33a5b 100644 --- a/lib/modules/login/views/login_view.dart +++ b/lib/modules/login/views/login_view.dart @@ -575,7 +575,7 @@ class LoginView extends GetView { break; } } - controller.login(); + await controller.login(fromSocial: true); } // 用户协议和隐私政策 @@ -816,7 +816,7 @@ class LoginView extends GetView { return SizedBox( width: double.infinity, child: Obx(() => ElevatedButton( - onPressed: controller.isLoading ? null : controller.login, + onPressed: controller.isLoading ? null : () => controller.login(), style: ElevatedButton.styleFrom( backgroundColor: const Color(0xFF3B82F6), foregroundColor: Colors.white, diff --git a/pubspec.yaml b/pubspec.yaml index e7d6eb828..36afbc46b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: voitrans description: "Voitrans - AI Voice Assistant." publish_to: "none" -version: 1.0.21+71 +version: 1.0.21+72 environment: sdk: ">=3.3.0 <4.0.0"