feat: 更新代码仓库全部修改
Build Android APK / 编译 libcore.aar (push) Has been cancelled
Build Android APK / 编译 Android APK (release) (push) Has been cancelled
Build Android APK / 创建 GitHub Release (push) Has been cancelled
Build Multi-Platform / 编译 libcore (Android) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (Windows) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (macOS) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (Linux) (push) Has been cancelled
Build Multi-Platform / 构建 Android APK (push) Has been cancelled
Build Multi-Platform / 构建 Windows (push) Has been cancelled
Build Multi-Platform / 构建 macOS (push) Has been cancelled
Build Multi-Platform / 构建 Linux (push) Has been cancelled
Build Multi-Platform / 创建 Release (push) Has been cancelled
Build Windows / build (push) Has been cancelled
Build Android APK / 编译 libcore.aar (push) Has been cancelled
Build Android APK / 编译 Android APK (release) (push) Has been cancelled
Build Android APK / 创建 GitHub Release (push) Has been cancelled
Build Multi-Platform / 编译 libcore (Android) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (Windows) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (macOS) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (Linux) (push) Has been cancelled
Build Multi-Platform / 构建 Android APK (push) Has been cancelled
Build Multi-Platform / 构建 Windows (push) Has been cancelled
Build Multi-Platform / 构建 macOS (push) Has been cancelled
Build Multi-Platform / 构建 Linux (push) Has been cancelled
Build Multi-Platform / 创建 Release (push) Has been cancelled
Build Windows / build (push) Has been cancelled
This commit is contained in:
@@ -12,6 +12,8 @@ import 'package:kaer_with_panels/app/utils/kr_event_bus.dart';
|
||||
import 'package:kaer_with_panels/app/services/kr_site_config_service.dart';
|
||||
|
||||
import '../../../localization/kr_language_utils.dart';
|
||||
import 'package:kaer_with_panels/app/services/kr_subscribe_service.dart';
|
||||
import 'package:kaer_with_panels/app/modules/hi_user_info/controllers/hi_user_info_controller.dart';
|
||||
|
||||
/// 登录类型
|
||||
enum KRLoginProgressStatus {
|
||||
@@ -60,6 +62,9 @@ extension KRLoginTypeExt on KRLoginProgressStatus {
|
||||
|
||||
class KRLoginController extends GetxController
|
||||
with GetSingleTickerProviderStateMixin {
|
||||
/// 订阅服务
|
||||
final KRSubscribeService kr_subscribeService = KRSubscribeService();
|
||||
|
||||
/// 是否注册
|
||||
RxBool kr_isRegistered = false.obs;
|
||||
|
||||
@@ -67,7 +72,7 @@ class KRLoginController extends GetxController
|
||||
var kr_loginType = KRLoginType.kr_email.obs;
|
||||
|
||||
/// 登陆进度状态
|
||||
var kr_loginStatus = KRLoginProgressStatus.kr_check.obs;
|
||||
var kr_loginStatus = KRLoginProgressStatus.kr_registerSendCode.obs;
|
||||
|
||||
/// 验证码倒计时
|
||||
var _countdown = 60; // 倒计时初始值
|
||||
@@ -138,7 +143,7 @@ class KRLoginController extends GetxController
|
||||
case KRLoginProgressStatus.kr_registerSendCode:
|
||||
return AppTranslations.kr_login.next;
|
||||
case KRLoginProgressStatus.kr_registerSetPsd:
|
||||
return AppTranslations.kr_login.registerNow;
|
||||
return AppTranslations.kr_login.passwordLogin;
|
||||
case KRLoginProgressStatus.kr_forgetPsdSendCode:
|
||||
return AppTranslations.kr_login.next;
|
||||
case KRLoginProgressStatus.kr_forgetPsdSetPsd:
|
||||
@@ -149,7 +154,25 @@ class KRLoginController extends GetxController
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
|
||||
// 1. 检查并获取路由参数
|
||||
if (Get.arguments != null && Get.arguments is Map<String, dynamic>) {
|
||||
final String? entry = Get.arguments['entry'];
|
||||
print('entry: $entry');
|
||||
// 2. 根据 entry 的值设置初始的 kr_loginStatus
|
||||
if (entry == 'forget_psd') {
|
||||
// 如果是从“忘记密码”进入,直接设置为“忘记密码-发送验证码”状态
|
||||
kr_loginStatus.value = KRLoginProgressStatus.kr_forgetPsdSendCode;
|
||||
} else if (entry == 'bind_email') {
|
||||
// 如果是从“绑定邮箱”进入,直接设置为“注册-发送验证码”状态
|
||||
kr_loginStatus.value = KRLoginProgressStatus.kr_registerSetPsd;
|
||||
}else if (entry == 'login') {
|
||||
// 登录
|
||||
kr_loginStatus.value = KRLoginProgressStatus.kr_loginByPsd;
|
||||
}
|
||||
// 如果没有匹配的 entry 值,则保持默认的 kr_loginByPsd 状态
|
||||
}
|
||||
|
||||
|
||||
// 初始化计时器
|
||||
_timer = Timer(Duration.zero, () {});
|
||||
|
||||
@@ -244,12 +267,12 @@ class KRLoginController extends GetxController
|
||||
});
|
||||
|
||||
// 语言变化时更新所有翻译文本
|
||||
ever(KRLanguageUtils.kr_language, (_) {
|
||||
/*ever(KRLanguageUtils.kr_language, (_) {
|
||||
if (kr_canSendCode.value) {
|
||||
kr_countdownText.value = "";
|
||||
kr_countdownText.value = AppTranslations.kr_login.sendCode;
|
||||
}
|
||||
});
|
||||
});*/
|
||||
|
||||
kr_initFocus();
|
||||
}
|
||||
@@ -280,9 +303,13 @@ class KRLoginController extends GetxController
|
||||
void kr_sendCode() async {
|
||||
final either = await KRAuthApi().kr_sendCode(
|
||||
accountController.text,
|
||||
kr_loginStatus.value == KRLoginProgressStatus.kr_registerSendCode
|
||||
2
|
||||
); // 重置密码验证码类型为3
|
||||
/*
|
||||
*
|
||||
* kr_loginStatus.value == KRLoginProgressStatus.kr_registerSendCode
|
||||
? 2 // 注册验证码类型为2
|
||||
: 3); // 重置密码验证码类型为3
|
||||
: 3*/
|
||||
either.fold((l) {
|
||||
KRCommonUtil.kr_showToast(l.msg);
|
||||
}, (r) async {
|
||||
@@ -316,25 +343,25 @@ class KRLoginController extends GetxController
|
||||
return;
|
||||
}
|
||||
|
||||
if (psdController.text.isEmpty) {
|
||||
KRCommonUtil.kr_showToast(AppTranslations.kr_login.enterPassword);
|
||||
return;
|
||||
}
|
||||
if (agPsdController.text.isEmpty) {
|
||||
KRCommonUtil.kr_showToast(AppTranslations.kr_login.reenterPassword);
|
||||
return;
|
||||
}
|
||||
if (psdController.text != agPsdController.text) {
|
||||
KRCommonUtil.kr_showToast(AppTranslations.kr_login.passwordMismatch);
|
||||
return;
|
||||
}
|
||||
// if (psdController.text.isEmpty) {
|
||||
// KRCommonUtil.kr_showToast(AppTranslations.kr_login.enterPassword);
|
||||
// return;
|
||||
// }
|
||||
// if (agPsdController.text.isEmpty) {
|
||||
// KRCommonUtil.kr_showToast(AppTranslations.kr_login.reenterPassword);
|
||||
// return;
|
||||
// }
|
||||
// if (psdController.text != agPsdController.text) {
|
||||
// KRCommonUtil.kr_showToast(AppTranslations.kr_login.passwordMismatch);
|
||||
// return;
|
||||
// }
|
||||
|
||||
// 检查是否需要验证码(基于站点配置)
|
||||
final siteConfig = KRSiteConfigService();
|
||||
final needVerification = siteConfig.isEmailVerificationEnabled() ||
|
||||
siteConfig.isRegisterVerificationEnabled();
|
||||
// final siteConfig = KRSiteConfigService();
|
||||
// final needVerification = siteConfig.isEmailVerificationEnabled() ||
|
||||
// siteConfig.isRegisterVerificationEnabled();
|
||||
|
||||
if (needVerification && codeController.text.isEmpty) {
|
||||
if (codeController.text.isEmpty) {
|
||||
KRCommonUtil.kr_showToast(AppTranslations.kr_login.enterCode);
|
||||
return;
|
||||
}
|
||||
@@ -348,7 +375,8 @@ class KRLoginController extends GetxController
|
||||
KRCommonUtil.kr_showToast(l.msg);
|
||||
}, (r) async {
|
||||
_saveLoginData(r);
|
||||
KRCommonUtil.kr_showToast(AppTranslations.kr_login.registerSuccess);
|
||||
// KRCommonUtil.kr_showToast(AppTranslations.kr_login.registerSuccess);
|
||||
KRCommonUtil.kr_showToast('登录成功');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -460,7 +488,8 @@ class KRLoginController extends GetxController
|
||||
Future.delayed(Duration(milliseconds: 100), () {
|
||||
KREventBus().kr_sendMessage(KRMessageType.kr_payment);
|
||||
});
|
||||
|
||||
final controller = Get.find<HIUserInfoController>();
|
||||
controller.loadDeviceList();
|
||||
// 登录成功后返回到上一页
|
||||
Get.back();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user