diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart index 261cab3f..c9d0397d 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart @@ -138,14 +138,9 @@ class ElectronicKeyDetailLogic extends BaseGetXController { state.getIDCardNumber.value.isEmpty) { ShowCupertinoAlertView() .showOpenAuthWithIDCardInfoAlert((idCard, realName) { - if (idCard.isNotEmpty && realName.isNotEmpty) { - state.getIDCardNumber.value = idCard; - state.getRealName.value = realName; - updateRealNameInfoWithAuthStatus(realNameAuthStatus); - } else { - showToast("请输入完整信息".tr); - return; - } + state.getIDCardNumber.value = idCard ?? ''; + state.getRealName.value = realName ?? ''; + updateRealNameInfoWithAuthStatus(realNameAuthStatus); }); } else { updateRealNameInfoWithAuthStatus(realNameAuthStatus); @@ -233,11 +228,11 @@ class ElectronicKeyDetailLogic extends BaseGetXController { Future openModalBottomSheet(BuildContext context) async { var textList = []; - if(CommonDataManage().currentKeyInfo.keyRight == 1){ + if (CommonDataManage().currentKeyInfo.keyRight == 1) { textList = [ state.itemData.value.keyStatus == 110405 ? '取消冻结'.tr : "冻结".tr ]; - }else if(CommonDataManage().currentKeyInfo.isLockOwner == 1){ + } else if (CommonDataManage().currentKeyInfo.isLockOwner == 1) { if (state.keyType.value == 1 || state.keyType.value == 2) { textList = [ state.itemData.value.keyStatus == 110405 ? '取消冻结'.tr : "冻结".tr, diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart index df82e7f4..e2a76afa 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart @@ -8,6 +8,7 @@ import 'package:star_lock/app_settings/app_colors.dart'; import 'package:star_lock/flavors.dart'; import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_list_page.dart'; import 'package:star_lock/tools/aliyunRealNameAuth/aliyunRealNameAuthHandle.dart'; +import 'package:star_lock/tools/showCupertinoAlertView.dart'; import 'package:star_lock/tools/showTipView.dart'; import 'package:star_lock/widget/flavors_img.dart'; @@ -641,7 +642,14 @@ class _LockDetailPageState extends State ? true : false, child: GestureDetector( - onTap: () {}, + onTap: () { + ShowCupertinoAlertView() + .isToRemoteUnLockAlert((idCard, name) { + if (state.keyInfos.value.hasGateway != 1) { + logic.showToast('附近没有可用网关'); + } + }); + }, child: Align( alignment: const Alignment(0.6, 1), child: FlavorsImg( diff --git a/star_lock/lib/tools/showCupertinoAlertView.dart b/star_lock/lib/tools/showCupertinoAlertView.dart index 8e35501e..ddca72fd 100644 --- a/star_lock/lib/tools/showCupertinoAlertView.dart +++ b/star_lock/lib/tools/showCupertinoAlertView.dart @@ -1,11 +1,12 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/appRouters.dart'; import 'package:star_lock/app_settings/app_colors.dart'; -typedef AuthInfoCallback = void Function(String idCard, String name); +typedef AuthInfoCallback = void Function(String? idCard, String? name); class ShowCupertinoAlertView { //微信公众号二维码弹窗 @@ -256,6 +257,10 @@ class ShowCupertinoAlertView { CupertinoDialogAction( onPressed: () { // 在这里处理确认按钮的逻辑 + if (idCard.isEmpty || name.isEmpty) { + EasyLoading.showToast('请输入身份证号和真实姓名'.tr); + return; + } callback(idCard, name); Get.back(); }, @@ -269,4 +274,39 @@ class ShowCupertinoAlertView { }, ); } + + //是否要远程开锁弹窗 + void isToRemoteUnLockAlert(AuthInfoCallback callback) { + showCupertinoDialog( + context: Get.context!, + builder: (BuildContext context) { + return CupertinoAlertDialog( + title: Container(), + content: Text('是否要远程开锁?'.tr), + actions: [ + CupertinoDialogAction( + onPressed: () { + Get.back(); + }, + child: Text( + '取消'.tr, + style: TextStyle(color: AppColors.mainColor), + ), + ), + CupertinoDialogAction( + onPressed: () { + // 在这里处理确认按钮的逻辑 + callback(null, null); + Get.back(); + }, + child: Text( + '远程开锁'.tr, + style: TextStyle(color: AppColors.mainColor), + ), + ), + ], + ); + }, + ); + } }