fix: 增加注册账户时使用国外手机号获取验证码时进行提示
This commit is contained in:
parent
4d60ea4535
commit
13bf53e964
@ -84,14 +84,13 @@ class StarLockRegisterLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> sendValidationCode() async {
|
Future<void> sendValidationCode() async {
|
||||||
final SendValidationCodeEntity entity =
|
final SendValidationCodeEntity entity = await ApiRepository.to.sendValidationCodeUnLogin(
|
||||||
await ApiRepository.to.sendValidationCodeUnLogin(
|
// state.countryCode.value,
|
||||||
// state.countryCode.value,
|
countryCode: state.countryCode.value.toString(),
|
||||||
countryCode: state.countryCode.value.toString(),
|
account: state.phoneOrEmailStr.value,
|
||||||
account: state.phoneOrEmailStr.value,
|
channel: state.isIphoneType.value ? '1' : '2',
|
||||||
channel: state.isIphoneType.value ? '1' : '2',
|
codeType: '1',
|
||||||
codeType: '1',
|
xWidth: state.xWidth.value.toString());
|
||||||
xWidth: state.xWidth.value.toString());
|
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
_startTimer();
|
_startTimer();
|
||||||
} else {}
|
} else {}
|
||||||
@ -100,13 +99,16 @@ class StarLockRegisterLogic extends BaseGetXController {
|
|||||||
Future<void> checkIpAction() async {
|
Future<void> checkIpAction() async {
|
||||||
final CheckIPEntity entity = await ApiRepository.to.checkIpAction(ip: '');
|
final CheckIPEntity entity = await ApiRepository.to.checkIpAction(ip: '');
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
if (entity.data!.abbreviation != 'CN') {
|
||||||
|
showToast('当前国家不支持手机验证码注册,请使用邮箱进行注册'.tr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (state.countryName.value != entity.data!.name) {
|
if (state.countryName.value != entity.data!.name) {
|
||||||
ShowTipView().showSureAlertDialog(
|
ShowTipView().showSureAlertDialog(
|
||||||
'国家地区的选择将影响数据安全,你当前选择的是'.tr +
|
'国家地区的选择将影响数据安全,你当前选择的是'.tr + '${state.countryName.value},' + '请确认后再继续'.tr,
|
||||||
'${state.countryName.value},' +
|
tipTitle: '确认国家或地区'.tr,
|
||||||
'请确认后再继续'.tr,
|
sureStr: '我知道了'.tr,
|
||||||
tipTitle: '确认国家或地区'.tr,
|
);
|
||||||
sureStr: '我知道了'.tr);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -138,15 +140,12 @@ class StarLockRegisterLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 重置是否能提交
|
// 重置是否能提交
|
||||||
void _resetCanSub() {
|
void _resetCanSub() {
|
||||||
state.canSub.value = state.pwdIsOK &&
|
state.canSub.value = state.pwdIsOK && state.codeIsOK && state.phoneOrEmailStr.value.isNotEmpty;
|
||||||
state.codeIsOK &&
|
|
||||||
state.phoneOrEmailStr.value.isNotEmpty;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 重置是否能发送验证码
|
// 重置是否能发送验证码
|
||||||
void _resetCanSendCode() {
|
void _resetCanSendCode() {
|
||||||
state.canSendCode.value =
|
state.canSendCode.value = state.pwdIsOK && state.phoneOrEmailStr.value.isNotEmpty;
|
||||||
state.pwdIsOK && state.phoneOrEmailStr.value.isNotEmpty;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@ -4,7 +4,10 @@ import 'package:flutter/services.dart';
|
|||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/app_settings/app_settings.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/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 '../../appRouters.dart';
|
||||||
import '../../app_settings/app_colors.dart';
|
import '../../app_settings/app_colors.dart';
|
||||||
@ -79,7 +82,8 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
|||||||
width: 340.w,
|
width: 340.w,
|
||||||
height: 60.h,
|
height: 60.h,
|
||||||
decoration: BoxDecoration(
|
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(
|
child: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
@ -153,13 +157,16 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
SizedBox(width: 5.w),
|
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),
|
SizedBox(width: 20.w),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
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,
|
textAlign: TextAlign.end,
|
||||||
style: TextStyle(fontSize: 26.sp, color: AppColors.blackColor),
|
style: TextStyle(fontSize: 26.sp, color: AppColors.blackColor),
|
||||||
)
|
)
|
||||||
@ -279,9 +286,19 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
|||||||
Obx(() => GestureDetector(
|
Obx(() => GestureDetector(
|
||||||
onTap: (state.canSendCode.value && state.canResend.value)
|
onTap: (state.canSendCode.value && state.canResend.value)
|
||||||
? () async {
|
? () 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});
|
// Navigator.pushNamed(context, Routers.safetyVerificationPage, arguments: {"countryCode":"+86", "account":state.phoneOrEmailStr.value});
|
||||||
final Object? result = await Navigator.pushNamed(context, Routers.safetyVerificationPage,
|
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'];
|
state.xWidth.value = (result! as Map<String, dynamic>)['xWidth'];
|
||||||
logic.sendValidationCode();
|
logic.sendValidationCode();
|
||||||
}
|
}
|
||||||
@ -338,7 +355,8 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
|||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
child: Text('《${'用户协议'.tr}》', style: TextStyle(color: AppColors.mainColor, fontSize: 20.sp)),
|
child: Text('《${'用户协议'.tr}》', style: TextStyle(color: AppColors.mainColor, fontSize: 20.sp)),
|
||||||
onTap: () {
|
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(
|
WidgetSpan(
|
||||||
@ -346,7 +364,8 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
|||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
child: Text('《${'隐私政策'.tr}》', style: TextStyle(color: AppColors.mainColor, fontSize: 20.sp)),
|
child: Text('《${'隐私政策'.tr}》', style: TextStyle(color: AppColors.mainColor, fontSize: 20.sp)),
|
||||||
onTap: () {
|
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