1,锁详情页面新增点击远程开锁逻辑处理

2,钥匙详情点击更改实名认证弹窗逻辑优化
This commit is contained in:
Daisy 2024-05-14 09:30:28 +08:00
parent 00c108b412
commit b6a3f5490b
3 changed files with 55 additions and 12 deletions

View File

@ -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 = <String>[];
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,

View File

@ -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<LockDetailPage>
? 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(

View File

@ -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: <Widget>[
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),
),
),
],
);
},
);
}
}