diff --git a/lib/blue/io_protocol/io_referEventRecordTime.dart b/lib/blue/io_protocol/io_referEventRecordTime.dart index 04e38917..0c5f6bf3 100755 --- a/lib/blue/io_protocol/io_referEventRecordTime.dart +++ b/lib/blue/io_protocol/io_referEventRecordTime.dart @@ -15,6 +15,7 @@ class SenderReferEventRecordTimeCommand extends SenderProtocol { String? userID; int? logsCount; int? time; + int? currentDate; List? token; int? needAuthor; List? publicKey; @@ -25,6 +26,7 @@ class SenderReferEventRecordTimeCommand extends SenderProtocol { this.userID, this.logsCount, this.time, + this.currentDate, this.token, this.needAuthor, this.publicKey, @@ -34,7 +36,7 @@ class SenderReferEventRecordTimeCommand extends SenderProtocol { @override String toString() { return 'SenderReferEventRecordTimeCommand{keyID: $keyID, ' - 'userID: $userID, logsCount: $logsCount, time:$time timeStr: ${DateTool().dateIntToYMDHNString(time)}, ' + 'userID: $userID, logsCount: $logsCount, time:$time timeStr: ${DateTool().dateIntToYMDHNString(time)}, currentDate: ${DateTool().dateIntToYMDHNString(time)}' 'token: $token, needAuthor: $needAuthor, publicKey: $publicKey, ' 'privateKey: $privateKey}'; } @@ -74,7 +76,13 @@ class SenderReferEventRecordTimeCommand extends SenderProtocol { subData.add((time! & 0xff000000) >> 24); subData.add((time! & 0xff0000) >> 16); subData.add((time! & 0xff00) >> 8); - subData.add((time! & 0xff)); + subData.add(time! & 0xff); + + // currentDate + subData.add((currentDate! & 0xff000000) >> 24); + subData.add((currentDate! & 0xff0000) >> 16); + subData.add((currentDate! & 0xff00) >> 8); + subData.add(currentDate! & 0xff); // token // subData.addAll(token!); @@ -107,7 +115,7 @@ class SenderReferEventRecordTimeCommand extends SenderProtocol { data.addAll(subData); if ((data.length % 16) != 0) { - int add = (16 - data.length % 16); + int add = 16 - data.length % 16; for (int i = 0; i < add; i++) { data.add(0); } diff --git a/lib/blue/sender_manage.dart b/lib/blue/sender_manage.dart index 329e05f2..d2a25337 100755 --- a/lib/blue/sender_manage.dart +++ b/lib/blue/sender_manage.dart @@ -816,6 +816,7 @@ class IoSenderManage { required String? userID, required int? logsCount, required int? time, + required int? currentDate, required List? token, required int? needAuthor, required List? publicKey, diff --git a/lib/main/lockDetail/doorLockLog/doorLockLog_logic.dart b/lib/main/lockDetail/doorLockLog/doorLockLog_logic.dart index bc1a85e8..f27a2023 100755 --- a/lib/main/lockDetail/doorLockLog/doorLockLog_logic.dart +++ b/lib/main/lockDetail/doorLockLog/doorLockLog_logic.dart @@ -59,19 +59,15 @@ class DoorLockLogLogic extends BaseGetXController { // AppLog.log("indexList:$indexList"); final Map indexMap = {}; indexMap['type'] = indexList[0].toString(); - const int operateDate = 0; - // if (indexList[0] == 2) { - final int userNo = (indexList[1] * 256) + indexList[2]; - indexMap['user'] = userNo.toString(); - AppLog.log('userNouserNouserNouserNo:$userNo'); - final List passwordData = indexList.sublist(7, 17); - final String password = utf8String(passwordData); - indexMap['password'] = password.toString(); - AppLog.log('passwordpasswordpassword:$password'); - // } else { - // final int userNo = (indexList[1] * 256) + indexList[2]; - // indexMap['user'] = userNo.toString(); - // } + + final int userNo = (indexList[1] * 256) + indexList[2]; + indexMap['user'] = userNo.toString(); + // AppLog.log('userNouserNouserNouserNo:$userNo'); + + final List passwordData = indexList.sublist(7, 17); + final String password = utf8String(passwordData); + indexMap['password'] = password.toString(); + // AppLog.log('passwordpasswordpassword:$password'); indexMap['success'] = '1'; @@ -81,17 +77,13 @@ class DoorLockLogLogic extends BaseGetXController { (0xFF & indexList[6]); indexMap['date'] = '${time * 1000}'; uploadList.add(indexMap); - - if (i == getList.length - 1) { - //设置最后的时间戳 - state.operateDate = operateDate; - } } - lockRecordUploadData(uploadList); - if (dataLength == state.logCountPage) { state.ifHaveNext = true; + } else { + state.ifHaveNext = false; } + lockRecordUploadData(uploadList); } break; case 0x06: @@ -110,8 +102,7 @@ class DoorLockLogLogic extends BaseGetXController { showBlueConnetctToastTimer(action: () { dismissEasyLoading(); }); - BlueManage().blueSendData(BlueManage().connectDeviceName, - (BluetoothConnectionState connectionStateState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionStateState) async { if (connectionStateState == BluetoothConnectionState.connected) { final List? privateKey = await Storage.getStringList(saveBluePrivateKey); final List getPrivateKeyList = @@ -130,6 +121,7 @@ class DoorLockLogLogic extends BaseGetXController { logsCount: state.logCountPage, // time:DateTime.now().millisecondsSinceEpoch~/1000, time: state.operateDate, + currentDate: state.currentDate, token: getTokenList, needAuthor: 1, publicKey: getPublicKeyList, @@ -202,6 +194,7 @@ class DoorLockLogLogic extends BaseGetXController { lockId: state.keyInfos.value.lockId.toString()); if (entity.errorCode!.codeIsSuccessful) { state.operateDate = entity.data!.operateDate! ~/ 1000; + state.currentDate = entity.data!.currentDate! ~/ 1000; senderReferEventRecordTime(); } } diff --git a/lib/main/lockDetail/doorLockLog/doorLockLog_state.dart b/lib/main/lockDetail/doorLockLog/doorLockLog_state.dart index 9baea876..e4ff3970 100755 --- a/lib/main/lockDetail/doorLockLog/doorLockLog_state.dart +++ b/lib/main/lockDetail/doorLockLog/doorLockLog_state.dart @@ -63,6 +63,7 @@ class DoorLockLogState { RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示 int operateDate = 0; // 按日期查询消息记录的时间戳 + int currentDate = 0; // 当前服务器UTC毫秒时间戳 bool ifHaveNext = false; // 页码 int logCountPage = 10; // 蓝牙记录一页多少个 Rx currentSelectDate = DateTime.now().obs; diff --git a/lib/main/lockDetail/lockDetail/lockDetail_logic.dart b/lib/main/lockDetail/lockDetail/lockDetail_logic.dart index 68c694d0..5d0dbf01 100755 --- a/lib/main/lockDetail/lockDetail/lockDetail_logic.dart +++ b/lib/main/lockDetail/lockDetail/lockDetail_logic.dart @@ -51,10 +51,10 @@ class LockDetailLogic extends BaseGetXController { } // 开完锁之后上传记录 - if (reply is SenderReferEventRecordTimeReply && - state.ifCurrentScreen.value == true) { - _replyReferEventRecordTime(reply); - } + // if (reply is SenderReferEventRecordTimeReply && + // state.ifCurrentScreen.value == true) { + // _replyReferEventRecordTime(reply); + // } }); } @@ -255,71 +255,71 @@ class LockDetailLogic extends BaseGetXController { } // 根据时间查解析数据 - Future _replyReferEventRecordTime(Reply reply) async { - final int status = reply.data[2]; - switch (status) { - case 0x00: - //成功 - final int dataLength = (reply.data[5] << 8) + reply.data[6]; - AppLog.log('dataLength:$dataLength'); - if (dataLength > 0) { - reply.data.removeRange(0, 7); - // 把得到的数据按17个字节分割成数组 然后塞进一个新的数组里面 - if (reply.data.length < 17) { - return; - } - final List> getList = splitList(reply.data, 17); - AppLog.log('getList:$getList'); - final List uploadList = []; - for (int i = 0; i < getList.length; i++) { - final List indexList = getList[i]; - AppLog.log('indexList:$indexList'); - final Map indexMap = {}; - indexMap['type'] = indexList[0].toString(); - int operateDate = 0; - // if (indexList[0] == 2) { - final List passwordData = indexList.sublist(7, 17); - final String password = utf8String(passwordData); - AppLog.log('passwordData:$passwordData password:$password'); - indexMap['user'] = password.toString(); - // } else { - // final int userNo = (indexList[1] * 256) + indexList[2]; - // indexMap['user'] = userNo.toString(); - // } - - indexMap['success'] = '1'; - - final int time = (0xff & indexList[3]) << 24 | - (0xff & indexList[4]) << 16 | - (0xff & indexList[5]) << 8 | - (0xFF & indexList[6]); - operateDate = time * 1000; - indexMap['date'] = '$operateDate'; - uploadList.add(indexMap); - - if (i == getList.length - 1) { - //设置最后的时间戳 - state.operateDate = operateDate; - } - } - lockRecordUploadData(uploadList); - - if (dataLength == state.logCountPage) { - senderReferEventRecordTime(); - } else { - await blueManageDisconnect(); - } - } - break; - case 0x06: - //无权限 - blueManageDisconnect(); - break; - default: - blueManageDisconnect(); - break; - } - } + // Future _replyReferEventRecordTime(Reply reply) async { + // final int status = reply.data[2]; + // switch (status) { + // case 0x00: + // //成功 + // final int dataLength = (reply.data[5] << 8) + reply.data[6]; + // AppLog.log('dataLength:$dataLength'); + // if (dataLength > 0) { + // reply.data.removeRange(0, 7); + // // 把得到的数据按17个字节分割成数组 然后塞进一个新的数组里面 + // if (reply.data.length < 17) { + // return; + // } + // final List> getList = splitList(reply.data, 17); + // AppLog.log('getList:$getList'); + // final List uploadList = []; + // for (int i = 0; i < getList.length; i++) { + // final List indexList = getList[i]; + // AppLog.log('indexList:$indexList'); + // final Map indexMap = {}; + // indexMap['type'] = indexList[0].toString(); + // int operateDate = 0; + // // if (indexList[0] == 2) { + // final List passwordData = indexList.sublist(7, 17); + // final String password = utf8String(passwordData); + // AppLog.log('passwordData:$passwordData password:$password'); + // indexMap['user'] = password.toString(); + // // } else { + // // final int userNo = (indexList[1] * 256) + indexList[2]; + // // indexMap['user'] = userNo.toString(); + // // } + // + // indexMap['success'] = '1'; + // + // final int time = (0xff & indexList[3]) << 24 | + // (0xff & indexList[4]) << 16 | + // (0xff & indexList[5]) << 8 | + // (0xFF & indexList[6]); + // operateDate = time * 1000; + // indexMap['date'] = '$operateDate'; + // uploadList.add(indexMap); + // + // if (i == getList.length - 1) { + // //设置最后的时间戳 + // state.operateDate = operateDate; + // } + // } + // lockRecordUploadData(uploadList); + // + // if (dataLength == state.logCountPage) { + // senderReferEventRecordTime(); + // } else { + // await blueManageDisconnect(); + // } + // } + // break; + // case 0x06: + // //无权限 + // blueManageDisconnect(); + // break; + // default: + // blueManageDisconnect(); + // break; + // } + // } // 点击开门事件 Future openDoorAction() async { @@ -375,42 +375,42 @@ class LockDetailLogic extends BaseGetXController { } // 查询事件记录(时间查询) - void senderReferEventRecordTime() { - showBlueConnetctToastTimer( - isShowBlueConnetctToast: false, - action: () { - blueManageDisconnect(); - }); - BlueManage().blueSendData(BlueManage().connectDeviceName, - (BluetoothConnectionState connectionState) async { - if (connectionState == BluetoothConnectionState.connected) { - final List? privateKey = - await Storage.getStringList(saveBluePrivateKey); - final List getPrivateKeyList = - changeStringListToIntList(privateKey!); - - final List? token = await Storage.getStringList(saveBlueToken); - final List getTokenList = changeStringListToIntList(token!); - - final List? publicKey = - await Storage.getStringList(saveBluePublicKey); - final List getPublicKeyList = - changeStringListToIntList(publicKey!); - - IoSenderManage.senderReferEventRecordTimeCommand( - keyID: BlueManage().connectDeviceName, - userID: await Storage.getUid(), - logsCount: state.logCountPage, - // time:DateTime.now().millisecondsSinceEpoch~/1000, - time: state.operateDate, - token: getTokenList, - needAuthor: 1, - publicKey: getPublicKeyList, - privateKey: getPrivateKeyList, - ); - } - }); - } + // void senderReferEventRecordTime() { + // showBlueConnetctToastTimer( + // isShowBlueConnetctToast: false, + // action: () { + // blueManageDisconnect(); + // }); + // BlueManage().blueSendData(BlueManage().connectDeviceName, + // (BluetoothConnectionState connectionState) async { + // if (connectionState == BluetoothConnectionState.connected) { + // final List? privateKey = + // await Storage.getStringList(saveBluePrivateKey); + // final List getPrivateKeyList = + // changeStringListToIntList(privateKey!); + // + // final List? token = await Storage.getStringList(saveBlueToken); + // final List getTokenList = changeStringListToIntList(token!); + // + // final List? publicKey = + // await Storage.getStringList(saveBluePublicKey); + // final List getPublicKeyList = + // changeStringListToIntList(publicKey!); + // + // IoSenderManage.senderReferEventRecordTimeCommand( + // keyID: BlueManage().connectDeviceName, + // userID: await Storage.getUid(), + // logsCount: state.logCountPage, + // // time:DateTime.now().millisecondsSinceEpoch~/1000, + // time: state.operateDate, + // token: getTokenList, + // needAuthor: 1, + // publicKey: getPublicKeyList, + // privateKey: getPrivateKeyList, + // ); + // } + // }); + // } // 从服务器获取锁的时间 开锁时传入 Future getServerDatetime() async { @@ -468,15 +468,15 @@ class LockDetailLogic extends BaseGetXController { } // 查询锁记录最后时间 - Future getLockRecordLastUploadDataTime() async { - final LockOperatingRecordGetLastRecordTimeEntity entity = - await ApiRepository.to.getLockRecordLastUploadDataTime( - lockId: state.keyInfos.value.lockId.toString()); - if (entity.errorCode!.codeIsSuccessful) { - state.operateDate = entity.data!.operateDate! ~/ 1000; - senderReferEventRecordTime(); - } - } + // Future getLockRecordLastUploadDataTime() async { + // final LockOperatingRecordGetLastRecordTimeEntity entity = + // await ApiRepository.to.getLockRecordLastUploadDataTime( + // lockId: state.keyInfos.value.lockId.toString()); + // if (entity.errorCode!.codeIsSuccessful) { + // state.operateDate = entity.data!.operateDate! ~/ 1000; + // senderReferEventRecordTime(); + // } + // } // 操作记录上传 Future lockRecordUploadData(List list) async { diff --git a/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecordGetLastRecordTime_entity.dart b/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecordGetLastRecordTime_entity.dart index 01b46a0d..dcbcf887 100755 --- a/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecordGetLastRecordTime_entity.dart +++ b/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecordGetLastRecordTime_entity.dart @@ -1,8 +1,4 @@ class LockOperatingRecordGetLastRecordTimeEntity { - int? errorCode; - String? description; - String? errorMsg; - Data? data; LockOperatingRecordGetLastRecordTimeEntity( {this.errorCode, this.description, this.errorMsg, this.data}); @@ -13,6 +9,10 @@ class LockOperatingRecordGetLastRecordTimeEntity { errorMsg = json['errorMsg']; data = json['data'] != null ? Data.fromJson(json['data']) : null; } + int? errorCode; + String? description; + String? errorMsg; + Data? data; Map toJson() { final Map data = {}; @@ -27,20 +27,22 @@ class LockOperatingRecordGetLastRecordTimeEntity { } class Data { - String? lockId; - int? operateDate; - - Data({this.lockId, this.operateDate}); + Data({this.lockId, this.operateDate, this.currentDate}); Data.fromJson(Map json) { lockId = json['lockId']; operateDate = json['operateDate']; + currentDate = json['currentDate']; } + String? lockId; + int? operateDate; + int? currentDate; Map toJson() { final Map data = {}; data['lockId'] = lockId; data['operateDate'] = operateDate; + data['currentDate'] = currentDate; return data; } } \ No newline at end of file diff --git a/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_logic.dart b/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_logic.dart index adb7be65..1ed1d547 100755 --- a/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_logic.dart +++ b/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_logic.dart @@ -43,30 +43,28 @@ class LockOperatingRecordLogic extends BaseGetXController { if (dataLength > 0) { reply.data.removeRange(0, 7); // 把得到的数据按8位分割成数组 然后塞进一个新的数组里面 - if(reply.data.length < 17){ + if (reply.data.length < 17) { return; } final List> getList = splitList(reply.data, 17); - AppLog.log('getList:$getList'); + // AppLog.log("getList:$getList"); final List uploadList = []; for (int i = 0; i < getList.length; i++) { final List indexList = getList[i]; - AppLog.log('indexList:$indexList'); + // AppLog.log("indexList:$indexList"); final Map indexMap = {}; + indexMap['type'] = indexList[0].toString(); - // if(indexList[0] == 2){ - final int userNo = (indexList[1] * 256) + indexList[2]; - indexMap['user'] = userNo.toString(); - AppLog.log('userNouserNouserNouserNo:$userNo'); - final List passwordData = indexList.sublist(7, 17); - final String password = utf8String(passwordData); - indexMap['password'] = password.toString(); - AppLog.log('passwordpasswordpassword:$password'); - // }else{ - // final int userNo = (indexList[1]*256) + indexList[2]; - // indexMap['user'] = userNo.toString(); - // } + + final int userNo = (indexList[1] * 256) + indexList[2]; + indexMap['user'] = userNo.toString(); + AppLog.log('userNouserNouserNouserNo:$userNo'); + + final List passwordData = indexList.sublist(7, 17); + final String password = utf8String(passwordData); + indexMap['password'] = password.toString(); + AppLog.log('passwordpasswordpassword:$password'); indexMap['success'] = '1'; @@ -77,11 +75,12 @@ class LockOperatingRecordLogic extends BaseGetXController { indexMap['date'] = '${time * 1000}'; uploadList.add(indexMap); } - lockRecordUploadData(uploadList); - - if(dataLength == state.logCountPage){ + if (dataLength == state.logCountPage) { state.ifHaveNext = true; + } else { + state.ifHaveNext = false; } + lockRecordUploadData(uploadList); } break; case 0x06: @@ -117,6 +116,7 @@ class LockOperatingRecordLogic extends BaseGetXController { logsCount: state.logCountPage, // time:DateTime.now().millisecondsSinceEpoch~/1000, time: state.operateDate, + currentDate: state.currentDate, token: getTokenList, needAuthor: 1, publicKey: getPublicKeyList, @@ -164,18 +164,19 @@ class LockOperatingRecordLogic extends BaseGetXController { } // 查询锁记录最后时间 - void getLockRecordLastUploadDataTime() async { + Future getLockRecordLastUploadDataTime() async { final LockOperatingRecordGetLastRecordTimeEntity entity = await ApiRepository.to .getLockRecordLastUploadDataTime( lockId: CommonDataManage().currentKeyInfo.lockId.toString()); if (entity.errorCode!.codeIsSuccessful) { state.operateDate = entity.data!.operateDate! ~/ 1000; + state.currentDate = entity.data!.currentDate! ~/ 1000; senderReferEventRecordTime(); } } // 操作记录上传 - void lockRecordUploadData(List list) async { + Future lockRecordUploadData(List list) async { final KeyOperationRecordEntity entity = await ApiRepository.to .lockRecordUploadData(lockId: CommonDataManage().currentKeyInfo.lockId.toString(), records: list); if (entity.errorCode!.codeIsSuccessful) { @@ -189,7 +190,7 @@ class LockOperatingRecordLogic extends BaseGetXController { } //清空操作记录 - void clearOperationRecordRequest() async { + Future clearOperationRecordRequest() async { final KeyOperationRecordEntity entity = await ApiRepository.to.clearOperationRecord(CommonDataManage().currentKeyInfo.lockId.toString()); if (entity.errorCode!.codeIsSuccessful) { showToast('清除数据成功', something: (){ @@ -201,7 +202,6 @@ class LockOperatingRecordLogic extends BaseGetXController { @override Future onReady() async { - // TODO: implement onReady super.onReady(); // 获取是否是演示模式 演示模式不获取接口 @@ -230,7 +230,6 @@ class LockOperatingRecordLogic extends BaseGetXController { @override Future onClose() async { - // TODO: implement onClose super.onClose(); //获取是否是演示模式 演示模式不获取接口 diff --git a/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_state.dart b/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_state.dart index 308daede..109e696e 100755 --- a/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_state.dart +++ b/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_state.dart @@ -26,6 +26,7 @@ class LockOperatingRecordState { // 记录名称 RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示 int operateDate = 0; // 按日期查询消息记录的时间戳 + int currentDate = 0; // 当前服务器UTC毫秒时间戳 bool ifHaveNext = false; // 页码 int logCountPage = 10; // 蓝牙记录一页多少个 String idStr = ''; // diff --git a/lib/main/lockDetail/lockSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_page.dart b/lib/main/lockDetail/lockSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_page.dart index 6d6fd4ff..db4e0466 100755 --- a/lib/main/lockDetail/lockSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_page.dart +++ b/lib/main/lockDetail/lockSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_page.dart @@ -11,6 +11,7 @@ import '../../../../../tools/dateTool.dart'; import '../../../../../tools/submitBtn.dart'; import '../../../../../tools/titleAppBar.dart'; import '../../../../../translations/trans_lib.dart'; +import '../../lockSet/lockSetInfo_entity.dart'; import 'uploadElectricQuantity_logic.dart'; class UploadElectricQuantityPage extends StatefulWidget { @@ -61,7 +62,7 @@ class _UploadElectricQuantityPageState extends State ], )), Visibility( - visible: state.lockSetInfoData.value.lockFeature!.isSupportBackupBattery == 1, + visible: (state.lockSetInfoData.value.lockFeature ?? LockFeature()).isSupportBackupBattery == 1, child: Row( mainAxisAlignment: MainAxisAlignment.start, children: [ diff --git a/lib/main/lockDetail/lockSet/lockSet/lockSet_logic.dart b/lib/main/lockDetail/lockSet/lockSet/lockSet_logic.dart index b99435f0..2a38d64c 100755 --- a/lib/main/lockDetail/lockSet/lockSet/lockSet_logic.dart +++ b/lib/main/lockDetail/lockSet/lockSet/lockSet_logic.dart @@ -513,7 +513,6 @@ class LockSetLogic extends BaseGetXController { // 下级界面修改成功后传递数据 StreamSubscription? _passCurrentLockInformationEvent; - void initLoadDataAction(BlockSetStateCallback blockSetStateCallback) { // 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus _passCurrentLockInformationEvent = eventBus @@ -527,22 +526,21 @@ class LockSetLogic extends BaseGetXController { final String content = showContent!.isEmpty ? "${"删除设备失败,请确保在设备附近,设备未被连接,设备已打开".tr}${BlueManage().connectDeviceName!.contains("T9A") == true ? "。如果是全自动锁,请使屏幕变亮".tr : ""}" : showContent; - ShowTipView().showSureAlertDialog(content); + state.showTipView.showSureAlertDialog(content); } /// 以下为删除逻辑 void deleyLockLogicOfRoles() { if (state.lockBasicInfo.value.isLockOwner == 1) { // 超级管理员必须通过连接蓝牙删除 - ShowTipView().showIosTipWithContentDialog('删除锁后,所有信息都会一起删除,确定删除锁吗?'.tr, - () { + state.showTipView.showIosTipWithContentDialog('删除锁后,所有信息都会一起删除,确定删除锁吗?'.tr, () { // 删除锁 - ShowTipView().showTFViewAlertDialog( - state.passwordTF, '请输入登录密码'.tr, '请输入登录密码'.tr, checkLoginPassword); + state.showTipView.resetGetController(); + state.showTipView.showTFViewAlertDialog(state.passwordTF, '请输入登录密码'.tr, '请输入登录密码'.tr, checkLoginPassword); }); } else if (state.lockBasicInfo.value.keyRight == 1) { // 授权管理员弹框提示 - ShowTipView().showDeleteAdministratorIsHaveAllDataDialog( + state.showTipView.showDeleteAdministratorIsHaveAllDataDialog( '同时删除其发送的所有钥匙,钥匙删除后不能恢复'.tr, (bool a) { // 授权管理员删除 state.deleteAdministratorIsHaveAllData.value = a; @@ -550,7 +548,7 @@ class LockSetLogic extends BaseGetXController { }); } else { // 普通用户直接删除 - ShowTipView().showIosTipWithContentDialog('是否删除钥匙?'.tr, deletKeyData); + state.showTipView.showIosTipWithContentDialog('是否删除钥匙?'.tr, deletKeyData); } } diff --git a/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart b/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart index dea517aa..0152248e 100755 --- a/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart +++ b/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart @@ -27,8 +27,7 @@ class LockSetPage extends StatefulWidget { State createState() => _LockSetPageState(); } -class _LockSetPageState extends State - with WidgetsBindingObserver, RouteAware { +class _LockSetPageState extends State with WidgetsBindingObserver, RouteAware { final LockSetLogic logic = Get.put(LockSetLogic()); final LockSetState state = Get.find().state; diff --git a/lib/main/lockDetail/lockSet/lockSet/lockSet_state.dart b/lib/main/lockDetail/lockSet/lockSet/lockSet_state.dart index b5fef828..2713b51e 100755 --- a/lib/main/lockDetail/lockSet/lockSet/lockSet_state.dart +++ b/lib/main/lockDetail/lockSet/lockSet/lockSet_state.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; +import '../../../../tools/showTipView.dart'; import 'lockSetInfo_entity.dart'; class LockSetState { @@ -29,6 +30,7 @@ class LockSetState { RxBool deleteAdministratorIsHaveAllData = false.obs; // 删除管理员是否有所有数据 RxInt sureBtnState = 0.obs;// 0普通状态(可用) 1连接中(不可用) + final ShowTipView showTipView = ShowTipView(); LockSetState() { Map map = Get.arguments; lockId.value = map['lockId']; diff --git a/lib/main/lockDetail/remoteControl/remoteControlList/remoteControlList_logic.dart b/lib/main/lockDetail/remoteControl/remoteControlList/remoteControlList_logic.dart index e531054f..bf959e07 100755 --- a/lib/main/lockDetail/remoteControl/remoteControlList/remoteControlList_logic.dart +++ b/lib/main/lockDetail/remoteControl/remoteControlList/remoteControlList_logic.dart @@ -162,7 +162,7 @@ class RemoteControlListLogic extends BaseGetXController{ return entity; } - // 删除所有IC卡 + // 删除所有遥控 Future resetRemoteControlData() async { final LoginEntity entity = await ApiRepository.to.resetRemoteControlData( lockId: state.lockId.value @@ -181,7 +181,7 @@ class RemoteControlListLogic extends BaseGetXController{ ); if (entity.errorCode!.codeIsSuccessful) { showToast('删除成功'.tr, something: () { - Get.back(result: 'addScuess'); + getRemoteControlListData(isRefresh: true); }); } } diff --git a/lib/main/lockMian/lockList/lockList_logic.dart b/lib/main/lockMian/lockList/lockList_logic.dart index 3796c66b..f83eb672 100755 --- a/lib/main/lockMian/lockList/lockList_logic.dart +++ b/lib/main/lockMian/lockList/lockList_logic.dart @@ -30,6 +30,7 @@ class LockListLogic extends BaseGetXController { LockListState state = LockListState(); List _groupDataList = []; LockListInfoGroupEntity? entity; + final ShowTipView showTipView = ShowTipView(); List get groupDataList { @@ -180,23 +181,22 @@ class LockListLogic extends BaseGetXController { void deleyLockLogicOfRoles() { if (state.lockListInfoItemEntity.isLockOwner == 1) { // 超级管理员必须通过连接蓝牙删除 - ShowTipView().showIosTipWithContentDialog('删除锁后,所有信息都会一起删除,确定删除锁吗?'.tr, - () { + showTipView.showIosTipWithContentDialog('删除锁后,所有信息都会一起删除,确定删除锁吗?'.tr, () { // 删除锁 - ShowTipView().showTFViewAlertDialog( - state.passwordTF, '请输入登录密码'.tr, '请输入登录密码'.tr, checkLoginPassword); + AppLog.log('调用了删除锁'); + showTipView.resetGetController(); + showTipView.showTFViewAlertDialog(state.passwordTF, '请输入登录密码'.tr, '请输入登录密码'.tr, checkLoginPassword); }); } else if (state.lockListInfoItemEntity.keyRight == 1) { // 授权管理员弹框提示 - ShowTipView().showDeleteAdministratorIsHaveAllDataDialog( - '同时删除其发送的所有钥匙,钥匙删除后不能恢复'.tr, (bool a) { + showTipView.showDeleteAdministratorIsHaveAllDataDialog('同时删除其发送的所有钥匙,钥匙删除后不能恢复'.tr, (bool a) { // 授权管理员删除 state.deleteAdministratorIsHaveAllData.value = a; deletKeyData(); }); } else { // 普通用户直接删除 - ShowTipView().showIosTipWithContentDialog('是否删除钥匙?'.tr, deletKeyData); + showTipView.showIosTipWithContentDialog('是否删除钥匙?'.tr, deletKeyData); } } diff --git a/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart b/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart index e2108bc8..da6afb8c 100755 --- a/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart +++ b/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart @@ -179,8 +179,7 @@ class _MinePersonInfoPageState extends State { } })), CommonItem( - leftTitel: - TranslationLoader.lanKeys!.resetPasswords!.tr, + leftTitel: '重置密码'.tr, rightTitle: '', isHaveLine: true, isHaveDirection: true, diff --git a/lib/tools/showTipView.dart b/lib/tools/showTipView.dart index d2cc2369..c38d3dea 100755 --- a/lib/tools/showTipView.dart +++ b/lib/tools/showTipView.dart @@ -94,10 +94,12 @@ class ShowTipView { ); } + TextEditingController getController = TextEditingController(); void showTFViewAlertDialog(TextEditingController controller, String title, String tipTitle, Function sureClick, {List? inputFormatters, bool? isShowSuffixIcon}) { // 点击删除 开始扫描 + getController = controller; showDialog( context: Get.context!, builder: (BuildContext context) { @@ -108,7 +110,6 @@ class ShowTipView { controller: controller, isShowSuffixIcon: isShowSuffixIcon ?? false, sureClick: () { - //发送删除锁请求 if (controller.text.isEmpty) { EasyLoading.showToast(tipTitle, duration: 2000.milliseconds); return; @@ -124,6 +125,10 @@ class ShowTipView { ); } + void resetGetController(){ + getController.text = ''; + } + // 只有一个确定按钮 void showSureBtnTipsAlert( {required String tipsText, required String sureText}) {