更新眠花糖邮箱登录

This commit is contained in:
wyf
2026-01-26 15:01:57 +08:00
parent dfd9523433
commit 2aedbb3d74
11 changed files with 1220 additions and 388 deletions

View File

@@ -22,7 +22,8 @@ part 'mht_login_controller.g.dart';
@JsonSerializable()
class LoginModel {
//版本id
int? loginStyle = 1; //1.密码登录 2.短信登录(登录类型: 1:手机号/邮箱+验证码 2:微信一键登录 3:手机号+密码)
int? loginStyle =
1; //1.密码登录 2.短信登录 3.邮箱登录(登录类型: 1:手机号/邮箱+验证码 2:微信一键登录 3:手机号+密码)
// String? account = '17649984946'; //账户
// String? account = '13953240733'; //账户
@@ -35,7 +36,7 @@ class LoginModel {
String? account = ''; //账户
String? password = ''; //密码
String? phone; //手机号
String? phone; //手机号/邮箱
String? code; //验证码
String? register_code;
@@ -123,6 +124,33 @@ class MHTLoginController extends GetControllerEx<LoginModel> {
account = model.phone!;
password = model.code!;
}
if (model.loginStyle == 3) {
//账号登录
if (model.phone == null || model.phone!.isEmpty) {
message = '请输入邮箱'.tr;
TopSlideNotification.show(context,
text: message, textColor: stringToColor("#FF7159"));
return message;
}
if (!MyUtils.isValidEmail(model.phone!)) {
message = '请输入正确的邮箱'.tr;
TopSlideNotification.show(context,
text: message, textColor: stringToColor("#FF7159"));
return message;
}
if (model.code == null || model.code!.isEmpty) {
message = '验证码不能为空'.tr;
TopSlideNotification.show(context,
text: message, textColor: stringToColor("#FF7159"));
return message;
}
account = model.phone!;
password = model.code!;
}
if (registerController.model.register_agree == null ||
registerController.model.register_agree != true) {
@@ -186,14 +214,52 @@ class MHTLoginController extends GetControllerEx<LoginModel> {
// text: message, textColor: themeController.currentColor.sc9);
// return message;
// }
if (model.phone == null || model.phone!.isEmpty) {
message = "请输入手机号".tr;
TopSlideNotification.show(context,
text: message, textColor: themeController.currentColor.sc9);
return message;
}
if (!MyUtils.isValidPhoneNumber(model.phone!)) {
message = '请输入正确的手机号'.tr;
// model.loginStyle;// 2 手机号 3 邮箱
// if (model.phone == null || model.phone!.isEmpty) {
// message = "请输入手机号".tr;
// TopSlideNotification.show(context,
// text: message, textColor: themeController.currentColor.sc9);
// return message;
// }
// if (!MyUtils.isValidPhoneNumber(model.phone!)) {
// message = '请输入正确的手机号'.tr;
// TopSlideNotification.show(context,
// text: message, textColor: themeController.currentColor.sc9);
// return message;
// }
// 2 手机号 3 邮箱
if (model.loginStyle == 2) {
// 短信登录:验证手机号
if (model.phone == null || model.phone!.isEmpty) {
message = "请输入手机号".tr;
TopSlideNotification.show(context,
text: message, textColor: themeController.currentColor.sc9);
return message;
}
if (!MyUtils.isValidPhoneNumber(model.phone!)) {
message = '请输入正确的手机号'.tr;
TopSlideNotification.show(context,
text: message, textColor: themeController.currentColor.sc9);
return message;
}
} else if (model.loginStyle == 3) {
// 邮箱登录:验证邮箱
if (model.phone == null || model.phone!.isEmpty) {
message = "请输入邮箱".tr;
TopSlideNotification.show(context,
text: message, textColor: themeController.currentColor.sc9);
return message;
}
if (!MyUtils.isValidEmail(model.phone!)) {
message = '请输入正确的邮箱地址'.tr;
TopSlideNotification.show(context,
text: message, textColor: themeController.currentColor.sc9);
return message;
}
} else {
// 其他登录类型(如密码登录)
// 根据你的实际需求处理
message = "请选择正确的登录方式".tr;
TopSlideNotification.show(context,
text: message, textColor: themeController.currentColor.sc9);
return message;