完善游客模式登录 并且新增设备管理

This commit is contained in:
2025-10-17 21:11:40 +08:00
parent 2333ad52a9
commit de9cf751f3
46 changed files with 4590 additions and 543 deletions
@@ -43,23 +43,17 @@ class KRDeleteAccountController extends GetxController {
super.onClose();
}
// 发送验证码
// 发送验证码(仅支持邮箱)
Future<void> kr_sendCode() async {
final account = KRAppRunData.getInstance().kr_account;
final account = KRAppRunData.getInstance().kr_account.value;
if (account == null || account.isEmpty) {
KRCommonUtil.kr_showToast('账号不能为空');
return;
}
// 判断账号类型
final isEmail = KRAppRunData.getInstance().kr_loginType == KRLoginType.kr_email;
final type = isEmail ? KRLoginType.kr_email : KRLoginType.kr_telephone;
// 发送验证码
// 发送验证码(简化后的 API 只需要 email 和 type
final result = await _authApi.kr_sendCode(
type,
account,
KRAppRunData.getInstance().kr_areaCode, // 手机号不需要区号
account, // 邮箱地址
2, // 删除账号的验证码类型
);
@@ -70,7 +64,7 @@ class KRDeleteAccountController extends GetxController {
(success) {
kr_canSendCode.value = false;
kr_countdown.value = 60;
_timer = Timer.periodic(const Duration(seconds: 1), (timer) {
if (kr_countdown.value > 0) {
kr_countdown.value--;
@@ -89,11 +83,12 @@ class KRDeleteAccountController extends GetxController {
KRCommonUtil.kr_showToast(AppTranslations.kr_login.sendCode);
return;
}
final result = await _authApi.kr_deleteAccount(
KRAppRunData.getInstance().kr_loginType ?? KRLoginType.kr_telephone,
// 删除账号(简化后的 API 只需要 code)
final result = await _authApi.kr_deleteAccount(
kr_codeController.text,
);
result.fold(
(error) {
KRCommonUtil.kr_showToast(error.msg);
@@ -103,7 +98,5 @@ class KRDeleteAccountController extends GetxController {
KRAppRunData.getInstance().kr_loginOut();
},
);
// TODO: 实现删除账号的逻辑
}
}