fix: 增加注册账户时使用国外手机号获取验证码时进行提示
This commit is contained in:
parent
4d60ea4535
commit
13bf53e964
@ -84,14 +84,13 @@ class StarLockRegisterLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
Future<void> 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<void> 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
|
||||
|
||||
@ -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<StarLockRegisterPage> {
|
||||
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: <Widget>[
|
||||
GestureDetector(
|
||||
@ -153,13 +157,16 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
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: <Widget>[
|
||||
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<StarLockRegisterPage> {
|
||||
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: <String, Object>{'countryCode': state.countryCode, 'account': state.phoneOrEmailStr.value});
|
||||
arguments: <String, Object>{
|
||||
'countryCode': state.countryCode,
|
||||
'account': state.phoneOrEmailStr.value
|
||||
});
|
||||
state.xWidth.value = (result! as Map<String, dynamic>)['xWidth'];
|
||||
logic.sendValidationCode();
|
||||
}
|
||||
@ -338,7 +355,8 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
||||
child: GestureDetector(
|
||||
child: Text('《${'用户协议'.tr}》', style: TextStyle(color: AppColors.mainColor, fontSize: 20.sp)),
|
||||
onTap: () {
|
||||
Get.toNamed(Routers.webviewShowPage, arguments: <String, String>{'url': XSConstantMacro.userAgreementURL, 'title': '用户协议'.tr});
|
||||
Get.toNamed(Routers.webviewShowPage,
|
||||
arguments: <String, String>{'url': XSConstantMacro.userAgreementURL, 'title': '用户协议'.tr});
|
||||
},
|
||||
)),
|
||||
WidgetSpan(
|
||||
@ -346,7 +364,8 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
||||
child: GestureDetector(
|
||||
child: Text('《${'隐私政策'.tr}》', style: TextStyle(color: AppColors.mainColor, fontSize: 20.sp)),
|
||||
onTap: () {
|
||||
Get.toNamed(Routers.webviewShowPage, arguments: <String, String>{'url': XSConstantMacro.privacyPolicyURL, 'title': '隐私政策'.tr});
|
||||
Get.toNamed(Routers.webviewShowPage,
|
||||
arguments: <String, String>{'url': XSConstantMacro.privacyPolicyURL, 'title': '隐私政策'.tr});
|
||||
},
|
||||
)),
|
||||
],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user