diff --git a/lan/lan_en.json b/lan/lan_en.json index a84ceb62..c2fbf2a7 100644 --- a/lan/lan_en.json +++ b/lan/lan_en.json @@ -1150,5 +1150,6 @@ "暂无最新记录": "There are currently no latest records available", "请将手机切换至2.4G WiFi进行手动连接": "Please switch your phone to 2.4G WiFi for manual connection", "请确保网络是2.4GHz Wi-Fi": "Please ensure that the network is 2.4GHz Wi Fi", + "是否要远程开锁": "Do you want to unlock remotely", "网关添加成功": "Gateway added successfully" } diff --git a/lan/lan_keys.json b/lan/lan_keys.json index 174e1185..f93afdae 100755 --- a/lan/lan_keys.json +++ b/lan/lan_keys.json @@ -1155,5 +1155,6 @@ "请扫描可视门铃码二维码": "请扫描可视门铃码二维码", "请确保网络是2.4GHz Wi-Fi": "请确保网络是2.4GHz Wi-Fi", "已选": "已选", + "是否要远程开锁": "是否要远程开锁", "网关添加成功": "网关添加成功" } diff --git a/lan/lan_ru.json b/lan/lan_ru.json index 3297d79a..07772f3b 100644 --- a/lan/lan_ru.json +++ b/lan/lan_ru.json @@ -1152,5 +1152,6 @@ "请扫描可视门铃码二维码": "Сканируйте код вызова", "请确保网络是2.4GHz Wi-Fi": "Убедитесь, что сеть имеет 2,4 ГГц Wi - Fi", "已选": "Выбранные", + "是否要远程开锁": "Нужно ли удалённо открывать замок", "请将手机切换至2.4G WiFi进行手动连接": "Пожалуйста, переключите телефон на 2.4G WiFi для ручного подключения" } \ No newline at end of file diff --git a/lan/lan_zh.json b/lan/lan_zh.json index f622d613..351e3fff 100755 --- a/lan/lan_zh.json +++ b/lan/lan_zh.json @@ -1155,5 +1155,6 @@ "请扫描可视门铃码二维码": "请扫描可视门铃码二维码", "请确保网络是2.4GHz Wi-Fi": "请确保网络是2.4GHz Wi-Fi", "已选": "已选", + "是否要远程开锁": "是否要远程开锁", "网关添加成功": "网关添加成功" } diff --git a/lib/main/lockDetail/fingerprint/addFingerprint/addFingerprint_logic.dart b/lib/main/lockDetail/fingerprint/addFingerprint/addFingerprint_logic.dart index bab8f1f0..c8507a3f 100755 --- a/lib/main/lockDetail/fingerprint/addFingerprint/addFingerprint_logic.dart +++ b/lib/main/lockDetail/fingerprint/addFingerprint/addFingerprint_logic.dart @@ -1,4 +1,3 @@ - import 'dart:async'; import 'package:flutter_blue_plus/flutter_blue_plus.dart'; @@ -26,20 +25,23 @@ class AddFingerprintLogic extends BaseGetXController { // 监听设备返回的数据 late StreamSubscription _replySubscription; + void _initReplySubscription() { - _replySubscription = EventBusManager().eventBus!.on().listen((Reply reply) async { + _replySubscription = + EventBusManager().eventBus!.on().listen((Reply reply) async { // 添加指纹开始 - if((reply is SenderAddFingerprintWithTimeCycleCoercionReply) && (state.ifCurrentScreen.value == true)) { + if ((reply is SenderAddFingerprintWithTimeCycleCoercionReply) && + (state.ifCurrentScreen.value == true)) { _replyAddFingerprintBegin(reply); } // 添加指纹过程 - if(reply is SenderAddFingerprintProcessReply) { + if (reply is SenderAddFingerprintProcessReply) { _replyAddFingerprintProcess(reply); } // 添加指纹确认 - if(reply is SenderAddFingerprintConfirmationReply) { + if (reply is SenderAddFingerprintConfirmationReply) { _replyAddFingerprintConfirmation(reply); } }); @@ -49,11 +51,10 @@ class AddFingerprintLogic extends BaseGetXController { BuglyTool.uploadException( message: '添加指纹开始,解析数据', detail: '添加指纹开始,解析数据 _replyAddFingerprintBegin:${reply.data}', - upload: false - ); + upload: false); final int status = reply.data[2]; - switch(status){ + switch (status) { case 0x00: //成功 state.ifConnectScuess.value = true; @@ -67,10 +68,13 @@ class AddFingerprintLogic extends BaseGetXController { break; case 0x06: //无权限 - final List? privateKey = await Storage.getStringList(saveBluePrivateKey); - final List getPrivateKeyList = changeStringListToIntList(privateKey!); + final List? privateKey = + await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = + changeStringListToIntList(privateKey!); - final List? signKey = await Storage.getStringList(saveBlueSignKey); + final List? signKey = + await Storage.getStringList(saveBlueSignKey); final List signKeyDataList = changeStringListToIntList(signKey!); final List token = reply.data.sublist(5, 9); @@ -78,30 +82,33 @@ class AddFingerprintLogic extends BaseGetXController { Storage.setStringList(saveBlueToken, saveStrList); IoSenderManage.senderAddFingerprintWithTimeCycleCoercionCommand( - keyID:'1', - userID:await Storage.getUid(), - fingerNo:0, - useCountLimit:0xffff, - isForce:state.isCoerced.value == '1' ? 1 : 0, // 是否是胁迫 - isAdmin: state.isAdministrator.value == '2' ? 1 : 0, - operate: 0, - isRound:state.selectType.value == '2' ? 1: 0, // 是否是循环 - weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环 - startDate: int.parse(state.startDate.value)~/1000, - endDate: int.parse(state.endDate.value)~/1000, - startTime:DateTool().dateToHNString(state.effectiveDateTime.value), - endTime:DateTool().dateToHNString(state.failureDateTime.value), - needAuthor:1, - signKey:signKeyDataList, - privateKey:getPrivateKeyList, - token: token, - isBeforeAddUser: false - ); + keyID: '1', + userID: await Storage.getUid(), + fingerNo: 0, + useCountLimit: 0xffff, + isForce: state.isCoerced.value == '1' ? 1 : 0, + // 是否是胁迫 + isAdmin: state.isAdministrator.value == '2' ? 1 : 0, + operate: 0, + isRound: state.selectType.value == '2' ? 1 : 0, + // 是否是循环 + weekRound: DateTool().accordingTheCycleIntoTheCorrespondingNumber( + state.weekDay.value), + // 周循环 + startDate: int.parse(state.startDate.value) ~/ 1000, + endDate: int.parse(state.endDate.value) ~/ 1000, + startTime: DateTool().dateToHNString(state.effectiveDateTime.value), + endTime: DateTool().dateToHNString(state.failureDateTime.value), + needAuthor: 1, + signKey: signKeyDataList, + privateKey: getPrivateKeyList, + token: token, + isBeforeAddUser: false); break; default: //失败 state.ifAddState.value = false; - showToast('添加指纹失败'.tr, something: (){ + showToast('添加指纹失败'.tr, something: () { Get.back(); }); break; @@ -112,13 +119,12 @@ class AddFingerprintLogic extends BaseGetXController { BuglyTool.uploadException( message: '添加指纹过程,解析数据', detail: '添加指纹过程,解析数据 _replyAddFingerprintProcess:${reply.data}', - upload: false - ); + upload: false); final int status = reply.data[2]; - switch(status){ + switch (status) { case 0x00: //成功 - switch(reply.data[5]){ + switch (reply.data[5]) { case 0xff: // 注册指纹失败 showToast('退出添加'.tr); @@ -166,35 +172,37 @@ class AddFingerprintLogic extends BaseGetXController { Future _replyAddFingerprintConfirmation(Reply reply) async { final int status = reply.data[2]; final String getMobile = (await Storage.getMobile())!; - switch(status){ + switch (status) { case 0x00: //成功 - // var fingerprintNum = listChangInt(reply.data.sublist(9, 11)).toString(); + // var fingerprintNum = listChangInt(reply.data.sublist(9, 11)).toString(); ApmHelper.instance.trackEvent('add_fingerprint', { - 'lock_name':BlueManage().connectDeviceName, - 'account':getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!, - 'date':DateTool().getNowDateWithType(1), - 'add_fingerprint_result':'成功', + 'lock_name': BlueManage().connectDeviceName, + 'account': + getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!, + 'date': DateTool().getNowDateWithType(1), + 'add_fingerprint_result': '成功', }); BuglyTool.uploadException( message: '添加指纹确认结果,解析数据', - detail: '添加指纹确认结果,解析数据 _replyAddFingerprintConfirmation:${reply.data}', - upload: false - ); + detail: + '添加指纹确认结果,解析数据 _replyAddFingerprintConfirmation:${reply.data}', + upload: false); - final List fingerprintList = reply.data.sublist(reply.data.length - 2); + final List fingerprintList = + reply.data.sublist(reply.data.length - 2); final String fingerprintNum = listChangInt(fingerprintList).toString(); state.regIndex.value++; - if(state.fingerprintNumber.value == fingerprintNum){ + if (state.fingerprintNumber.value == fingerprintNum) { return; - }else{ + } else { state.fingerprintNumber.value = fingerprintNum; } // if(state.isCoerced.value == "1"){ - // 调用添加指纹接口 + // 调用添加指纹接口 state.ifAddState.value = false; - addFingerprintsData(); + await addFingerprintsData(); // }else{ // // 如果是胁迫指纹在 添加完之后以后再调用添加胁迫指纹的 // senderAddStressFingerprint(); @@ -203,18 +211,19 @@ class AddFingerprintLogic extends BaseGetXController { default: //失败 ApmHelper.instance.trackEvent('add_fingerprint', { - 'lock_name':BlueManage().connectDeviceName, - 'account':getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!, - 'date':DateTool().getNowDateWithType(1), - 'add_fingerprint_result':'失败-${reply.data}', + 'lock_name': BlueManage().connectDeviceName, + 'account': + getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!, + 'date': DateTool().getNowDateWithType(1), + 'add_fingerprint_result': '失败-${reply.data}', }); BuglyTool.uploadException( message: '添加指纹确认结果,解析数据', - detail: '添加指纹确认结果蓝牙返回失败结果,解析数据 _replyAddFingerprintConfirmation:${reply.data}', + detail: + '添加指纹确认结果蓝牙返回失败结果,解析数据 _replyAddFingerprintConfirmation:${reply.data}', eventStr: '添加指纹事件蓝牙返回失败结果', - upload: true - ); + upload: true); state.ifAddState.value = false; break; } @@ -222,7 +231,8 @@ class AddFingerprintLogic extends BaseGetXController { // 添加指纹开始 Future senderAddFingerprint() async { - final List? privateKey = await Storage.getStringList(saveBluePrivateKey); + final List? privateKey = + await Storage.getStringList(saveBluePrivateKey); final List getPrivateKeyList = changeStringListToIntList(privateKey!); final List? signKey = await Storage.getStringList(saveBlueSignKey); @@ -232,90 +242,104 @@ class AddFingerprintLogic extends BaseGetXController { final List getTokenList = changeStringListToIntList(token!); final String command = SenderAddFingerprintWithTimeCycleCoercionCommand( - keyID:'1', - userID:await Storage.getUid(), - fingerNo:0, - useCountLimit:0xffff, - isForce:state.isCoerced.value == '1' ? 1 : 0, // 是否是胁迫 + keyID: '1', + userID: await Storage.getUid(), + fingerNo: 0, + useCountLimit: 0xffff, + isForce: state.isCoerced.value == '1' ? 1 : 0, + // 是否是胁迫 isAdmin: state.isAdministrator.value == '2' ? 1 : 0, operate: 0, - isRound:state.selectType.value == '2' ? 1: 0, // 是否是循环 - weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环 - startDate: int.parse(state.startDate.value)~/1000, - endDate: int.parse(state.endDate.value)~/1000, - startTime:DateTool().dateToHNString(state.effectiveDateTime.value), - endTime:DateTool().dateToHNString(state.failureDateTime.value), - needAuthor:1, - signKey:signKeyDataList, - privateKey:getPrivateKeyList, + isRound: state.selectType.value == '2' ? 1 : 0, + // 是否是循环 + weekRound: DateTool() + .accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), + // 周循环 + startDate: int.parse(state.startDate.value) ~/ 1000, + endDate: int.parse(state.endDate.value) ~/ 1000, + startTime: DateTool().dateToHNString(state.effectiveDateTime.value), + endTime: DateTool().dateToHNString(state.failureDateTime.value), + needAuthor: 1, + signKey: signKeyDataList, + privateKey: getPrivateKeyList, token: getTokenList, ).toString(); showBlueConnetctToastTimer(action: () async { final String getMobile = (await Storage.getMobile())!; ApmHelper.instance.trackEvent('add_fingerprint', { - 'lock_name':BlueManage().connectDeviceName, - 'account':getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!, - 'date':DateTool().getNowDateWithType(1), - 'add_fingerprint_result':'超时', + 'lock_name': BlueManage().connectDeviceName, + 'account': + getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!, + 'date': DateTool().getNowDateWithType(1), + 'add_fingerprint_result': '超时', }); BuglyTool.uploadException( message: '添加指纹超时处理-添加指纹失败', - detail: '添加指纹超时处理,断开连接,添加指纹失败--SenderAddFingerprintWithTimeCycleCoercionCommand:$command', + detail: + '添加指纹超时处理,断开连接,添加指纹失败--SenderAddFingerprintWithTimeCycleCoercionCommand:$command', eventStr: '添加指纹事件超时', - upload: true - ); + upload: true); Get.close(1); }); - BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { - if (deviceConnectionState == BluetoothConnectionState.connected){ - final List? privateKey = await Storage.getStringList(saveBluePrivateKey); - final List getPrivateKeyList = changeStringListToIntList(privateKey!); + BlueManage().blueSendData(BlueManage().connectDeviceName, + (BluetoothConnectionState deviceConnectionState) async { + if (deviceConnectionState == BluetoothConnectionState.connected) { + final List? privateKey = + await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = + changeStringListToIntList(privateKey!); - final List? signKey = await Storage.getStringList(saveBlueSignKey); + final List? signKey = + await Storage.getStringList(saveBlueSignKey); final List signKeyDataList = changeStringListToIntList(signKey!); final List? token = await Storage.getStringList(saveBlueToken); final List getTokenList = changeStringListToIntList(token!); IoSenderManage.senderAddFingerprintWithTimeCycleCoercionCommand( - keyID:'1', - userID:await Storage.getUid(), - fingerNo:0, - useCountLimit:0xffff, - isForce:state.isCoerced.value == '1' ? 1 : 0, // 是否是胁迫 - isAdmin: state.isAdministrator.value == '2' ? 1 : 0, - operate: 0, - isRound:state.selectType.value == '2' ? 1: 0, // 是否是循环 - weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环 - startDate: int.parse(state.startDate.value)~/1000, - endDate: int.parse(state.endDate.value)~/1000, - startTime:DateTool().dateToHNString(state.effectiveDateTime.value), - endTime:DateTool().dateToHNString(state.failureDateTime.value), - needAuthor:1, - signKey:signKeyDataList, - privateKey:getPrivateKeyList, - token: getTokenList, - isBeforeAddUser: false - ); - }else if (deviceConnectionState == BluetoothConnectionState.disconnected){ + keyID: '1', + userID: await Storage.getUid(), + fingerNo: 0, + useCountLimit: 0xffff, + isForce: state.isCoerced.value == '1' ? 1 : 0, + // 是否是胁迫 + isAdmin: state.isAdministrator.value == '2' ? 1 : 0, + operate: 0, + isRound: state.selectType.value == '2' ? 1 : 0, + // 是否是循环 + weekRound: DateTool().accordingTheCycleIntoTheCorrespondingNumber( + state.weekDay.value), + // 周循环 + startDate: int.parse(state.startDate.value) ~/ 1000, + endDate: int.parse(state.endDate.value) ~/ 1000, + startTime: DateTool().dateToHNString(state.effectiveDateTime.value), + endTime: DateTool().dateToHNString(state.failureDateTime.value), + needAuthor: 1, + signKey: signKeyDataList, + privateKey: getPrivateKeyList, + token: getTokenList, + isBeforeAddUser: false); + } else if (deviceConnectionState == + BluetoothConnectionState.disconnected) { final String getMobile = (await Storage.getMobile())!; ApmHelper.instance.trackEvent('add_fingerprint', { - 'lock_name':BlueManage().connectDeviceName, - 'account':getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!, - 'date':DateTool().getNowDateWithType(1), - 'add_fingerprint_result':'断开', + 'lock_name': BlueManage().connectDeviceName, + 'account': + getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!, + 'date': DateTool().getNowDateWithType(1), + 'add_fingerprint_result': '断开', }); BuglyTool.uploadException( message: '添加指纹断开连接-添加指纹失败', - detail: '添加指纹断开连接-添加指纹失败--SenderAddFingerprintWithTimeCycleCoercionCommand:$command', + detail: + '添加指纹断开连接-添加指纹失败--SenderAddFingerprintWithTimeCycleCoercionCommand:$command', eventStr: '添加指纹事件断开连接', - upload: true - ); + upload: true); - if(state.ifCurrentScreen.value == true){ + if (state.ifCurrentScreen.value == true) { showBlueConnetctToast(); } cancelBlueConnetctToastTimer(); @@ -326,27 +350,32 @@ class AddFingerprintLogic extends BaseGetXController { // 取消添加指纹 Future senderCancelAddFingerprintCommand() async { - BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { - if (deviceConnectionState == BluetoothConnectionState.connected){ - final List? privateKey = await Storage.getStringList(saveBluePrivateKey); - final List getPrivateKeyList = changeStringListToIntList(privateKey!); + BlueManage().blueSendData(BlueManage().connectDeviceName, + (BluetoothConnectionState deviceConnectionState) async { + if (deviceConnectionState == BluetoothConnectionState.connected) { + final List? privateKey = + await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = + changeStringListToIntList(privateKey!); - final List? signKey = await Storage.getStringList(saveBlueSignKey); + final List? signKey = + await Storage.getStringList(saveBlueSignKey); final List signKeyDataList = changeStringListToIntList(signKey!); final List? token = await Storage.getStringList(saveBlueToken); final List getTokenList = changeStringListToIntList(token!); IoSenderManage.senderCancelAddFingerprintCommand( - keyID:'1', - userID:await Storage.getUid(), - needAuthor:1, - signKey:signKeyDataList, - privateKey:getPrivateKeyList, + keyID: '1', + userID: await Storage.getUid(), + needAuthor: 1, + signKey: signKeyDataList, + privateKey: getPrivateKeyList, token: getTokenList, ); - }else if (deviceConnectionState == BluetoothConnectionState.disconnected){ - if(state.ifCurrentScreen.value == true){ + } else if (deviceConnectionState == + BluetoothConnectionState.disconnected) { + if (state.ifCurrentScreen.value == true) { showBlueConnetctToast(); } cancelBlueConnetctToastTimer(); @@ -356,53 +385,54 @@ class AddFingerprintLogic extends BaseGetXController { } // 添加指纹 - Future addFingerprintsData() async{ - final AddFingerprintEntity entity = await ApiRepository.to.addFingerprintsData( + Future addFingerprintsData() async { + final AddFingerprintEntity entity = + await ApiRepository.to.addFingerprintsData( lockId: state.lockId.value.toString(), endDate: state.endDate.value, - addType:state.addType.value, + addType: state.addType.value, fingerprintName: state.fingerprintName.value, fingerprintNumber: state.fingerprintNumber.value, fingerprintType: state.fingerprintType.value, isCoerced: state.isCoerced.value, startDate: state.startDate.value, weekDay: state.weekDay.value, - fingerRight:state.isAdministrator.value == '2' ? 1 : 0, + fingerRight: state.isAdministrator.value == '2' ? 1 : 0, startTime: int.parse(state.effectiveDateTime.value), endTime: int.parse(state.failureDateTime.value), ); - if(entity.errorCode!.codeIsSuccessful){ + if (entity.errorCode!.codeIsSuccessful) { updateFingerprintUserNoLoadData(entity.data!.fingerprintId.toString()); BuglyTool.uploadException( message: '添加指纹调用接口成功', detail: '添加指纹调用接口成功', eventStr: '添加指纹事件用接口成功', - upload: true - ); - }else{ + upload: true); + } else { updateFingerprintUserNoLoadData(entity.data!.fingerprintId.toString()); BuglyTool.uploadException( message: '添加指纹调用接口失败', detail: '添加指纹调用接口添加指纹调用接口失败 - ${entity.errorMsg}', eventStr: '添加指纹事件接口失败', - upload: true - ); + upload: true); } } // 更新指纹用户账号 - Future updateFingerprintUserNoLoadData(String fingerprintId) async{ - final LoginEntity entity = await ApiRepository.to.updateFingerprintUserNoLoadData( - fingerprintId: fingerprintId, - lockId: state.lockId.value.toString(), - fingerprintUserNo: state.fingerprintNumber.value, + Future updateFingerprintUserNoLoadData(String fingerprintId) async { + final LoginEntity entity = + await ApiRepository.to.updateFingerprintUserNoLoadData( + fingerprintId: fingerprintId, + lockId: state.lockId.value.toString(), + fingerprintUserNo: state.fingerprintNumber.value, ); - if(entity.errorCode!.codeIsSuccessful){ - showToast('添加成功'.tr, something: (){ - if(state.fromType.value == 2){ + if (entity.errorCode!.codeIsSuccessful) { + showToast('添加成功'.tr, something: () { + if (state.fromType.value == 2) { // 回调指纹号 - eventBus.fire(ChickInAddStaffCardAndFingerprintBlockNumberEvent(state.fingerprintNumber.value)); - }else if(state.fromType.value == 1){ + eventBus.fire(ChickInAddStaffCardAndFingerprintBlockNumberEvent( + state.fingerprintNumber.value)); + } else if (state.fromType.value == 1) { eventBus.fire(OtherTypeRefreshListEvent()); } Get.close(2); @@ -430,5 +460,4 @@ class AddFingerprintLogic extends BaseGetXController { _replySubscription.cancel(); } - -} \ No newline at end of file +} diff --git a/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_logic.dart b/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_logic.dart index 37d56740..09523db0 100755 --- a/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_logic.dart +++ b/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_logic.dart @@ -23,6 +23,7 @@ class FingerprintListLogic extends BaseGetXController { // 获取解析后的数据 late StreamSubscription _replySubscription; + void _initReplySubscription() { _replySubscription = EventBusManager().eventBus!.on().listen((Reply reply) { @@ -74,11 +75,15 @@ class FingerprintListLogic extends BaseGetXController { userID: (await Storage.getUid())!, fingerNo: state.deletFingerNo, useCountLimit: 0xffff, - operate: state.isDeletAll == true ? 3 : 2, // 0:注册 1:修改 2:删除 3:删除全部 + operate: state.isDeletAll == true ? 3 : 2, + // 0:注册 1:修改 2:删除 3:删除全部 isAdmin: 0, - isForce: 0, // 是否是胁迫 - isRound: 0, // 是否是循环 - weekRound: 0, // 周循环 + isForce: 0, + // 是否是胁迫 + isRound: 0, + // 是否是循环 + weekRound: 0, + // 周循环 startDate: 0x11223344, endDate: 0x11223344, startTime: '0', @@ -275,11 +280,15 @@ class FingerprintListLogic extends BaseGetXController { userID: (await Storage.getUid())!, fingerNo: state.deletFingerNo, useCountLimit: 0xffff, - operate: state.isDeletAll == true ? 3 : 2, // 0:注册 1:修改 2:删除 3:删除全部 + operate: state.isDeletAll == true ? 3 : 2, + // 0:注册 1:修改 2:删除 3:删除全部 isAdmin: 0, - isForce: 0, // 是否是胁迫 - isRound: 0, // 是否是循环 - weekRound: 0, // 周循环 + isForce: 0, + // 是否是胁迫 + isRound: 0, + // 是否是循环 + weekRound: 0, + // 周循环 startDate: 0x11223344, endDate: 0x11223344, startTime: '0', @@ -299,30 +308,31 @@ class FingerprintListLogic extends BaseGetXController { } }); } + /** * //请求密码钥匙列表 - Future mockNetworkDataRequest( + Future mockNetworkDataRequest( {required bool isRefresh}) async { - // 如果是下拉刷新,清空已有数据 - if (isRefresh) { + // 如果是下拉刷新,清空已有数据 + if (isRefresh) { state.itemDataList.clear(); pageNo = 1; - } + } - final PasswordKeyListEntity entity = await ApiRepository.to.passwordKeyList( - state.keyInfo.value.keyStatus.toString(), - state.keyInfo.value.lockId.toString(), - pageNo.toString(), - pageSize.toString(), - state.searchController.text); - if (entity.errorCode!.codeIsSuccessful) { + final PasswordKeyListEntity entity = await ApiRepository.to.passwordKeyList( + state.keyInfo.value.keyStatus.toString(), + state.keyInfo.value.lockId.toString(), + pageNo.toString(), + pageSize.toString(), + state.searchController.text); + if (entity.errorCode!.codeIsSuccessful) { // 更新数据列表 state.itemDataList.addAll(entity.data!.itemList!); // 更新页码 pageNo++; - } - return entity; - } + } + return entity; + } */ @@ -390,6 +400,7 @@ class FingerprintListLogic extends BaseGetXController { // 监听修改完详情之后刷新列表 late StreamSubscription _teamEvent; + void _initRefreshAction() { _teamEvent = eventBus .on() @@ -450,6 +461,7 @@ class FingerprintListLogic extends BaseGetXController { _initReplySubscription(); _initRefreshAction(); + getFingerprintsListData(isRefresh: true); } } diff --git a/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_page.dart b/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_page.dart index acfb8e9a..15c16dbd 100755 --- a/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_page.dart +++ b/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_page.dart @@ -31,24 +31,9 @@ class _FingerprintListPageState extends State final FingerprintListLogic logic = Get.put(FingerprintListLogic()); final FingerprintListState state = Get.find().state; - Future getHttpData({required bool isRefresh}) async { - final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); - if (isDemoMode == false) { - logic - .getFingerprintsListData(isRefresh: isRefresh) - .then((FingerprintListDataEntity value) { - if (mounted) { - setState(() {}); - } - }); - } - } - @override void initState() { super.initState(); - - getHttpData(isRefresh: true); } @override @@ -91,17 +76,17 @@ class _FingerprintListPageState extends State ), body: EasyRefreshTool( onRefresh: () { - getHttpData(isRefresh: true); + logic.getFingerprintsListData(isRefresh: true); }, onLoad: () { - getHttpData(isRefresh: false); + logic.getFingerprintsListData(isRefresh: false); }, child: Column( children: [ KeySearchWidget( editingController: state.searchController, - onSubmittedAction: () { - getHttpData(isRefresh: true); + onSubmittedAction: () async { + await logic.getFingerprintsListData(isRefresh: true); }, ), SizedBox( @@ -116,7 +101,8 @@ class _FingerprintListPageState extends State 'lockId': state.lockId.value, 'fromType': 1 // 1从添加钥匙列表进入 2从考勤添加员工入口进入 })! - .then((value) => getHttpData(isRefresh: true)); + .then((value) => + logic.getFingerprintsListData(isRefresh: true)); // if (data != null) { // getHttpData(isRefresh: true); // } @@ -179,7 +165,7 @@ class _FingerprintListPageState extends State 'fingerprintItemData': fingerprintItemData, })! .then((value) { - getHttpData(isRefresh: true); + logic.getFingerprintsListData(isRefresh: true); }); // if (data == 'deletScuess') { // // state.fingerprintItemListData.removeWhere((FingerprintItemData item) => item.fingerprintId == fingerprintItemData.fingerprintId!); diff --git a/lib/main/lockDetail/lockDetail/lockDetail_page.dart b/lib/main/lockDetail/lockDetail/lockDetail_page.dart index d6740553..fc69d86b 100755 --- a/lib/main/lockDetail/lockDetail/lockDetail_page.dart +++ b/lib/main/lockDetail/lockDetail/lockDetail_page.dart @@ -55,7 +55,19 @@ class _LockDetailPageState extends State void initState() { super.initState(); - listeningAnimations(); + state.animationController = + AnimationController(duration: const Duration(seconds: 1), vsync: this); + state.animationController!.repeat(); + //动画开始、结束、向前移动或向后移动时会调用StatusListener + state.animationController!.addStatusListener((AnimationStatus status) { + if (status == AnimationStatus.completed) { + state.animationController!.reset(); + state.animationController!.forward(); + } else if (status == AnimationStatus.dismissed) { + state.animationController!.reset(); + state.animationController!.forward(); + } + }); state.pageController.addListener(() { state.currentPage.value = state.pageController.page!.round(); @@ -1321,24 +1333,6 @@ class _LockDetailPageState extends State ); } - Future listeningAnimations() async { - await Future.delayed(Duration.zero, () { - state.animationController = AnimationController( - duration: const Duration(seconds: 1), vsync: this); - state.animationController!.repeat(); - //动画开始、结束、向前移动或向后移动时会调用StatusListener - state.animationController!.addStatusListener((AnimationStatus status) { - if (status == AnimationStatus.completed) { - state.animationController!.reset(); - state.animationController!.forward(); - } else if (status == AnimationStatus.dismissed) { - state.animationController!.reset(); - state.animationController!.forward(); - } - }); - }); - } - String showElectricIcon(int electricnumber) { if (electricnumber >= 100) { return 'images/main/icon_lockElectricLevel_5.png'; diff --git a/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart b/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart index 9ed38957..04059392 100755 --- a/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart +++ b/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart @@ -202,7 +202,7 @@ class PasswordKeyDetailLogic extends BaseGetXController { break; case 2: //永久 2 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效 - useDateStr = '永久'; + useDateStr = '永久'.tr; state.isCirculation.value = false; break; case 3: diff --git a/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart b/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart index 65be1a07..cc02af47 100755 --- a/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart +++ b/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart @@ -205,7 +205,7 @@ class _PasswordKeyDetailPageState extends State children: [ Expanded( child: Text( - '密码生成后,请在当日23:59前使用一次进行激活,否则过0点后未激活则失效。'.tr, + '密码生成后,请在当日23:59前使用一次进行激活,否则过0点后未激活则失效。密码激活后,有效期内不限次数使用。'.tr, textAlign: TextAlign.start, style: TextStyle(fontSize: 20.sp), )), diff --git a/lib/tools/showCupertinoAlertView.dart b/lib/tools/showCupertinoAlertView.dart index d973cc78..cf585bf1 100755 --- a/lib/tools/showCupertinoAlertView.dart +++ b/lib/tools/showCupertinoAlertView.dart @@ -297,7 +297,7 @@ class ShowCupertinoAlertView { builder: (BuildContext context) { return CupertinoAlertDialog( title: Container(), - content: Text('是否要远程开锁?'.tr), + content: Text('是否要远程开锁'.tr), actions: [ CupertinoDialogAction( onPressed: Get.back,