Browse Source

手机登陆

weicu
fdp 2 years ago
parent
commit
dc73c789b9
  1. 35
      lib/modules/login/controllers/login_controller.dart

35
lib/modules/login/controllers/login_controller.dart

@ -66,7 +66,6 @@ class LoginController extends GetxController {
{'name': '中国台湾', 'code': '+886', 'flag': '🇹🇼'}, {'name': '中国台湾', 'code': '+886', 'flag': '🇹🇼'},
]; ];
// 状态管理 // 状态管理
final _viewState = LoginViewState.welcome.obs; final _viewState = LoginViewState.welcome.obs;
final _isLoading = false.obs; final _isLoading = false.obs;
@ -248,8 +247,8 @@ class LoginController extends GetxController {
if (isEmialContactController() || isPhoneContactController()) { if (isEmialContactController() || isPhoneContactController()) {
_startCountdown(); _startCountdown();
var response = await Api.getCode({ var response = await Api.getCode({
"addr": contactController.text, "addr": selectedCountryCode + contactController.text,
"vtype": 0, "vtype": loginType,
}); });
if (response != null) { if (response != null) {
print("请求后台数据验证码params=${response}"); print("请求后台数据验证码params=${response}");
@ -323,7 +322,7 @@ class LoginController extends GetxController {
// 模拟验证过程 // 模拟验证过程
switch (loginType) { switch (loginType) {
case 0 || 1: case 0:
{ {
if (!isVerificationCodeComplete()) { if (!isVerificationCodeComplete()) {
Get.snackbar( Get.snackbar(
@ -337,7 +336,32 @@ class LoginController extends GetxController {
} }
requestLogin({ requestLogin({
"mail": contactController.text, "mail": contactController.text,
"phone": "", "phone": selectedCountryCode + contactController.text,
"stype": loginType,
"vcode": verificationCodeController.text,
"ttoken": "",
"phonemodel": "",
"phonemac": "",
"name": "",
"avatar": "",
});
break;
}
case 1:
{
if (!isVerificationCodeComplete()) {
Get.snackbar(
'提示',
'请输入完整的验证码',
snackPosition: SnackPosition.TOP,
backgroundColor: Colors.red.withOpacity(0.1),
colorText: Colors.red,
);
break;
}
requestLogin({
"mail": "",
"phone": selectedCountryCode + contactController.text,
"stype": loginType, "stype": loginType,
"vcode": verificationCodeController.text, "vcode": verificationCodeController.text,
"ttoken": "", "ttoken": "",
@ -348,7 +372,6 @@ class LoginController extends GetxController {
}); });
break; break;
} }
case 4: case 4:
{ {
print("数据获取Facebook"); print("数据获取Facebook");

Loading…
Cancel
Save