From 43155d2c6723f4005e6ddba13743c1ae5fcc313e Mon Sep 17 00:00:00 2001 From: Daisy <> Date: Thu, 9 May 2024 15:28:51 +0800 Subject: [PATCH 1/5] =?UTF-8?q?1=EF=BC=8C=E5=AE=9E=E5=90=8D=E8=AE=A4?= =?UTF-8?q?=E8=AF=81=E4=BD=BF=E7=94=A8=E8=AE=B0=E5=BD=95=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E5=8F=8A=E5=B8=83=E5=B1=80=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=202=EF=BC=8C=E7=94=B5=E5=AD=90=E9=92=A5=E5=8C=99=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E8=AE=A4=E8=AF=81=E4=BF=A1=E6=81=AF=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=B5=81=E7=A8=8B=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- star_lock/images/lan/lan_zh.json | 2 +- .../electronicKeyDetail_logic.dart | 1 - .../electronicKeyDetail_page.dart | 3 +- .../electronicKeyDetail_state.dart | 2 + .../use_record_list_entity.dart | 127 +++++++++++++++--- .../value_added_services_record_logic.dart | 18 +++ .../value_added_services_record_page.dart | 98 ++++++++++++-- star_lock/lib/network/api_repository.dart | 25 ++-- 8 files changed, 237 insertions(+), 39 deletions(-) diff --git a/star_lock/images/lan/lan_zh.json b/star_lock/images/lan/lan_zh.json index fabe850c..c159b3c3 100644 --- a/star_lock/images/lan/lan_zh.json +++ b/star_lock/images/lan/lan_zh.json @@ -349,7 +349,7 @@ "customMailTemplate":"自定义邮件模版", "record":"记录", - "buyRealNameTip":"给用户发送电子钥匙时,可以要求其开锁前先进行实名认证,以保证是他本人在操作。实名认证调用国家公安系统接口,为付费功能,请购买次数后再使用。", + "buyRealNameTip":"给用户发送电子钥匙时,可以要求其开锁前先进行人脸识别,以保证是他本人在操作。人脸实名认证调用国家公安系统接口,为付费功能,请购买次数后再使用。", "buyRealNameSelectYouWantBuyTip":"请选择你希望的实名认证频数", "forTheFirstTime":"仅首次", "onceDay":"每日一次", 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 4de6dffd..7b7ef394 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 @@ -168,7 +168,6 @@ class ElectronicKeyDetailLogic extends BaseGetXController { showToast("修改成功".tr, something: () { eventBus.fire(ElectronicKeyListRefreshUI()); eventBus.fire(AuthorizedAdminPageRefreshUI()); - Get.back(); }); } } diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart index 9d9b339c..e8e836bc 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart @@ -2,9 +2,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; -import 'package:get/get_rx/src/rx_typedefs/rx_typedefs.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart'; -import 'package:star_lock/tools/showCupertinoAlertView.dart'; import '../../../../../appRouters.dart'; import '../../../../../app_settings/app_colors.dart'; @@ -326,6 +324,7 @@ class _ElectronicKeyDetailPageState extends State { if (alertEnum == ShowAlertEnum.name) { logic.modifyKeyNameRequest(); } else { + Get.back(); logic.updateRealNameInfoRequest(alertEnum); } }, diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_state.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_state.dart index 5b35050e..9337f8bd 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_state.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_state.dart @@ -35,7 +35,9 @@ class ElectronicKeyDetailState { keyName.value = itemData.value.keyName!; if (itemData.value.userIdCard != null) { getRealName.value = itemData.value.userIdCard!.realName ?? ""; + changeRealNameController.text = getRealName.value; getIDCardNumber.value = itemData.value.userIdCard!.idCardNumber ?? ""; + changeIDCardController.text = getIDCardNumber.value; } isRemoteUnlock.value = itemData.value.remoteEnable! == 1 ? true : false; diff --git a/star_lock/lib/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_entity.dart b/star_lock/lib/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_entity.dart index 7af59153..6acd6ea7 100644 --- a/star_lock/lib/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_entity.dart +++ b/star_lock/lib/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_entity.dart @@ -1,25 +1,116 @@ class UseRecordListEntity { - UseRecordListEntity({ - this.description, - this.errorCode, - this.errorMsg, - }); - - UseRecordListEntity.fromJson(dynamic json) { - description = json['description']; - errorCode = json['errorCode']; - errorMsg = json['errorMsg']; - } - - String? description; int? errorCode; + String? description; String? errorMsg; + Data? data; + + UseRecordListEntity( + {this.errorCode, this.description, this.errorMsg, this.data}); + + UseRecordListEntity.fromJson(Map json) { + errorCode = json['errorCode']; + description = json['description']; + errorMsg = json['errorMsg']; + data = json['data'] != null ? Data.fromJson(json['data']) : null; + } Map toJson() { - final map = {}; - map['description'] = description; - map['errorCode'] = errorCode; - map['errorMsg'] = errorMsg; - return map; + final Map data = {}; + data['errorCode'] = errorCode; + data['description'] = description; + data['errorMsg'] = errorMsg; + if (this.data != null) { + data['data'] = this.data!.toJson(); + } + return data; + } +} + +class Data { + int? pageNo; + int? pageSize; + int? total; + List? useRecordList; + + Data({this.pageNo, this.pageSize, this.total, this.useRecordList}); + + Data.fromJson(Map json) { + pageNo = json['pageNo']; + pageSize = json['pageSize']; + total = json['total']; + if (json['list'] != null) { + useRecordList = []; + json['list'].forEach((v) { + useRecordList!.add(UseItemData.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = {}; + data['pageNo'] = pageNo; + data['pageSize'] = pageSize; + data['total'] = total; + if (useRecordList != null) { + data['list'] = useRecordList!.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class UseItemData { + int? id; + int? userId; + String? type; + String? receiverAccount; + String? realName; + int? authStatus; + int? lockId; + String? lockName; + int? consCount; + String? createdAt; + String? updatedAt; + + UseItemData( + {this.id, + this.userId, + this.type, + this.receiverAccount, + this.realName, + this.authStatus, + this.lockId, + this.lockName, + this.consCount, + this.createdAt, + this.updatedAt}); + + UseItemData.fromJson(Map json) { + id = json['id']; + userId = json['user_id']; + type = json['type']; + receiverAccount = json['receiver_account']; + realName = json['real_name']; + authStatus = json['status']; + lockId = json['lock_id']; + lockName = json['lock_name']; + consCount = json['cons_count']; + createdAt = json['created_at']; + updatedAt = json['updated_at']; + } + + Map toJson() { + final Map data = {}; + data['id'] = id; + data['user_id'] = userId; + data['type'] = type; + data['receiver_account'] = receiverAccount; + data['real_name'] = realName; + data['status'] = authStatus; + data['lock_id'] = lockId; + data['lock_name'] = lockName; + data['cons_count'] = consCount; + data['created_at'] = createdAt; + data['updated_at'] = updatedAt; + return data; } } diff --git a/star_lock/lib/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_logic.dart b/star_lock/lib/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_logic.dart index d1c9ec53..f7573588 100644 --- a/star_lock/lib/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_logic.dart +++ b/star_lock/lib/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_logic.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'package:get/get.dart'; import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_entity.dart'; +import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_entity.dart'; import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_state.dart'; import 'package:star_lock/tools/baseGetXController.dart'; import '../../../network/api_repository.dart'; @@ -11,6 +12,7 @@ class ValueAddedServicesRecordLogic extends BaseGetXController { final ValueAddedServicesRecordState state = ValueAddedServicesRecordState(); int buyPageNo = 1; + int usePageNo = 1; late String type; @override @@ -41,10 +43,26 @@ class ValueAddedServicesRecordLogic extends BaseGetXController { } } + //请求使用记录列表 + Future loadUseRecordList(bool load) async { + if (!load) { + usePageNo = 1; + } + UseRecordListEntity entity = await ApiRepository.to.getUseRecordList( + type: type, + pageNo: buyPageNo, + ); + if (entity.errorCode!.codeIsSuccessful) { + state.useRecordList.value = entity.data!.useRecordList!; + state.useRecordList.refresh(); + } + } + @override void onReady() { super.onReady(); loadBuyRecordList(true); + loadUseRecordList(true); } } diff --git a/star_lock/lib/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_page.dart b/star_lock/lib/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_page.dart index b60b9d39..a4cbd4c2 100644 --- a/star_lock/lib/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_page.dart +++ b/star_lock/lib/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_page.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_entity.dart'; +import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_entity.dart'; import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_logic.dart'; import 'package:star_lock/tools/noData.dart'; import '../../../app_settings/app_colors.dart'; @@ -45,10 +46,10 @@ class _ValueAddedServicesRealNamePageState Obx(() => Expanded( child: TabBarView(children: [ _PurchaseRecords( - getRecordList: logic.state.buyRecordList.value, + buyRecordList: logic.state.buyRecordList.value, ), - _PurchaseRecords( - getRecordList: logic.state.useRecordList.value, + _UseRecordsTable( + useRecordList: logic.state.useRecordList.value, ), ]), )), @@ -70,11 +71,11 @@ Widget tabTextItem(String tabText) { ); } -//购买记录、使用记录 +//购买记录 class _PurchaseRecords extends StatefulWidget { - final List getRecordList; + final List buyRecordList; - const _PurchaseRecords({required this.getRecordList}); + const _PurchaseRecords({required this.buyRecordList}); @override State<_PurchaseRecords> createState() => _PurchaseRecordsState(); @@ -88,11 +89,11 @@ class _PurchaseRecordsState extends State<_PurchaseRecords> { return EasyRefresh( onRefresh: () async {}, onLoad: () async {}, - child: widget.getRecordList.isNotEmpty + child: widget.buyRecordList.isNotEmpty ? ListView.builder( - itemCount: widget.getRecordList.length, + itemCount: widget.buyRecordList.length, itemBuilder: (BuildContext context, int index) { - return _recordKeyItem(widget.getRecordList[index]); + return _recordKeyItem(widget.buyRecordList[index]); }) : NoData(), ); @@ -143,3 +144,82 @@ class _PurchaseRecordsState extends State<_PurchaseRecords> { ); } } + +//使用记录 +class _UseRecordsTable extends StatefulWidget { + final List useRecordList; + + const _UseRecordsTable({required this.useRecordList}); + + @override + State<_UseRecordsTable> createState() => _UseRecordsTableState(); +} + +class _UseRecordsTableState extends State<_UseRecordsTable> { + @override + Widget build(BuildContext context) { + return EasyRefresh( + onRefresh: () async {}, + onLoad: () async {}, + child: widget.useRecordList.isNotEmpty + ? ListView.builder( + itemCount: widget.useRecordList.length, + itemBuilder: (BuildContext context, int index) { + return _recordKeyItem(widget.useRecordList[index]); + }) + : NoData(), + ); + } + + Widget _recordKeyItem(UseItemData itemData) { + return Container( + color: Colors.white, + margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 10.h), + padding: + EdgeInsets.only(left: 20.w, right: 20.w, top: 16.h, bottom: 16.h), + child: Column( + children: [ + Row( + children: [ + Text( + '${itemData.lockName ?? ""} ${itemData.realName ?? ""}', + style: TextStyle( + fontSize: 24.sp, + color: AppColors.blackColor, + fontWeight: FontWeight.bold), + ), + Expanded(child: Container()), + itemData.authStatus == 0 + ? Container( + padding: EdgeInsets.only( + right: 6.w, left: 6.w, top: 2.h, bottom: 2.h), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.w), + color: AppColors.toBeReceiveBgColor, + ), + child: Text('失败', + style: TextStyle(fontSize: 16.sp, color: Colors.red)), + ) + : Container() + ], + ), + SizedBox( + height: 8.h, + ), + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + itemData.createdAt!.length > 10 + ? itemData.createdAt!.substring(0, 10) + : itemData.createdAt!, + textAlign: TextAlign.left, + style: TextStyle( + fontSize: 22.sp, color: AppColors.darkGrayTextColor)) + ], + ), + ], + ), + ); + } +} diff --git a/star_lock/lib/network/api_repository.dart b/star_lock/lib/network/api_repository.dart index 1edc2755..291e317d 100644 --- a/star_lock/lib/network/api_repository.dart +++ b/star_lock/lib/network/api_repository.dart @@ -1387,8 +1387,19 @@ class ApiRepository { required int startTime, required int endTime, required int faceRight}) async { - final res = await apiProvider.addFaceData(lockId, faceName, faceNumber, - faceType, startDate, endDate, featureData, addType, weekDay, startTime, endTime, faceRight); + final res = await apiProvider.addFaceData( + lockId, + faceName, + faceNumber, + faceType, + startDate, + endDate, + featureData, + addType, + weekDay, + startTime, + endTime, + faceRight); return AddFaceEntity.fromJson(res.body); } @@ -1652,10 +1663,8 @@ class ApiRepository { } //重置密码钥匙 - Future keyboardPwdReset({ - required String lockId, - required List passwordKey - }) async { + Future keyboardPwdReset( + {required String lockId, required List passwordKey}) async { final res = await apiProvider.keyboardPwdReset(lockId, passwordKey); return PasswordKeyListEntity.fromJson(res.body); } @@ -2031,7 +2040,7 @@ class ApiRepository { return FaceAuthenticationEntity.fromJson(res.body); } - // 获取使用记录 + // 获取购买记录 Future getBuyRecordList({ required String type, required int pageNo, @@ -2043,7 +2052,7 @@ class ApiRepository { return AdvancedFunctionRecordEntity.fromJson(res.body); } - // 获取购买记录 + // 获取使用记录 Future getUseRecordList({ required String type, required int pageNo, From ead3cbcb028000f5af132ac7fd92a314f21398dd Mon Sep 17 00:00:00 2001 From: anfe <448468458@qq.com> Date: Thu, 9 May 2024 17:06:28 +0800 Subject: [PATCH 2/5] =?UTF-8?q?feat:=E5=AE=8C=E6=88=90=E6=BB=A1=2032=20?= =?UTF-8?q?=E4=B8=AA=E7=94=A8=E6=88=B7=E6=B8=85=E9=99=A4=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=90=8E=E6=B7=BB=E5=8A=A0=E7=94=A8=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- star_lock/lib/blue/blue_manage.dart | 6 +- star_lock/lib/blue/io_reply.dart | 47 ++--- star_lock/lib/blue/reciver_data.dart | 3 - .../lib/blue/sender_beforeDataManage.dart | 186 ++++++------------ star_lock/lib/debug/controller.dart | 49 ++++- 5 files changed, 140 insertions(+), 151 deletions(-) diff --git a/star_lock/lib/blue/blue_manage.dart b/star_lock/lib/blue/blue_manage.dart index 3822e77f..4d86e8be 100644 --- a/star_lock/lib/blue/blue_manage.dart +++ b/star_lock/lib/blue/blue_manage.dart @@ -477,7 +477,7 @@ class BlueManage { // 当包有头时 // 判断是否需要分包 dataLen = data[8] * 256 + data[9]; // 高16位用来指示后面数据块内容的长度 - AppLog.log("dataLen1111:$dataLen getDataLength:${data.length} data:$data"); + // AppLog.log("dataLen1111:$dataLen getDataLength:${data.length} data:$data"); if (dataLen! + 14 > data.length) { // 当前包的长度小于实际的包时 分包添加 不解析 allData.addAll(data); @@ -493,8 +493,8 @@ class BlueManage { // 当包没有头时 是分包的包 直接添加 allData.addAll(data); // var len = allData[8] * 256 + allData[9]; - AppLog.log( - "dataLen3333:$dataLen allData.length:${allData.length} allData:$allData"); + // AppLog.log( + // "dataLen3333:$dataLen allData.length:${allData.length} allData:$allData"); if (((dataLen ?? 0) + 14) <= allData.length) { // 当长度小于等于当前包的数据时 直接解析数据 CommandReciverManager.appDataReceive(allData); diff --git a/star_lock/lib/blue/io_reply.dart b/star_lock/lib/blue/io_reply.dart index 61d8a25d..c8625aeb 100644 --- a/star_lock/lib/blue/io_reply.dart +++ b/star_lock/lib/blue/io_reply.dart @@ -12,121 +12,124 @@ abstract class Reply{ //command key flag int status = 0; List data = []; + static String logTag= '锁 -> App,指令订阅类型 :'; Reply.parseData(this.commandType, List dataDetail); void errorWithStstus(int status){ + switch(status){ case 0x00: // 成功 + AppLog.log("$logTag ${commandType?.typeName} 0x00 成功"); break; case 0x01: // 包格式错误 - AppLog.log("${commandType!.typeName} 0x01 包格式错误"); + AppLog.log("$logTag ${commandType!.typeName} 0x01 包格式错误"); showErrorMessage("包格式错误"); break; case 0x02: // 密码错误 - AppLog.log("${commandType!.typeName} 0x02 密码错误"); + AppLog.log("$logTag ${commandType!.typeName} 0x02 密码错误"); showErrorMessage("密码错误"); break; case 0x03: // 网络中断 - AppLog.log("${commandType!.typeName} 0x03 网络中断"); + AppLog.log("$logTag ${commandType!.typeName} 0x03 网络中断"); showErrorMessage("网络中断"); break; case 0x04: // 用户未登记 - AppLog.log("${commandType!.typeName} 0x04 用户未登记"); + AppLog.log("$logTag ${commandType!.typeName} 0x04 用户未登记"); showErrorMessage("用户未登记"); break; case 0x05: // 参数错误 - AppLog.log("${commandType!.typeName} 0x05 参数错误"); + AppLog.log("$logTag ${commandType!.typeName} 0x05 参数错误"); showErrorMessage("参数错误"); break; case 0x06: // 需要鉴权 - AppLog.log("${commandType!.typeName} 0x06 需要鉴权"); + AppLog.log("$logTag ${commandType!.typeName} 0x06 需要鉴权"); // showErrorMessage("需要鉴权"); break; case 0x07: // 无权限 - AppLog.log("${commandType!.typeName} 0x07 无权限"); + AppLog.log("$logTag ${commandType!.typeName} 0x07 无权限"); // showErrorMessage("无权限"); break; case 0x08: // 应答超时 - AppLog.log("${commandType!.typeName} 0x08 应答超时"); + AppLog.log("$logTag ${commandType!.typeName} 0x08 应答超时"); showErrorMessage("应答超时"); break; case 0x09: // 权限校验错误 - AppLog.log("${commandType!.typeName} 0x09 权限校验错误"); + AppLog.log("$logTag ${commandType!.typeName} 0x09 权限校验错误"); showErrorMessage("权限校验错误"); break; case 0x0a: // 钥匙不存在 showErrorMessage("钥匙不存在"); - AppLog.log("${commandType!.typeName} 0x0a 钥匙不存在"); + AppLog.log("$logTag ${commandType!.typeName} 0x0a 钥匙不存在"); break; case 0x0b: // 钥匙过期 showErrorMessage("钥匙过期"); - AppLog.log("${commandType!.typeName} 0x0b 钥匙过期"); + AppLog.log("$logTag ${commandType!.typeName} 0x0b 钥匙过期"); break; case 0x0c: // 钥匙数量已到上限 showErrorMessage("钥匙数量已到上限"); - AppLog.log("${commandType!.typeName} 0x0c 钥匙数量已到上限"); + AppLog.log("$logTag ${commandType!.typeName} 0x0c 钥匙数量已到上限"); break; case 0x0d: // 钥匙无效 showErrorMessage("钥匙无效"); - AppLog.log("${commandType!.typeName} 0x0d 钥匙无效"); + AppLog.log("$logTag ${commandType!.typeName} 0x0d 钥匙无效"); break; case 0x0e: // 钥匙已存在 showErrorMessage("钥匙已存在"); - AppLog.log("${commandType!.typeName} 0x0e 钥匙无效"); + AppLog.log("$logTag ${commandType!.typeName} 0x0e 钥匙无效"); break; case 0x0f: // 用户已存在 - AppLog.log("${commandType!.typeName} 0x0f 用户已存在"); + AppLog.log("$logTag ${commandType!.typeName} 0x0f 用户已存在"); showErrorMessage("用户已存在"); break; case 0x10: // 密码失效 - AppLog.log("${commandType!.typeName} 0x11 密码失效"); + AppLog.log("$logTag ${commandType!.typeName} 0x11 密码失效"); showErrorMessage("密码失效"); break; case 0x11: // 无效指令 - AppLog.log("${commandType!.typeName} 0x11 无效指令"); + AppLog.log("$logTag ${commandType!.typeName} 0x11 无效指令"); showErrorMessage("无效指令"); break; case 0x12: // 门锁时间异常 - AppLog.log("${commandType!.typeName} 0x12 门锁时间异常"); + AppLog.log("$logTag ${commandType!.typeName} 0x12 门锁时间异常"); showErrorMessage("门锁时间异常"); break; case 0x15: // APP(手机)未联网 - AppLog.log("${commandType!.typeName} 0x15 APP(手机)未联网"); + AppLog.log("$logTag ${commandType!.typeName} 0x15 APP(手机)未联网"); showErrorMessage("APP(手机)未联网"); break; case 0x16: // 正在开锁中... - AppLog.log("${commandType!.typeName}正在开锁中..."); + AppLog.log("$logTag ${commandType!.typeName}正在开锁中..."); // showErrorMessage("正在开锁中..."); break; case 0xff: // 异常,未知错误 - AppLog.log("${commandType!.typeName} 0xff"); + AppLog.log("$logTag ${commandType!.typeName} 0xff"); showErrorMessage("异常,未知错误"); break; default: //失败 - AppLog.log("蓝牙返回其他错误问题"); + AppLog.log("$logTag ${commandType!.typeName} 蓝牙返回其他错误问题"); break; } } diff --git a/star_lock/lib/blue/reciver_data.dart b/star_lock/lib/blue/reciver_data.dart index 5ba45b40..e2aaad2b 100644 --- a/star_lock/lib/blue/reciver_data.dart +++ b/star_lock/lib/blue/reciver_data.dart @@ -110,9 +110,6 @@ class CommandReciverManager { } parseData(oriDataList).then((Reply? value) async { EasyLoading.dismiss(); - if (value != null) { - AppLog.log("锁 -> App,指令订阅类型 :${value.commandType?.typeName} \n $value"); - } await EventBusManager().eventBusFir(value); }).catchError((error) { AppLog.log("APP解析数据时发生错误: $error"); diff --git a/star_lock/lib/blue/sender_beforeDataManage.dart b/star_lock/lib/blue/sender_beforeDataManage.dart index ed927f13..55c78e30 100644 --- a/star_lock/lib/blue/sender_beforeDataManage.dart +++ b/star_lock/lib/blue/sender_beforeDataManage.dart @@ -44,6 +44,7 @@ class SenderBeforeDataManage { // 监听设备返回的数据 StreamSubscription? _replySubscription; + // 启动订阅 void _initReplySubscription() { _replySubscription ??= EventBusManager().eventBus!.on().listen((reply) async { @@ -52,128 +53,36 @@ class SenderBeforeDataManage { _replyAddUserKey(reply); } - if(reply is CleanUpUsersReply){ + if (reply is CleanUpUsersReply) { _cleanUpUsersReply(reply); } }); } - // 添加用户 + // 解析添加用户订阅 Future _replyAddUserKey(Reply reply) async { int status = reply.data[46]; switch (status) { case 0x00: //成功 - CommonDataManage().currentLockUserNo = listChangInt(reply.data.sublist(47, 49)); - CommonDataManage().currentKeyInfo.lockUserNo = CommonDataManage().currentLockUserNo; + CommonDataManage().currentLockUserNo = + listChangInt(reply.data.sublist(47, 49)); + CommonDataManage().currentKeyInfo.lockUserNo = + CommonDataManage().currentLockUserNo; _updateLockUserNo(); break; case 0x06: //无权限 - var privateKey = await Storage.getStringList(saveBluePrivateKey); - List getPrivateKeyList = changeStringListToIntList(privateKey!); - - var publicKey = await Storage.getStringList(saveBluePublicKey); - List publicKeyDataList = changeStringListToIntList(publicKey!); - var token = reply.data.sublist(42, 46); List strTokenList = changeIntListToStringList(token); Storage.setStringList(saveBlueToken, strTokenList); - - // IoSenderManage.senderAddUser( - // lockID: BlueManage().connectDeviceName, - // authUserID: CommonDataManage().currentKeyInfo.senderUserId!.toString(), - // keyID: CommonDataManage().currentKeyInfo.keyId.toString(), - // userID: await Storage.getUid(), - // openMode: 1, - // keyType: 0, - // startDate: CommonDataManage().currentKeyInfo.startDate!~/10000, - // expireDate: CommonDataManage().currentKeyInfo.endDate!~/10000, - // role: CommonDataManage().currentKeyInfo.keyRight == 1 ? 1 : 0, - // password: "123456", - // needAuthor: 1, - // publicKey: publicKeyDataList, - // privateKey: getPrivateKeyList, - // token: token); - LockListInfoItemEntity currentKeyInfo = CommonDataManage().currentKeyInfo; - AppLog.log( - "startDate111:${currentKeyInfo.startDate} endDate:${currentKeyInfo.endDate}"); - DateTime startTime = DateTime.fromMillisecondsSinceEpoch( - currentKeyInfo.startDate! ~/ 1000); - DateTime endTime = DateTime.fromMillisecondsSinceEpoch( - currentKeyInfo.endDate! ~/ 1000); - bool isRound = currentKeyInfo.keyType == 2; - var addUserData = AddUserCommand( - lockID: BlueManage().connectDeviceName, - authUserID: currentKeyInfo.senderUserId!.toString(), - keyID: currentKeyInfo.keyId.toString(), - userID: await Storage.getUid(), - openMode: 1, - keyType: currentKeyInfo.keyType, - startDate: currentKeyInfo.startDate! ~/ 1000, - expireDate: currentKeyInfo.endDate! ~/ 1000, - useCountLimit: 0xFFFF, - // useCountLimit: 1, - isRound: isRound ? 1 : 0, - weekRound: isRound - ? DateTool().accordingTheCycleIntoTheCorrespondingNumber( - currentKeyInfo.weekDays!) - : 0, - startHour: isRound ? startTime.hour : 0, - startMin: isRound ? startTime.minute : 0, - endHour: isRound ? endTime.hour : 0, - endMin: isRound ? endTime.minute : 0, - role: currentKeyInfo.keyRight == 1 ? 1 : 0, - password: "123456", - needAuthor: 1, - publicKey: publicKeyDataList, - privateKey: getPrivateKeyList, - token: token); - eventBus.fire(LockAddUserSucceedEvent(addUserData.packageData(), 1)); + var addUserData = await getAddUserKeyData(tokenList: token); + eventBus.fire(LockAddUserSucceedEvent(addUserData, 1)); break; case 0x0c: //锁设备用户超过 32个,需要同步锁用户列表刷新 - var entity = await ApiRepository.to.getLockUserNoList( - lockId: CommonDataManage().currentKeyInfo.lockId!); - if (!entity.errorCode!.codeIsSuccessful && - (entity.data?.userNos ?? []).isNotEmpty) { - return; - } - var privateKey = await Storage.getStringList(saveBluePrivateKey); - List getPrivateKeyList = changeStringListToIntList(privateKey!); - - var publicKey = await Storage.getStringList(saveBluePublicKey); - List publicKeyDataList = changeStringListToIntList(publicKey!); - - var tokenKey = await Storage.getStringList(saveBlueToken); - List tokenList = changeStringListToIntList(tokenKey!); - AppLog.log('---> ${entity.data?.userNos}'); - - var cleanUpUsersData = CleanUpUsersCommand( - lockID: BlueManage().connectDeviceName, - authUserID: CommonDataManage().currentKeyInfo.senderUserId!.toString(), - keyID: CommonDataManage().currentKeyInfo.keyId.toString(), - userID: await Storage.getUid(), - needAuthor: 1, - publicKey: publicKeyDataList, - privateKey: getPrivateKeyList, - userNoList: entity.data!.userNos!, - token: tokenList, - ).packageData(); - CommandSenderManager().sendNormalData(cleanUpUsersData); - - // IoSenderManage.senderCleanUpUsersCommand( - // lockID: BlueManage().connectDeviceName, - // authUserID: - // CommonDataManage().currentKeyInfo.senderUserId!.toString(), - // keyID: CommonDataManage().currentKeyInfo.keyId.toString(), - // userID: await Storage.getUid(), - // userNoList: entity.data!.userNos!, - // needAuthor: 1, - // publicKey: publicKeyDataList, - // privateKey: getPrivateKeyList, - // token: tokenList); - + var addUserData = await getCleanUpUsers(); + CommandSenderManager().sendNormalData(addUserData); break; default: //失败 @@ -181,47 +90,81 @@ class SenderBeforeDataManage { } } - // 清理用户 + // 解析清理用户订阅 Future _cleanUpUsersReply(Reply reply) async { int status = reply.data[6]; switch (status) { case 0x00: //成功 - + //添加用户 + var addUserData = await getAddUserKeyData(); + CommandSenderManager().sendNormalData(addUserData); break; case 0x06: - //无权限 - var privateKey = await Storage.getStringList(saveBluePrivateKey); - List getPrivateKeyList = changeStringListToIntList(privateKey!); - - var publicKey = await Storage.getStringList(saveBluePublicKey); - List publicKeyDataList = changeStringListToIntList(publicKey!); - - var token = reply.data.sublist(42, 46); + //无权限 + var token = reply.data.sublist(2, 6); List strTokenList = changeIntListToStringList(token); Storage.setStringList(saveBlueToken, strTokenList); - - + var addUserData = await getCleanUpUsers(tokenList: token); + CommandSenderManager().sendNormalData(addUserData); break; default: - //失败 + //失败 break; } } - Future> getAddUserKeyData() async { + //获取清除用户列表指令 + Future> getCleanUpUsers({List? tokenList}) async { + var entity = await ApiRepository.to + .getLockUserNoList(lockId: CommonDataManage().currentKeyInfo.lockId!); + if (!entity.errorCode!.codeIsSuccessful || + (entity.data?.userNos ?? []).isEmpty) { + throw Exception('ApiRepository.to.getLockUserNoList 访问失败'); + } 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!); + if (tokenList == null) { + var tokenKey = await Storage.getStringList(saveBlueToken); + tokenList = changeStringListToIntList(tokenKey!); + } + + var cleanUpUsersData = CleanUpUsersCommand( + lockID: BlueManage().connectDeviceName, + authUserID: CommonDataManage().currentKeyInfo.senderUserId!.toString(), + keyID: CommonDataManage().currentKeyInfo.keyId.toString(), + userID: await Storage.getUid(), + needAuthor: 1, + publicKey: publicKeyDataList, + privateKey: getPrivateKeyList, + userNoList: entity.data!.userNos!, + token: tokenList, + ); + return cleanUpUsersData.packageData(); + } + + //获取添加用户指令 + Future> getAddUserKeyData({List? tokenList}) async { + var privateKey = await Storage.getStringList(saveBluePrivateKey); + List getPrivateKeyList = changeStringListToIntList(privateKey!); + + var publicKey = await Storage.getStringList(saveBluePublicKey); + List publicKeyDataList = changeStringListToIntList(publicKey!); + + if (tokenList == null) { + var token = await Storage.getStringList(saveBlueToken); + tokenList = changeStringListToIntList(token!); + } LockListInfoItemEntity currentKeyInfo = CommonDataManage().currentKeyInfo; - DateTime startTime = DateTime.fromMillisecondsSinceEpoch(currentKeyInfo.startDate! ~/ 1000); - DateTime endTime = DateTime.fromMillisecondsSinceEpoch(currentKeyInfo.endDate! ~/ 1000); + DateTime startTime = + DateTime.fromMillisecondsSinceEpoch(currentKeyInfo.startDate! ~/ 1000); + DateTime endTime = + DateTime.fromMillisecondsSinceEpoch(currentKeyInfo.endDate! ~/ 1000); bool isRound = currentKeyInfo.keyType == 2; var addUserData = AddUserCommand( @@ -234,7 +177,6 @@ class SenderBeforeDataManage { startDate: currentKeyInfo.startDate! ~/ 1000, expireDate: currentKeyInfo.endDate! ~/ 1000, useCountLimit: 0xFFFF, - // useCountLimit: 1, isRound: isRound ? 1 : 0, weekRound: isRound ? DateTool().accordingTheCycleIntoTheCorrespondingNumber( @@ -249,7 +191,7 @@ class SenderBeforeDataManage { needAuthor: 1, publicKey: publicKeyDataList, privateKey: getPrivateKeyList, - token: getTokenList); + token: tokenList); return addUserData.packageData(); } diff --git a/star_lock/lib/debug/controller.dart b/star_lock/lib/debug/controller.dart index 1d87cccb..27cbdb43 100644 --- a/star_lock/lib/debug/controller.dart +++ b/star_lock/lib/debug/controller.dart @@ -9,11 +9,16 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:rxdart/rxdart.dart'; import 'package:star_lock/app_settings/app_colors.dart'; +import 'package:star_lock/app_settings/app_settings.dart'; import 'package:star_lock/blue/blue_manage.dart'; +import 'package:star_lock/blue/io_protocol/io_cleanUpUsers.dart'; import 'package:star_lock/blue/io_tool/io_tool.dart'; +import 'package:star_lock/blue/sender_data.dart'; import 'package:star_lock/blue/sender_manage.dart'; import 'package:star_lock/debug/log.dart'; import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart'; +import 'package:star_lock/network/api_repository.dart'; +import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/commonDataManage.dart'; import 'package:star_lock/tools/dateTool.dart'; import 'package:star_lock/tools/storage.dart'; @@ -85,6 +90,14 @@ class DebugConsoleController { .catchError(EasyLoading.dismiss); }, child: const Text('给锁设备创建 32个用户')), + ElevatedButton( + onPressed: () { + EasyLoading.show(); + sendCleanUpUsers() + .then((value) => EasyLoading.dismiss()) + .catchError(EasyLoading.dismiss); + }, + child: const Text('清除用户,只保留超级管理员')), ], ), ), @@ -141,9 +154,11 @@ class DebugConsoleController { privateKey: getPrivateKeyList, token: tokenList); } + + AppLog.log('--> 添加第$count 用户'); }); - await Future.delayed(const Duration(seconds: 2)); + await Future.delayed(const Duration(seconds: 3)); count++; await randomlyCreate32Users(count, max); } @@ -155,4 +170,36 @@ class DebugConsoleController { return List.generate(length, (index) => chars[random.nextInt(chars.length)]) .join(); } + + //获取清除用户列表指令 + Future sendCleanUpUsers({List? tokenList}) async { + var privateKey = await Storage.getStringList(saveBluePrivateKey); + List getPrivateKeyList = changeStringListToIntList(privateKey!); + + var publicKey = await Storage.getStringList(saveBluePublicKey); + List publicKeyDataList = changeStringListToIntList(publicKey!); + + if (tokenList == null) { + var tokenKey = await Storage.getStringList(saveBlueToken); + tokenList = changeStringListToIntList(tokenKey!); + } + + BlueManage().bludSendData(BlueManage().connectDeviceName, + (BluetoothConnectionState deviceConnectionState) async { + if (deviceConnectionState == BluetoothConnectionState.connected) { + IoSenderManage.senderCleanUpUsersCommand( + lockID: BlueManage().connectDeviceName, + authUserID: + CommonDataManage().currentKeyInfo.senderUserId!.toString(), + keyID: CommonDataManage().currentKeyInfo.keyId.toString(), + userID: await Storage.getUid(), + needAuthor: 1, + publicKey: publicKeyDataList, + privateKey: getPrivateKeyList, + userNoList: [1], + token: tokenList, + ); + } + }); + } } From dfced733487ab11994ea076f6de0ed4402c5e3b1 Mon Sep 17 00:00:00 2001 From: anfe <448468458@qq.com> Date: Thu, 9 May 2024 17:32:38 +0800 Subject: [PATCH 3/5] =?UTF-8?q?feat:=E6=B7=BB=E5=8A=A0=E9=85=8D=E5=AF=B9?= =?UTF-8?q?=E5=89=8D=E6=8F=90=E7=A4=BA=E8=AF=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- star_lock/images/lan/lan_en.json | 3 +- star_lock/images/lan/lan_keys.json | 3 +- star_lock/images/lan/lan_zh.json | 4 ++- .../addLock/nearbyLock/nearbyLock_logic.dart | 1 - .../addLock/nearbyLock/nearbyLock_page.dart | 33 ++++++++++++------- 5 files changed, 29 insertions(+), 15 deletions(-) diff --git a/star_lock/images/lan/lan_en.json b/star_lock/images/lan/lan_en.json index eed00e5f..90eb2734 100644 --- a/star_lock/images/lan/lan_en.json +++ b/star_lock/images/lan/lan_en.json @@ -832,5 +832,6 @@ "钥匙详情":"Key details", "姓名":"Name", "发送":"Send", - "请确认姓名全名和身份证号码是否正确":"Please confirm that the full name and ID number are correct" + "请确认姓名全名和身份证号码是否正确":"Please confirm that the full name and ID number are correct", + "传输期间请勿离开当前页面":"Do not leave the current page during transfer" } diff --git a/star_lock/images/lan/lan_keys.json b/star_lock/images/lan/lan_keys.json index b1e72ad1..7aaa9d43 100644 --- a/star_lock/images/lan/lan_keys.json +++ b/star_lock/images/lan/lan_keys.json @@ -860,5 +860,6 @@ "钥匙详情":"钥匙详情", "姓名":"姓名", "发送":"发送", - "请确认姓名全名和身份证号码是否正确":"请确认姓名全名和身份证号码是否正确" + "请确认姓名全名和身份证号码是否正确":"请确认姓名全名和身份证号码是否正确", + "传输期间请勿离开当前页面":"传输期间请勿离开当前页面" } diff --git a/star_lock/images/lan/lan_zh.json b/star_lock/images/lan/lan_zh.json index c159b3c3..42188044 100644 --- a/star_lock/images/lan/lan_zh.json +++ b/star_lock/images/lan/lan_zh.json @@ -863,5 +863,7 @@ "钥匙详情":"钥匙详情", "姓名":"姓名", "发送":"发送", - "请确认姓名全名和身份证号码是否正确":"请确认姓名全名和身份证号码是否正确" + "请确认姓名全名和身份证号码是否正确":"请确认姓名全名和身份证号码是否正确", + "传输期间请勿离开当前页面":"传输期间请勿离开当前页面" + } diff --git a/star_lock/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart b/star_lock/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart index a7fe8858..75c57c81 100644 --- a/star_lock/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart +++ b/star_lock/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart @@ -479,7 +479,6 @@ class NearbyLockLogic extends BaseGetXController { token: token, encrypt: false, ).packageData()); - showTitleEasyLoading("连接设备中..."); } else if (deviceConnectionState == BluetoothConnectionState.disconnected) {} },isAddEquipment: true); diff --git a/star_lock/lib/mine/addLock/nearbyLock/nearbyLock_page.dart b/star_lock/lib/mine/addLock/nearbyLock/nearbyLock_page.dart index 3740694b..cdf99f97 100644 --- a/star_lock/lib/mine/addLock/nearbyLock/nearbyLock_page.dart +++ b/star_lock/lib/mine/addLock/nearbyLock/nearbyLock_page.dart @@ -279,20 +279,31 @@ class OTAProgressDialog extends StatelessWidget { title: Text( '固件升级中'.tr, ), - content: Row( + content: Column( children: [ - Text( - '传输中'.tr, - style: TextStyle(fontSize: 22.sp, color: AppColors.mainColor), + Padding( + padding: EdgeInsets.only(top: 20.h, bottom: 10.h), + child: Text( + '传输期间请勿离开当前页面'.tr, + style: TextStyle(fontSize: 20.sp, color: AppColors.blackColor), + ), ), - SizedBox( - width: 15.w, + Row( + children: [ + Text( + '传输中'.tr, + style: TextStyle(fontSize: 18.sp, color: AppColors.mainColor), + ), + SizedBox( + width: 15.w, + ), + Expanded( + child: LinearProgressIndicator( + value: logic.state.otaProgress.value, + color: AppColors.mainColor, + )), + ], ), - Expanded( - child: LinearProgressIndicator( - value: logic.state.otaProgress.value, - color: AppColors.mainColor, - )), ], ), actions: [ From 171469ef9884264e306bced364bbbceef9ce031f Mon Sep 17 00:00:00 2001 From: anfe <448468458@qq.com> Date: Thu, 9 May 2024 17:36:05 +0800 Subject: [PATCH 4/5] =?UTF-8?q?feat:=E5=9B=9E=E5=A4=8D=20log?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- star_lock/lib/blue/io_protocol/io_otaUpgrade.dart | 1 - star_lock/lib/blue/io_sender.dart | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/star_lock/lib/blue/io_protocol/io_otaUpgrade.dart b/star_lock/lib/blue/io_protocol/io_otaUpgrade.dart index bb02f62d..05c30b1c 100644 --- a/star_lock/lib/blue/io_protocol/io_otaUpgrade.dart +++ b/star_lock/lib/blue/io_protocol/io_otaUpgrade.dart @@ -183,7 +183,6 @@ class OTAUpgradeReply extends Reply { data = dataDetail; token = data.sublist(2, 6); status = data[6]; - // AppLog.log('--->2' + data.toString()); errorWithStstus(status); } } diff --git a/star_lock/lib/blue/io_sender.dart b/star_lock/lib/blue/io_sender.dart index f51300b1..3d98678d 100644 --- a/star_lock/lib/blue/io_sender.dart +++ b/star_lock/lib/blue/io_sender.dart @@ -34,8 +34,8 @@ abstract class SenderProtocol extends IOData { } void printLog(List data) { - // AppLog.log( - // "App -> 锁,指令类型:${commandType!.typeName} \n参数是:\n${toString()} \n加密之前数据是:\n$data 长度是:${data.length}"); + AppLog.log( + "App -> 锁,指令类型:${commandType!.typeName} \n参数是:\n${toString()} \n加密之前数据是:\n$data 长度是:${data.length}"); } //TODO:拼装数据Ï From cfa309c0ba5ab660ecdaa1f5772775a40c6db667 Mon Sep 17 00:00:00 2001 From: Daisy <> Date: Thu, 9 May 2024 18:09:03 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8E=88=E6=9D=83?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E6=A8=A1=E5=9D=97=E5=AE=9E=E5=90=8D?= =?UTF-8?q?=E8=AE=A4=E8=AF=81=E7=9B=B8=E5=85=B3=E6=B5=81=E7=A8=8B=E5=8F=8A?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../authorizedAdmin_logic.dart | 123 ++++--- .../authorizedAdmin/authorizedAdmin_page.dart | 90 ++--- .../authorizedAdmin_state.dart | 28 +- .../authorizedAdminList_logic.dart | 18 +- .../authorizedAdminList_page.dart | 311 +++++------------- .../volumeAuthorizationLock_page.dart | 10 - .../view/sendElectronicKeyView_logic.dart | 2 +- .../lockOperatingRecord_page.dart | 58 +--- .../catEyeWorkMode/catEyeWorkMode_logic.dart | 9 +- .../catEyeWorkMode/catEyeWorkMode_page.dart | 18 - 10 files changed, 256 insertions(+), 411 deletions(-) diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart index bd9f3179..051825a5 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart @@ -1,9 +1,13 @@ import 'dart:async'; +import 'package:flutter/material.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:get/get.dart'; +import 'package:star_lock/appRouters.dart'; import 'package:star_lock/app_settings/app_settings.dart'; +import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_entity.dart'; import 'package:star_lock/tools/dateTool.dart'; +import 'package:star_lock/tools/showCupertinoAlertView.dart'; import '../../../../blue/blue_manage.dart'; import '../../../../blue/io_reply.dart'; @@ -136,6 +140,45 @@ class AuthorizedAdminLogic extends BaseGetXController { } } + //如果打开了实名认证,需要弹出输入身份证信息框 + if (state.isAuthentication.value == true) { + if (state.realNameController.text.isEmpty) { + showToast("请输入真实姓名".tr); + return; + } + + if (state.idCardController.text.isEmpty) { + showToast("请输入身份证号".tr); + return; + } + //弹出身份证信息确认框 + ShowCupertinoAlertView().realNameIDCardInfoComfirmAlert( + getNameStr: state.realNameController.text, + getIDCardStr: state.idCardController.text, + onConfirm: () { + goSendElectronicKey( + endDate: endDate, + getKeyType: getKeyType, + startDate: startDate, + startTime: startTime, + endTime: endTime); + }); + } else { + goSendElectronicKey( + endDate: endDate, + getKeyType: getKeyType, + startDate: startDate, + startTime: startTime, + endTime: endTime); + } + } + + Future goSendElectronicKey( + {required String endDate, + required String getKeyType, + required String startDate, + required String startTime, + required String endTime}) async { var entity = await ApiRepository.to.sendElectronicKey( createUser: state.isCreateUser.value ? "1" : "0", countryCode: state.countryCode.value, @@ -156,8 +199,12 @@ class AuthorizedAdminLogic extends BaseGetXController { startTime: int.parse(startTime), endTime: int.parse(endTime), isOnlyManageSelf: state.onlyManageYouCreatesUser.value ? 1 : 0, - realName: '', - idCardNumber: ''); + realName: state.isRequireAuth.value == true + ? state.realNameController.text + : "", + idCardNumber: state.isRequireAuth.value == true + ? state.idCardController.text + : ""); if (entity.errorCode!.codeIsSuccessful) { state.isCreateUser.value = false; state.isSendSuccess.value = true; @@ -169,7 +216,6 @@ class AuthorizedAdminLogic extends BaseGetXController { if (entity.errorCode == 425) { //用户未注册 state.isCreateUser.value = true; - // _showDialog('${entity.errorMsg}'); ShowTipView().showIosTipWithContentDialog( '${"是否发送授权管理员给未注册账号".tr}\n${state.emailOrPhoneController.text}', () { @@ -179,6 +225,24 @@ class AuthorizedAdminLogic extends BaseGetXController { } } + //检测实名认证是否支持开启 + Future keyCheckFace() async { + AdvancedFunctionRecordEntity entity = await ApiRepository.to.keyCheckFace( + countryCode: int.parse(state.countryCode.value), + account: state.emailOrPhoneController.text); + if (entity.errorCode!.codeIsSuccessful) { + //打开实名认证,需要弹出输入身份证信息框 + state.isRequireAuth.value = true; + } else { + ShowTipView().showBuyTipWithContentAlert( + titleStr: '实名认证为付费功能,请购买后再使用'.tr, + sureClick: () { + Get.toNamed(Routers.advancedFeaturesWebPage, + arguments: {'isShop': false}); + }); + } + } + //标记房间为已入住 isOn:已入住: 1 空闲:2 Future updateRoomCheckIn() async { var entity = await ApiRepository.to.setRoomStatusData( @@ -190,40 +254,25 @@ class AuthorizedAdminLogic extends BaseGetXController { } } - //用户未注册确认弹窗 - // void _showDialog(String errMsg) { - // showCupertinoDialog( - // context: Get.context!, - // builder: (context) { - // return CupertinoAlertDialog( - // title: const Text('接收者号码未注册,请重新发送'), - // actions: [ - // CupertinoDialogAction( - // child: Text(TranslationLoader.lanKeys!.cancel!.tr), - // onPressed: () { - // Get.back(); - // }, - // ), - // CupertinoDialogAction( - // child: Text(TranslationLoader.lanKeys!.sure!.tr), - // onPressed: () async { - // //选择国家代码 - // Get.back(); - // - // // var result = await Get.toNamed(Routers.selectCountryRegionPage); - // // if (result != null) { - // // result as Map; - // // state.countryCode.value = result['code']; - // // state.countryName.value = result['countryName']; - // // } - // sendElectronicKeyRequest(); - // }, - // ), - // ], - // ); - // }, - // ); - // } + TextEditingController getCurrentController(int lineIndex) { + TextEditingController currentController = TextEditingController(); + switch (lineIndex) { + case 1: + currentController = state.emailOrPhoneController; + break; + case 2: + currentController = state.keyNameController; + break; + case 3: + currentController = state.realNameController; + break; + case 4: + currentController = state.idCardController; + break; + default: + } + return currentController; + } @override void onReady() { diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart index 8d71f90b..492e6220 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart @@ -36,7 +36,6 @@ class _AuthorizedAdminPageState extends State @override void initState() { - // TODO: implement initState super.initState(); state.tabController = @@ -82,7 +81,7 @@ class _AuthorizedAdminPageState extends State children: [ keyInfoWidget(), keyTimeWidget(), - keyRealNameWidget(), + keyOnlyManageWidget(), keyBottomWidget( TranslationLoader.lanKeys!.authorizedAdminTip!.tr) ], @@ -95,7 +94,7 @@ class _AuthorizedAdminPageState extends State child: Column( children: [ keyInfoWidget(), - keyRealNameWidget(), + keyOnlyManageWidget(), keyBottomWidget( TranslationLoader.lanKeys!.authorizedAdminTip!.tr) ], @@ -189,7 +188,7 @@ class _AuthorizedAdminPageState extends State } // 实名认证 - Widget keyRealNameWidget() { + Widget keyOnlyManageWidget() { return Column( children: [ CommonItem( @@ -205,17 +204,7 @@ class _AuthorizedAdminPageState extends State height: 50.h, child: _onlyManageYouCreatesUserSwitch())), Container(height: 10.h), - CommonItem( - leftTitel: TranslationLoader.lanKeys!.realNameAuthentication!.tr, - rightTitle: "", - isTipsImg: true, - tipsImgAction: () { - ShowTipView().showSureAlertDialog( - "人脸实名认证指的是用户在使用手机APP开锁时,需要先进行本人人脸验证,验证通过才能开锁。"); - }, - isHaveRightWidget: true, - rightWidget: SizedBox(width: 60.w, height: 50.h, child: _switch()), - action: () {}), + keyRealNameWidget(), Container(height: 10.h), ], ); @@ -227,7 +216,6 @@ class _AuthorizedAdminPageState extends State Container( padding: EdgeInsets.all(20.w), child: Row( - // crossAxisAlignment: CrossAxisAlignment.start, children: [ Expanded( child: Text( @@ -255,7 +243,6 @@ class _AuthorizedAdminPageState extends State }), Container( padding: EdgeInsets.only(right: 30.w), - // color: Colors.red, child: Row( mainAxisAlignment: MainAxisAlignment.end, children: [ @@ -264,7 +251,6 @@ class _AuthorizedAdminPageState extends State var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); if (isDemoMode == false) { Get.toNamed(Routers.volumeAuthorizationLockManagePage); - // Navigator.pushNamed(context, Routers.volumeAuthorizationLockManagePage); } else { logic.showToast("演示模式"); } @@ -281,6 +267,43 @@ class _AuthorizedAdminPageState extends State ); } + // 实名认证 + Widget keyRealNameWidget() { + return Column( + children: [ + Obx(() => CommonItem( + leftTitel: TranslationLoader.lanKeys!.realNameAuthentication!.tr, + rightTitle: "", + isTipsImg: true, + isHaveLine: + logic.state.isRequireAuth.value == true ? true : false, + tipsImgAction: () { + ShowTipView().showSureAlertDialog( + "人脸实名认证指的是用户在使用手机APP开锁时,需要先进行本人人脸验证,验证通过才能开锁。".tr); + }, + isHaveRightWidget: true, + rightWidget: SizedBox( + width: 60.w, height: 50.h, child: _realNameAuthSwitch()), + )), + Obx(() => Visibility( + visible: logic.state.isRequireAuth.value, + child: CommonItem( + leftTitel: '真实姓名'.tr, + rightTitle: "", + isHaveRightWidget: true, + isHaveLine: true, + rightWidget: getTFWidget(false, '请输入真实姓名'.tr, 3)))), + Obx(() => Visibility( + visible: logic.state.isRequireAuth.value, + child: CommonItem( + leftTitel: '身份证号'.tr, + rightTitle: "", + isHaveRightWidget: true, + rightWidget: getTFWidget(false, '请输入身份证号'.tr, 4)))), + ], + ); + } + // 发送电子钥匙成功 Widget sendElectronicKeySucceed() { return Column( @@ -336,11 +359,9 @@ class _AuthorizedAdminPageState extends State if (state.emailOrPhoneController.text.contains("@")) { Get.toNamed(Routers.sendEmailNotificationPage); } else { - // _openModalBottomSheet(); NativeInteractionTool() .loadNativeShare(shareText: state.pwdShareStr); } - // Get.toNamed(state.emailOrPhoneController.text.contains("@")? Routers.sendEmailNotificationPage:Routers.sendEmailNotificationPage); }, ), SizedBox( @@ -349,7 +370,6 @@ class _AuthorizedAdminPageState extends State OutLineBtn( btnName: '微信通知', onClick: () { - // _openModalBottomSheet(); NativeInteractionTool() .loadNativeShare(shareText: state.pwdShareStr); }, @@ -357,12 +377,6 @@ class _AuthorizedAdminPageState extends State SizedBox( height: 10.h, ), - // OutLineBtn( - // btnName: '标记为:已入住', - // onClick: () { - // logic.updateRoomCheckIn(); - // }, - // ), ], ); } @@ -384,9 +398,7 @@ class _AuthorizedAdminPageState extends State ], style: TextStyle( fontSize: 22.sp, color: AppColors.darkGrayTextColor), - controller: lineIndex == 1 - ? state.emailOrPhoneController - : state.keyNameController, + controller: logic.getCurrentController(lineIndex), autofocus: false, textAlign: TextAlign.end, decoration: InputDecoration( @@ -408,15 +420,6 @@ class _AuthorizedAdminPageState extends State BorderSide(width: 0, color: Colors.transparent)), contentPadding: const EdgeInsets.symmetric(vertical: 0), ), - // decoration: InputDecoration( - // //输入里面输入文字内边距设置 - // contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0), - // hintText: tfStr, - // hintStyle: TextStyle( - // color: AppColors.placeholderTextColor, fontSize: 22.sp), - // //不需要输入框下划线 - // border: InputBorder.none, - // ), ), ), SizedBox( @@ -460,7 +463,7 @@ class _AuthorizedAdminPageState extends State } //实名认证 - CupertinoSwitch _switch() { + CupertinoSwitch _realNameAuthSwitch() { return CupertinoSwitch( activeColor: CupertinoColors.activeBlue, trackColor: CupertinoColors.systemGrey5, @@ -469,6 +472,11 @@ class _AuthorizedAdminPageState extends State onChanged: (value) { setState(() { state.isAuthentication.value = !state.isAuthentication.value; + if (state.isAuthentication.value == true) { + logic.keyCheckFace(); + } else { + state.isRequireAuth.value = false; + } }); }, ); @@ -631,11 +639,9 @@ class _AuthorizedAdminPageState extends State Tab _tab(ItemView item) { return Tab( - // text: item.title, child: Container( width: 1.sw / 4, margin: EdgeInsets.all(10.w), - // color: Colors.red, child: Text( item.title, textAlign: TextAlign.center, diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_state.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_state.dart index 1421ac32..0a350e43 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_state.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_state.dart @@ -3,23 +3,27 @@ import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart import 'package:get/get.dart'; import 'package:star_lock/tools/dateTool.dart'; -import '../../../lockMian/entity/lockListInfo_entity.dart'; - class AuthorizedAdminState { - final TextEditingController emailOrPhoneController = TextEditingController(); //邮箱/手机号输入框 - final TextEditingController keyNameController = TextEditingController(); //钥匙名输入框 + final TextEditingController emailOrPhoneController = + TextEditingController(); //邮箱/手机号输入框 + final TextEditingController keyNameController = + TextEditingController(); //钥匙名输入框 late TabController tabController; + TextEditingController realNameController = TextEditingController(); //真实姓名输入框 + TextEditingController idCardController = TextEditingController(); //身份证号输入框 final FlutterContactPicker contactPicker = FlutterContactPicker(); late Contact contact; - // final keyInfo = LockListInfoItemEntity().obs; - // final lockMainEntity = LockMainEntity().obs; - final isAuthentication = false.obs; //是否可以实名认证 + var isAuthentication = false.obs; //是否可以实名认证 final onlyManageYouCreatesUser = false.obs; // 只能管理自己创建的用户 - var beginDate = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs; //默认为当前时间 开始时间 - var endDate = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;//默认为当前时间 结束时间 + var beginDate = DateTool() + .dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()) + .obs; //默认为当前时间 开始时间 + var endDate = DateTool() + .dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()) + .obs; //默认为当前时间 结束时间 var isSendSuccess = false.obs; var countryName = '中国'.obs; @@ -31,9 +35,5 @@ class AuthorizedAdminState { String pwdShareStr = '您好,您的授权管理员生成成功'; var addUserId = ''.obs; - // AuthorizedAdminState() { - // Map map = Get.arguments; - // // lockMainEntity.value = map["lockMainEntity"]; - // keyInfo.value = map["keyInfo"]; - // } + var isRequireAuth = false.obs; //是否需要实名认证的必填项 } diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_logic.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_logic.dart index dd967e4b..c89ecb27 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_logic.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_logic.dart @@ -22,14 +22,14 @@ class AuthorizedAdminListLogic extends BaseGetXController { pageNo: pageNo.toString(), pageSize: pageSize.toString(), startDate: '0', - searchStr:state.searchStr.value); + searchStr: state.searchStr.value); if (entity.errorCode!.codeIsSuccessful) { if (pageNo == 1) { - state.itemDataList.value = entity.data!.itemList!; + state.itemDataList.value = entity.data!.itemList; pageNo++; } else { - if (entity.data!.itemList!.isNotEmpty) { - state.itemDataList.value.addAll(entity.data!.itemList!); + if (entity.data!.itemList.isNotEmpty) { + state.itemDataList.addAll(entity.data!.itemList); pageNo++; } } @@ -39,11 +39,8 @@ class AuthorizedAdminListLogic extends BaseGetXController { //删除电子钥匙名称请求 Future deleteKeyRequest(String keyId, int includeUnderlings) async { - ElectronicKeyListEntity entity = - await ApiRepository.to.deleteElectronicKey( - keyId:keyId, - includeUnderlings: includeUnderlings - ); + ElectronicKeyListEntity entity = await ApiRepository.to.deleteElectronicKey( + keyId: keyId, includeUnderlings: includeUnderlings); if (entity.errorCode!.codeIsSuccessful) { showToast("删除成功"); pageNo = 1; @@ -55,7 +52,8 @@ class AuthorizedAdminListLogic extends BaseGetXController { StreamSubscription? _getAuthorizedAdminPageRefreshUIEvent; void _getAuthorizedAdminPageRefreshUIAction() { // 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus - _getAuthorizedAdminPageRefreshUIEvent = eventBus.on().listen((event) { + _getAuthorizedAdminPageRefreshUIEvent = + eventBus.on().listen((event) { pageNo = 1; mockNetworkDataRequest(); }); diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart index 1400711f..752a1115 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart @@ -11,7 +11,6 @@ import 'package:star_lock/tools/storage.dart'; import '../../../../appRouters.dart'; import '../../../../app_settings/app_colors.dart'; import '../../../../tools/EasyRefreshTool.dart'; -import '../../../../tools/showIosTipView.dart'; import '../../../../tools/showTipView.dart'; import '../../../../tools/submitBtn.dart'; import '../../../../tools/titleAppBar.dart'; @@ -40,7 +39,7 @@ class _AuthorizedAdminListPageState extends State { // 获取是否是演示模式 演示模式不获取接口 var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); if (isDemoMode == false) { - logic.mockNetworkDataRequest().then((ElectronicKeyListEntity value){ + logic.mockNetworkDataRequest().then((ElectronicKeyListEntity value) { setState(() {}); }); } @@ -56,24 +55,24 @@ class _AuthorizedAdminListPageState extends State { backgroundColor: AppColors.mainColor, ), body: EasyRefreshTool( - onRefresh: (){ + onRefresh: () { logic.pageNo = 1; mockRequest(); }, - onLoad: (){ + onLoad: () { mockRequest(); }, child: Column( children: [ - Expanded( - child:_buildMainUI()), + Expanded(child: _buildMainUI()), SizedBox( height: 20.h, ), AddBottomWhiteBtn( btnName: TranslationLoader.lanKeys!.addAuthorizedAdmin!.tr, onClick: () { - Navigator.pushNamed(context, Routers.authorizedAdminPage).then((val) { + Navigator.pushNamed(context, Routers.authorizedAdminPage) + .then((val) { if (val != null) { logic.pageNo = 1; mockRequest(); @@ -93,116 +92,80 @@ class _AuthorizedAdminListPageState extends State { return Obx(() => state.itemDataList.value.isEmpty ? NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - 90) : SlidableAutoCloseBehavior( - child: ListView.separated( - itemCount: state.itemDataList.value.length, - itemBuilder: (c, index) { - ElectronicKeyListItem indexEntity = state.itemDataList.value[index]; - String useDateStr = ''; //使用期限 - String keyStatus = ''; //钥匙状态 + child: ListView.separated( + itemCount: state.itemDataList.value.length, + itemBuilder: (c, index) { + ElectronicKeyListItem indexEntity = + state.itemDataList.value[index]; + String useDateStr = ''; //使用期限 + String keyStatus = ''; //钥匙状态 - //使用期限 - useDateStr = getUseDateStr(indexEntity); + //使用期限 + useDateStr = getUseDateStr(indexEntity); - //钥匙状态 - keyStatus = XSConstantMacro.getKeyStatusStr(indexEntity.keyStatus!); + //钥匙状态 + keyStatus = + XSConstantMacro.getKeyStatusStr(indexEntity.keyStatus!); - //是否为管理钥匙 - bool isAdminKey = false; - if (indexEntity.keyRight == 1) { - isAdminKey = true; - } else { - isAdminKey = false; - } - - return Slidable( - key:ValueKey(indexEntity.keyId), - endActionPane: ActionPane( - extentRatio: 0.2, - motion: const ScrollMotion(), - children: [ - SlidableAction( - onPressed: (BuildContext context){ - ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时删除其发送的所有钥匙,钥匙删除后不能恢复', (isAllData) { - logic.deleteKeyRequest(indexEntity.keyId.toString(), isAllData ? 1 : 0); - }); - }, - backgroundColor: Colors.red, - foregroundColor: Colors.white, - label: '删除', - padding: EdgeInsets.only(left: 5.w, right: 5.w), - ), - ], - ), - child: _electronicKeyItem('images/controls_user.png', indexEntity.keyName!, useDateStr, keyStatus, isAdminKey, () { - Navigator.pushNamed(context, Routers.electronicKeyDetailPage, arguments: { - "itemData": indexEntity, - }).then((val) { - if (val != null) { - logic.mockNetworkDataRequest(); - setState(() {}); + //是否为管理钥匙 + bool isAdminKey = false; + if (indexEntity.keyRight == 1) { + isAdminKey = true; + } else { + isAdminKey = false; } - }); - }), - ); - // if (index < state.itemDataList.value.length) { - // return LeftSlideActions( - // // key: Key(indexEntity.lockId!.toString()), - // actionsWidth: 60, - // actions: [ - // _buildDeleteBtn(indexEntity), - // ], - // decoration: const BoxDecoration( - // borderRadius: BorderRadius.all(Radius.circular(1)), - // ), - // child: _electronicKeyItem( - // 'images/controls_user.png', - // indexEntity.keyName!, - // useDateStr, - // keyStatus, - // isAdminKey, () { - // Navigator.pushNamed( - // context, Routers.electronicKeyDetailPage, - // arguments: {'itemData': indexEntity}).then((val) { - // if (val != null) { - // logic.mockNetworkDataRequest(); - // setState(() {}); - // } - // }); - // }), - // ); - // } - return const SizedBox.shrink(); - }, - separatorBuilder: (BuildContext context, int index) { - return Divider( - height: 1.h, - color: AppColors.greyLineColor, - ); - }, - ), - )); + return Slidable( + key: ValueKey(indexEntity.keyId), + endActionPane: ActionPane( + extentRatio: 0.2, + motion: const ScrollMotion(), + children: [ + SlidableAction( + onPressed: (BuildContext context) { + ShowTipView() + .showDeleteAdministratorIsHaveAllDataDialog( + '同时删除其发送的所有钥匙,钥匙删除后不能恢复', (isAllData) { + logic.deleteKeyRequest(indexEntity.keyId.toString(), + isAllData ? 1 : 0); + }); + }, + backgroundColor: Colors.red, + foregroundColor: Colors.white, + label: '删除', + padding: EdgeInsets.only(left: 5.w, right: 5.w), + ), + ], + ), + child: _electronicKeyItem( + 'images/controls_user.png', + indexEntity.keyName!, + useDateStr, + keyStatus, + isAdminKey, () { + Navigator.pushNamed( + context, Routers.electronicKeyDetailPage, + arguments: { + "itemData": indexEntity, + }).then((val) { + if (val != null) { + logic.mockNetworkDataRequest(); + setState(() {}); + } + }); + }), + ); + }, + separatorBuilder: (BuildContext context, int index) { + return Divider( + height: 1.h, + color: AppColors.greyLineColor, + ); + }, + ), + )); } - // void showIosTipViewDialog( - // BuildContext context, String keyId) { - // showDialog( - // context: context, - // builder: (BuildContext context) { - // return ShowIosTipView( - // title: "提示", - // tipTitle: "确定要删除吗?", - // sureClick: () { - // Get.back(); - // logic.deleteKeyRequest(keyId); - // }, - // cancelClick: () { - // Get.back(); - // }, - // ); - // }); - // } - //使用期限 String getUseDateStr(ElectronicKeyListItem indexEntity) { String useDateStr = ''; @@ -216,48 +179,11 @@ class _AuthorizedAdminListPageState extends State { useDateStr = '${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}'; } else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) { - //永久 - // DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); - // useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 永久'; useDateStr = "永久"; } - // else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) { - // //单次 - // // DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); - // // useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 单次'; - // useDateStr = "单次"; - // } else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) { - // //循环 - // useDateStr = '循环'; - // } - return useDateStr; } -//钥匙状态 -// String getKeyStatus(int? keyStatusFlag) { -// String keyStatus = ''; -// -// if (keyStatusFlag == 110401) { -// //正常使用 -// keyStatus = ''; -// } else if (keyStatusFlag == 110402) { -// //待接收 -// keyStatus = '待接收'; -// } else if (keyStatusFlag == 110405) { -// //已冻结 -// keyStatus = '已冻结'; -// } else if (keyStatusFlag == 110408) { -// //已删除 -// keyStatus = '已删除'; -// } else if (keyStatusFlag == 110410) { -// //已重置 -// keyStatus = '已重置'; -// } -// -// return keyStatus; -// } - Widget _electronicKeyItem(String avatarURL, String receiveUser, String useDate, String keyStatus, bool isAdminKey, Function() action) { return GestureDetector( @@ -268,7 +194,11 @@ class _AuthorizedAdminListPageState extends State { child: Row( children: [ SizedBox(width: 30.w), - Image.asset(avatarURL, width: 60.w, height: 60.w,), + Image.asset( + avatarURL, + width: 60.w, + height: 60.w, + ), SizedBox(width: 20.w), Expanded( child: Column( @@ -281,14 +211,13 @@ class _AuthorizedAdminListPageState extends State { child: Row( children: [ Flexible( - child: Text( - receiveUser, + child: Text(receiveUser, maxLines: 1, overflow: TextOverflow.ellipsis, - style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor) - ), + style: TextStyle( + fontSize: 24.sp, + color: AppColors.blackColor)), ), - ], ), ), @@ -321,80 +250,4 @@ class _AuthorizedAdminListPageState extends State { ), ); } - - // Widget _electronicKeyItem(String avatarURL, String receiveUser, - // String useDate, String keyStatus, bool isAdminKey, Function() action) { - // return GestureDetector( - // onTap: action, - // child: Container( - // height: 100.h, - // // margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w), - // // decoration: BoxDecoration( - // // color: Colors.white, - // // borderRadius: BorderRadius.circular(10.w), - // // ), - // child: Row( - // children: [ - // SizedBox( - // width: 30.w, - // ), - // Image.asset( - // avatarURL, - // width: 60.w, - // height: 60.w, - // ), - // SizedBox( - // width: 20.w, - // ), - // Expanded( - // child: Column( - // mainAxisAlignment: MainAxisAlignment.center, - // children: [ - // Row( - // mainAxisAlignment: MainAxisAlignment.start, - // children: [ - // Text( - // receiveUser, - // style: TextStyle( - // fontSize: 24.sp, color: AppColors.blackColor), - // ), - // SizedBox( - // width: 8.w, - // ), - // Container( - // padding: EdgeInsets.only( - // left: 4.w, right: 4.w, top: 1.w, bottom: 1.w), - // decoration: BoxDecoration( - // color: AppColors.toBeReceiveBgColor, - // borderRadius: BorderRadius.circular(5.0), - // ), - // child: Text( - // keyStatus, - // style: TextStyle(color: Colors.red, fontSize: 16.sp), - // ), - // ) - // ], - // ), - // SizedBox(height: 5.h), - // Row( - // mainAxisAlignment: MainAxisAlignment.start, - // children: [ - // Text( - // useDate, - // style: TextStyle( - // fontSize: 18.sp, - // color: AppColors.placeholderTextColor), - // ), - // ], - // ), - // SizedBox(width: 20.h), - // ], - // ), - // ), - // SizedBox(width: 20.h), - // ], - // ), - // ), - // ); - // } } diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_page.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_page.dart index f3077f96..1766a13d 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_page.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_page.dart @@ -270,8 +270,6 @@ class _VolumeAuthorizationLockPageState autofocus: false, textAlign: TextAlign.end, decoration: InputDecoration( - //输入里面输入文字内边距设置 - // contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0), hintText: tfStr, hintStyle: TextStyle(fontSize: 22.sp), focusedBorder: const OutlineInputBorder( @@ -288,14 +286,6 @@ class _VolumeAuthorizationLockPageState BorderSide(width: 0, color: Colors.transparent)), contentPadding: const EdgeInsets.symmetric(vertical: 0), ), - // decoration: InputDecoration( - // //输入里面输入文字内边距设置 - // contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0), - // hintText: tfStr, - // hintStyle: TextStyle(fontSize: 22.sp), - // //不需要输入框下划线 - // border: InputBorder.none, - // ), ), ), SizedBox( diff --git a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_logic.dart b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_logic.dart index 5aefa554..59fb9403 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_logic.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_logic.dart @@ -142,7 +142,7 @@ class SendElectronicKeyViewLogic extends BaseGetXController { ? '1' : '2', endDate: int.parse(endDate), - faceAuthentication: state.isAuthentication == true ? '1' : '2', + faceAuthentication: state.isAuthentication.value == true ? '1' : '2', isCameraEnable: '2', isRemoteUnlock: state.isRemoteUnlock == true ? '1' : '2', keyNameForAdmin: state.keyNameController.text, diff --git a/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_page.dart b/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_page.dart index 1e5b0d33..6e00872c 100644 --- a/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_page.dart +++ b/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_page.dart @@ -43,18 +43,6 @@ class _LockOperatingRecordPageState extends State { onPressed: () async { var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); if (isDemoMode == false) { - // JhPopMenus.showLinePop(context, clickCallback: (index, selText) { - // if (index == 0) { - // logic.mockNetworkDataRequest(); - // } else if (index == 1) { - // logic.clearOperationRecordRequest(); - // } - // }, listData: [ - // {'text': '读取记录'}, - // {'text': '清空记录'}, - // {'text': '导出记录'}, - // ]); - _openModalBottomSheet(); } else { // Get.toNamed(Routers.selectLockTypePage); @@ -67,20 +55,22 @@ class _LockOperatingRecordPageState extends State { ), body: Column( children: [ - (state.keyInfos.value.isLockOwner == 1 || state.keyInfos.value.keyRight == 1) ? - Column( - children: [ - Container( - padding: EdgeInsets.all(20.h), - child: Text( - TranslationLoader.lanKeys!.lockOperatingRecordTip!.tr, - textAlign: TextAlign.start, - style: TextStyle(fontSize: 20.sp), - ), - ), - _searchWidget(), - ], - ) : Container(), + (state.keyInfos.value.isLockOwner == 1 || + state.keyInfos.value.keyRight == 1) + ? Column( + children: [ + Container( + padding: EdgeInsets.all(20.h), + child: Text( + TranslationLoader.lanKeys!.lockOperatingRecordTip!.tr, + textAlign: TextAlign.start, + style: TextStyle(fontSize: 20.sp), + ), + ), + _searchWidget(), + ], + ) + : Container(), SizedBox(height: 10.h), Expanded(child: _buildMainUI()), ], @@ -148,22 +138,6 @@ class _LockOperatingRecordPageState extends State { : NoData()); } - Widget _dateItem(String lockDate) { - return Container( - height: 60.h, - // color: Colors.red, - padding: EdgeInsets.only(left: 20.h, right: 20.h), - child: Row( - children: [ - Text( - lockDate, - style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor), - ), - ], - ), - ); - } - String getTypeIcon(int type) { String title = 'images/controls_user.png'; switch (type) { diff --git a/star_lock/lib/main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_logic.dart b/star_lock/lib/main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_logic.dart index 00b8ee8c..10be744e 100644 --- a/star_lock/lib/main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_logic.dart +++ b/star_lock/lib/main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_logic.dart @@ -14,7 +14,7 @@ class CatEyeWorkModeLogic extends BaseGetXController { catEyeConfig: [ { 'catEyeMode': - state.boolList.value.indexWhere((element) => element == true) + 1, + state.boolList.indexWhere((element) => element == true) + 1, 'catEyeModeConfig': { 'recordMode': state.lockSetInfoData.value.lockSettingInfo! .catEyeConfig!.isNotEmpty @@ -63,24 +63,17 @@ class CatEyeWorkModeLogic extends BaseGetXController { state.catEyeConfigData.value = entity.data!.lockSettingInfo!.catEyeConfig![0]; - // state.selectCatEyeWorkMode.value = - // state.catEyeConfigData.value.catEyeMode!; - if (state.catEyeConfigData.value.catEyeMode == XSConstantMacro.catEyeWorkModePowerSaving) { - // state.boolList.value[0] = true; state.boolList.value = [true, false, false, false]; } else if (state.catEyeConfigData.value.catEyeMode == XSConstantMacro.catEyeWorkModeStayCapture) { - // state.boolList.value[1] = true; state.boolList.value = [false, true, false, false]; } else if (state.catEyeConfigData.value.catEyeMode == XSConstantMacro.catEyeWorkModeRealTimeMonitoring) { - // state.boolList.value[2] = true; state.boolList.value = [false, false, true, false]; } else if (state.catEyeConfigData.value.catEyeMode == XSConstantMacro.catEyeWorkModeCustom) { - // state.boolList.value[3] = true; state.boolList.value = [false, false, false, true]; } } diff --git a/star_lock/lib/main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_page.dart b/star_lock/lib/main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_page.dart index 14a56478..c205c0fc 100644 --- a/star_lock/lib/main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_page.dart +++ b/star_lock/lib/main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_page.dart @@ -137,24 +137,6 @@ class _CatEyeWorkModePageState extends State { for (int i = 0; i < state.boolList.value.length; i++) { if (clickIndex == i) { state.boolList.value[clickIndex] = true; - // switch (clickIndex) { - // case 0: - // state.selectCatEyeWorkMode.value = - // XSConstantMacro.catEyeWorkModePowerSaving; - // break; - // case 1: - // state.selectCatEyeWorkMode.value = - // XSConstantMacro.catEyeWorkModeStayCapture; - // break; - // case 2: - // state.selectCatEyeWorkMode.value = - // XSConstantMacro.catEyeWorkModeRealTimeMonitoring; - // break; - // case 3: - // state.selectCatEyeWorkMode.value = - // XSConstantMacro.catEyeWorkModeCustom; - // break; - // } logic.updateCatEyeModeConfig(); } else { state.boolList.value[i] = false;