From 13bf53e9643229a9eceb68002bebdf2bfb467c91 Mon Sep 17 00:00:00 2001 From: liyi Date: Wed, 17 Sep 2025 09:34:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=A2=9E=E5=8A=A0=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E8=B4=A6=E6=88=B7=E6=97=B6=E4=BD=BF=E7=94=A8=E5=9B=BD=E5=A4=96?= =?UTF-8?q?=E6=89=8B=E6=9C=BA=E5=8F=B7=E8=8E=B7=E5=8F=96=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E7=A0=81=E6=97=B6=E8=BF=9B=E8=A1=8C=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../register/starLock_register_logic.dart | 35 +++++++++---------- .../register/starLock_register_page.dart | 31 ++++++++++++---- 2 files changed, 42 insertions(+), 24 deletions(-) diff --git a/lib/login/register/starLock_register_logic.dart b/lib/login/register/starLock_register_logic.dart index 5796d422..b0731e23 100755 --- a/lib/login/register/starLock_register_logic.dart +++ b/lib/login/register/starLock_register_logic.dart @@ -84,14 +84,13 @@ class StarLockRegisterLogic extends BaseGetXController { } Future sendValidationCode() async { - final SendValidationCodeEntity entity = - await ApiRepository.to.sendValidationCodeUnLogin( - // state.countryCode.value, - countryCode: state.countryCode.value.toString(), - account: state.phoneOrEmailStr.value, - channel: state.isIphoneType.value ? '1' : '2', - codeType: '1', - xWidth: state.xWidth.value.toString()); + final SendValidationCodeEntity entity = await ApiRepository.to.sendValidationCodeUnLogin( + // state.countryCode.value, + countryCode: state.countryCode.value.toString(), + account: state.phoneOrEmailStr.value, + channel: state.isIphoneType.value ? '1' : '2', + codeType: '1', + xWidth: state.xWidth.value.toString()); if (entity.errorCode!.codeIsSuccessful) { _startTimer(); } else {} @@ -100,13 +99,16 @@ class StarLockRegisterLogic extends BaseGetXController { Future checkIpAction() async { final CheckIPEntity entity = await ApiRepository.to.checkIpAction(ip: ''); if (entity.errorCode!.codeIsSuccessful) { + if (entity.data!.abbreviation != 'CN') { + showToast('当前国家不支持手机验证码注册,请使用邮箱进行注册'.tr); + return; + } if (state.countryName.value != entity.data!.name) { ShowTipView().showSureAlertDialog( - '国家地区的选择将影响数据安全,你当前选择的是'.tr + - '${state.countryName.value},' + - '请确认后再继续'.tr, - tipTitle: '确认国家或地区'.tr, - sureStr: '我知道了'.tr); + '国家地区的选择将影响数据安全,你当前选择的是'.tr + '${state.countryName.value},' + '请确认后再继续'.tr, + tipTitle: '确认国家或地区'.tr, + sureStr: '我知道了'.tr, + ); } } } @@ -138,15 +140,12 @@ class StarLockRegisterLogic extends BaseGetXController { // 重置是否能提交 void _resetCanSub() { - state.canSub.value = state.pwdIsOK && - state.codeIsOK && - state.phoneOrEmailStr.value.isNotEmpty; + state.canSub.value = state.pwdIsOK && state.codeIsOK && state.phoneOrEmailStr.value.isNotEmpty; } // 重置是否能发送验证码 void _resetCanSendCode() { - state.canSendCode.value = - state.pwdIsOK && state.phoneOrEmailStr.value.isNotEmpty; + state.canSendCode.value = state.pwdIsOK && state.phoneOrEmailStr.value.isNotEmpty; } @override diff --git a/lib/login/register/starLock_register_page.dart b/lib/login/register/starLock_register_page.dart index cec34d5a..279010d0 100755 --- a/lib/login/register/starLock_register_page.dart +++ b/lib/login/register/starLock_register_page.dart @@ -4,7 +4,10 @@ import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/app_settings/app_settings.dart'; +import 'package:star_lock/login/register/entity/checkIP_entity.dart'; import 'package:star_lock/login/register/starLock_register_state.dart'; +import 'package:star_lock/network/api_repository.dart'; +import 'package:star_lock/tools/baseGetXController.dart'; import '../../appRouters.dart'; import '../../app_settings/app_colors.dart'; @@ -79,7 +82,8 @@ class _StarLockRegisterPageState extends State { width: 340.w, height: 60.h, decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(30.h)), border: Border.all(width: 1.0, color: AppColors.greyLineColor)), + borderRadius: BorderRadius.all(Radius.circular(30.h)), + border: Border.all(width: 1.0, color: AppColors.greyLineColor)), child: Row( children: [ GestureDetector( @@ -153,13 +157,16 @@ class _StarLockRegisterPageState extends State { child: Row( children: [ SizedBox(width: 5.w), - Expanded(child: Text('你所在的国家/地区'.tr, style: TextStyle(fontSize: 26.sp, color: AppColors.blackColor))), + Expanded( + child: Text('你所在的国家/地区'.tr, style: TextStyle(fontSize: 26.sp, color: AppColors.blackColor))), SizedBox(width: 20.w), Row( mainAxisAlignment: MainAxisAlignment.end, children: [ Text( - state.isIphoneType.value ? '${state.countryName.value} +${state.countryCode.value}' : state.countryName.value, + state.isIphoneType.value + ? '${state.countryName.value} +${state.countryCode.value}' + : state.countryName.value, textAlign: TextAlign.end, style: TextStyle(fontSize: 26.sp, color: AppColors.blackColor), ) @@ -279,9 +286,19 @@ class _StarLockRegisterPageState extends State { Obx(() => GestureDetector( onTap: (state.canSendCode.value && state.canResend.value) ? () async { + final CheckIPEntity entity = await ApiRepository.to.checkIpAction(ip: ''); + if (entity.errorCode!.codeIsSuccessful) { + if (entity.data!.abbreviation != 'CN') { + logic.showToast('当前国家不支持手机验证码注册,请使用邮箱进行注册'.tr); + return; + } + } // Navigator.pushNamed(context, Routers.safetyVerificationPage, arguments: {"countryCode":"+86", "account":state.phoneOrEmailStr.value}); final Object? result = await Navigator.pushNamed(context, Routers.safetyVerificationPage, - arguments: {'countryCode': state.countryCode, 'account': state.phoneOrEmailStr.value}); + arguments: { + 'countryCode': state.countryCode, + 'account': state.phoneOrEmailStr.value + }); state.xWidth.value = (result! as Map)['xWidth']; logic.sendValidationCode(); } @@ -338,7 +355,8 @@ class _StarLockRegisterPageState extends State { child: GestureDetector( child: Text('《${'用户协议'.tr}》', style: TextStyle(color: AppColors.mainColor, fontSize: 20.sp)), onTap: () { - Get.toNamed(Routers.webviewShowPage, arguments: {'url': XSConstantMacro.userAgreementURL, 'title': '用户协议'.tr}); + Get.toNamed(Routers.webviewShowPage, + arguments: {'url': XSConstantMacro.userAgreementURL, 'title': '用户协议'.tr}); }, )), WidgetSpan( @@ -346,7 +364,8 @@ class _StarLockRegisterPageState extends State { child: GestureDetector( child: Text('《${'隐私政策'.tr}》', style: TextStyle(color: AppColors.mainColor, fontSize: 20.sp)), onTap: () { - Get.toNamed(Routers.webviewShowPage, arguments: {'url': XSConstantMacro.privacyPolicyURL, 'title': '隐私政策'.tr}); + Get.toNamed(Routers.webviewShowPage, + arguments: {'url': XSConstantMacro.privacyPolicyURL, 'title': '隐私政策'.tr}); }, )), ],