From 22368566f2ab356995e83d6f5f9392e0c77a7494 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cante=E2=80=9D?= <“448468458@qq.com”> Date: Wed, 10 Apr 2024 17:18:53 +0800 Subject: [PATCH 1/4] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E5=9B=BD?= =?UTF-8?q?=E9=99=85=E5=8C=96=E7=9A=84=E4=BD=BF=E7=94=A8=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- star_lock/images/lan/lan_en.json | 32 +++++++-------- star_lock/images/lan/lan_keys.json | 32 +++++++-------- star_lock/images/lan/lan_zh.json | 32 +++++++-------- star_lock/lib/network/api_provider_base.dart | 29 ++++++++------ .../lib/permission/permission_dialog.dart | 39 +++++++------------ 5 files changed, 80 insertions(+), 84 deletions(-) diff --git a/star_lock/images/lan/lan_en.json b/star_lock/images/lan/lan_en.json index d775c007..53fef00e 100644 --- a/star_lock/images/lan/lan_en.json +++ b/star_lock/images/lan/lan_en.json @@ -616,20 +616,20 @@ "请填写信息": "Please fill in the information", - "permission_dialog_camera": "camera", - "permission_dialog_photos": "photos", - "permission_dialog_storage": "storage", - "permission_dialog_location": "location", - "permission_dialog_camera_text": "Access to the camera is required to take photos and upload files, such as uploading a profile picture", - "permission_dialog_photos_text": "Access to camera is required to upload files and avatars using album images", - "permission_dialog_storage_text": "Access to read and write permissions is required to upload avatars using local images", - "permission_dialog_location_text": "Access to location information is required to use the add key function", - "permission_dialog_application": "application", - "permission_dialog_authority": "permission", - "permission_dialog_not_allowed": "Not Allowed", - "permission_dialog_allowed": "Allowed", - "permission_dialog_permission_denied": "Permission denied", - "permission_dialog_open_permissions": "Please manually enable it in the system settings", - "permission_dialog_permission_continue_text": "Permission to continue using the application.", - "permission_dialog_go_set_up": "Go set it up" + "相机": "camera", + "相册": "photos", + "读写": "storage", + "定位": "location", + "需要访问相机权限才能拍照上传文件例如头像上传": "Access to the camera is required to take photos and upload files, such as uploading a profile picture", + "需要访问相机权限才能使用相册图片上传文件上传头像": "Access to camera is required to upload files and avatars using album images", + "需要访问读写权限才能使用本地图片上传头像": "Access to read and write permissions is required to upload avatars using local images", + "需要访问定位权限才能使用添加钥匙功能的位置信息": "Access to location information is required to use the add key function", + "申请": "application", + "权限": "permission", + "不允许": "Not Allowed", + "允许": "Allowed", + "权限被拒绝": "Permission denied", + "请手动在系统设置中开启": "Please manually enable it in the system settings", + "权限以继续使用应用": "Permission to continue using the application.", + "去设置": "Go set it up" } diff --git a/star_lock/images/lan/lan_keys.json b/star_lock/images/lan/lan_keys.json index 0cbfcb97..44de7df0 100644 --- a/star_lock/images/lan/lan_keys.json +++ b/star_lock/images/lan/lan_keys.json @@ -616,20 +616,20 @@ "还未获取到位置信息哦,请耐心等待一下!": "还未获取到位置信息哦,请耐心等待一下!", "请填写信息": "请填写信息", - "permission_dialog_camera": "相机", - "permission_dialog_photos": "相册", - "permission_dialog_storage": "读写", - "permission_dialog_location": "定位", - "permission_dialog_camera_text": "需要访问相机权限才能拍照上传文件例如头像上传", - "permission_dialog_photos_text": "需要访问相机权限才能使用相册图片上传文件上传头像", - "permission_dialog_storage_text": "需要访问读写权限才能使用本地图片上传头像", - "permission_dialog_location_text": "需要访问定位权限才能使用添加钥匙功能的位置信息", - "permission_dialog_application": "申请", - "permission_dialog_authority": "权限", - "permission_dialog_not_allowed": "不允许", - "permission_dialog_allowed": "允许", - "permission_dialog_permission_denied": "权限被拒绝", - "permission_dialog_open_permissions": "请手动在系统设置中开启", - "permission_dialog_permission_continue_text": "权限以继续使用应用。", - "permission_dialog_go_set_up": "去设置" + "相机": "相机", + "相册": "相册", + "读写": "读写", + "定位": "定位", + "需要访问相机权限才能拍照上传文件例如头像上传": "需要访问相机权限才能拍照上传文件例如头像上传", + "需要访问相机权限才能使用相册图片上传文件上传头像": "需要访问相机权限才能使用相册图片上传文件上传头像", + "需要访问读写权限才能使用本地图片上传头像": "需要访问读写权限才能使用本地图片上传头像", + "需要访问定位权限才能使用添加钥匙功能的位置信息": "需要访问定位权限才能使用添加钥匙功能的位置信息", + "申请": "申请", + "权限": "权限", + "不允许": "不允许", + "允许": "允许", + "权限被拒绝": "权限被拒绝", + "请手动在系统设置中开启": "请手动在系统设置中开启", + "权限以继续使用应用": "权限以继续使用应用。", + "去设置": "去设置" } diff --git a/star_lock/images/lan/lan_zh.json b/star_lock/images/lan/lan_zh.json index 91e8c838..f08ef3e9 100644 --- a/star_lock/images/lan/lan_zh.json +++ b/star_lock/images/lan/lan_zh.json @@ -617,20 +617,20 @@ "还未获取到位置信息哦,请耐心等待一下!": "还未获取到位置信息哦,请耐心等待一下!", "请填写信息": "请填写信息", - "permission_dialog_camera": "相机", - "permission_dialog_photos": "相册", - "permission_dialog_storage": "读写", - "permission_dialog_location": "定位", - "permission_dialog_camera_text": "需要访问相机权限才能拍照上传文件例如头像上传", - "permission_dialog_photos_text": "需要访问相机权限才能使用相册图片上传文件上传头像", - "permission_dialog_storage_text": "需要访问读写权限才能使用本地图片上传头像", - "permission_dialog_location_text": "需要访问定位权限才能使用添加钥匙功能的位置信息", - "permission_dialog_application": "申请", - "permission_dialog_authority": "权限", - "permission_dialog_not_allowed": "不允许", - "permission_dialog_allowed": "允许", - "permission_dialog_permission_denied": "权限被拒绝", - "permission_dialog_open_permissions": "请手动在系统设置中开启", - "permission_dialog_permission_continue_text": "权限以继续使用应用。", - "permission_dialog_go_set_up": "去设置" + "相机": "相机", + "相册": "相册", + "读写": "读写", + "定位": "定位", + "需要访问相机权限才能拍照上传文件例如头像上传": "需要访问相机权限才能拍照上传文件例如头像上传", + "需要访问相机权限才能使用相册图片上传文件上传头像": "需要访问相机权限才能使用相册图片上传文件上传头像", + "需要访问读写权限才能使用本地图片上传头像": "需要访问读写权限才能使用本地图片上传头像", + "需要访问定位权限才能使用添加钥匙功能的位置信息": "需要访问定位权限才能使用添加钥匙功能的位置信息", + "申请": "申请", + "权限": "权限", + "不允许": "不允许", + "允许": "允许", + "权限被拒绝": "权限被拒绝", + "请手动在系统设置中开启": "请手动在系统设置中开启", + "权限以继续使用应用": "权限以继续使用应用。", + "去设置": "去设置" } diff --git a/star_lock/lib/network/api_provider_base.dart b/star_lock/lib/network/api_provider_base.dart index e38b52b6..6cb02bc7 100644 --- a/star_lock/lib/network/api_provider_base.dart +++ b/star_lock/lib/network/api_provider_base.dart @@ -22,22 +22,24 @@ class BaseProvider extends GetConnect with Api { } @override - Future> post(String? url, body, - {String? contentType = "application/json", - Map? headers, - Map? query, - Decoder? decoder, - bool? isUnUploadFile = true, - Progress? uploadProgress, - bool? isUnShowLoading = false,// 是否显示loading - bool? isUserBaseUrl = true,// 文件上传不使用baseUrl - }) async { + Future> post( + String? url, + body, { + String? contentType = "application/json", + Map? headers, + Map? query, + Decoder? decoder, + bool? isUnUploadFile = true, + Progress? uploadProgress, + bool? isUnShowLoading = false, // 是否显示loading + bool? isUserBaseUrl = true, // 文件上传不使用baseUrl + }) async { // print("post: url:${url} body:${body} contentType:${contentType} headers:${headers} query:${query}"); if (isUnShowLoading == false) EasyLoading.show(); // print('请求url======>$url'); - if (isUserBaseUrl == false){ + if (isUserBaseUrl == false) { httpClient.baseUrl = ''; - }else{ + } else { httpClient.baseUrl = '${F.apiPrefix}/api'; } print('请求body体======>$body'); @@ -51,6 +53,9 @@ class BaseProvider extends GetConnect with Api { if (res.body == null) { if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); // EasyLoading.showToast("Network Error!", duration: 2000.milliseconds); + if (res.statusCode == null) { + EasyLoading.showToast("Network Error!", duration: 2000.milliseconds); + } var rs = { "errorMsg": "Network Error!", "errorCode": -1, diff --git a/star_lock/lib/permission/permission_dialog.dart b/star_lock/lib/permission/permission_dialog.dart index 6b4469b6..246db99e 100644 --- a/star_lock/lib/permission/permission_dialog.dart +++ b/star_lock/lib/permission/permission_dialog.dart @@ -8,21 +8,17 @@ import 'package:star_lock/translations/trans_lib.dart'; class PermissionDialog { static Map titles = { - Permission.camera: TranslationLoader.lanKeys!.permissionDialogCamera!.tr, - Permission.photos: TranslationLoader.lanKeys!.permissionDialogPhotos!.tr, - Permission.storage: TranslationLoader.lanKeys!.permissionDialogStorage!.tr, - Permission.location: - TranslationLoader.lanKeys!.permissionDialogLocation!.tr, + Permission.camera: '相机'.tr, + Permission.photos: '相册'.tr, + Permission.storage: '读写'.tr, + Permission.location: '定位'.tr, }; static Map contents = { - Permission.camera: - TranslationLoader.lanKeys!.permissionDialogCameraText!.tr, - Permission.photos: TranslationLoader.lanKeys!.permissionDialogPhotos!.tr, - Permission.storage: - TranslationLoader.lanKeys!.permissionDialogStorageText!.tr, - Permission.location: - TranslationLoader.lanKeys!.permissionDialogLocationText!.tr, + Permission.camera: '需要访问相机权限才能拍照上传文件例如头像上传'.tr, + Permission.photos: '需要访问相机权限才能使用相册图片上传文件上传头像'.tr, + Permission.storage: '需要访问读写权限才能使用本地图片上传头像'.tr, + Permission.location: '需要访问定位权限才能使用添加钥匙功能的位置信息'.tr, }; //显示权限判断申请框 @@ -40,20 +36,17 @@ class PermissionDialog { return PopScope( canPop: false, child: CupertinoAlertDialog( - title: Text( - '${TranslationLoader.lanKeys!.permissionDialogApplication!.tr}${titles[permission] ?? ''}${TranslationLoader.lanKeys!.permissionDialogAuthority!.tr}'), + title: Text('${'申请'.tr}${titles[permission] ?? ''}${'权限'.tr}'), content: Text(contents[permission] ?? ''), actions: [ CupertinoDialogAction( - child: Text(TranslationLoader - .lanKeys!.permissionDialogNotAllowed!.tr), + child: Text('不允许'.tr), onPressed: () { Get.back(result: false); }, ), CupertinoDialogAction( - child: Text( - TranslationLoader.lanKeys!.permissionDialogAllowed!.tr), + child: Text('允许'.tr), onPressed: () { Get.back(result: true); }, @@ -62,7 +55,7 @@ class PermissionDialog { )); }, ); - if(application){ + if (application) { await Storage.setString(titles[permission], titles[permission]); } } else if (cache is String) { @@ -89,14 +82,12 @@ class PermissionDialog { return PopScope( canPop: false, child: CupertinoAlertDialog( - title: Text( - '${titles[permission] ?? ''}${TranslationLoader.lanKeys!.permissionDialogPermissionDenied!.tr}'), + title: Text('${titles[permission] ?? ''}${'权限被拒绝'.tr}'), content: Text( - '${contents[permission] ?? ''},${TranslationLoader.lanKeys!.permissionDialogOpenPermissions!.tr}${titles[permission]}${TranslationLoader.lanKeys!.permissionDialogCameraText!.tr}'), + '${contents[permission] ?? ''},${'请手动在系统设置中开启'.tr}${titles[permission]}${'权限以继续使用应用'.tr}'), actions: [ CupertinoDialogAction( - child: Text( - TranslationLoader.lanKeys!.permissionDialogGoSetUp!.tr), + child: Text('去设置'.tr), onPressed: () { Get.back(); // 关闭对话框 openAppSettings(); // 打开系统设置页面 From 12d2c70da3dcca8275ffd1131d22183d80bfb557 Mon Sep 17 00:00:00 2001 From: Daisy <> Date: Wed, 10 Apr 2024 18:01:05 +0800 Subject: [PATCH 2/4] =?UTF-8?q?1=EF=BC=8C=E6=96=B0=E5=A2=9E=E8=99=B9?= =?UTF-8?q?=E8=86=9C=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2=202=EF=BC=8C?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=89=8B=E6=8E=8C=E8=AF=A6=E6=83=85=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=203=EF=BC=8C=E4=BF=AE=E5=A4=8D=E4=BA=BA=E8=84=B8?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E7=82=B9=E5=87=BB=E6=9C=89=E6=95=88=E6=9C=9F?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../face/faceDetail/faceDetail_logic.dart | 30 +- .../face/faceDetail/faceDetail_page.dart | 208 +++------ .../face/faceDetail/faceDetail_state.dart | 12 +- .../iris/irisDetail/irisDetail_logic.dart | 214 +++++++++ .../iris/irisDetail/irisDetail_page.dart | 416 ++++++++++++++++++ .../iris/irisDetail/irisDetail_state.dart | 47 ++ .../iris/irisList/irisList_logic.dart | 4 +- .../palm/palmDetail/palmDetail_logic.dart | 213 +++++++++ .../palm/palmDetail/palmDetail_page.dart | 301 +++++++++++++ .../palm/palmDetail/palmDetail_state.dart | 47 ++ 10 files changed, 1337 insertions(+), 155 deletions(-) diff --git a/star_lock/lib/main/lockDetail/face/faceDetail/faceDetail_logic.dart b/star_lock/lib/main/lockDetail/face/faceDetail/faceDetail_logic.dart index 71b796d5..05352a33 100644 --- a/star_lock/lib/main/lockDetail/face/faceDetail/faceDetail_logic.dart +++ b/star_lock/lib/main/lockDetail/face/faceDetail/faceDetail_logic.dart @@ -7,6 +7,7 @@ import 'package:star_lock/blue/io_protocol/io_addFace.dart'; import 'package:star_lock/blue/io_type.dart'; import 'package:star_lock/main/lockDetail/face/faceDetail/faceDetail_state.dart'; import 'package:star_lock/tools/baseGetXController.dart'; +import 'package:star_lock/tools/dateTool.dart'; import '../../../../blue/blue_manage.dart'; import '../../../../blue/io_reply.dart'; import '../../../../blue/io_tool/io_tool.dart'; @@ -30,6 +31,20 @@ class FaceDetailLogic extends BaseGetXController { }); } + String getKeyTypeShowDateTime() { + String useDateStr = ''; + if (state.keyType.value == 1) { + useDateStr = "永久"; + } else if (state.keyType.value == 2) { + useDateStr = + "${DateTool().dateToYMDHNString(state.startDate.value)}\n${DateTool().dateToYMDHNString(state.endDate.value)}"; + } else if (state.keyType.value == 4) { + useDateStr = + "${DateTool().dateToYMDString(state.startDate.value)}\n${DateTool().dateToYMDString(state.endDate.value)}"; + } + return useDateStr; + } + // 添加人脸开始 Future _replyAddFaceBegin(Reply reply) async { int status = reply.data[2]; @@ -62,8 +77,8 @@ class FaceDetailLogic extends BaseGetXController { userID: userID, faceNo: int.parse(state.typeNumber.value), useCountLimit: 0, - startTime: state.effectiveDateTime.value, - endTime: state.failureDateTime.value, + startTime: int.parse(state.startDate.value), + endTime: int.parse(state.endDate.value), needAuthor: 1, publicKey: publicKeyDataList, privateKey: getPrivateKeyList, @@ -119,14 +134,15 @@ class FaceDetailLogic extends BaseGetXController { userID: userID, faceNo: int.parse(state.typeNumber.value), useCountLimit: 0, - startTime: state.effectiveDateTime.value, - endTime: state.failureDateTime.value, + startTime: int.parse(state.startDate.value), + endTime: int.parse(state.endDate.value), needAuthor: 1, publicKey: publicKeyDataList, privateKey: getPrivateKeyList, token: getTokenList, ); - } else if (deviceConnectionState == BluetoothConnectionState.disconnected) { + } else if (deviceConnectionState == + BluetoothConnectionState.disconnected) { dismissEasyLoading(); cancelBlueConnetctToastTimer(); state.sureBtnState.value = 0; @@ -170,8 +186,8 @@ class FaceDetailLogic extends BaseGetXController { var entity = await ApiRepository.to.updateFaceValidity( lockId: state.faceItemData.value.lockId!, faceId: state.faceItemData.value.faceId!, - startDate: state.effectiveDateTime.value, - endDate: state.failureDateTime.value, + startDate: int.parse(state.startTime.value), + endDate: int.parse(state.endTime.value), ); if (entity.errorCode!.codeIsSuccessful) { showToast("修改成功", something: () { diff --git a/star_lock/lib/main/lockDetail/face/faceDetail/faceDetail_page.dart b/star_lock/lib/main/lockDetail/face/faceDetail/faceDetail_page.dart index cd164feb..56dd7b55 100644 --- a/star_lock/lib/main/lockDetail/face/faceDetail/faceDetail_page.dart +++ b/star_lock/lib/main/lockDetail/face/faceDetail/faceDetail_page.dart @@ -12,6 +12,7 @@ import '../../../../tools/commonItem.dart'; import '../../../../tools/dateTool.dart'; import '../../../../tools/showIosTipView.dart'; import '../../../../tools/showTFView.dart'; +import '../../../../tools/storage.dart'; import '../../../../tools/submitBtn.dart'; import '../../../../tools/titleAppBar.dart'; import '../../../../translations/trans_lib.dart'; @@ -35,16 +36,8 @@ class _FaceDetailPageState extends State with RouteAware { barTitle: "人脸详情", haveBack: true, backgroundColor: AppColors.mainColor, - // actionsList: [ - // TextButton( - // child: Text(TranslationLoader.lanKeys!.share!.tr, style: TextStyle(color: Colors.white, fontSize: 24.sp),), - // onPressed: () { - // - // }, - // ), - // ], ), - body: Column( + body: ListView( children: [ Obx(() => CommonItem( leftTitel: "人脸号", @@ -60,40 +53,32 @@ class _FaceDetailPageState extends State with RouteAware { showCupertinoAlertDialog(context); })), Obx(() => Visibility( - visible: (state.keyType.value == 4 || state.keyType.value == 2) + visible: (state.keyType.value == 4 || + state.keyType.value == 2 || + state.keyType.value == 1) ? true : false, child: CommonItem( leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr, allHeight: 70.h, // rightTitle:"2023.09.19 11:27\n2023.09.25 11:27", - rightTitle: state.keyType.value == 1 - ? "永久" - : "${DateTool().dateToYMDHNString(state.effectiveDateTime.value.toString())}\n${DateTool().dateToYMDHNString(state.failureDateTime.value.toString())}", + rightTitle: logic.getKeyTypeShowDateTime(), isHaveDirection: true, isHaveLine: true, action: () async { - // switch(state.type.value){ - // case 0: - // // 卡 - // - // break; - // case 1: - // 当是指纹的时候 - if (state.keyType.value == 2) { + if (state.keyType.value == 2 || state.keyType.value == 1) { // 限时 var data = await Get.toNamed( Routers.otherTypeKeyChangeDatePage, arguments: { - "faceItemData": state.faceItemData.value, - "pushType": 1, + "pushType": 0, + "fingerprintItemData": state.faceItemData.value, }); if (data != null) { setState(() { - state.effectiveDateTime.value = - data["beginTimeTimestamp"]; - state.failureDateTime.value = - data["endTimeTimestamp"]; + state.startDate.value = data["beginTimeTimestamp"]; + state.endDate.value = data["endTimeTimestamp"]; + state.keyType.value = 2; }); } } else if (state.keyType.value == 4) { @@ -101,14 +86,21 @@ class _FaceDetailPageState extends State with RouteAware { var data = await Get.toNamed( Routers.otherTypeKeyChangeValidityDatePage, arguments: { - "faceItemData": state.faceItemData.value, + "pushType": 0, + "fingerprintItemData": state.faceItemData.value, }); if (data != null) { setState(() { - state.effectiveDateTime.value = - data["beginTimeTimestamp"]; - state.failureDateTime.value = - data["endTimeTimestamp"]; + print("state.starDate.value:${data["starDate"]} " + "state.endDate.value:${data["endDate"]} " + "state.starTime.value:${data["starTime"]} " + "state.endTime.value:${data["endTime"]} " + "state.weekDay.value:${data["weekDay"]}"); + + state.startDate.value = data["starDate"]; + state.endDate.value = data["endDate"]; + state.startTime.value = data["starTime"]; + state.endTime.value = data["endTime"]; state.weekDay.value = data["weekDay"]; }); } @@ -120,42 +112,64 @@ class _FaceDetailPageState extends State with RouteAware { leftTitel: TranslationLoader.lanKeys!.effectiveDay!.tr, rightTitle: state.weekDay.value.join(','), isHaveDirection: true, + isHaveLine: true, action: () async { - // 当是人脸的时候 var data = await Get.toNamed( Routers.otherTypeKeyChangeValidityDatePage, arguments: { - "faceItemData": state.faceItemData.value, + "pushType": 0, + "fingerprintItemData": state.faceItemData.value, }); if (data != null) { setState(() { - state.effectiveDateTime.value = - data["beginTimeTimestamp"]; - state.failureDateTime.value = data["endTimeTimestamp"]; + state.startDate.value = data["starDate"]; + state.endDate.value = data["endDate"]; + state.startTime.value = data["starTime"]; + state.endTime.value = data["endTime"]; state.weekDay.value = data["weekDay"]; }); } })))), + Obx(() => Visibility( + visible: state.keyType.value == 4 ? true : false, + child: Obx(() => CommonItem( + leftTitel: "有效时间", + rightTitle: + "${DateTool().dateToHNString(state.startTime.value)}-${DateTool().dateToHNString(state.endTime.value)}", + isHaveDirection: true, + action: () async { + var data = await Get.toNamed( + Routers.otherTypeKeyChangeValidityDatePage, + arguments: { + "pushType": 0, + "fingerprintItemData": state.faceItemData.value, + }); + if (data != null) { + setState(() { + state.startDate.value = data["starDate"]; + state.endDate.value = data["endDate"]; + state.startTime.value = data["starTime"]; + state.endTime.value = data["endTime"]; + state.weekDay.value = data["validityValue"]; + }); + } + })))), Container(height: 10.h), Obx(() => CommonItem( - leftTitel: TranslationLoader.lanKeys!.additive!.tr, - rightTitle: state.adder.value, - isHaveLine: true, - action: () {})), + leftTitel: TranslationLoader.lanKeys!.additive!.tr, + rightTitle: state.adder.value, + )), Obx(() => CommonItem( - leftTitel: TranslationLoader.lanKeys!.addTime!.tr, - rightTitle: - DateTool().dateToYMDHNString(state.addTime.value.toString()), - action: () {})), + leftTitel: TranslationLoader.lanKeys!.addTime!.tr, + rightTitle: DateTool() + .dateToYMDHNString(state.addTime.value.toString()), + )), SizedBox(height: 10.h), - - Container(height: 10.h), CommonItem( leftTitel: TranslationLoader.lanKeys!.operatingRecord!.tr, rightTitle: "", isHaveDirection: true, action: () { - // 人脸 Get.toNamed(Routers.keyOperationRecordPage, arguments: { 'lockId': state.faceItemData.value.lockId.toString(), 'faceId': state.faceItemData.value.faceId.toString() @@ -179,96 +193,6 @@ class _FaceDetailPageState extends State with RouteAware { ); } - // Widget addControlsBtn(int type) { - // List widgetList = []; - // List> routerList = []; - // //卡详情 - // if (type == 0) { - // routerList.add({ - // 'btnTitle': '设置密码', - // 'routerName': Routers.passwordKeyDetailPage, - // 'type': 9 - // }); - // routerList.add({ - // 'btnTitle': '设置指纹', - // 'routerName': Routers.otherTypeKeyManagePage, - // 'type': 1 - // }); - // routerList.add({ - // 'btnTitle': '设置遥控', - // 'routerName': Routers.otherTypeKeyManagePage, - // 'type': 2 - // }); - // } else if (type == 1) { - // //指纹详情 - // routerList.add({ - // 'btnTitle': '设置密码', - // 'routerName': Routers.passwordKeyDetailPage, - // 'type': 9 - // }); - // routerList.add({ - // 'btnTitle': '设置卡', - // 'routerName': Routers.otherTypeKeyManagePage, - // 'type': 0 - // }); - // routerList.add({ - // 'btnTitle': '设置遥控', - // 'routerName': Routers.otherTypeKeyManagePage, - // 'type': 2 - // }); - // } else if (type == 2) { - // //遥控详情 - // routerList.add({ - // 'btnTitle': '设置密码', - // 'routerName': Routers.passwordKeyDetailPage, - // 'type': 9 - // }); - // routerList.add({ - // 'btnTitle': '设置卡', - // 'routerName': Routers.otherTypeKeyManagePage, - // 'type': 0 - // }); - // routerList.add({ - // 'btnTitle': '设置指纹', - // 'routerName': Routers.otherTypeKeyManagePage, - // 'type': 1 - // }); - // } - // - // for (int i = 0; i < routerList.length; i++) { - // widgetList.add(SizedBox( - // width: ScreenUtil().screenWidth - 40.w, - // height: 60.h, - // child: OutlinedButton( - // style: OutlinedButton.styleFrom( - // // backgroundColor: Colors.white, - // side: BorderSide(width: 1, color: AppColors.mainColor)), - // onPressed: () { - // if (routerList[i]['type'] == 9) { - // Navigator.pushNamed(context, Routers.passwordKeyManagePage); - // } else { - // Navigator.pushNamed(context, Routers.otherTypeKeyManagePage, - // arguments: routerList[i]['type']); - // } - // }, - // child: Text( - // routerList[i]['btnTitle'], - // style: TextStyle(color: AppColors.mainColor, fontSize: 24.sp), - // )), - // )); - // - // widgetList.add( - // SizedBox( - // height: 10.h, - // ), - // ); - // } - // - // return Column( - // children: widgetList, - // ); - // } - void showCupertinoAlertDialog(BuildContext context) { showDialog( context: context, @@ -284,8 +208,8 @@ class _FaceDetailPageState extends State with RouteAware { return; } Get.back(); - // 面容 - logic.updateFaceNameData(); + state.typeName.value = state.changeNameController.text; + // logic.editFaceData(); }, cancelClick: () { Get.back(); @@ -301,9 +225,9 @@ class _FaceDetailPageState extends State with RouteAware { return ShowIosTipView( title: "提示", tipTitle: "确定要删除吗?", - sureClick: () { + sureClick: () async { Get.back(); - // 人脸 + String? idStr = await Storage.getUid(); logic.senderAddFace(); }, cancelClick: () { diff --git a/star_lock/lib/main/lockDetail/face/faceDetail/faceDetail_state.dart b/star_lock/lib/main/lockDetail/face/faceDetail/faceDetail_state.dart index c56cefc8..7a47f81c 100644 --- a/star_lock/lib/main/lockDetail/face/faceDetail/faceDetail_state.dart +++ b/star_lock/lib/main/lockDetail/face/faceDetail/faceDetail_state.dart @@ -9,8 +9,10 @@ class FaceDetailState { final typeNumber = "".obs; // 人脸号 final typeName = "".obs; // 人脸名字 - var effectiveDateTime = 0.obs; // 生效时间 - var failureDateTime = 0.obs; // 失效时间 + var startDate = "".obs; // 开始时间 + var endDate = "".obs; // 结束时间 + var startTime = "".obs; // 生效时间 + var endTime = "".obs; // 失效时间 final keyType = 0.obs; // 永久:1;限时2,单次3,循环:4 var weekDay = [].obs; // 有效日 var adder = "".obs; // 添加者 @@ -27,8 +29,10 @@ class FaceDetailState { typeNumber.value = faceItemData.value.faceNumber!; typeName.value = faceItemData.value.faceName!; changeNameController.text = typeName.value; - effectiveDateTime.value = faceItemData.value.startDate!; - failureDateTime.value = faceItemData.value.endDate!; + startDate.value = faceItemData.value.startDate!.toString(); + endDate.value = faceItemData.value.endDate!.toString(); + startTime.value = faceItemData.value.startDate!.toString(); + endTime.value = faceItemData.value.endDate!.toString(); keyType.value = faceItemData.value.faceType!; adder.value = faceItemData.value.senderUsername!; addTime.value = faceItemData.value.createDate!; diff --git a/star_lock/lib/main/lockDetail/iris/irisDetail/irisDetail_logic.dart b/star_lock/lib/main/lockDetail/iris/irisDetail/irisDetail_logic.dart index e69de29b..39408697 100644 --- a/star_lock/lib/main/lockDetail/iris/irisDetail/irisDetail_logic.dart +++ b/star_lock/lib/main/lockDetail/iris/irisDetail/irisDetail_logic.dart @@ -0,0 +1,214 @@ +import 'dart:async'; + +// import 'package:flutter_reactive_ble/flutter_reactive_ble.dart'; +import 'package:flutter_blue_plus/flutter_blue_plus.dart'; +import 'package:get/get.dart'; +import 'package:star_lock/blue/io_type.dart'; +import 'package:star_lock/main/lockDetail/iris/irisDetail/irisDetail_state.dart'; +import 'package:star_lock/tools/baseGetXController.dart'; +import 'package:star_lock/tools/eventBusEventManage.dart'; + +import '../../../../blue/blue_manage.dart'; +import '../../../../blue/io_protocol/io_addICCard.dart'; +import '../../../../blue/io_reply.dart'; +import '../../../../blue/io_tool/io_tool.dart'; +import '../../../../blue/io_tool/manager_event_bus.dart'; +import '../../../../blue/sender_manage.dart'; +import '../../../../network/api_repository.dart'; +import '../../../../tools/dateTool.dart'; +import '../../../../tools/storage.dart'; + +class IrisDetailLogic extends BaseGetXController { + IrisDetailState state = IrisDetailState(); + + // 监听设备返回的数据 + late StreamSubscription _replySubscription; + void _initReplySubscription() { + _replySubscription = + EventBusManager().eventBus!.on().listen((reply) async { + // 添加卡片开始(重置锁里面所有卡) + if ((reply is SenderAddICCardReply)) { + _replyAddICCardBegin(reply); + } + }); + } + + // 添加卡片开始(此处用作删除卡片) + Future _replyAddICCardBegin(Reply reply) async { + int status = reply.data[2]; + print("_replyAddFingerprintStatus:$status"); + + switch (status) { + case 0x00: + //成功 + print("${reply.commandType!.typeValue} 数据解析成功"); + cancelBlueConnetctToastTimer(); + dismissEasyLoading(); + deletICCardData(); + break; + case 0x06: + //无权限 + print("${reply.commandType!.typeValue} 需要鉴权"); + var privateKey = await Storage.getStringList(saveBluePrivateKey); + List getPrivateKeyList = changeStringListToIntList(privateKey!); + + var publicKey = await Storage.getStringList(saveBluePublicKey); + List publicKeyDataList = changeStringListToIntList(publicKey!); + + var token = await Storage.getStringList(saveBlueToken); + List getTokenList = changeStringListToIntList(token!); + + String? userID = await Storage.getUid(); + IoSenderManage.senderAddICCardCommand( + keyID: state.keyId.value.toString(), + userID: userID, + cardNo: int.parse(state.typeNumber.value), + useCountLimit: 0, + startTime: int.parse(state.starDate.value), + endTime: int.parse(state.endDate.value), + needAuthor: 1, + publicKey: publicKeyDataList, + privateKey: getPrivateKeyList, + token: getTokenList, + ); + break; + case 0x07: + //无权限 + print("${reply.commandType!.typeValue} 用户无权限"); + + break; + case 0x09: + // 权限校验错误 + print("${reply.commandType!.typeValue} 权限校验错误"); + + break; + default: + //失败 + print("${reply.commandType!.typeValue} 失败"); + + break; + } + } + + // 添加卡片 + Future senderAddICCard() async { + if (state.sureBtnState.value == 1) { + return; + } + state.sureBtnState.value = 1; + + showEasyLoading(); + showBlueConnetctToastTimer(action: () { + dismissEasyLoading(); + state.sureBtnState.value = 0; + }); + BlueManage().bludSendData(BlueManage().connectDeviceName, + (BluetoothConnectionState deviceConnectionState) async { + if (deviceConnectionState == BluetoothConnectionState.connected) { + var publicKey = await Storage.getStringList(saveBluePublicKey); + List publicKeyDataList = changeStringListToIntList(publicKey!); + + var privateKey = await Storage.getStringList(saveBluePrivateKey); + List getPrivateKeyList = changeStringListToIntList(privateKey!); + + var token = await Storage.getStringList(saveBlueToken); + List getTokenList = changeStringListToIntList(token!); + print("openDoorTokenPubToken:$getTokenList"); + + String? userID = await Storage.getUid(); + IoSenderManage.senderAddICCardCommand( + keyID: state.keyId.value.toString(), + userID: userID, + cardNo: int.parse(state.typeNumber.value), + useCountLimit: 0, + startTime: int.parse(state.starDate.value), + endTime: int.parse(state.endDate.value), + needAuthor: 1, + publicKey: publicKeyDataList, + privateKey: getPrivateKeyList, + token: getTokenList, + ); + } else if (deviceConnectionState == + BluetoothConnectionState.disconnected) { + dismissEasyLoading(); + cancelBlueConnetctToastTimer(); + state.sureBtnState.value = 0; + if (state.ifCurrentScreen.value == true) { + showBlueConnetctToast(); + } + } + }); + } + + // 编辑iC卡 + void editICCardData() async { + var entity = await ApiRepository.to.editICCardData( + cardId: state.keyId.value.toString(), + lockId: state.fingerprintItemData.value.lockId.toString(), + weekDay: state.weekDay.value, + startDate: state.starDate.value * 1000, + endDate: state.endDate.value * 1000, + isCoerced: state.isStressFingerprint.value ? "2" : "1", + cardName: state.changeNameController.text, + changeType: "1", + startTime: int.parse(state.starTime.value), + endTime: int.parse(state.endTime.value), + cardType: state.keyType.value, + ); + if (entity.errorCode!.codeIsSuccessful) { + showToast("修改成功", something: () { + eventBus.fire(OtherTypeRefreshListEvent()); + }); + } + } + + // 删除IC卡 + void deletICCardData() async { + var entity = await ApiRepository.to.deletIcCardData( + cardId: state.fingerprintItemData.value.cardId.toString(), + lockId: state.fingerprintItemData.value.lockId.toString(), + type: "0", + deleteType: "1"); + if (entity.errorCode!.codeIsSuccessful) { + showToast("删除成功", something: () { + Get.back(result: "addScuess"); + }); + } + } + + String getKeyTypeShowDateTime() { + String useDateStr = ''; + if (state.keyType.value == 1) { + useDateStr = "永久"; + } else if (state.keyType.value == 2) { + useDateStr = + "${DateTool().dateToYMDHNString(state.starDate.value)}\n${DateTool().dateToYMDHNString(state.endDate.value)}"; + } else if (state.keyType.value == 4) { + useDateStr = + "${DateTool().dateToYMDString(state.starDate.value)}\n${DateTool().dateToYMDString(state.endDate.value)}"; + } + return useDateStr; + } + + @override + void onReady() { + // TODO: implement onReady + super.onReady(); + + _initReplySubscription(); + } + + @override + void onInit() { + // TODO: implement onInit + super.onInit(); + } + + @override + void onClose() { + // TODO: implement onClose + super.onClose(); + + _replySubscription.cancel(); + } +} diff --git a/star_lock/lib/main/lockDetail/iris/irisDetail/irisDetail_page.dart b/star_lock/lib/main/lockDetail/iris/irisDetail/irisDetail_page.dart index e69de29b..52798347 100644 --- a/star_lock/lib/main/lockDetail/iris/irisDetail/irisDetail_page.dart +++ b/star_lock/lib/main/lockDetail/iris/irisDetail/irisDetail_page.dart @@ -0,0 +1,416 @@ +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/main/lockDetail/iris/irisDetail/irisDetail_logic.dart'; + +import '../../../../appRouters.dart'; +import '../../../../app_settings/app_colors.dart'; +import '../../../../blue/blue_manage.dart'; +import '../../../../tools/appRouteObserver.dart'; +import '../../../../tools/commonItem.dart'; +import '../../../../tools/dateTool.dart'; +import '../../../../tools/showIosTipView.dart'; +import '../../../../tools/showTFView.dart'; +import '../../../../tools/storage.dart'; +import '../../../../tools/submitBtn.dart'; +import '../../../../tools/titleAppBar.dart'; +import '../../../../translations/trans_lib.dart'; + +class CardDetailPage extends StatefulWidget { + const CardDetailPage({Key? key}) : super(key: key); + + @override + State createState() => _CardDetailPageState(); +} + +class _CardDetailPageState extends State with RouteAware { + final logic = Get.put(IrisDetailLogic()); + final state = Get.find().state; + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: AppColors.mainBackgroundColor, + appBar: TitleAppBar( + barTitle: "虹膜详情", + haveBack: true, + backgroundColor: AppColors.mainColor, + ), + body: ListView( + children: [ + Obx(() => CommonItem( + leftTitel: + "${TranslationLoader.lanKeys!.card!.tr}${TranslationLoader.lanKeys!.number!.tr}", + rightTitle: state.typeNumber.value, + isHaveDirection: false, + isHaveLine: true)), + Obx(() => CommonItem( + leftTitel: TranslationLoader.lanKeys!.name!.tr, + rightTitle: state.typeName.value, + isHaveDirection: true, + isHaveLine: true, + action: () { + showCupertinoAlertDialog(context); + })), + Obx(() => Visibility( + visible: (state.keyType.value == 4 || + state.keyType.value == 2 || + state.keyType.value == 1) + ? true + : false, + child: CommonItem( + leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr, + allHeight: 70.h, + // rightTitle:"2023.09.19 11:27\n2023.09.25 11:27", + rightTitle: logic.getKeyTypeShowDateTime(), + isHaveDirection: true, + isHaveLine: true, + action: () async { + if (state.keyType.value == 2 || state.keyType.value == 1) { + // 限时 + var data = await Get.toNamed( + Routers.otherTypeKeyChangeDatePage, + arguments: { + "pushType": 0, + "fingerprintItemData": + state.fingerprintItemData.value, + }); + if (data != null) { + setState(() { + state.starDate.value = data["beginTimeTimestamp"]; + state.endDate.value = data["endTimeTimestamp"]; + state.keyType.value = 2; + }); + } + } else if (state.keyType.value == 4) { + // 循环 + var data = await Get.toNamed( + Routers.otherTypeKeyChangeValidityDatePage, + arguments: { + "pushType": 0, + "fingerprintItemData": + state.fingerprintItemData.value, + }); + if (data != null) { + setState(() { + print("state.starDate.value:${data["starDate"]} " + "state.endDate.value:${data["endDate"]} " + "state.starTime.value:${data["starTime"]} " + "state.endTime.value:${data["endTime"]} " + "state.weekDay.value:${data["weekDay"]}"); + + state.starDate.value = data["starDate"]; + state.endDate.value = data["endDate"]; + state.starTime.value = data["starTime"]; + state.endTime.value = data["endTime"]; + state.weekDay.value = data["weekDay"]; + }); + } + } + }))), + Obx(() => Visibility( + visible: state.keyType.value == 4 ? true : false, + child: Obx(() => CommonItem( + leftTitel: TranslationLoader.lanKeys!.effectiveDay!.tr, + rightTitle: state.weekDay.value.join(','), + isHaveDirection: true, + isHaveLine: true, + action: () async { + var data = await Get.toNamed( + Routers.otherTypeKeyChangeValidityDatePage, + arguments: { + "pushType": 0, + "fingerprintItemData": + state.fingerprintItemData.value, + }); + if (data != null) { + setState(() { + state.starDate.value = data["starDate"]; + state.endDate.value = data["endDate"]; + state.starTime.value = data["starTime"]; + state.endTime.value = data["endTime"]; + state.weekDay.value = data["weekDay"]; + }); + } + })))), + Obx(() => Visibility( + visible: state.keyType.value == 4 ? true : false, + child: Obx(() => CommonItem( + leftTitel: "有效时间", + rightTitle: + "${DateTool().dateToHNString(state.starTime.value)}-${DateTool().dateToHNString(state.endTime.value)}", + isHaveDirection: true, + action: () async { + var data = await Get.toNamed( + Routers.otherTypeKeyChangeValidityDatePage, + arguments: { + "pushType": 0, + "fingerprintItemData": + state.fingerprintItemData.value, + }); + if (data != null) { + setState(() { + state.starDate.value = data["starDate"]; + state.endDate.value = data["endDate"]; + state.starTime.value = data["starTime"]; + state.endTime.value = data["endTime"]; + state.weekDay.value = data["validityValue"]; + }); + } + })))), + Container(height: 10.h), + Obx(() => CommonItem( + leftTitel: TranslationLoader.lanKeys!.additive!.tr, + rightTitle: state.adder.value, + )), + Obx(() => CommonItem( + leftTitel: TranslationLoader.lanKeys!.addTime!.tr, + rightTitle: DateTool() + .dateToYMDHNString(state.addTime.value.toString()), + )), + SizedBox(height: 10.h), + Obx(() => CommonItem( + leftTitel: TranslationLoader.lanKeys!.stressCard!.tr, + rightTitle: "", + isTipsImg: false, + isHaveRightWidget: true, + rightWidget: SizedBox( + width: 60.w, height: 50.h, child: _isStressFingerprint()))), + Container(height: 10.h), + CommonItem( + leftTitel: TranslationLoader.lanKeys!.operatingRecord!.tr, + rightTitle: "", + isHaveDirection: true, + action: () { + Get.toNamed(Routers.keyOperationRecordPage, arguments: { + 'lockId': state.fingerprintItemData.value.lockId.toString(), + 'cardId': state.fingerprintItemData.value.cardId.toString() + }); + }), + // SizedBox(height: 40.h), + // addControlsBtn(type), + SizedBox(height: 30.h), + SubmitBtn( + btnName: TranslationLoader.lanKeys!.delete!.tr, + isDelete: true, + borderRadius: 20.w, + margin: EdgeInsets.only( + left: 30.w, right: 30.w, top: 30.w, bottom: 30.w), + padding: EdgeInsets.only(top: 25.w, bottom: 25.w), + onClick: () { + showIosTipViewDialog(context); + }), + ], + ), + ); + } + + //isStressFingerprint false:不是胁迫指纹 ture:胁迫指纹 + CupertinoSwitch _isStressFingerprint() { + return CupertinoSwitch( + activeColor: CupertinoColors.activeBlue, + trackColor: CupertinoColors.systemGrey5, + thumbColor: CupertinoColors.white, + value: state.isStressFingerprint.value, + onChanged: (value) { + setState(() { + state.isStressFingerprint.value = value; + logic.editICCardData(); + }); + }, + ); + } + + // Widget addControlsBtn(int type) { + // List widgetList = []; + // List> routerList = []; + // //卡详情 + // if (type == 0) { + // routerList.add({ + // 'btnTitle': '设置密码', + // 'routerName': Routers.passwordKeyDetailPage, + // 'type': 9 + // }); + // routerList.add({ + // 'btnTitle': '设置指纹', + // 'routerName': Routers.otherTypeKeyManagePage, + // 'type': 1 + // }); + // routerList.add({ + // 'btnTitle': '设置遥控', + // 'routerName': Routers.otherTypeKeyManagePage, + // 'type': 2 + // }); + // } else if (type == 1) { + // //指纹详情 + // routerList.add({ + // 'btnTitle': '设置密码', + // 'routerName': Routers.passwordKeyDetailPage, + // 'type': 9 + // }); + // routerList.add({ + // 'btnTitle': '设置卡', + // 'routerName': Routers.otherTypeKeyManagePage, + // 'type': 0 + // }); + // routerList.add({ + // 'btnTitle': '设置遥控', + // 'routerName': Routers.otherTypeKeyManagePage, + // 'type': 2 + // }); + // } else if (type == 2) { + // //遥控详情 + // routerList.add({ + // 'btnTitle': '设置密码', + // 'routerName': Routers.passwordKeyDetailPage, + // 'type': 9 + // }); + // routerList.add({ + // 'btnTitle': '设置卡', + // 'routerName': Routers.otherTypeKeyManagePage, + // 'type': 0 + // }); + // routerList.add({ + // 'btnTitle': '设置指纹', + // 'routerName': Routers.otherTypeKeyManagePage, + // 'type': 1 + // }); + // } + // + // for (int i = 0; i < routerList.length; i++) { + // widgetList.add(SizedBox( + // width: ScreenUtil().screenWidth - 40.w, + // height: 60.h, + // child: OutlinedButton( + // style: OutlinedButton.styleFrom( + // // backgroundColor: Colors.white, + // side: BorderSide(width: 1, color: AppColors.mainColor)), + // onPressed: () { + // if (routerList[i]['type'] == 9) { + // Navigator.pushNamed(context, Routers.passwordKeyManagePage); + // } else { + // Navigator.pushNamed(context, Routers.otherTypeKeyManagePage, + // arguments: routerList[i]['type']); + // } + // }, + // child: Text( + // routerList[i]['btnTitle'], + // style: TextStyle(color: AppColors.mainColor, fontSize: 24.sp), + // )), + // )); + // + // widgetList.add( + // SizedBox( + // height: 10.h, + // ), + // ); + // } + // + // return Column( + // children: widgetList, + // ); + // } + + void showCupertinoAlertDialog(BuildContext context) { + showDialog( + context: context, + builder: (BuildContext context) { + return ShowTFView( + title: + "${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}", + tipTitle: "", + controller: state.changeNameController, + sureClick: () { + if (state.changeNameController.text.isEmpty) { + logic.showToast("请输入姓名"); + return; + } + Get.back(); + state.typeName.value = state.changeNameController.text; + logic.editICCardData(); + }, + cancelClick: () { + Get.back(); + }, + ); + }); + } + + void showIosTipViewDialog(BuildContext context) { + showDialog( + context: context, + builder: (BuildContext context) { + return ShowIosTipView( + title: "提示", + tipTitle: "确定要删除吗?", + sureClick: () async { + Get.back(); + String? idStr = await Storage.getUid(); + logic.senderAddICCard(); + }, + cancelClick: () { + Get.back(); + }, + ); + }); + } + + @override + void didChangeDependencies() { + // TODO: implement didChangeDependencies + super.didChangeDependencies(); + + /// 路由订阅 + AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!); + } + + @override + void dispose() { + // TODO: implement dispose + /// 取消路由订阅 + AppRouteObserver().routeObserver.unsubscribe(this); + super.dispose(); + } + + /// 从上级界面进入 当前界面即将出现 + @override + void didPush() { + super.didPush(); + print("lockSet===didPush"); + state.ifCurrentScreen.value = true; + } + + /// 返回上一个界面 当前界面即将消失 + @override + void didPop() { + super.didPop(); + print("lockSet===didPop"); + logic.cancelBlueConnetctToastTimer(); + if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); + BlueManage().stopScan(); + state.ifCurrentScreen.value = false; + state.sureBtnState.value = 0; + } + + /// 从下级返回 当前界面即将出现 + @override + void didPopNext() { + super.didPopNext(); + print("lockSet===didPopNext"); + state.ifCurrentScreen.value = true; + } + + /// 进入下级界面 当前界面即将消失 + @override + void didPushNext() { + super.didPushNext(); + print("lockSet===didPushNext"); + logic.cancelBlueConnetctToastTimer(); + if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); + BlueManage().stopScan(); + state.ifCurrentScreen.value = false; + state.sureBtnState.value = 0; + } +} diff --git a/star_lock/lib/main/lockDetail/iris/irisDetail/irisDetail_state.dart b/star_lock/lib/main/lockDetail/iris/irisDetail/irisDetail_state.dart index e69de29b..27b7d125 100644 --- a/star_lock/lib/main/lockDetail/iris/irisDetail/irisDetail_state.dart +++ b/star_lock/lib/main/lockDetail/iris/irisDetail/irisDetail_state.dart @@ -0,0 +1,47 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; + +import '../../fingerprint/fingerprintList/fingerprintListData_entity.dart'; + +class IrisDetailState { + final fingerprintItemData = FingerprintItemData().obs; + + final TextEditingController changeNameController = TextEditingController(); + + var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示 + var sureBtnState = 0.obs; // 0普通状态(可用) 1连接中(不可用) + + final typeNumber = "".obs; // 指纹号 + final typeName = "".obs; // 指纹名字 + var starDate = "".obs; // 开始时间 + var endDate = "".obs; // 结束时间 + var starTime = "".obs; // 生效时间 + var endTime = "".obs; // 失效时间 + final keyType = 0.obs; // 永久:1;限时2,单次3,循环:4 + var weekDay = [].obs; // 有效日 + var adder = "".obs; // 添加者 + var addTime = 0.obs; // 添加时间 + var keyId = 0.obs; // 卡id + + final isStressFingerprint = false.obs; + IrisDetailState() { + Map map = Get.arguments; + if ((map["fingerprintItemData"] != null)) { + fingerprintItemData.value = map["fingerprintItemData"]; + keyId.value = fingerprintItemData.value.cardId!; + typeNumber.value = fingerprintItemData.value.cardNumber!; + typeName.value = fingerprintItemData.value.cardName!; + changeNameController.text = typeName.value; + starDate.value = fingerprintItemData.value.startDate!.toString(); + endDate.value = fingerprintItemData.value.endDate!.toString(); + starTime.value = fingerprintItemData.value.startDate!.toString(); + endTime.value = fingerprintItemData.value.endDate!.toString(); + keyType.value = fingerprintItemData.value.cardType!; + adder.value = fingerprintItemData.value.senderUsername!; + addTime.value = fingerprintItemData.value.createDate!; + isStressFingerprint.value = + fingerprintItemData.value.isCoerced! == 2 ? true : false; + weekDay.value = fingerprintItemData.value.weekDay!; + } + } +} diff --git a/star_lock/lib/main/lockDetail/iris/irisList/irisList_logic.dart b/star_lock/lib/main/lockDetail/iris/irisList/irisList_logic.dart index 7cc4251f..772ca294 100644 --- a/star_lock/lib/main/lockDetail/iris/irisList/irisList_logic.dart +++ b/star_lock/lib/main/lockDetail/iris/irisList/irisList_logic.dart @@ -438,8 +438,8 @@ class IrisListLogic extends BaseGetXController { var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); if (isDemoMode == false) { - _replySubscription.cancel(); - _teamEvent.cancel(); + // _replySubscription.cancel(); + // _teamEvent.cancel(); } } } diff --git a/star_lock/lib/main/lockDetail/palm/palmDetail/palmDetail_logic.dart b/star_lock/lib/main/lockDetail/palm/palmDetail/palmDetail_logic.dart index e69de29b..d8858d24 100644 --- a/star_lock/lib/main/lockDetail/palm/palmDetail/palmDetail_logic.dart +++ b/star_lock/lib/main/lockDetail/palm/palmDetail/palmDetail_logic.dart @@ -0,0 +1,213 @@ +import 'dart:async'; + +import 'package:flutter_blue_plus/flutter_blue_plus.dart'; +import 'package:get/get.dart'; +import 'package:star_lock/blue/io_type.dart'; +import 'package:star_lock/main/lockDetail/palm/palmDetail/palmDetail_state.dart'; +import 'package:star_lock/tools/baseGetXController.dart'; +import 'package:star_lock/tools/eventBusEventManage.dart'; + +import '../../../../blue/blue_manage.dart'; +import '../../../../blue/io_protocol/io_addICCard.dart'; +import '../../../../blue/io_reply.dart'; +import '../../../../blue/io_tool/io_tool.dart'; +import '../../../../blue/io_tool/manager_event_bus.dart'; +import '../../../../blue/sender_manage.dart'; +import '../../../../network/api_repository.dart'; +import '../../../../tools/dateTool.dart'; +import '../../../../tools/storage.dart'; + +class PalmDetailLogic extends BaseGetXController { + PalmDetailState state = PalmDetailState(); + + // 监听设备返回的数据 + late StreamSubscription _replySubscription; + void _initReplySubscription() { + _replySubscription = + EventBusManager().eventBus!.on().listen((reply) async { + // 添加卡片开始(重置锁里面所有卡) + if ((reply is SenderAddICCardReply)) { + _replyAddICCardBegin(reply); + } + }); + } + + // 添加卡片开始(此处用作删除卡片) + Future _replyAddICCardBegin(Reply reply) async { + int status = reply.data[2]; + print("_replyAddFingerprintStatus:$status"); + + switch (status) { + case 0x00: + //成功 + print("${reply.commandType!.typeValue} 数据解析成功"); + cancelBlueConnetctToastTimer(); + dismissEasyLoading(); + deletPalmData(); + break; + case 0x06: + //无权限 + print("${reply.commandType!.typeValue} 需要鉴权"); + var privateKey = await Storage.getStringList(saveBluePrivateKey); + List getPrivateKeyList = changeStringListToIntList(privateKey!); + + var publicKey = await Storage.getStringList(saveBluePublicKey); + List publicKeyDataList = changeStringListToIntList(publicKey!); + + var token = await Storage.getStringList(saveBlueToken); + List getTokenList = changeStringListToIntList(token!); + + String? userID = await Storage.getUid(); + IoSenderManage.senderAddICCardCommand( + keyID: state.keyId.value.toString(), + userID: userID, + cardNo: int.parse(state.typeNumber.value), + useCountLimit: 0, + startTime: int.parse(state.starDate.value), + endTime: int.parse(state.endDate.value), + needAuthor: 1, + publicKey: publicKeyDataList, + privateKey: getPrivateKeyList, + token: getTokenList, + ); + break; + case 0x07: + //无权限 + print("${reply.commandType!.typeValue} 用户无权限"); + + break; + case 0x09: + // 权限校验错误 + print("${reply.commandType!.typeValue} 权限校验错误"); + + break; + default: + //失败 + print("${reply.commandType!.typeValue} 失败"); + + break; + } + } + + // 添加手掌 + Future senderAddPalm() async { + if (state.sureBtnState.value == 1) { + return; + } + state.sureBtnState.value = 1; + + showEasyLoading(); + showBlueConnetctToastTimer(action: () { + dismissEasyLoading(); + state.sureBtnState.value = 0; + }); + BlueManage().bludSendData(BlueManage().connectDeviceName, + (BluetoothConnectionState deviceConnectionState) async { + if (deviceConnectionState == BluetoothConnectionState.connected) { + var publicKey = await Storage.getStringList(saveBluePublicKey); + List publicKeyDataList = changeStringListToIntList(publicKey!); + + var privateKey = await Storage.getStringList(saveBluePrivateKey); + List getPrivateKeyList = changeStringListToIntList(privateKey!); + + var token = await Storage.getStringList(saveBlueToken); + List getTokenList = changeStringListToIntList(token!); + print("openDoorTokenPubToken:$getTokenList"); + + String? userID = await Storage.getUid(); + IoSenderManage.senderAddICCardCommand( + keyID: state.keyId.value.toString(), + userID: userID, + cardNo: int.parse(state.typeNumber.value), + useCountLimit: 0, + startTime: int.parse(state.starDate.value), + endTime: int.parse(state.endDate.value), + needAuthor: 1, + publicKey: publicKeyDataList, + privateKey: getPrivateKeyList, + token: getTokenList, + ); + } else if (deviceConnectionState == + BluetoothConnectionState.disconnected) { + dismissEasyLoading(); + cancelBlueConnetctToastTimer(); + state.sureBtnState.value = 0; + if (state.ifCurrentScreen.value == true) { + showBlueConnetctToast(); + } + } + }); + } + + // 编辑iC卡 + void editPalmData() async { + var entity = await ApiRepository.to.editICCardData( + cardId: state.keyId.value.toString(), + lockId: state.fingerprintItemData.value.lockId.toString(), + weekDay: state.weekDay.value, + startDate: state.starDate.value * 1000, + endDate: state.endDate.value * 1000, + isCoerced: state.isStressFingerprint.value ? "2" : "1", + cardName: state.changeNameController.text, + changeType: "1", + startTime: int.parse(state.starTime.value), + endTime: int.parse(state.endTime.value), + cardType: state.keyType.value, + ); + if (entity.errorCode!.codeIsSuccessful) { + showToast("修改成功", something: () { + eventBus.fire(OtherTypeRefreshListEvent()); + }); + } + } + + // 删除IC卡 + void deletPalmData() async { + var entity = await ApiRepository.to.deletIcCardData( + cardId: state.fingerprintItemData.value.cardId.toString(), + lockId: state.fingerprintItemData.value.lockId.toString(), + type: "0", + deleteType: "1"); + if (entity.errorCode!.codeIsSuccessful) { + showToast("删除成功", something: () { + Get.back(result: "addScuess"); + }); + } + } + + String getKeyTypeShowDateTime() { + String useDateStr = ''; + if (state.keyType.value == 1) { + useDateStr = "永久"; + } else if (state.keyType.value == 2) { + useDateStr = + "${DateTool().dateToYMDHNString(state.starDate.value)}\n${DateTool().dateToYMDHNString(state.endDate.value)}"; + } else if (state.keyType.value == 4) { + useDateStr = + "${DateTool().dateToYMDString(state.starDate.value)}\n${DateTool().dateToYMDString(state.endDate.value)}"; + } + return useDateStr; + } + + @override + void onReady() { + // TODO: implement onReady + super.onReady(); + + _initReplySubscription(); + } + + @override + void onInit() { + // TODO: implement onInit + super.onInit(); + } + + @override + void onClose() { + // TODO: implement onClose + super.onClose(); + + _replySubscription.cancel(); + } +} diff --git a/star_lock/lib/main/lockDetail/palm/palmDetail/palmDetail_page.dart b/star_lock/lib/main/lockDetail/palm/palmDetail/palmDetail_page.dart index e69de29b..77fd9bd0 100644 --- a/star_lock/lib/main/lockDetail/palm/palmDetail/palmDetail_page.dart +++ b/star_lock/lib/main/lockDetail/palm/palmDetail/palmDetail_page.dart @@ -0,0 +1,301 @@ +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/main/lockDetail/iris/irisDetail/irisDetail_logic.dart'; + +import '../../../../appRouters.dart'; +import '../../../../app_settings/app_colors.dart'; +import '../../../../blue/blue_manage.dart'; +import '../../../../tools/appRouteObserver.dart'; +import '../../../../tools/commonItem.dart'; +import '../../../../tools/dateTool.dart'; +import '../../../../tools/showIosTipView.dart'; +import '../../../../tools/showTFView.dart'; +import '../../../../tools/storage.dart'; +import '../../../../tools/submitBtn.dart'; +import '../../../../tools/titleAppBar.dart'; +import '../../../../translations/trans_lib.dart'; + +class PalmDetailPage extends StatefulWidget { + const PalmDetailPage({Key? key}) : super(key: key); + + @override + State createState() => _PalmDetailPageState(); +} + +class _PalmDetailPageState extends State with RouteAware { + final logic = Get.put(IrisDetailLogic()); + final state = Get.find().state; + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: AppColors.mainBackgroundColor, + appBar: TitleAppBar( + barTitle: "手掌详情", + haveBack: true, + backgroundColor: AppColors.mainColor, + ), + body: ListView( + children: [ + Obx(() => CommonItem( + leftTitel: "手掌号", + rightTitle: state.typeNumber.value, + isHaveDirection: false, + isHaveLine: true)), + Obx(() => CommonItem( + leftTitel: TranslationLoader.lanKeys!.name!.tr, + rightTitle: state.typeName.value, + isHaveDirection: true, + isHaveLine: true, + action: () { + showCupertinoAlertDialog(context); + })), + Obx(() => Visibility( + visible: (state.keyType.value == 4 || + state.keyType.value == 2 || + state.keyType.value == 1) + ? true + : false, + child: CommonItem( + leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr, + allHeight: 70.h, + // rightTitle:"2023.09.19 11:27\n2023.09.25 11:27", + rightTitle: logic.getKeyTypeShowDateTime(), + isHaveDirection: true, + isHaveLine: true, + action: () async { + if (state.keyType.value == 2 || state.keyType.value == 1) { + // 限时 + var data = await Get.toNamed( + Routers.otherTypeKeyChangeDatePage, + arguments: { + "pushType": 0, + "fingerprintItemData": + state.fingerprintItemData.value, + }); + if (data != null) { + setState(() { + state.starDate.value = data["beginTimeTimestamp"]; + state.endDate.value = data["endTimeTimestamp"]; + state.keyType.value = 2; + }); + } + } else if (state.keyType.value == 4) { + // 循环 + var data = await Get.toNamed( + Routers.otherTypeKeyChangeValidityDatePage, + arguments: { + "pushType": 0, + "fingerprintItemData": + state.fingerprintItemData.value, + }); + if (data != null) { + setState(() { + print("state.starDate.value:${data["starDate"]} " + "state.endDate.value:${data["endDate"]} " + "state.starTime.value:${data["starTime"]} " + "state.endTime.value:${data["endTime"]} " + "state.weekDay.value:${data["weekDay"]}"); + + state.starDate.value = data["starDate"]; + state.endDate.value = data["endDate"]; + state.starTime.value = data["starTime"]; + state.endTime.value = data["endTime"]; + state.weekDay.value = data["weekDay"]; + }); + } + } + }))), + Obx(() => Visibility( + visible: state.keyType.value == 4 ? true : false, + child: Obx(() => CommonItem( + leftTitel: TranslationLoader.lanKeys!.effectiveDay!.tr, + rightTitle: state.weekDay.value.join(','), + isHaveDirection: true, + isHaveLine: true, + action: () async { + var data = await Get.toNamed( + Routers.otherTypeKeyChangeValidityDatePage, + arguments: { + "pushType": 0, + "fingerprintItemData": + state.fingerprintItemData.value, + }); + if (data != null) { + setState(() { + state.starDate.value = data["starDate"]; + state.endDate.value = data["endDate"]; + state.starTime.value = data["starTime"]; + state.endTime.value = data["endTime"]; + state.weekDay.value = data["weekDay"]; + }); + } + })))), + Obx(() => Visibility( + visible: state.keyType.value == 4 ? true : false, + child: Obx(() => CommonItem( + leftTitel: "有效时间", + rightTitle: + "${DateTool().dateToHNString(state.starTime.value)}-${DateTool().dateToHNString(state.endTime.value)}", + isHaveDirection: true, + action: () async { + var data = await Get.toNamed( + Routers.otherTypeKeyChangeValidityDatePage, + arguments: { + "pushType": 0, + "fingerprintItemData": + state.fingerprintItemData.value, + }); + if (data != null) { + setState(() { + state.starDate.value = data["starDate"]; + state.endDate.value = data["endDate"]; + state.starTime.value = data["starTime"]; + state.endTime.value = data["endTime"]; + state.weekDay.value = data["validityValue"]; + }); + } + })))), + Container(height: 10.h), + Obx(() => CommonItem( + leftTitel: TranslationLoader.lanKeys!.additive!.tr, + rightTitle: state.adder.value, + )), + Obx(() => CommonItem( + leftTitel: TranslationLoader.lanKeys!.addTime!.tr, + rightTitle: DateTool() + .dateToYMDHNString(state.addTime.value.toString()), + )), + SizedBox(height: 10.h), + CommonItem( + leftTitel: TranslationLoader.lanKeys!.operatingRecord!.tr, + rightTitle: "", + isHaveDirection: true, + action: () { + Get.toNamed(Routers.keyOperationRecordPage, arguments: { + 'lockId': state.fingerprintItemData.value.lockId.toString(), + 'cardId': state.fingerprintItemData.value.cardId.toString() + }); + }), + // SizedBox(height: 40.h), + // addControlsBtn(type), + SizedBox(height: 30.h), + SubmitBtn( + btnName: TranslationLoader.lanKeys!.delete!.tr, + isDelete: true, + borderRadius: 20.w, + margin: EdgeInsets.only( + left: 30.w, right: 30.w, top: 30.w, bottom: 30.w), + padding: EdgeInsets.only(top: 25.w, bottom: 25.w), + onClick: () { + showIosTipViewDialog(context); + }), + ], + ), + ); + } + + void showCupertinoAlertDialog(BuildContext context) { + showDialog( + context: context, + builder: (BuildContext context) { + return ShowTFView( + title: + "${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}", + tipTitle: "", + controller: state.changeNameController, + sureClick: () { + if (state.changeNameController.text.isEmpty) { + logic.showToast("请输入姓名"); + return; + } + Get.back(); + state.typeName.value = state.changeNameController.text; + // logic.editICCardData(); + }, + cancelClick: () { + Get.back(); + }, + ); + }); + } + + void showIosTipViewDialog(BuildContext context) { + showDialog( + context: context, + builder: (BuildContext context) { + return ShowIosTipView( + title: "提示", + tipTitle: "确定要删除吗?", + sureClick: () async { + Get.back(); + String? idStr = await Storage.getUid(); + logic.senderAddICCard(); + }, + cancelClick: () { + Get.back(); + }, + ); + }); + } + + @override + void didChangeDependencies() { + // TODO: implement didChangeDependencies + super.didChangeDependencies(); + + /// 路由订阅 + AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!); + } + + @override + void dispose() { + // TODO: implement dispose + /// 取消路由订阅 + AppRouteObserver().routeObserver.unsubscribe(this); + super.dispose(); + } + + /// 从上级界面进入 当前界面即将出现 + @override + void didPush() { + super.didPush(); + print("lockSet===didPush"); + state.ifCurrentScreen.value = true; + } + + /// 返回上一个界面 当前界面即将消失 + @override + void didPop() { + super.didPop(); + print("lockSet===didPop"); + logic.cancelBlueConnetctToastTimer(); + if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); + BlueManage().stopScan(); + state.ifCurrentScreen.value = false; + state.sureBtnState.value = 0; + } + + /// 从下级返回 当前界面即将出现 + @override + void didPopNext() { + super.didPopNext(); + print("lockSet===didPopNext"); + state.ifCurrentScreen.value = true; + } + + /// 进入下级界面 当前界面即将消失 + @override + void didPushNext() { + super.didPushNext(); + print("lockSet===didPushNext"); + logic.cancelBlueConnetctToastTimer(); + if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); + BlueManage().stopScan(); + state.ifCurrentScreen.value = false; + state.sureBtnState.value = 0; + } +} diff --git a/star_lock/lib/main/lockDetail/palm/palmDetail/palmDetail_state.dart b/star_lock/lib/main/lockDetail/palm/palmDetail/palmDetail_state.dart index e69de29b..49fda945 100644 --- a/star_lock/lib/main/lockDetail/palm/palmDetail/palmDetail_state.dart +++ b/star_lock/lib/main/lockDetail/palm/palmDetail/palmDetail_state.dart @@ -0,0 +1,47 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; + +import '../../fingerprint/fingerprintList/fingerprintListData_entity.dart'; + +class PalmDetailState { + final fingerprintItemData = FingerprintItemData().obs; + + final TextEditingController changeNameController = TextEditingController(); + + var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示 + var sureBtnState = 0.obs; // 0普通状态(可用) 1连接中(不可用) + + final typeNumber = "".obs; // 指纹号 + final typeName = "".obs; // 指纹名字 + var starDate = "".obs; // 开始时间 + var endDate = "".obs; // 结束时间 + var starTime = "".obs; // 生效时间 + var endTime = "".obs; // 失效时间 + final keyType = 0.obs; // 永久:1;限时2,单次3,循环:4 + var weekDay = [].obs; // 有效日 + var adder = "".obs; // 添加者 + var addTime = 0.obs; // 添加时间 + var keyId = 0.obs; // 卡id + + final isStressFingerprint = false.obs; + PalmDetailState() { + Map map = Get.arguments; + if ((map["fingerprintItemData"] != null)) { + fingerprintItemData.value = map["fingerprintItemData"]; + keyId.value = fingerprintItemData.value.cardId!; + typeNumber.value = fingerprintItemData.value.cardNumber!; + typeName.value = fingerprintItemData.value.cardName!; + changeNameController.text = typeName.value; + starDate.value = fingerprintItemData.value.startDate!.toString(); + endDate.value = fingerprintItemData.value.endDate!.toString(); + starTime.value = fingerprintItemData.value.startDate!.toString(); + endTime.value = fingerprintItemData.value.endDate!.toString(); + keyType.value = fingerprintItemData.value.cardType!; + adder.value = fingerprintItemData.value.senderUsername!; + addTime.value = fingerprintItemData.value.createDate!; + isStressFingerprint.value = + fingerprintItemData.value.isCoerced! == 2 ? true : false; + weekDay.value = fingerprintItemData.value.weekDay!; + } + } +} From 81a289e2edb010de7629e5ea4f5e13aeac2381fc Mon Sep 17 00:00:00 2001 From: ante <448468458@qq.com> Date: Wed, 10 Apr 2024 18:13:46 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=20google=20=E4=B8=8A?= =?UTF-8?q?=E6=9E=B6=E7=9A=84=E5=AE=A1=E6=A0=B8=E9=97=AE=E9=A2=98=EF=BC=8C?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E8=AE=B0=E5=BD=95=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../doorLockLog/doorLockLog_page.dart | 21 ++----------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/star_lock/lib/main/lockDetail/doorLockLog/doorLockLog_page.dart b/star_lock/lib/main/lockDetail/doorLockLog/doorLockLog_page.dart index b1af4795..84a97d61 100644 --- a/star_lock/lib/main/lockDetail/doorLockLog/doorLockLog_page.dart +++ b/star_lock/lib/main/lockDetail/doorLockLog/doorLockLog_page.dart @@ -35,26 +35,9 @@ class _DoorLockLogPageState extends State { return Scaffold( backgroundColor: AppColors.mainBackgroundColor, appBar: TitleAppBar( - barTitle: TranslationLoader.lanKeys!.doorLockLog!.tr, + barTitle: TranslationLoader.lanKeys!.operatingRecord!.tr, haveBack: true, backgroundColor: AppColors.mainColor, - actionsList: [ - IconButton( - icon: Image.asset( - 'images/icon_bar_more.png', - height: 30.h, - width: 10.w, - ), - onPressed: () async { - var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); - if (isDemoMode == false) { - } else { - // Get.toNamed(Routers.selectLockTypePage); - logic.showToast("演示模式"); - } - }, - ), - ], ), body: Column( mainAxisSize: MainAxisSize.max, @@ -68,7 +51,7 @@ class _DoorLockLogPageState extends State { endIndent: 30.w, ), eventDropDownWidget(), - Expanded(child: Obx(() => timeLineView(state.lockLogItemList.value))) + Expanded(child: Obx(() => timeLineView(state.lockLogItemList))) ], ), ); From 34fd4256d5e6f16ac5368d9a0b95a7f9a24104bc Mon Sep 17 00:00:00 2001 From: ante <448468458@qq.com> Date: Wed, 10 Apr 2024 18:32:11 +0800 Subject: [PATCH 4/4] =?UTF-8?q?fix:=E6=B7=BB=E5=8A=A0=E9=94=81=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=EF=BC=8C=E5=AF=B9=E6=9C=AA=E5=AE=9E=E7=8E=B0=E7=9A=84?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E6=8C=89=E9=92=AE=E6=B7=BB=E5=8A=A0=E7=AE=80?= =?UTF-8?q?=E6=98=93=E7=89=88=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mine/addLock/selectLockType/selectLockType_page.dart | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/star_lock/lib/mine/addLock/selectLockType/selectLockType_page.dart b/star_lock/lib/mine/addLock/selectLockType/selectLockType_page.dart index 33854ea5..64c01a0b 100644 --- a/star_lock/lib/mine/addLock/selectLockType/selectLockType_page.dart +++ b/star_lock/lib/mine/addLock/selectLockType/selectLockType_page.dart @@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:permission_handler/permission_handler.dart'; +import 'package:star_lock/flavors.dart'; import 'package:star_lock/tools/appFirstEnterHandle.dart'; import 'package:star_lock/tools/storage.dart'; @@ -47,10 +48,12 @@ class _SelectLockTypePageState extends State Navigator.pushNamed(context, Routers.addLockPage, arguments: {'getLockType': 1}); }), - lockTypeItem('images/lockType/lockType_NFCLock.png', + if (!F.isLite) + lockTypeItem('images/lockType/lockType_NFCLock.png', TranslationLoader.lanKeys!.NFCPassiveLock!.tr, () { // Navigator.pushNamed(context, Routers.addLockPage); }), + if (!F.isLite) lockTypeItem('images/lockType/lockType_padlock.png', TranslationLoader.lanKeys!.padlock!.tr, () { // Navigator.pushNamed(context, Routers.addLockPage); @@ -76,10 +79,12 @@ class _SelectLockTypePageState extends State // TranslationLoader.lanKeys!.bicycleLock!.tr, () { // Navigator.pushNamed(context, Routers.addLockPage); // }), + if (!F.isLite) lockTypeItem('images/lockType/lockType_gatewayLock.png', TranslationLoader.lanKeys!.gateway!.tr, () { // Navigator.pushNamed(context, Routers.gatewayListPage); }), + if (!F.isLite) lockTypeItem('images/lockType/lockType_camera.png', '网络摄像头', () { // Navigator.pushNamed(context, Routers.gatewayListPage);