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"