Merge branch 'release' into International-language+20240725

This commit is contained in:
魏少阳 2024-07-27 14:37:09 +08:00
commit 7b7e04669b
16 changed files with 202 additions and 193 deletions

View File

@ -15,6 +15,7 @@ class SenderReferEventRecordTimeCommand extends SenderProtocol {
String? userID; String? userID;
int? logsCount; int? logsCount;
int? time; int? time;
int? currentDate;
List<int>? token; List<int>? token;
int? needAuthor; int? needAuthor;
List<int>? publicKey; List<int>? publicKey;
@ -25,6 +26,7 @@ class SenderReferEventRecordTimeCommand extends SenderProtocol {
this.userID, this.userID,
this.logsCount, this.logsCount,
this.time, this.time,
this.currentDate,
this.token, this.token,
this.needAuthor, this.needAuthor,
this.publicKey, this.publicKey,
@ -34,7 +36,7 @@ class SenderReferEventRecordTimeCommand extends SenderProtocol {
@override @override
String toString() { String toString() {
return 'SenderReferEventRecordTimeCommand{keyID: $keyID, ' 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, ' 'token: $token, needAuthor: $needAuthor, publicKey: $publicKey, '
'privateKey: $privateKey}'; 'privateKey: $privateKey}';
} }
@ -74,7 +76,13 @@ class SenderReferEventRecordTimeCommand extends SenderProtocol {
subData.add((time! & 0xff000000) >> 24); subData.add((time! & 0xff000000) >> 24);
subData.add((time! & 0xff0000) >> 16); subData.add((time! & 0xff0000) >> 16);
subData.add((time! & 0xff00) >> 8); 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 // token
// subData.addAll(token!); // subData.addAll(token!);
@ -107,7 +115,7 @@ class SenderReferEventRecordTimeCommand extends SenderProtocol {
data.addAll(subData); data.addAll(subData);
if ((data.length % 16) != 0) { if ((data.length % 16) != 0) {
int add = (16 - data.length % 16); int add = 16 - data.length % 16;
for (int i = 0; i < add; i++) { for (int i = 0; i < add; i++) {
data.add(0); data.add(0);
} }

View File

@ -816,6 +816,7 @@ class IoSenderManage {
required String? userID, required String? userID,
required int? logsCount, required int? logsCount,
required int? time, required int? time,
required int? currentDate,
required List<int>? token, required List<int>? token,
required int? needAuthor, required int? needAuthor,
required List<int>? publicKey, required List<int>? publicKey,

View File

@ -59,19 +59,15 @@ class DoorLockLogLogic extends BaseGetXController {
// AppLog.log("indexList:$indexList"); // AppLog.log("indexList:$indexList");
final Map indexMap = {}; final Map indexMap = {};
indexMap['type'] = indexList[0].toString(); indexMap['type'] = indexList[0].toString();
const int operateDate = 0;
// if (indexList[0] == 2) { final int userNo = (indexList[1] * 256) + indexList[2];
final int userNo = (indexList[1] * 256) + indexList[2]; indexMap['user'] = userNo.toString();
indexMap['user'] = userNo.toString(); // AppLog.log('userNouserNouserNouserNo:$userNo');
AppLog.log('userNouserNouserNouserNo:$userNo');
final List<int> passwordData = indexList.sublist(7, 17); final List<int> passwordData = indexList.sublist(7, 17);
final String password = utf8String(passwordData); final String password = utf8String(passwordData);
indexMap['password'] = password.toString(); indexMap['password'] = password.toString();
AppLog.log('passwordpasswordpassword:$password'); // AppLog.log('passwordpasswordpassword:$password');
// } else {
// final int userNo = (indexList[1] * 256) + indexList[2];
// indexMap['user'] = userNo.toString();
// }
indexMap['success'] = '1'; indexMap['success'] = '1';
@ -81,17 +77,13 @@ class DoorLockLogLogic extends BaseGetXController {
(0xFF & indexList[6]); (0xFF & indexList[6]);
indexMap['date'] = '${time * 1000}'; indexMap['date'] = '${time * 1000}';
uploadList.add(indexMap); uploadList.add(indexMap);
if (i == getList.length - 1) {
//
state.operateDate = operateDate;
}
} }
lockRecordUploadData(uploadList);
if (dataLength == state.logCountPage) { if (dataLength == state.logCountPage) {
state.ifHaveNext = true; state.ifHaveNext = true;
} else {
state.ifHaveNext = false;
} }
lockRecordUploadData(uploadList);
} }
break; break;
case 0x06: case 0x06:
@ -110,8 +102,7 @@ class DoorLockLogLogic extends BaseGetXController {
showBlueConnetctToastTimer(action: () { showBlueConnetctToastTimer(action: () {
dismissEasyLoading(); dismissEasyLoading();
}); });
BlueManage().blueSendData(BlueManage().connectDeviceName, BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionStateState) async {
(BluetoothConnectionState connectionStateState) async {
if (connectionStateState == BluetoothConnectionState.connected) { if (connectionStateState == BluetoothConnectionState.connected) {
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey); final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = final List<int> getPrivateKeyList =
@ -130,6 +121,7 @@ class DoorLockLogLogic extends BaseGetXController {
logsCount: state.logCountPage, logsCount: state.logCountPage,
// time:DateTime.now().millisecondsSinceEpoch~/1000, // time:DateTime.now().millisecondsSinceEpoch~/1000,
time: state.operateDate, time: state.operateDate,
currentDate: state.currentDate,
token: getTokenList, token: getTokenList,
needAuthor: 1, needAuthor: 1,
publicKey: getPublicKeyList, publicKey: getPublicKeyList,
@ -202,6 +194,7 @@ class DoorLockLogLogic extends BaseGetXController {
lockId: state.keyInfos.value.lockId.toString()); lockId: state.keyInfos.value.lockId.toString());
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
state.operateDate = entity.data!.operateDate! ~/ 1000; state.operateDate = entity.data!.operateDate! ~/ 1000;
state.currentDate = entity.data!.currentDate! ~/ 1000;
senderReferEventRecordTime(); senderReferEventRecordTime();
} }
} }

View File

@ -63,6 +63,7 @@ class DoorLockLogState {
RxBool ifCurrentScreen = true.obs; // , RxBool ifCurrentScreen = true.obs; // ,
int operateDate = 0; // int operateDate = 0; //
int currentDate = 0; // UTC毫秒时间戳
bool ifHaveNext = false; // bool ifHaveNext = false; //
int logCountPage = 10; // int logCountPage = 10; //
Rx<DateTime> currentSelectDate = DateTime.now().obs; Rx<DateTime> currentSelectDate = DateTime.now().obs;

View File

@ -51,10 +51,10 @@ class LockDetailLogic extends BaseGetXController {
} }
// //
if (reply is SenderReferEventRecordTimeReply && // if (reply is SenderReferEventRecordTimeReply &&
state.ifCurrentScreen.value == true) { // state.ifCurrentScreen.value == true) {
_replyReferEventRecordTime(reply); // _replyReferEventRecordTime(reply);
} // }
}); });
} }
@ -255,71 +255,71 @@ class LockDetailLogic extends BaseGetXController {
} }
// //
Future<void> _replyReferEventRecordTime(Reply reply) async { // Future<void> _replyReferEventRecordTime(Reply reply) async {
final int status = reply.data[2]; // final int status = reply.data[2];
switch (status) { // switch (status) {
case 0x00: // case 0x00:
// // //
final int dataLength = (reply.data[5] << 8) + reply.data[6]; // final int dataLength = (reply.data[5] << 8) + reply.data[6];
AppLog.log('dataLength:$dataLength'); // AppLog.log('dataLength:$dataLength');
if (dataLength > 0) { // if (dataLength > 0) {
reply.data.removeRange(0, 7); // reply.data.removeRange(0, 7);
// 17 // // 17
if (reply.data.length < 17) { // if (reply.data.length < 17) {
return; // return;
} // }
final List<List<int>> getList = splitList(reply.data, 17); // final List<List<int>> getList = splitList(reply.data, 17);
AppLog.log('getList:$getList'); // AppLog.log('getList:$getList');
final List uploadList = []; // final List uploadList = [];
for (int i = 0; i < getList.length; i++) { // for (int i = 0; i < getList.length; i++) {
final List<int> indexList = getList[i]; // final List<int> indexList = getList[i];
AppLog.log('indexList:$indexList'); // AppLog.log('indexList:$indexList');
final Map indexMap = {}; // final Map indexMap = {};
indexMap['type'] = indexList[0].toString(); // indexMap['type'] = indexList[0].toString();
int operateDate = 0; // int operateDate = 0;
// if (indexList[0] == 2) { // // if (indexList[0] == 2) {
final List<int> passwordData = indexList.sublist(7, 17); // final List<int> passwordData = indexList.sublist(7, 17);
final String password = utf8String(passwordData); // final String password = utf8String(passwordData);
AppLog.log('passwordData:$passwordData password:$password'); // AppLog.log('passwordData:$passwordData password:$password');
indexMap['user'] = password.toString(); // indexMap['user'] = password.toString();
// } else { // // } else {
// final int userNo = (indexList[1] * 256) + indexList[2]; // // final int userNo = (indexList[1] * 256) + indexList[2];
// indexMap['user'] = userNo.toString(); // // indexMap['user'] = userNo.toString();
// } // // }
//
indexMap['success'] = '1'; // indexMap['success'] = '1';
//
final int time = (0xff & indexList[3]) << 24 | // final int time = (0xff & indexList[3]) << 24 |
(0xff & indexList[4]) << 16 | // (0xff & indexList[4]) << 16 |
(0xff & indexList[5]) << 8 | // (0xff & indexList[5]) << 8 |
(0xFF & indexList[6]); // (0xFF & indexList[6]);
operateDate = time * 1000; // operateDate = time * 1000;
indexMap['date'] = '$operateDate'; // indexMap['date'] = '$operateDate';
uploadList.add(indexMap); // uploadList.add(indexMap);
//
if (i == getList.length - 1) { // if (i == getList.length - 1) {
// // //
state.operateDate = operateDate; // state.operateDate = operateDate;
} // }
} // }
lockRecordUploadData(uploadList); // lockRecordUploadData(uploadList);
//
if (dataLength == state.logCountPage) { // if (dataLength == state.logCountPage) {
senderReferEventRecordTime(); // senderReferEventRecordTime();
} else { // } else {
await blueManageDisconnect(); // await blueManageDisconnect();
} // }
} // }
break; // break;
case 0x06: // case 0x06:
// // //
blueManageDisconnect(); // blueManageDisconnect();
break; // break;
default: // default:
blueManageDisconnect(); // blueManageDisconnect();
break; // break;
} // }
} // }
// //
Future<void> openDoorAction() async { Future<void> openDoorAction() async {
@ -375,42 +375,42 @@ class LockDetailLogic extends BaseGetXController {
} }
// () // ()
void senderReferEventRecordTime() { // void senderReferEventRecordTime() {
showBlueConnetctToastTimer( // showBlueConnetctToastTimer(
isShowBlueConnetctToast: false, // isShowBlueConnetctToast: false,
action: () { // action: () {
blueManageDisconnect(); // blueManageDisconnect();
}); // });
BlueManage().blueSendData(BlueManage().connectDeviceName, // BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState connectionState) async { // (BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) { // if (connectionState == BluetoothConnectionState.connected) {
final List<String>? privateKey = // final List<String>? privateKey =
await Storage.getStringList(saveBluePrivateKey); // await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = // final List<int> getPrivateKeyList =
changeStringListToIntList(privateKey!); // changeStringListToIntList(privateKey!);
//
final List<String>? token = await Storage.getStringList(saveBlueToken); // final List<String>? token = await Storage.getStringList(saveBlueToken);
final List<int> getTokenList = changeStringListToIntList(token!); // final List<int> getTokenList = changeStringListToIntList(token!);
//
final List<String>? publicKey = // final List<String>? publicKey =
await Storage.getStringList(saveBluePublicKey); // await Storage.getStringList(saveBluePublicKey);
final List<int> getPublicKeyList = // final List<int> getPublicKeyList =
changeStringListToIntList(publicKey!); // changeStringListToIntList(publicKey!);
//
IoSenderManage.senderReferEventRecordTimeCommand( // IoSenderManage.senderReferEventRecordTimeCommand(
keyID: BlueManage().connectDeviceName, // keyID: BlueManage().connectDeviceName,
userID: await Storage.getUid(), // userID: await Storage.getUid(),
logsCount: state.logCountPage, // logsCount: state.logCountPage,
// time:DateTime.now().millisecondsSinceEpoch~/1000, // // time:DateTime.now().millisecondsSinceEpoch~/1000,
time: state.operateDate, // time: state.operateDate,
token: getTokenList, // token: getTokenList,
needAuthor: 1, // needAuthor: 1,
publicKey: getPublicKeyList, // publicKey: getPublicKeyList,
privateKey: getPrivateKeyList, // privateKey: getPrivateKeyList,
); // );
} // }
}); // });
} // }
// //
Future<void> getServerDatetime() async { Future<void> getServerDatetime() async {
@ -468,15 +468,15 @@ class LockDetailLogic extends BaseGetXController {
} }
// //
Future<void> getLockRecordLastUploadDataTime() async { // Future<void> getLockRecordLastUploadDataTime() async {
final LockOperatingRecordGetLastRecordTimeEntity entity = // final LockOperatingRecordGetLastRecordTimeEntity entity =
await ApiRepository.to.getLockRecordLastUploadDataTime( // await ApiRepository.to.getLockRecordLastUploadDataTime(
lockId: state.keyInfos.value.lockId.toString()); // lockId: state.keyInfos.value.lockId.toString());
if (entity.errorCode!.codeIsSuccessful) { // if (entity.errorCode!.codeIsSuccessful) {
state.operateDate = entity.data!.operateDate! ~/ 1000; // state.operateDate = entity.data!.operateDate! ~/ 1000;
senderReferEventRecordTime(); // senderReferEventRecordTime();
} // }
} // }
// //
Future<void> lockRecordUploadData(List list) async { Future<void> lockRecordUploadData(List list) async {

View File

@ -1,8 +1,4 @@
class LockOperatingRecordGetLastRecordTimeEntity { class LockOperatingRecordGetLastRecordTimeEntity {
int? errorCode;
String? description;
String? errorMsg;
Data? data;
LockOperatingRecordGetLastRecordTimeEntity( LockOperatingRecordGetLastRecordTimeEntity(
{this.errorCode, this.description, this.errorMsg, this.data}); {this.errorCode, this.description, this.errorMsg, this.data});
@ -13,6 +9,10 @@ class LockOperatingRecordGetLastRecordTimeEntity {
errorMsg = json['errorMsg']; errorMsg = json['errorMsg'];
data = json['data'] != null ? Data.fromJson(json['data']) : null; data = json['data'] != null ? Data.fromJson(json['data']) : null;
} }
int? errorCode;
String? description;
String? errorMsg;
Data? data;
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{}; final Map<String, dynamic> data = <String, dynamic>{};
@ -27,20 +27,22 @@ class LockOperatingRecordGetLastRecordTimeEntity {
} }
class Data { class Data {
String? lockId; Data({this.lockId, this.operateDate, this.currentDate});
int? operateDate;
Data({this.lockId, this.operateDate});
Data.fromJson(Map<String, dynamic> json) { Data.fromJson(Map<String, dynamic> json) {
lockId = json['lockId']; lockId = json['lockId'];
operateDate = json['operateDate']; operateDate = json['operateDate'];
currentDate = json['currentDate'];
} }
String? lockId;
int? operateDate;
int? currentDate;
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{}; final Map<String, dynamic> data = <String, dynamic>{};
data['lockId'] = lockId; data['lockId'] = lockId;
data['operateDate'] = operateDate; data['operateDate'] = operateDate;
data['currentDate'] = currentDate;
return data; return data;
} }
} }

View File

@ -43,30 +43,28 @@ class LockOperatingRecordLogic extends BaseGetXController {
if (dataLength > 0) { if (dataLength > 0) {
reply.data.removeRange(0, 7); reply.data.removeRange(0, 7);
// 8 // 8
if(reply.data.length < 17){ if (reply.data.length < 17) {
return; return;
} }
final List<List<int>> getList = splitList(reply.data, 17); final List<List<int>> getList = splitList(reply.data, 17);
AppLog.log('getList:$getList'); // AppLog.log("getList:$getList");
final List uploadList = []; final List uploadList = [];
for (int i = 0; i < getList.length; i++) { for (int i = 0; i < getList.length; i++) {
final List<int> indexList = getList[i]; final List<int> indexList = getList[i];
AppLog.log('indexList:$indexList'); // AppLog.log("indexList:$indexList");
final Map indexMap = {}; final Map indexMap = {};
indexMap['type'] = indexList[0].toString(); indexMap['type'] = indexList[0].toString();
// if(indexList[0] == 2){
final int userNo = (indexList[1] * 256) + indexList[2]; final int userNo = (indexList[1] * 256) + indexList[2];
indexMap['user'] = userNo.toString(); indexMap['user'] = userNo.toString();
AppLog.log('userNouserNouserNouserNo:$userNo'); AppLog.log('userNouserNouserNouserNo:$userNo');
final List<int> passwordData = indexList.sublist(7, 17);
final String password = utf8String(passwordData); final List<int> passwordData = indexList.sublist(7, 17);
indexMap['password'] = password.toString(); final String password = utf8String(passwordData);
AppLog.log('passwordpasswordpassword:$password'); indexMap['password'] = password.toString();
// }else{ AppLog.log('passwordpasswordpassword:$password');
// final int userNo = (indexList[1]*256) + indexList[2];
// indexMap['user'] = userNo.toString();
// }
indexMap['success'] = '1'; indexMap['success'] = '1';
@ -77,11 +75,12 @@ class LockOperatingRecordLogic extends BaseGetXController {
indexMap['date'] = '${time * 1000}'; indexMap['date'] = '${time * 1000}';
uploadList.add(indexMap); uploadList.add(indexMap);
} }
lockRecordUploadData(uploadList); if (dataLength == state.logCountPage) {
if(dataLength == state.logCountPage){
state.ifHaveNext = true; state.ifHaveNext = true;
} else {
state.ifHaveNext = false;
} }
lockRecordUploadData(uploadList);
} }
break; break;
case 0x06: case 0x06:
@ -117,6 +116,7 @@ class LockOperatingRecordLogic extends BaseGetXController {
logsCount: state.logCountPage, logsCount: state.logCountPage,
// time:DateTime.now().millisecondsSinceEpoch~/1000, // time:DateTime.now().millisecondsSinceEpoch~/1000,
time: state.operateDate, time: state.operateDate,
currentDate: state.currentDate,
token: getTokenList, token: getTokenList,
needAuthor: 1, needAuthor: 1,
publicKey: getPublicKeyList, publicKey: getPublicKeyList,
@ -164,18 +164,19 @@ class LockOperatingRecordLogic extends BaseGetXController {
} }
// //
void getLockRecordLastUploadDataTime() async { Future<void> getLockRecordLastUploadDataTime() async {
final LockOperatingRecordGetLastRecordTimeEntity entity = await ApiRepository.to final LockOperatingRecordGetLastRecordTimeEntity entity = await ApiRepository.to
.getLockRecordLastUploadDataTime( .getLockRecordLastUploadDataTime(
lockId: CommonDataManage().currentKeyInfo.lockId.toString()); lockId: CommonDataManage().currentKeyInfo.lockId.toString());
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
state.operateDate = entity.data!.operateDate! ~/ 1000; state.operateDate = entity.data!.operateDate! ~/ 1000;
state.currentDate = entity.data!.currentDate! ~/ 1000;
senderReferEventRecordTime(); senderReferEventRecordTime();
} }
} }
// //
void lockRecordUploadData(List list) async { Future<void> lockRecordUploadData(List list) async {
final KeyOperationRecordEntity entity = await ApiRepository.to final KeyOperationRecordEntity entity = await ApiRepository.to
.lockRecordUploadData(lockId: CommonDataManage().currentKeyInfo.lockId.toString(), records: list); .lockRecordUploadData(lockId: CommonDataManage().currentKeyInfo.lockId.toString(), records: list);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
@ -189,7 +190,7 @@ class LockOperatingRecordLogic extends BaseGetXController {
} }
// //
void clearOperationRecordRequest() async { Future<void> clearOperationRecordRequest() async {
final KeyOperationRecordEntity entity = await ApiRepository.to.clearOperationRecord(CommonDataManage().currentKeyInfo.lockId.toString()); final KeyOperationRecordEntity entity = await ApiRepository.to.clearOperationRecord(CommonDataManage().currentKeyInfo.lockId.toString());
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
showToast('清除数据成功', something: (){ showToast('清除数据成功', something: (){
@ -201,7 +202,6 @@ class LockOperatingRecordLogic extends BaseGetXController {
@override @override
Future<void> onReady() async { Future<void> onReady() async {
// TODO: implement onReady
super.onReady(); super.onReady();
// //
@ -230,7 +230,6 @@ class LockOperatingRecordLogic extends BaseGetXController {
@override @override
Future<void> onClose() async { Future<void> onClose() async {
// TODO: implement onClose
super.onClose(); super.onClose();
// //

View File

@ -26,6 +26,7 @@ class LockOperatingRecordState { // 记录名称
RxBool ifCurrentScreen = true.obs; // , RxBool ifCurrentScreen = true.obs; // ,
int operateDate = 0; // int operateDate = 0; //
int currentDate = 0; // UTC毫秒时间戳
bool ifHaveNext = false; // bool ifHaveNext = false; //
int logCountPage = 10; // int logCountPage = 10; //
String idStr = ''; // String idStr = ''; //

View File

@ -11,6 +11,7 @@ import '../../../../../tools/dateTool.dart';
import '../../../../../tools/submitBtn.dart'; import '../../../../../tools/submitBtn.dart';
import '../../../../../tools/titleAppBar.dart'; import '../../../../../tools/titleAppBar.dart';
import '../../../../../translations/trans_lib.dart'; import '../../../../../translations/trans_lib.dart';
import '../../lockSet/lockSetInfo_entity.dart';
import 'uploadElectricQuantity_logic.dart'; import 'uploadElectricQuantity_logic.dart';
class UploadElectricQuantityPage extends StatefulWidget { class UploadElectricQuantityPage extends StatefulWidget {
@ -61,7 +62,7 @@ class _UploadElectricQuantityPageState extends State<UploadElectricQuantityPage>
], ],
)), )),
Visibility( Visibility(
visible: state.lockSetInfoData.value.lockFeature!.isSupportBackupBattery == 1, visible: (state.lockSetInfoData.value.lockFeature ?? LockFeature()).isSupportBackupBattery == 1,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[ children: <Widget>[

View File

@ -513,7 +513,6 @@ class LockSetLogic extends BaseGetXController {
// //
StreamSubscription? _passCurrentLockInformationEvent; StreamSubscription? _passCurrentLockInformationEvent;
void initLoadDataAction(BlockSetStateCallback blockSetStateCallback) { void initLoadDataAction(BlockSetStateCallback blockSetStateCallback) {
// eventBus // eventBus
_passCurrentLockInformationEvent = eventBus _passCurrentLockInformationEvent = eventBus
@ -527,22 +526,21 @@ class LockSetLogic extends BaseGetXController {
final String content = showContent!.isEmpty final String content = showContent!.isEmpty
? "${"删除设备失败,请确保在设备附近,设备未被连接,设备已打开".tr}${BlueManage().connectDeviceName!.contains("T9A") == true ? "。如果是全自动锁,请使屏幕变亮".tr : ""}" ? "${"删除设备失败,请确保在设备附近,设备未被连接,设备已打开".tr}${BlueManage().connectDeviceName!.contains("T9A") == true ? "。如果是全自动锁,请使屏幕变亮".tr : ""}"
: showContent; : showContent;
ShowTipView().showSureAlertDialog(content); state.showTipView.showSureAlertDialog(content);
} }
/// ///
void deleyLockLogicOfRoles() { void deleyLockLogicOfRoles() {
if (state.lockBasicInfo.value.isLockOwner == 1) { if (state.lockBasicInfo.value.isLockOwner == 1) {
// //
ShowTipView().showIosTipWithContentDialog('删除锁后,所有信息都会一起删除,确定删除锁吗?'.tr, state.showTipView.showIosTipWithContentDialog('删除锁后,所有信息都会一起删除,确定删除锁吗?'.tr, () {
() {
// //
ShowTipView().showTFViewAlertDialog( state.showTipView.resetGetController();
state.passwordTF, '请输入登录密码'.tr, '请输入登录密码'.tr, checkLoginPassword); state.showTipView.showTFViewAlertDialog(state.passwordTF, '请输入登录密码'.tr, '请输入登录密码'.tr, checkLoginPassword);
}); });
} else if (state.lockBasicInfo.value.keyRight == 1) { } else if (state.lockBasicInfo.value.keyRight == 1) {
// //
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog( state.showTipView.showDeleteAdministratorIsHaveAllDataDialog(
'同时删除其发送的所有钥匙,钥匙删除后不能恢复'.tr, (bool a) { '同时删除其发送的所有钥匙,钥匙删除后不能恢复'.tr, (bool a) {
// //
state.deleteAdministratorIsHaveAllData.value = a; state.deleteAdministratorIsHaveAllData.value = a;
@ -550,7 +548,7 @@ class LockSetLogic extends BaseGetXController {
}); });
} else { } else {
// //
ShowTipView().showIosTipWithContentDialog('是否删除钥匙?'.tr, deletKeyData); state.showTipView.showIosTipWithContentDialog('是否删除钥匙?'.tr, deletKeyData);
} }
} }

View File

@ -27,8 +27,7 @@ class LockSetPage extends StatefulWidget {
State<LockSetPage> createState() => _LockSetPageState(); State<LockSetPage> createState() => _LockSetPageState();
} }
class _LockSetPageState extends State<LockSetPage> class _LockSetPageState extends State<LockSetPage> with WidgetsBindingObserver, RouteAware {
with WidgetsBindingObserver, RouteAware {
final LockSetLogic logic = Get.put(LockSetLogic()); final LockSetLogic logic = Get.put(LockSetLogic());
final LockSetState state = Get.find<LockSetLogic>().state; final LockSetState state = Get.find<LockSetLogic>().state;

View File

@ -2,6 +2,7 @@ import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../../../../tools/showTipView.dart';
import 'lockSetInfo_entity.dart'; import 'lockSetInfo_entity.dart';
class LockSetState { class LockSetState {
@ -29,6 +30,7 @@ class LockSetState {
RxBool deleteAdministratorIsHaveAllData = false.obs; // RxBool deleteAdministratorIsHaveAllData = false.obs; //
RxInt sureBtnState = 0.obs;// 0() 1() RxInt sureBtnState = 0.obs;// 0() 1()
final ShowTipView showTipView = ShowTipView();
LockSetState() { LockSetState() {
Map map = Get.arguments; Map map = Get.arguments;
lockId.value = map['lockId']; lockId.value = map['lockId'];

View File

@ -162,7 +162,7 @@ class RemoteControlListLogic extends BaseGetXController{
return entity; return entity;
} }
// IC卡 //
Future<void> resetRemoteControlData() async { Future<void> resetRemoteControlData() async {
final LoginEntity entity = await ApiRepository.to.resetRemoteControlData( final LoginEntity entity = await ApiRepository.to.resetRemoteControlData(
lockId: state.lockId.value lockId: state.lockId.value
@ -181,7 +181,7 @@ class RemoteControlListLogic extends BaseGetXController{
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
showToast('删除成功'.tr, something: () { showToast('删除成功'.tr, something: () {
Get.back(result: 'addScuess'); getRemoteControlListData(isRefresh: true);
}); });
} }
} }

View File

@ -30,6 +30,7 @@ class LockListLogic extends BaseGetXController {
LockListState state = LockListState(); LockListState state = LockListState();
List<GroupList> _groupDataList = <GroupList>[]; List<GroupList> _groupDataList = <GroupList>[];
LockListInfoGroupEntity? entity; LockListInfoGroupEntity? entity;
final ShowTipView showTipView = ShowTipView();
List<GroupList> get groupDataList { List<GroupList> get groupDataList {
@ -180,23 +181,22 @@ class LockListLogic extends BaseGetXController {
void deleyLockLogicOfRoles() { void deleyLockLogicOfRoles() {
if (state.lockListInfoItemEntity.isLockOwner == 1) { if (state.lockListInfoItemEntity.isLockOwner == 1) {
// //
ShowTipView().showIosTipWithContentDialog('删除锁后,所有信息都会一起删除,确定删除锁吗?'.tr, showTipView.showIosTipWithContentDialog('删除锁后,所有信息都会一起删除,确定删除锁吗?'.tr, () {
() {
// //
ShowTipView().showTFViewAlertDialog( AppLog.log('调用了删除锁');
state.passwordTF, '请输入登录密码'.tr, '请输入登录密码'.tr, checkLoginPassword); showTipView.resetGetController();
showTipView.showTFViewAlertDialog(state.passwordTF, '请输入登录密码'.tr, '请输入登录密码'.tr, checkLoginPassword);
}); });
} else if (state.lockListInfoItemEntity.keyRight == 1) { } else if (state.lockListInfoItemEntity.keyRight == 1) {
// //
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog( showTipView.showDeleteAdministratorIsHaveAllDataDialog('同时删除其发送的所有钥匙,钥匙删除后不能恢复'.tr, (bool a) {
'同时删除其发送的所有钥匙,钥匙删除后不能恢复'.tr, (bool a) {
// //
state.deleteAdministratorIsHaveAllData.value = a; state.deleteAdministratorIsHaveAllData.value = a;
deletKeyData(); deletKeyData();
}); });
} else { } else {
// //
ShowTipView().showIosTipWithContentDialog('是否删除钥匙?'.tr, deletKeyData); showTipView.showIosTipWithContentDialog('是否删除钥匙?'.tr, deletKeyData);
} }
} }

View File

@ -179,8 +179,7 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
} }
})), })),
CommonItem( CommonItem(
leftTitel: leftTitel: '重置密码'.tr,
TranslationLoader.lanKeys!.resetPasswords!.tr,
rightTitle: '', rightTitle: '',
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,

View File

@ -94,10 +94,12 @@ class ShowTipView {
); );
} }
TextEditingController getController = TextEditingController();
void showTFViewAlertDialog(TextEditingController controller, String title, void showTFViewAlertDialog(TextEditingController controller, String title,
String tipTitle, Function sureClick, String tipTitle, Function sureClick,
{List<TextInputFormatter>? inputFormatters, bool? isShowSuffixIcon}) { {List<TextInputFormatter>? inputFormatters, bool? isShowSuffixIcon}) {
// //
getController = controller;
showDialog( showDialog(
context: Get.context!, context: Get.context!,
builder: (BuildContext context) { builder: (BuildContext context) {
@ -108,7 +110,6 @@ class ShowTipView {
controller: controller, controller: controller,
isShowSuffixIcon: isShowSuffixIcon ?? false, isShowSuffixIcon: isShowSuffixIcon ?? false,
sureClick: () { sureClick: () {
//
if (controller.text.isEmpty) { if (controller.text.isEmpty) {
EasyLoading.showToast(tipTitle, duration: 2000.milliseconds); EasyLoading.showToast(tipTitle, duration: 2000.milliseconds);
return; return;
@ -124,6 +125,10 @@ class ShowTipView {
); );
} }
void resetGetController(){
getController.text = '';
}
// //
void showSureBtnTipsAlert( void showSureBtnTipsAlert(
{required String tipsText, required String sureText}) { {required String tipsText, required String sureText}) {