feat: 完成代码
Build Android APK / 编译 libcore.aar (push) Has been cancelled
Build Android APK / 创建 GitHub Release (push) Has been cancelled
Build Multi-Platform / 编译 libcore (iOS/tvOS) (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 / 构建 iOS (push) Has been cancelled
Build Multi-Platform / 创建 Release (push) Has been cancelled
Build Windows / 编译 libcore (Windows) (push) Has been cancelled
Build Windows / build (push) Has been cancelled
Build Android APK / 编译 Android APK (release) (push) Has been cancelled
Build Android APK / 编译 libcore.aar (push) Has been cancelled
Build Android APK / 创建 GitHub Release (push) Has been cancelled
Build Multi-Platform / 编译 libcore (iOS/tvOS) (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 / 构建 iOS (push) Has been cancelled
Build Multi-Platform / 创建 Release (push) Has been cancelled
Build Windows / 编译 libcore (Windows) (push) Has been cancelled
Build Windows / build (push) Has been cancelled
Build Android APK / 编译 Android APK (release) (push) Has been cancelled
This commit is contained in:
@@ -10,6 +10,7 @@ import 'package:kaer_with_panels/app/utils/kr_common_util.dart';
|
||||
import 'package:kaer_with_panels/app/localization/app_translations.dart';
|
||||
import 'package:kaer_with_panels/app/utils/kr_event_bus.dart';
|
||||
import 'package:kaer_with_panels/app/services/kr_site_config_service.dart';
|
||||
import 'package:kaer_with_panels/app/widgets/dialogs/hi_dialog.dart';
|
||||
|
||||
import '../../../localization/kr_language_utils.dart';
|
||||
import 'package:kaer_with_panels/app/services/kr_subscribe_service.dart';
|
||||
@@ -366,18 +367,43 @@ class KRLoginController extends GetxController
|
||||
return;
|
||||
}
|
||||
|
||||
final either = await KRAuthApi().kr_register(
|
||||
accountController.text,
|
||||
psdController.text,
|
||||
code: codeController.text.isEmpty ? null : codeController.text,
|
||||
inviteCode: inviteCodeController.text.isEmpty ? null : inviteCodeController.text);
|
||||
either.fold((l) {
|
||||
KRCommonUtil.kr_showToast(l.msg);
|
||||
}, (r) async {
|
||||
_saveLoginData(r);
|
||||
// KRCommonUtil.kr_showToast(AppTranslations.kr_login.registerSuccess);
|
||||
KRCommonUtil.kr_showToast('登录成功');
|
||||
});
|
||||
// 定义注册请求逻辑
|
||||
Future<void> performRegister() async {
|
||||
final either = await KRAuthApi().kr_register(
|
||||
accountController.text,
|
||||
psdController.text,
|
||||
code: codeController.text.isEmpty ? null : codeController.text,
|
||||
inviteCode: inviteCodeController.text.isEmpty ? null : inviteCodeController.text,
|
||||
);
|
||||
|
||||
either.fold(
|
||||
(l) => KRCommonUtil.kr_showToast(l.msg),
|
||||
(r) async {
|
||||
_saveLoginData(r);
|
||||
KRCommonUtil.kr_showToast('登录成功');
|
||||
},
|
||||
);
|
||||
}
|
||||
// 检查是否已有订阅
|
||||
final subscriptionResult = await KRAuthApi().kr_checkSubscription(accountController.text);
|
||||
|
||||
subscriptionResult.fold(
|
||||
(error) {
|
||||
KRCommonUtil.kr_showToast(error.msg);
|
||||
},
|
||||
(isFullySubscribed) async {
|
||||
if (isFullySubscribed) {
|
||||
HIDialog.show(
|
||||
message: '当前邮箱已有套餐,继续绑定会丢失设备当前套餐,是否继续?',
|
||||
confirmText: '继续',
|
||||
cancelText: '取消',
|
||||
onConfirm: performRegister,
|
||||
);
|
||||
} else {
|
||||
await performRegister();
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
void kr_checkCode() {
|
||||
|
||||
Reference in New Issue
Block a user