From bb1607235dfe2e911b2d7fb86313a65cf4016000 Mon Sep 17 00:00:00 2001 From: Liuyf Date: Mon, 21 Apr 2025 19:21:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=B8=80=E9=94=AE=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E6=B2=A1=E6=9C=89=E8=A7=A6=E5=8F=91=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E6=89=A7=E8=A1=8C=E4=B8=80=E9=94=AE=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E5=A4=B1=E8=B4=A5=E5=90=8E=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E4=BB=BB=E4=BD=95=E6=8F=90=E7=A4=BA=E4=BF=A1=E6=81=AF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/login/login/starLock_login_logic.dart | 60 +++++++++++++---------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/lib/login/login/starLock_login_logic.dart b/lib/login/login/starLock_login_logic.dart index 01453fba..dc894170 100755 --- a/lib/login/login/starLock_login_logic.dart +++ b/lib/login/login/starLock_login_logic.dart @@ -109,35 +109,41 @@ class StarLockLoginLogic extends BaseGetXController { final String? content = e.message; // final String operator = map['operator']; AppLog.log('1111code:$code content:$content'); - if (code == 6000) { - final LoginEntity entity = await ApiRepository.to.oneClickLogin( - loginType: '3', - loginToken: content ?? '', - deviceInfo: state.deviceInfoMap); - if (entity.errorCode!.codeIsSuccessful) { - ApmHelper.instance.trackEvent('login_result', { - 'account': state.emailOrPhone.value, - 'date': DateTool().getNowDateWithType(1), - 'login_res': '成功', - }); + switch (code) { + case 6000: + final LoginEntity entity = await ApiRepository.to.oneClickLogin( + loginType: '3', + loginToken: content ?? '', + deviceInfo: state.deviceInfoMap); + if (entity.errorCode!.codeIsSuccessful) { + ApmHelper.instance.trackEvent('login_result', { + 'account': state.emailOrPhone.value, + 'date': DateTool().getNowDateWithType(1), + 'login_res': '成功', + }); - Storage.saveLoginData(entity.data); - Storage.setBool(saveIsVip, entity.data!.isVip == 1); - eventBus.fire(MineInfoChangeRefreshUI()); - if (Get.isRegistered()) { - Get.find().getStarLockInfo(isUnShowLoading: true); + Storage.saveLoginData(entity.data); + Storage.setBool(saveIsVip, entity.data!.isVip == 1); + eventBus.fire(MineInfoChangeRefreshUI()); + if (Get.isRegistered()) { + Get.find().getStarLockInfo(isUnShowLoading: true); + } + Get.offNamedUntil(Routers.starLockMain, (Route route) => false); + BlueManage().scanDevices.clear(); //清除设备缓存 + } else { + ApmHelper.instance.trackEvent('login_result', { + 'account': state.emailOrPhone.value, + 'date': DateTool().getNowDateWithType(1), + 'login_res': '${entity.errorCode}--${entity.errorMsg}', + }); } - Get.offNamedUntil(Routers.starLockMain, (Route route) => false); - BlueManage().scanDevices.clear(); //清除设备缓存 - } else { - ApmHelper.instance.trackEvent('login_result', { - 'account': state.emailOrPhone.value, - 'date': DateTool().getNowDateWithType(1), - 'login_res': '${entity.errorCode}--${entity.errorMsg}', - }); - } - } else { - showToast('一键登录失败,请重试'.tr); + break; + case 6002: + showToast('取消一键登录'.tr); + break; + default: + showToast('一键登录失败,请重试'.tr); + break; } }); }