From 1434a44f78029ec7db7c1f4e28dd2bb9055ae72b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AD=8F=E5=B0=91=E9=98=B3?= <786612630@qq.com> Date: Fri, 3 Nov 2023 13:58:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E9=94=81=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=EF=BC=8C=E4=BF=AE=E5=A4=8D=E5=B7=B2=E7=9F=A5?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../android/app/src/main/AndroidManifest.xml | 2 +- star_lock/lib/appRouters.dart | 8 +- star_lock/lib/blue/blue_manage.dart | 11 +- .../lib/login/login/starLock_login_page.dart | 17 +- .../register/starLock_register_page.dart | 16 +- .../authorizedAdmin/authorizedAdmin_page.dart | 20 +- .../checkingInSet/checkingInSet_page.dart | 2 +- .../checkingInSetWorkTime_state.dart | 4 +- .../checkingInAddStaff_logic.dart | 3 +- .../electronicKeyDetail_page.dart | 12 +- .../entity/ElectronicKeyListEntity.dart | 8 +- .../sendElectronicKey_page.dart | 20 +- .../automaticBlocking_logic.dart | 25 +- .../checkInCreatCompany_logic.dart | 8 +- .../checkInCreatCompany_page.dart | 2 +- .../lockEscalation/lockEscalation_page.dart | 3 +- .../lcokSet/lockSet/lockSetInfo_entity.dart | 40 ++- .../lcokSet/lockSet/lockSet_logic.dart | 32 +-- .../lcokSet/lockSet/lockSet_page.dart | 30 +- .../lcokSet/lockSet/lockSet_state.dart | 4 +- .../lockTime/getServerDatetime_entity.dart | 2 +- .../lcokSet/lockTime/lockTime_logic.dart | 2 +- .../lcokSet/lockTime/lockTime_page.dart | 18 +- .../markedHouseState_logic.dart | 16 +- .../markedHouseState_page.dart | 6 +- .../markedHouseState_state.dart | 4 +- .../normallyOpenMode_logic.dart | 52 ++-- .../normallyOpenMode_page.dart | 88 +++--- .../normallyOpenMode_state.dart | 18 +- .../passwordKeyDetail_page.dart | 25 +- .../passwordKey_perpetual_page.dart | 18 +- .../lockMian/entity/lockListInfo_entity.dart | 6 +- .../keyListByUserEntity.dart | 206 ++++++++++++++ .../lockUserManageList_logic.dart | 48 ++++ .../lockUserManageList_page.dart | 262 ++++++++++++++++++ .../lockUserManageList_state.dart | 11 + .../ownedKeyList/ownedKeyList_page.dart | 198 +++++++++++++ .../mine/mineSet/mineSet/mineSet_logic.dart | 3 + .../mine/mineSet/mineSet/mineSet_page.dart | 4 +- star_lock/lib/network/api.dart | 15 +- star_lock/lib/network/api_provider.dart | 94 +++---- star_lock/lib/network/api_repository.dart | 109 ++++---- star_lock/lib/tools/commonItem.dart | 2 +- 43 files changed, 1123 insertions(+), 351 deletions(-) create mode 100644 star_lock/lib/mine/mineSet/lockUserManage/lockUserManageList/keyListByUserEntity.dart create mode 100644 star_lock/lib/mine/mineSet/lockUserManage/lockUserManageList/lockUserManageList_logic.dart create mode 100644 star_lock/lib/mine/mineSet/lockUserManage/lockUserManageList/lockUserManageList_page.dart create mode 100644 star_lock/lib/mine/mineSet/lockUserManage/lockUserManageList/lockUserManageList_state.dart create mode 100644 star_lock/lib/mine/mineSet/lockUserManage/ownedKeyList/ownedKeyList_page.dart diff --git a/star_lock/android/app/src/main/AndroidManifest.xml b/star_lock/android/app/src/main/AndroidManifest.xml index b9f62bec..62715a64 100644 --- a/star_lock/android/app/src/main/AndroidManifest.xml +++ b/star_lock/android/app/src/main/AndroidManifest.xml @@ -40,7 +40,7 @@ diff --git a/star_lock/lib/appRouters.dart b/star_lock/lib/appRouters.dart index baba0851..69f09cb5 100644 --- a/star_lock/lib/appRouters.dart +++ b/star_lock/lib/appRouters.dart @@ -1,9 +1,7 @@ import 'package:get/get.dart'; import 'package:star_lock/common/safetyVerification/safetyVerification_binding.dart'; import 'package:star_lock/login/register/starLock_register_binding.dart'; -import 'package:get/get.dart'; -import 'package:star_lock/common/safetyVerification/safetyVerification_binding.dart'; -import 'package:star_lock/login/register/starLock_register_binding.dart'; + import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserList_page.dart'; import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupList_page.dart'; import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/massSendReceiver_page.dart'; @@ -18,7 +16,6 @@ import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorDeta import 'package:star_lock/mine/mineSet/lockGroup/lockGroupList_page.dart'; import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockChangeDate_page.dart'; import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockList_page.dart'; -import 'package:star_lock/mine/mineSet/lockUserManage/lockUserManageList_Page.dart'; import 'package:star_lock/mine/mineSet/mineSet/mineSet_page.dart'; import 'package:star_lock/mine/mineSet/transferGateway/selectGetewayList_page.dart'; import 'package:star_lock/mine/mineSet/transferSmartLock/recipientInformation/recipientInformation_page.dart'; @@ -128,7 +125,8 @@ import 'mine/mineSet/authorityManagement/getNameList_page.dart'; import 'mine/mineSet/hideInvalidUnlockPermissions/hideInvalidUnlockPermissions_page.dart'; import 'mine/mineSet/lockGroup/lockItemList_page.dart'; import 'mine/mineSet/lockScreen/lockScreen_page.dart'; -import 'mine/mineSet/lockUserManage/ownedKeyList_page.dart'; +import 'mine/mineSet/lockUserManage/lockUserManageList/lockUserManageList_page.dart'; +import 'mine/mineSet/lockUserManage/ownedKeyList/ownedKeyList_page.dart'; import 'mine/supportStaff/supportStaff_page.dart'; import 'mine/valueAddedServices/valueAddedServicesBuy/valueAddedServicesBuy_page.dart'; import 'mine/valueAddedServices/valueAddedServicesBuyAndUseRecord/valueAddedServicesBuyAndUseRecordManage/valueAddedServicesBuyAndUseRecordManage_page.dart'; diff --git a/star_lock/lib/blue/blue_manage.dart b/star_lock/lib/blue/blue_manage.dart index 9024d213..4c669d50 100644 --- a/star_lock/lib/blue/blue_manage.dart +++ b/star_lock/lib/blue/blue_manage.dart @@ -8,6 +8,7 @@ import 'package:star_lock/blue/sender_manage.dart'; import '../app_settings/app_settings.dart'; import '../tools/storage.dart'; +import '../tools/toast.dart'; import 'io_tool/io_manager.dart'; import 'io_tool/io_model.dart'; import 'io_tool/io_tool.dart'; @@ -230,10 +231,14 @@ class BlueManage{ } connectStateCallBack!(deviceConnectionState!); }else{ - print("333333333:${deviceConnectionState}"); + // print("333333333:${deviceConnectionState}"); connect(deviceMAC, deviceName, isShowLoading: false, connectStateCallBack: (state){ - print("44444444:${state}"); - connectStateCallBack!(state); + // print("44444444:${state}"); + // if(deviceConnectionState == DeviceConnectionState.connected){ + connectStateCallBack!(state); + // }else { + // Toast.show(msg: "连接设备失败,请确保在设备附近,设备未被连接,设备已打开"); + // } }); } } diff --git a/star_lock/lib/login/login/starLock_login_page.dart b/star_lock/lib/login/login/starLock_login_page.dart index 54e8c56d..0d222bde 100644 --- a/star_lock/lib/login/login/starLock_login_page.dart +++ b/star_lock/lib/login/login/starLock_login_page.dart @@ -5,6 +5,7 @@ import 'package:get/get.dart'; import '../../appRouters.dart'; import '../../app_settings/app_colors.dart'; +import '../../common/XSConstantMacro/XSConstantMacro.dart'; import '../../tools/tf_loginInput.dart'; import '../../tools/submitBtn.dart'; import '../../tools/titleAppBar.dart'; @@ -102,13 +103,25 @@ class _StarLockLoginPageState extends State { alignment: PlaceholderAlignment.middle, child: GestureDetector( child: Text('《${TranslationLoader.lanKeys!.userAgreement!.tr}》', style: TextStyle(color: AppColors.mainColor, fontSize: 20.sp)), - onTap: () {}, + onTap: () { + Get.toNamed(Routers.webviewShowPage, + arguments: { + "url": XSConstantMacro.userAgreementURL, + "title": '用户协议' + }); + }, )), WidgetSpan( alignment: PlaceholderAlignment.middle, child: GestureDetector( child: Text('《${TranslationLoader.lanKeys!.privacyPolicy!.tr}》', style: TextStyle( color: AppColors.mainColor, fontSize: 20.sp)), - onTap: () {}, + onTap: () { + Get.toNamed(Routers.webviewShowPage, + arguments: { + "url": XSConstantMacro.privacyPolicyURL, + "title": '隐私政策' + }); + }, )), ], )), diff --git a/star_lock/lib/login/register/starLock_register_page.dart b/star_lock/lib/login/register/starLock_register_page.dart index 47783eb3..f0a87275 100644 --- a/star_lock/lib/login/register/starLock_register_page.dart +++ b/star_lock/lib/login/register/starLock_register_page.dart @@ -8,6 +8,7 @@ import 'package:get/get.dart'; import '../../appRouters.dart'; import '../../app_settings/app_colors.dart'; +import '../../common/XSConstantMacro/XSConstantMacro.dart'; import '../../tools/tf_loginInput.dart'; import '../../tools/submitBtn.dart'; import '../../tools/titleAppBar.dart'; @@ -358,7 +359,13 @@ class _StarLockRegisterPageState extends State { '《${TranslationLoader.lanKeys!.userAgreement!.tr}》', style: TextStyle( color: AppColors.mainColor, fontSize: 20.sp)), - onTap: () {}, + onTap: () { + Get.toNamed(Routers.webviewShowPage, + arguments: { + "url": XSConstantMacro.userAgreementURL, + "title": '用户协议' + }); + }, )), WidgetSpan( alignment: PlaceholderAlignment.middle, @@ -367,7 +374,12 @@ class _StarLockRegisterPageState extends State { '《${TranslationLoader.lanKeys!.privacyPolicy!.tr}》', style: TextStyle( color: AppColors.mainColor, fontSize: 20.sp)), - onTap: () {}, + onTap: () { + Get.toNamed(Routers.webviewShowPage, arguments: { + "url": XSConstantMacro.privacyPolicyURL, + "title": '隐私政策' + }); + }, )), ], )), 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 05d0bcc7..a3dfa961 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart @@ -315,14 +315,24 @@ class _AuthorizedAdminPageState extends State { //标记房间为已入住 isOn:已入住: 1 空闲:2 Future updateRoomCheckIn() async { - var entity = await ApiRepository.to - .updateSetting(state.keyInfo.value.lockId.toString(), '1', '13'); - if (entity.errorCode!.codeIsSuccessful) { + // var entity = await ApiRepository.to + // .updateSetting(state.keyInfo.value.lockId.toString(), '1', '13'); + // if (entity.errorCode!.codeIsSuccessful) { + // print("标记为已入住成功啦啦啦啦啦"); + // Toast.show(msg: "标记成功"); + // setState(() {}); + // } else { + // Toast.show(msg: '操作失败'); + // } + + var entity = await ApiRepository.to.setRoomStatusData( + lockId: state.keyInfo.value.lockId!, + roomStatus:1, + ); + if(entity.errorCode!.codeIsSuccessful){ print("标记为已入住成功啦啦啦啦啦"); Toast.show(msg: "标记成功"); setState(() {}); - } else { - Toast.show(msg: '操作失败'); } } diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInSet/checkingInSet_page.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInSet/checkingInSet_page.dart index cd76e01a..0bcc0c7f 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInSet/checkingInSet_page.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInSet/checkingInSet_page.dart @@ -62,7 +62,7 @@ class _CheckingInSetPageState extends State { isHaveDirection: true, action: () async { var data = await Get.toNamed(Routers.checkingInSetWorkTimePage, arguments: { - "getKeyInfosData": state.getKeyInfosData.value, + // "getKeyInfosData": state.getKeyInfosData.value, "companyId": state.companyId.value, "pushType": "2", "checkingInSetInfo": state.checkingInSetInfo.value, diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInSetWorkTime/checkingInSetWorkTime_state.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInSetWorkTime/checkingInSetWorkTime_state.dart index 2f34b9d9..6716e698 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInSetWorkTime/checkingInSetWorkTime_state.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInSetWorkTime/checkingInSetWorkTime_state.dart @@ -5,7 +5,7 @@ import '../../../lockMian/entity/lockListInfo_entity.dart'; import '../checkingInSet/checkingInSet_entity.dart'; class CheckingInSetWorkTimeState{ - final getKeyInfosData = LockListInfoItemEntity().obs; + // final getKeyInfosData = LockListInfoItemEntity().obs; final checkingInSetInfo = CheckingInSetInfo().obs; final companyId = "".obs; @@ -19,7 +19,7 @@ class CheckingInSetWorkTimeState{ CheckingInSetWorkTimeState() { Map map = Get.arguments; pushType.value = map["pushType"]; - getKeyInfosData.value = map["getKeyInfosData"]; + // getKeyInfosData.value = map["getKeyInfosData"]; companyId.value = map["companyId"]; checkingInSetInfo.value = map["checkingInSetInfo"]; if(pushType.value != "0"){ diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_logic.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_logic.dart index df18f1c9..f1432dcf 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_logic.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_logic.dart @@ -165,7 +165,8 @@ class CheckingInAddStaffLogic extends BaseGetXController{ "0", '0', 0, - 0); + 0, + 1); if (entity.errorCode!.codeIsSuccessful) { print('获取密码成功'); if (entity.data != null) { 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 9eef9adb..0852ba7b 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 @@ -152,12 +152,14 @@ class _ElectronicKeyDetailPageState extends State { '${startDateStr.toLocal().toString().substring(0, 16)}\n${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)}\n 永久'; + // DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); + // useDateStr = '${dateStr.toLocal().toString().substring(0, 16)}\n 永久'; + useDateStr = '永久'; } else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) { //单次 - DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); - useDateStr = '${dateStr.toLocal().toString().substring(0, 16)}\n 单次'; + // DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); + // useDateStr = '${dateStr.toLocal().toString().substring(0, 16)}\n 单次'; + useDateStr = '单次'; } else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) { //循环 useDateStr = '循环'; @@ -169,7 +171,7 @@ class _ElectronicKeyDetailPageState extends State { //发送时间 String getSenderDate(ElectronicKeyListItem indexEntity) { String senderDate = ''; - DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); + DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!); senderDate = dateStr.toLocal().toString().substring(0, 16); return senderDate; } diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart index 51b5cc65..1a67ca25 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart @@ -83,7 +83,7 @@ class ElectronicKeyListItem { String? remarks; int? isCameraEnable; int? faceAuthentication; - int? date; + int? sendDate; int? remoteEnable; int? appUnlockMustOnline; List? weekDays; @@ -105,7 +105,7 @@ class ElectronicKeyListItem { this.remarks, this.isCameraEnable, this.faceAuthentication, - this.date, + this.sendDate, this.remoteEnable, this.appUnlockMustOnline, this.weekDays}); @@ -131,7 +131,7 @@ class ElectronicKeyListItem { json['faceAuthentication'] != null ? faceAuthentication = json['faceAuthentication'] : 0; - date = json['date']; + sendDate = json['sendDate']; remoteEnable = json['remoteEnable']; appUnlockMustOnline = json['appUnlockMustOnline']; json['weekDays'] != null ? weekDays = json['weekDays'] : []; @@ -155,7 +155,7 @@ class ElectronicKeyListItem { data['remarks'] = remarks; data['isCameraEnable'] = isCameraEnable; data['faceAuthentication'] = faceAuthentication; - data['date'] = date; + data['sendDate'] = sendDate; data['remoteEnable'] = remoteEnable; data['appUnlockMustOnline'] = appUnlockMustOnline; data['weekDays'] = weekDays; diff --git a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_page.dart b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_page.dart index 0d404a6b..0758cf3e 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_page.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_page.dart @@ -394,14 +394,24 @@ class _SendElectronicKeyPageState extends State { //标记房间为已入住 isOn:已入住: 1 空闲:2 Future updateRoomCheckIn() async { - var entity = await ApiRepository.to - .updateSetting(state.keyInfo.value.lockId.toString(), '1', '13'); - if (entity.errorCode!.codeIsSuccessful) { + // var entity = await ApiRepository.to + // .updateSetting(state.keyInfo.value.lockId.toString(), '1', '13'); + // if (entity.errorCode!.codeIsSuccessful) { + // print("标记为已入住成功啦啦啦啦啦"); + // Toast.show(msg: "标记成功"); + // setState(() {}); + // } else { + // Toast.show(msg: '操作失败'); + // } + + var entity = await ApiRepository.to.setRoomStatusData( + lockId: state.keyInfo.value.lockId!, + roomStatus:1, + ); + if(entity.errorCode!.codeIsSuccessful){ print("标记为已入住成功啦啦啦啦啦"); Toast.show(msg: "标记成功"); setState(() {}); - } else { - Toast.show(msg: '操作失败'); } } diff --git a/star_lock/lib/main/lockDetail/lcokSet/automaticBlocking/automaticBlocking_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/automaticBlocking/automaticBlocking_logic.dart index 04e5ca03..5b8d43b5 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/automaticBlocking/automaticBlocking_logic.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/automaticBlocking/automaticBlocking_logic.dart @@ -7,7 +7,6 @@ import 'package:star_lock/tools/baseGetXController.dart'; import '../../../../blue/blue_manage.dart'; import '../../../../blue/io_protocol/io_readSupportFunctionsWithParameters.dart'; import '../../../../blue/io_reply.dart'; -import '../../../../blue/io_tool/io_manager.dart'; import '../../../../blue/io_tool/io_tool.dart'; import '../../../../blue/io_tool/manager_event_bus.dart'; import '../../../../blue/sender_manage.dart'; @@ -20,26 +19,16 @@ import 'automaticBlocking_state.dart'; class AutomaticBlockingLogic extends BaseGetXController{ final AutomaticBlockingState state = AutomaticBlockingState(); - void _setAutoUnLock() async{ - String autoTime; - if(state.isOpen.value == false){ - autoTime = "-1"; - }else{ - if(state.isCustomLockTime.value == true){ - autoTime = state.timeController.text; - }else{ - autoTime = state.autoLockTime.value; - } - } - + void setAutoUnLock() async{ var entity = await ApiRepository.to.setAutoUnlock( lockId: state.lockSetInfoData.value.lockId!, - autoLockTime:int.parse(autoTime), - type: 1, + autoLock:state.isOpen.value == true ? 1 : 0, + autoLockSecond: int.parse(state.autoLockTime.value), ); if(entity.errorCode!.codeIsSuccessful){ - state.autoLockTime.value = state.isOpen.value == false ? "0" : autoTime; - state.lockSetInfoData.value.lockSettingInfo!.autoLockSecond = int.parse(autoTime); + + state.autoLockTime.value = state.isOpen.value == false ? "0" : state.autoLockTime.value; + state.lockSetInfoData.value.lockSettingInfo!.autoLockSecond = int.parse(state.autoLockTime.value); eventBus.fire(RefreshLockListInfoDataEvent()); eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value)); Toast.show(msg: "操作成功"); @@ -101,7 +90,7 @@ class AutomaticBlockingLogic extends BaseGetXController{ case 0x00: //成功 print("${reply.commandType}数据解析成功"); - _setAutoUnLock(); + setAutoUnLock(); break; case 0x06: //无权限 diff --git a/star_lock/lib/main/lockDetail/lcokSet/checkInCreatCompany/checkInCreatCompany_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/checkInCreatCompany/checkInCreatCompany_logic.dart index c185f64b..b6013de4 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/checkInCreatCompany/checkInCreatCompany_logic.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/checkInCreatCompany/checkInCreatCompany_logic.dart @@ -27,11 +27,9 @@ class CheckInCreatCompanyLogic extends BaseGetXController{ // 设置考勤 void setLockSetGeneralSetting() async{ - var entity = await ApiRepository.to.setLockSetGeneralSettingData( - lockId: state.lockSetInfoData.value.lockId.toString(), - changeType:"1", - isOn:"1", - type:"1", + var entity = await ApiRepository.to.setCheckInData( + lockId: state.lockSetInfoData.value.lockId!, + attendance:1, ); if(entity.errorCode!.codeIsSuccessful){ eventBus.fire(RefreshLockListInfoDataEvent()); diff --git a/star_lock/lib/main/lockDetail/lcokSet/checkInCreatCompany/checkInCreatCompany_page.dart b/star_lock/lib/main/lockDetail/lcokSet/checkInCreatCompany/checkInCreatCompany_page.dart index eca3dc70..8d2dc973 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/checkInCreatCompany/checkInCreatCompany_page.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/checkInCreatCompany/checkInCreatCompany_page.dart @@ -46,7 +46,7 @@ class _CheckInCreatCompanyPageState extends State { isHaveDirection: true, action: () async { var data = await Get.toNamed(Routers.checkingInSetWorkTimePage, arguments: { - "getKeyInfosData": state.lockSetInfoData.value, + // "getKeyInfosData": state.lockSetInfoData.value, "companyId": "1", "pushType": "0", "checkingInSetInfo": CheckingInSetInfo(), diff --git a/star_lock/lib/main/lockDetail/lcokSet/lockEscalation/lockEscalation_page.dart b/star_lock/lib/main/lockDetail/lcokSet/lockEscalation/lockEscalation_page.dart index 6413bc3b..5826a4f7 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/lockEscalation/lockEscalation_page.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/lockEscalation/lockEscalation_page.dart @@ -64,7 +64,8 @@ class _LockEscalationPageState extends State { height: 10.h, ), Text( - "${TranslationLoader.lanKeys!.newVersion!.tr}:1.0.1", + // "${TranslationLoader.lanKeys!.newVersion!.tr}:1.0.1", + "未发现新版本", style: TextStyle(color: AppColors.mainColor, fontSize: 18.sp), ), SizedBox( diff --git a/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSetInfo_entity.dart b/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSetInfo_entity.dart index 9a9c2c38..ee73544e 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSetInfo_entity.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSetInfo_entity.dart @@ -403,7 +403,7 @@ class LockSettingInfo { int? lightingTime; int? lightingSecond; int? passageMode; - List? passageModeConfig; + List? passageModeConfig; int? attendance; int? appUnlockOnline; int? bluetoothBroadcast; @@ -451,7 +451,12 @@ class LockSettingInfo { lightingTime = json['lightingTime']; lightingSecond = json['lightingSecond']; passageMode = json['passageMode']; - passageModeConfig = json['passageModeConfig'].cast(); + if (json['passageModeConfig'] != null) { + passageModeConfig = []; + json['passageModeConfig'].forEach((v) { + passageModeConfig!.add(PassageModeConfig.fromJson(v)); + }); + } attendance = json['attendance']; appUnlockOnline = json['appUnlockOnline']; bluetoothBroadcast = json['bluetoothBroadcast']; @@ -477,7 +482,10 @@ class LockSettingInfo { data['lightingTime'] = lightingTime; data['lightingSecond'] = lightingSecond; data['passageMode'] = passageMode; - data['passageModeConfig'] = passageModeConfig; + if (passageModeConfig != null) { + data['passageModeConfig'] = + passageModeConfig!.map((v) => v.toJson()).toList(); + } data['attendance'] = attendance; data['appUnlockOnline'] = appUnlockOnline; data['bluetoothBroadcast'] = bluetoothBroadcast; @@ -488,3 +496,29 @@ class LockSettingInfo { } } +class PassageModeConfig { + int? startDate; + int? endDate; + List? weekDays; + int? isAllDay; + + PassageModeConfig( + {this.startDate, this.endDate, this.weekDays, this.isAllDay}); + + PassageModeConfig.fromJson(Map json) { + startDate = json['startDate']; + endDate = json['endDate']; + weekDays = json['weekDays'].cast(); + isAllDay = json['isAllDay']; + } + + Map toJson() { + final Map data = {}; + data['startDate'] = startDate; + data['endDate'] = endDate; + data['weekDays'] = weekDays; + data['isAllDay'] = isAllDay; + return data; + } +} + diff --git a/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_logic.dart index 02f39c72..dd95e929 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_logic.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_logic.dart @@ -64,8 +64,7 @@ class LockSetLogic extends BaseGetXController { print("${reply.commandType}需要鉴权"); var privateKey = await Storage.getStringList(saveBluePrivateKey); - List getPrivateKeyList = - changeStringListToIntList(privateKey!); + List getPrivateKeyList = changeStringListToIntList(privateKey!); var publicKey = await Storage.getStringList(saveBluePublicKey); List publicKeyDataList = changeStringListToIntList(publicKey!); @@ -218,6 +217,7 @@ class LockSetLogic extends BaseGetXController { state.lockSettingInfo.value = state.lockSetInfoData.value.lockSettingInfo!; state.lockFeature.value = state.lockSetInfoData.value.lockFeature!; state.lockStatus.value = state.lockSetInfoData.value.lockStatus!; + state.isAttendance.value = state.lockSettingInfo.value.attendance!; } } @@ -291,34 +291,32 @@ class LockSetLogic extends BaseGetXController { } // 设置是否打开考勤 - void setLockSetGeneralSetting(String isOn) async { - var entity = await ApiRepository.to.setLockSetGeneralSettingData( - lockId: state.lockSetInfoData.value.lockId.toString(), - changeType: "1", - isOn: isOn, - type: "1", + void setLockSetGeneralSetting() async { + var entity = await ApiRepository.to.setCheckInData( + lockId: state.lockSetInfoData.value.lockId!, + attendance:state.isAttendance.value == 1 ? 0 : 1, ); - if (entity.errorCode!.codeIsSuccessful) { + if(entity.errorCode!.codeIsSuccessful){ eventBus.fire(RefreshLockListInfoDataEvent()); - // state.lockSetInfoData.value.attendance = int.parse(isOn); - // eventBus.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value)); + state.isAttendance.value = (state.isAttendance.value == 1 ? 0 : 1); + state.lockSettingInfo.value.attendance = state.isAttendance.value; + print("state.lockSettingInfo.value.attendance:${state.lockSettingInfo.value.attendance}"); Toast.show(msg: "设置成功"); - } else {} + } } // 设置是否打开开锁提醒 void setLockPickingReminder() async { var entity = await ApiRepository.to.setLockPickingReminderData( - lockId: state.lockSetInfoData.value.lockId.toString(), - keyId: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(), - monitorFlag: state.isLockPickingReminder.value == 1 ? "1" : "2", // 1开启,2关闭 + lockId: state.lockSetInfoData.value.lockId!, + unlockReminderPush: state.isLockPickingReminder.value == 1 ? 0 : 1, ); if (entity.errorCode!.codeIsSuccessful) { eventBus.fire(RefreshLockListInfoDataEvent()); - // state.lockSetInfoData.value.unlockReminder = state.isLockPickingReminder.value; - // eventBus.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value)); + state.isLockPickingReminder.value = (state.isLockPickingReminder.value == 1 ? 0 : 1); + state.lockSettingInfo.value.unlockReminderPush = state.isLockPickingReminder.value; Toast.show(msg: "设置成功"); } else {} } diff --git a/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_page.dart b/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_page.dart index bf6fb042..ec1b4f3d 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_page.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_page.dart @@ -188,8 +188,8 @@ class _LockSetPageState extends State with RouteAware { SizedBox(height: 10.h), // 常开模式 Obx(() => Visibility( - // visible: state.lockFeature.value.passageMode == 1 ? true : false, - visible:true, + visible: state.lockFeature.value.passageMode == 1 ? true : false, + // visible:true, child: CommonItem( leftTitel: TranslationLoader.lanKeys!.normallyOpenMode!.tr, rightTitle: (state.lockSettingInfo.value.passageMode ?? 0) == 1 @@ -320,20 +320,23 @@ class _LockSetPageState extends State with RouteAware { // 标记房态 Obx(() { var title = ""; - if (state.lockSettingInfo.value.passageMode == 1) { + if (state.lockStatus.value.roomStatus == 1) { title = TranslationLoader.lanKeys!.checkedIn!.tr; - } else if (state.lockSettingInfo.value.passageMode == 2) { + } else if (state.lockStatus.value.roomStatus == 0) { title = TranslationLoader.lanKeys!.leisure!.tr; } return Visibility( visible: state.lockStatus.value.roomStatus == 1 ? true : false, + // visible: true, child: CommonItem( leftTitel: TranslationLoader.lanKeys!.markedHouseState!.tr, rightTitle: title, isHaveLine: true, isHaveDirection: true, action: () { - Get.toNamed(Routers.markedHouseStatePage, arguments: state.lockSetInfoData.value); + Get.toNamed(Routers.markedHouseStatePage, arguments: { + 'lockSetInfoData': state.lockSetInfoData.value + }); })); }), // 考勤 @@ -470,28 +473,20 @@ class _LockSetPageState extends State with RouteAware { } CupertinoSwitch _openCheckInSwitch() { + print("111111state.lockSettingInfo.value.attendance:${state.lockSettingInfo.value.attendance}"); return CupertinoSwitch( activeColor: CupertinoColors.activeBlue, trackColor: CupertinoColors.systemGrey5, thumbColor: CupertinoColors.white, - value: ((state.lockSettingInfo.value.attendance ?? 0) == 1) ? true : false, + value: ((state.isAttendance.value) == 1) ? true : false, onChanged: (value) { - setState(() { - int isOnStr; - if (value == true) { - isOnStr = 1; - } else { - isOnStr = 2; - } - logic.openCheckingInData((checkingInInfoDataEntity) { if (checkingInInfoDataEntity.data!.companyId == 0) { showCupertinoAlertDialog(context); } else { - logic.setLockSetGeneralSetting(isOnStr.toString()); + logic.setLockSetGeneralSetting(); } }); - }); }, ); } @@ -501,10 +496,9 @@ class _LockSetPageState extends State with RouteAware { activeColor: CupertinoColors.activeBlue, trackColor: CupertinoColors.systemGrey5, thumbColor: CupertinoColors.white, - value: (state.lockSettingInfo.value.unlockReminder ?? 0) == 1 ? true : false, + value: (state.isLockPickingReminder.value) == 1 ? true : false, onChanged: (value) { setState(() { - state.isLockPickingReminder.value = state.isLockPickingReminder.value == 1 ? 2 : 1; logic.setLockPickingReminder(); }); }, diff --git a/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_state.dart b/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_state.dart index 7304e199..ffbcb1ec 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_state.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_state.dart @@ -11,9 +11,9 @@ class LockSetState { final lockId = 0.obs; - var isAttendance = 1.obs;// 是否开启考勤 + var isAttendance = 0.obs;// 是否开启考勤 var currentDeviceUUid = "".obs;// 当前设备的uuid - var isLockPickingReminder = 1.obs;// 是否开启开锁提醒 + var isLockPickingReminder = 0.obs;// 是否开启开锁提醒 var passwordTF = TextEditingController(); LockSetState() { diff --git a/star_lock/lib/main/lockDetail/lcokSet/lockTime/getServerDatetime_entity.dart b/star_lock/lib/main/lockDetail/lcokSet/lockTime/getServerDatetime_entity.dart index 6bc69cbb..d371632f 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/lockTime/getServerDatetime_entity.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/lockTime/getServerDatetime_entity.dart @@ -28,7 +28,7 @@ class GetServerDatetimeEntity { } class Data { - String? date; + int? date; Data( {this.date}); diff --git a/star_lock/lib/main/lockDetail/lcokSet/lockTime/lockTime_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/lockTime/lockTime_logic.dart index 96c22eb0..34464025 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/lockTime/lockTime_logic.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/lockTime/lockTime_logic.dart @@ -186,7 +186,7 @@ class LockTimeLogic extends BaseGetXController{ lockId: state.lockSetInfoData.value.lockId.toString(), ); if(entity.errorCode!.codeIsSuccessful){ - String dataEime = DateTool().dateToYMDHNSString("${int.parse(entity.data!.date!)}"); + String dataEime = DateTool().dateToYMDHNSString("${entity.data!.date!}"); state.dateTime.value = dataEime; sendTiming(); } diff --git a/star_lock/lib/main/lockDetail/lcokSet/lockTime/lockTime_page.dart b/star_lock/lib/main/lockDetail/lcokSet/lockTime/lockTime_page.dart index f8178765..7ac7f01b 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/lockTime/lockTime_page.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/lockTime/lockTime_page.dart @@ -53,19 +53,19 @@ class _LockTimePageState extends State { padding: EdgeInsets.only(top: 20.w, bottom: 20.w), onClick: () { // print("1111111"); - // logic.sendTiming(); - logic.getServerDatetime(); + logic.sendTiming(); + // logic.getServerDatetime(); }), SizedBox( height: 40.h, ), - GestureDetector( - onTap: () {}, - child: Container( - child: Text(TranslationLoader.lanKeys!.setTheDSTMode!.tr, - style: TextStyle( - fontSize: 24.sp, color: AppColors.mainColor))), - ), + // GestureDetector( + // onTap: () {}, + // child: Container( + // child: Text(TranslationLoader.lanKeys!.setTheDSTMode!.tr, + // style: TextStyle( + // fontSize: 24.sp, color: AppColors.mainColor))), + // ), ], ), )); diff --git a/star_lock/lib/main/lockDetail/lcokSet/markedHouseState/markedHouseState_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/markedHouseState/markedHouseState_logic.dart index 8da99e92..5a8fc7e5 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/markedHouseState/markedHouseState_logic.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/markedHouseState/markedHouseState_logic.dart @@ -11,19 +11,16 @@ class MarkedHouseStateLogic extends BaseGetXController{ MarkedHouseStateState state = MarkedHouseStateState(); // 标记房态 - Future setLockSetGeneralSetting() async{ - var entity = await ApiRepository.to.setLockSetGeneralSettingData( - lockId: state.getKeyInfosData.value.lockId.toString(), - changeType:"1", - isOn:state.roomStatus.value.toString(), // 已入住: 1 空闲:2 - type:"13", // 标记房态 + Future setRoomStatusData() async{ + var entity = await ApiRepository.to.setRoomStatusData( + lockId: state.lockSetInfoData.value.lockId!, + roomStatus:state.roomStatus.value, ); if(entity.errorCode!.codeIsSuccessful){ eventBus.fire(RefreshLockListInfoDataEvent()); - state.roomStatus.value = state.roomStatus.value; - // state.getKeyInfosData.value.antiPrySwitch = state.roomStatus.value; - // eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value.lockSetting!)); + state.lockSetInfoData.value.lockStatus!.roomStatus = state.roomStatus.value; + eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value)); Toast.show(msg: "操作成功"); }else if(entity.errorCode! == 1){ // 跳转到高级功能界面 需要开通高级功能 @@ -31,5 +28,4 @@ class MarkedHouseStateLogic extends BaseGetXController{ } } - } \ No newline at end of file diff --git a/star_lock/lib/main/lockDetail/lcokSet/markedHouseState/markedHouseState_page.dart b/star_lock/lib/main/lockDetail/lcokSet/markedHouseState/markedHouseState_page.dart index 099897e3..10224bf2 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/markedHouseState/markedHouseState_page.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/markedHouseState/markedHouseState_page.dart @@ -38,13 +38,13 @@ class _MarkedHouseStatePageState extends State { rightWidget: GestureDetector( onTap: () { setState(() { - state.roomStatus.value = 2; + state.roomStatus.value = 0; }); }, child: Row( children: [ Image.asset( - state.roomStatus.value == 2 ? 'images/icon_round_selet.png' : 'images/icon_round_unSelet.png', + state.roomStatus.value == 0 ? 'images/icon_round_selet.png' : 'images/icon_round_unSelet.png', width: 30.w, height: 30.w, ), @@ -82,7 +82,7 @@ class _MarkedHouseStatePageState extends State { // margin: EdgeInsets.only(left: 03.w, right: 30.w, top: 20.w), padding: EdgeInsets.only(top: 20.w, bottom: 20.w), onClick: () { - logic.setLockSetGeneralSetting(); + logic.setRoomStatusData(); }), ], )); diff --git a/star_lock/lib/main/lockDetail/lcokSet/markedHouseState/markedHouseState_state.dart b/star_lock/lib/main/lockDetail/lcokSet/markedHouseState/markedHouseState_state.dart index c406e164..1820563d 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/markedHouseState/markedHouseState_state.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/markedHouseState/markedHouseState_state.dart @@ -6,13 +6,13 @@ import '../lockSet/lockSetInfo_entity.dart'; class MarkedHouseStateState{ var lockSetInfoData = LockSetInfoData().obs; - final getKeyInfosData = LockListInfoItemEntity().obs; var roomStatus = 0.obs; MarkedHouseStateState() { var map = Get.arguments; lockSetInfoData.value = map["lockSetInfoData"]; - getKeyInfosData.value = map["keyInfo"]; + + roomStatus.value = lockSetInfoData.value.lockStatus!.roomStatus!; } } \ No newline at end of file diff --git a/star_lock/lib/main/lockDetail/lcokSet/normallyOpenMode/normallyOpenMode_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/normallyOpenMode/normallyOpenMode_logic.dart index 4eb7ca89..cba0c7a2 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/normallyOpenMode/normallyOpenMode_logic.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/normallyOpenMode/normallyOpenMode_logic.dart @@ -23,42 +23,30 @@ import 'normallyOpenMode_state.dart'; class NormallyOpenModeLogic extends BaseGetXController{ NormallyOpenModeState state = NormallyOpenModeState(); - // 获取锁的常开模式设置 - void getNormallyOpenModeConfig() async{ - var entity = await ApiRepository.to.getPassageModeConfig( - lockId: state.lockSetInfoData.value.lockId.toString(), - ); - if(entity.errorCode!.codeIsSuccessful){ - state.getPassageModeConfigData.value = entity; - state.isOpenNormallyOpenMode.value = state.getPassageModeConfigData.value.data!.passageMode == 1 ? true : false; - state.isOpenAutomaticUnLock.value = state.getPassageModeConfigData.value.data!.autoUnlock == 1 ? true : false; - state.isAllDay.value = state.getPassageModeConfigData.value.data!.isAllDay == 1 ? 1 : 2; - state.weekDays.value = state.getPassageModeConfigData.value.data!.weekDays!; - - state.beginTimeMinute.value = state.getPassageModeConfigData.value.data!.startDate!; - state.beginTime.value = "${state.getPassageModeConfigData.value.data!.startDate!~/60}:${state.getPassageModeConfigData.value.data!.startDate! % 60}"; - state.endTimeMinute.value = state.getPassageModeConfigData.value.data!.endDate!; - state.endTime.value = "${state.getPassageModeConfigData.value.data!.endDate!~/60}:${state.getPassageModeConfigData.value.data!.endDate! % 60}"; - } - } - // 配置锁的常开模式设置 void configPassageMode() async{ + if(state.weekDays.value.isNotEmpty){ + Toast.show(msg:"请选择常开日期"); + return; + } + if(state.endTimeMinute.value < state.beginTimeMinute.value){ Toast.show(msg:"结束时间不能小于开始时间哦"); return; } - print("state.isOpenNormallyOpenMode.value:${state.isOpenNormallyOpenMode.value}"); - var entity = await ApiRepository.to.configPassageModeLoadData( - lockId: state.lockSetInfoData.value.lockId.toString(), - passageMode:state.isOpenNormallyOpenMode.value == true ? "1":"2", - autoUnlock:state.isOpenAutomaticUnLock.value == true ? "1":"2", - type: "1", - startDate: state.beginTimeMinute.value.toString(), - endDate: state.endTimeMinute.value.toString(), - isAllDay: state.isAllDay.value == 1 ? "1":"2", - weekDays: state.weekDays, + var map = { + "isAllDay":state.isAllDay.value, + "weekDays":state.weekDays.value, + "startDate":state.beginTimeMinute.value, + "endDate":state.endTimeMinute.value, + }; + + // print("state.isOpenNormallyOpenMode.value:${state.isOpenNormallyOpenMode.value}"); + var entity = await ApiRepository.to.setNormallyModeData( + lockId: state.lockSetInfoData.value.lockId!, + passageMode:state.isOpenNormallyOpenMode.value == true ? 1:0, + passageModeConfig: map, ); if(entity.errorCode!.codeIsSuccessful){ eventBus.fire(RefreshLockListInfoDataEvent()); @@ -194,7 +182,7 @@ class NormallyOpenModeLogic extends BaseGetXController{ list.add(state.endTimeMinute.value); list.add(state.isAllDay.value == 1 ? 1:0); list.add(0); - list.add(state.isOpenAutomaticUnLock.value == true ? 1:0); + list.add(0); IoSenderManage.setSupportFunctionsWithParametersCommand( keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(), @@ -216,10 +204,6 @@ class NormallyOpenModeLogic extends BaseGetXController{ super.onReady(); print("onReady()"); - if(state.lockSetInfoData.value.lockSettingInfo!.passageMode == 1){ - getNormallyOpenModeConfig(); - } - _initReplySubscription(); } diff --git a/star_lock/lib/main/lockDetail/lcokSet/normallyOpenMode/normallyOpenMode_page.dart b/star_lock/lib/main/lockDetail/lcokSet/normallyOpenMode/normallyOpenMode_page.dart index a0e9921c..f807b103 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/normallyOpenMode/normallyOpenMode_page.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/normallyOpenMode/normallyOpenMode_page.dart @@ -67,36 +67,36 @@ class _NormallyOpenModePageState extends State { color: Colors.white, child: Column( children: [ - CommonItem( - leftTitel: TranslationLoader.lanKeys!.automaticUnLock!.tr, - rightTitle: "", - isHaveLine: false, - isHaveRightWidget: true, - rightWidget: - SizedBox(width: 60.w, height: 50.h, child: _autoUnlockSwitch())), - Container( - height: 1.h, - color: AppColors.mainBackgroundColor, - ), - Container( - padding: EdgeInsets.only( - left: 30.w, right: 30.w, top: 20.w, bottom: 20.w), - color: Colors.white, - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Expanded( - child: Text( - TranslationLoader.lanKeys!.automaticUnLockTip!.tr, - style: TextStyle(fontSize: 20.sp), - )), - ], - ), - ), - Container( - height: 10.h, - color: AppColors.mainBackgroundColor, - ), + // CommonItem( + // leftTitel: TranslationLoader.lanKeys!.automaticUnLock!.tr, + // rightTitle: "", + // isHaveLine: false, + // isHaveRightWidget: true, + // rightWidget: + // SizedBox(width: 60.w, height: 50.h, child: _autoUnlockSwitch())), + // Container( + // height: 1.h, + // color: AppColors.mainBackgroundColor, + // ), + // Container( + // padding: EdgeInsets.only( + // left: 30.w, right: 30.w, top: 20.w, bottom: 20.w), + // color: Colors.white, + // child: Row( + // mainAxisAlignment: MainAxisAlignment.start, + // children: [ + // Expanded( + // child: Text( + // TranslationLoader.lanKeys!.automaticUnLockTip!.tr, + // style: TextStyle(fontSize: 20.sp), + // )), + // ], + // ), + // ), + // Container( + // height: 10.h, + // color: AppColors.mainBackgroundColor, + // ), topWidget(), SizedBox( height: 10.h, @@ -224,7 +224,7 @@ class _NormallyOpenModePageState extends State { onTap: () { // 选择全天模式 if(state.isAllDay.value == 1){ - state.isAllDay.value = 2; + state.isAllDay.value = 0; }else{ state.isAllDay.value = 1; } @@ -304,17 +304,17 @@ class _NormallyOpenModePageState extends State { ); } - CupertinoSwitch _autoUnlockSwitch() { - return CupertinoSwitch( - activeColor: CupertinoColors.activeBlue, - trackColor: CupertinoColors.systemGrey5, - thumbColor: CupertinoColors.white, - value: state.isOpenAutomaticUnLock.value, - onChanged: (value) { - setState(() { - state.isOpenAutomaticUnLock.value = value; - }); - }, - ); - } + // CupertinoSwitch _autoUnlockSwitch() { + // return CupertinoSwitch( + // activeColor: CupertinoColors.activeBlue, + // trackColor: CupertinoColors.systemGrey5, + // thumbColor: CupertinoColors.white, + // value: state.isOpenAutomaticUnLock.value, + // onChanged: (value) { + // setState(() { + // state.isOpenAutomaticUnLock.value = value; + // }); + // }, + // ); + // } } diff --git a/star_lock/lib/main/lockDetail/lcokSet/normallyOpenMode/normallyOpenMode_state.dart b/star_lock/lib/main/lockDetail/lcokSet/normallyOpenMode/normallyOpenMode_state.dart index 348a6b31..c4e9c643 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/normallyOpenMode/normallyOpenMode_state.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/normallyOpenMode/normallyOpenMode_state.dart @@ -1,16 +1,13 @@ import 'package:get/get.dart'; -import 'package:star_lock/main/lockDetail/lcokSet/normallyOpenMode/getPassageModeConfig_entity.dart'; - -import '../../../lockMian/entity/lockListInfo_entity.dart'; import '../lockSet/lockSetInfo_entity.dart'; class NormallyOpenModeState{ var lockSetInfoData = LockSetInfoData().obs; - var getPassageModeConfigData = GetPassageModeConfigEntity().obs; + // var getPassageModeConfigData = GetPassageModeConfigEntity().obs; var isOpenNormallyOpenMode = false.obs;// 是否开启常开模式 常开模式:1-开启、2-关闭 - var isOpenAutomaticUnLock = false.obs;// 是否开启自动开锁模式 自动开锁:1-开启、2-关闭,开启后锁将在常开模式开始时自动打开 + // var isOpenAutomaticUnLock = false.obs;// 是否开启自动开锁模式 自动开锁:1-开启、2-关闭,开启后锁将在常开模式开始时自动打开 var isAllDay = 0.obs;// 是否开启全天模式 是否全天常开:1-是、2-否, 如果全天常开,startDate和endDate参数将被忽略. var weekDays = [].obs;// 常开时期 var beginTime = "".obs;// 开始时间 @@ -21,5 +18,16 @@ class NormallyOpenModeState{ NormallyOpenModeState() { var map = Get.arguments; lockSetInfoData.value = map["lockSetInfoData"]; + isOpenNormallyOpenMode.value = lockSetInfoData.value.lockSettingInfo!.passageMode! == 1 ? true : false; + + if((isOpenNormallyOpenMode.value == true) && (lockSetInfoData.value.lockSettingInfo!.passageModeConfig!.isNotEmpty)){ + isAllDay.value = lockSetInfoData.value.lockSettingInfo!.passageModeConfig![0].isAllDay!; + weekDays.value = lockSetInfoData.value.lockSettingInfo!.passageModeConfig![0].weekDays!; + + beginTimeMinute.value = lockSetInfoData.value.lockSettingInfo!.passageModeConfig![0].startDate!; + beginTime.value = "${lockSetInfoData.value.lockSettingInfo!.passageModeConfig![0].startDate!~/60}:${lockSetInfoData.value.lockSettingInfo!.passageModeConfig![0].startDate! % 60}"; + endTimeMinute.value = lockSetInfoData.value.lockSettingInfo!.passageModeConfig![0].endDate!; + endTime.value = "${lockSetInfoData.value.lockSettingInfo!.passageModeConfig![0].endDate!~/60}:${lockSetInfoData.value.lockSettingInfo!.passageModeConfig![0].endDate! % 60}"; + } } } \ No newline at end of file diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart index fad7aa13..0fe2c5c7 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart @@ -129,9 +129,10 @@ class _PasswordKeyDetailPageState extends State { // backgroundColor: Colors.white, side: BorderSide(width: 1, color: AppColors.mainColor)), onPressed: () { - Navigator.pushNamed( - context, Routers.otherTypeKeyManagePage, - arguments: 0); + Navigator.pushNamed(context, Routers.otherTypeKeyManagePage, arguments: { + "lockId": itemData.lockId, + "fromType": 0 + }); }, child: Text( '设置卡', @@ -151,13 +152,12 @@ class _PasswordKeyDetailPageState extends State { side: BorderSide(width: 1, color: AppColors.mainColor)), onPressed: () { Navigator.pushNamed( - context, Routers.otherTypeKeyManagePage, - arguments: 1); + context, Routers.otherTypeKeyManagePage,arguments: { + "lockId": itemData.lockId, + "fromType": 1 + }); }, - child: Text( - '设置指纹', - style: TextStyle( - color: AppColors.mainColor, fontSize: 24.sp), + child: Text('设置指纹', style: TextStyle(color: AppColors.mainColor, fontSize: 24.sp), )), ), SizedBox( @@ -171,9 +171,10 @@ class _PasswordKeyDetailPageState extends State { // backgroundColor: Colors.white, side: BorderSide(width: 1, color: AppColors.mainColor)), onPressed: () { - Navigator.pushNamed( - context, Routers.otherTypeKeyManagePage, - arguments: 2); + Navigator.pushNamed(context, Routers.otherTypeKeyManagePage, arguments: { + "lockId": itemData.lockId, + "fromType": 2 + }); }, child: Text( '设置遥控', diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart index ed75ae23..7ff94cca 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart @@ -1,3 +1,4 @@ + import 'package:date_format/date_format.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -16,6 +17,7 @@ import 'package:star_lock/tools/toast.dart'; import '../../../../appRouters.dart'; import '../../../../tools/commonItem.dart'; + import '../../../../tools/submitBtn.dart'; import '../../../../translations/trans_lib.dart'; import '../../../lockMian/entity/lockListInfo_entity.dart'; @@ -241,7 +243,7 @@ class _PasswordKeyPerpetualPageState extends State { // 自定义是否永久 Widget keyIfPerpetualWidget() { return Container( - margin: EdgeInsets.only(left: 20.w, right: 20.w), + // margin: EdgeInsets.only(left: 20.w, right: 20.w), child: Column( children: [ CommonItem( @@ -262,7 +264,7 @@ class _PasswordKeyPerpetualPageState extends State { // 循环 Widget keyCirculationWidget() { return Container( - margin: EdgeInsets.only(left: 20.w, right: 20.w), + // margin: EdgeInsets.only(left: 20.w, right: 20.w), child: Column( children: [ CommonItem( @@ -291,7 +293,7 @@ class _PasswordKeyPerpetualPageState extends State { isHaveLine: true, isHaveDirection: true, action: () { - Pickers.showDatePicker(context, mode: DateMode.HM, + Pickers.showDatePicker(context, mode: DateMode.H, onConfirm: (p) { setState(() { _effectiveDateTime = DateTime.parse( @@ -307,8 +309,7 @@ class _PasswordKeyPerpetualPageState extends State { rightTitle: _selectFailureDate, isHaveDirection: true, action: () { - Pickers.showDatePicker(context, mode: DateMode.HM, - onConfirm: (p) { + Pickers.showDatePicker(context, mode: DateMode.H, onConfirm: (p) { setState(() { _failureDateTime = DateTime.parse( '${_failureDateTime.year}-${intToStr(_failureDateTime.month)}-${intToStr(_failureDateTime.day)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}'); @@ -325,9 +326,7 @@ class _PasswordKeyPerpetualPageState extends State { //底部选择pickerView showPickerView(BuildContext context, List dataList) { - Pickers.showSinglePicker(context, - data: dataList, - pickerStyle: DefaultPickerStyle(), onConfirm: (p, position) { + Pickers.showSinglePicker(context, data: dataList, pickerStyle: DefaultPickerStyle(), onConfirm: (p, position) { setState(() { cyclicModeStr = p; }); @@ -482,7 +481,8 @@ class _PasswordKeyPerpetualPageState extends State { getEffectiveDateTime, '0', startHours, - endHours); + endHours, + 1); if (entity.errorCode!.codeIsSuccessful) { print('获取密码成功'); _isSendSuccess = true; diff --git a/star_lock/lib/main/lockMian/entity/lockListInfo_entity.dart b/star_lock/lib/main/lockMian/entity/lockListInfo_entity.dart index 4efdabee..e87b6e0e 100644 --- a/star_lock/lib/main/lockMian/entity/lockListInfo_entity.dart +++ b/star_lock/lib/main/lockMian/entity/lockListInfo_entity.dart @@ -114,6 +114,7 @@ class LockListInfoItemEntity { int? keyRight; int? keyStatus; int? isLockOwner; + int? sendDate; Bluetooth? bluetooth; LockFeature? lockFeature; LockSetting? lockSetting; @@ -140,7 +141,8 @@ class LockListInfoItemEntity { this.isLockOwner, this.bluetooth, this.lockFeature, - this.lockSetting}); + this.lockSetting, + this.sendDate}); LockListInfoItemEntity.fromJson(Map json) { keyId = json['keyId']; @@ -162,6 +164,7 @@ class LockListInfoItemEntity { keyRight = json['keyRight']; keyStatus = json['keyStatus']; isLockOwner = json['isLockOwner']; + sendDate = json['sendDate']; bluetooth = json['bluetooth'] != null ? Bluetooth.fromJson(json['bluetooth']) : null; @@ -194,6 +197,7 @@ class LockListInfoItemEntity { data['keyRight'] = keyRight; data['keyStatus'] = keyStatus; data['isLockOwner'] = isLockOwner; + data['sendDate'] = sendDate; if (bluetooth != null) { data['bluetooth'] = bluetooth!.toJson(); } diff --git a/star_lock/lib/mine/mineSet/lockUserManage/lockUserManageList/keyListByUserEntity.dart b/star_lock/lib/mine/mineSet/lockUserManage/lockUserManageList/keyListByUserEntity.dart new file mode 100644 index 00000000..65449998 --- /dev/null +++ b/star_lock/lib/mine/mineSet/lockUserManage/lockUserManageList/keyListByUserEntity.dart @@ -0,0 +1,206 @@ +class KeyListByUserEntity { + int? errorCode; + String? description; + String? errorMsg; + KeyListByUserData? data; + + KeyListByUserEntity( + {this.errorCode, this.description, this.errorMsg, this.data}); + + KeyListByUserEntity.fromJson(Map json) { + errorCode = json['errorCode']; + description = json['description']; + errorMsg = json['errorMsg']; + data = + json['data'] != null ? KeyListByUserData.fromJson(json['data']) : null; + } + + Map toJson() { + final Map data = {}; + data['errorCode'] = errorCode; + data['description'] = description; + data['errorMsg'] = errorMsg; + if (this.data != null) { + data['data'] = this.data!.toJson(); + } + return data; + } +} + +class KeyListByUserData { + List? keyList; + int? pageNo; + int? pageSize; + int? pages; + int? total; + + KeyListByUserData( + {this.keyList, this.pageNo, this.pageSize, this.pages, this.total}); + + KeyListByUserData.fromJson(Map json) { + if (json['list'] != null) { + keyList = []; + json['list'].forEach((v) { + keyList!.add(KeyListItem.fromJson(v)); + }); + } + pageNo = json['pageNo']; + pageSize = json['pageSize']; + pages = json['pages']; + total = json['total']; + } + + Map toJson() { + final Map data = {}; + if (keyList != null) { + data['list'] = keyList!.map((v) => v.toJson()).toList(); + } + data['pageNo'] = pageNo; + data['pageSize'] = pageSize; + data['pages'] = pages; + data['total'] = total; + return data; + } +} + +class KeyListItem { + String? clientId; + int? lockOwnerId; + int? lockId; + int? senderUserId; + String? keyName; + int? keyType; + int? startDate; + int? endDate; + List? weekDays; + String? remarks; + int? remoteEnable; + int? isCameraEnable; + int? faceAuthentication; + int? keyRight; + int? userType; + int? keyStatus; + int? groupId; + int? lockUserNo; + int? date; + String? createdAt; + String? updatedAt; + UserInfo? userInfo; + int? keyId; + int? uid; + String? lockAlias; + + KeyListItem( + {this.clientId, + this.lockOwnerId, + this.lockId, + this.senderUserId, + this.keyName, + this.keyType, + this.startDate, + this.endDate, + this.weekDays, + this.remarks, + this.remoteEnable, + this.isCameraEnable, + this.faceAuthentication, + this.keyRight, + this.userType, + this.keyStatus, + this.groupId, + this.lockUserNo, + this.date, + this.createdAt, + this.updatedAt, + this.userInfo, + this.keyId, + this.uid, + this.lockAlias}); + + KeyListItem.fromJson(Map json) { + clientId = json['clientId']; + lockOwnerId = json['lockOwnerId']; + lockId = json['lockId']; + senderUserId = json['senderUserId']; + keyName = json['keyName']; + keyType = json['keyType']; + startDate = json['startDate']; + endDate = json['endDate']; + if (json['weekDays'] != null) { + weekDays = []; + json['weekDays'].forEach((v) { + weekDays!.add(v); + }); + } + remarks = json['remarks']; + remoteEnable = json['remoteEnable']; + isCameraEnable = json['isCameraEnable']; + faceAuthentication = json['faceAuthentication']; + keyRight = json['keyRight']; + userType = json['userType']; + keyStatus = json['keyStatus']; + groupId = json['groupId']; + lockUserNo = json['lockUserNo']; + date = json['date']; + createdAt = json['created_at']; + updatedAt = json['updated_at']; + userInfo = + json['user_info'] != null ? UserInfo.fromJson(json['user_info']) : null; + keyId = json['keyId']; + uid = json['uid']; + lockAlias = json['lockAlias']; + } + + Map toJson() { + final Map data = {}; + data['clientId'] = clientId; + data['lockOwnerId'] = lockOwnerId; + data['lockId'] = lockId; + data['senderUserId'] = senderUserId; + data['keyName'] = keyName; + data['keyType'] = keyType; + data['startDate'] = startDate; + data['endDate'] = endDate; + if (weekDays != null) { + data['weekDays'] = weekDays!.map((v) => v.toJson()).toList(); + } + data['remarks'] = remarks; + data['remoteEnable'] = remoteEnable; + data['isCameraEnable'] = isCameraEnable; + data['faceAuthentication'] = faceAuthentication; + data['keyRight'] = keyRight; + data['userType'] = userType; + data['keyStatus'] = keyStatus; + data['groupId'] = groupId; + data['lockUserNo'] = lockUserNo; + data['date'] = date; + data['created_at'] = createdAt; + data['updated_at'] = updatedAt; + if (userInfo != null) { + data['user_info'] = userInfo!.toJson(); + } + data['keyId'] = keyId; + data['uid'] = uid; + data['lockAlias'] = lockAlias; + return data; + } +} + +class UserInfo { + int? id; + String? accountName; + + UserInfo({this.id, this.accountName}); + + UserInfo.fromJson(Map json) { + id = json['id']; + accountName = json['account_name']; + } + + Map toJson() { + final Map data = {}; + data['id'] = id; + data['account_name'] = accountName; + return data; + } +} diff --git a/star_lock/lib/mine/mineSet/lockUserManage/lockUserManageList/lockUserManageList_logic.dart b/star_lock/lib/mine/mineSet/lockUserManage/lockUserManageList/lockUserManageList_logic.dart new file mode 100644 index 00000000..355fbade --- /dev/null +++ b/star_lock/lib/mine/mineSet/lockUserManage/lockUserManageList/lockUserManageList_logic.dart @@ -0,0 +1,48 @@ + + +import '../../../../main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserListEntity.dart'; +import '../../../../network/api_repository.dart'; +import '../../../../tools/baseGetXController.dart'; +import '../../../../tools/toast.dart'; +import 'lockUserManageList_state.dart'; + +class LockUserManageListLogic extends BaseGetXController { + final LockUserManageListState state = LockUserManageListState(); + + //请求锁用户列表 + void lockUserListRequest() async { + LockUserListEntity entity = + await ApiRepository.to.lockUserList('1', '20', state.searchController.text); + if (entity.errorCode!.codeIsSuccessful) { + state.dataList.value = entity.data!; + } + } + + //删除锁用户管理 + Future deletelockUserRequest(int uid) async { + var entity = await ApiRepository.to.deletLockUser(uid); + if (entity.errorCode!.codeIsSuccessful) { + Toast.show(msg: "删除成功"); + lockUserListRequest(); + } + } + + @override + void onReady() { + // TODO: implement onReady + super.onReady(); + + lockUserListRequest(); + } + + @override + void onInit() { + // TODO: implement onInit + super.onInit(); + } + + @override + void onClose() { + // TODO: implement onClose + } +} \ No newline at end of file diff --git a/star_lock/lib/mine/mineSet/lockUserManage/lockUserManageList/lockUserManageList_page.dart b/star_lock/lib/mine/mineSet/lockUserManage/lockUserManageList/lockUserManageList_page.dart new file mode 100644 index 00000000..680f972f --- /dev/null +++ b/star_lock/lib/mine/mineSet/lockUserManage/lockUserManageList/lockUserManageList_page.dart @@ -0,0 +1,262 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserListEntity.dart'; +import 'package:star_lock/tools/noData.dart'; + +import '../../../../../appRouters.dart'; +import '../../../../../app_settings/app_colors.dart'; +import '../../../../../tools/titleAppBar.dart'; +import '../../../../../translations/trans_lib.dart'; +import '../../../../tools/left_slide_actions.dart'; +import '../../../../tools/showIosTipView.dart'; +import 'lockUserManageList_logic.dart'; + +class LockUserManageListPage extends StatefulWidget { + const LockUserManageListPage({Key? key}) : super(key: key); + + @override + State createState() => _LockUserManageListPageState(); +} + +class _LockUserManageListPageState extends State { + final logic = Get.put(LockUserManageListLogic()); + final state = Get.find().state; + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: AppColors.mainBackgroundColor, + appBar: TitleAppBar( + barTitle: TranslationLoader.lanKeys!.lockUserManagement!.tr, + haveBack: true, + backgroundColor: AppColors.mainColor, + actionsList: [ + TextButton( + child: Text( + TranslationLoader.lanKeys!.aboutToExpire!.tr, + style: TextStyle(color: Colors.white, fontSize: 24.sp), + ), + onPressed: () { + Navigator.pushNamed(context, Routers.expireLockListPage); + }, + ), + ], + ), + body: Column( + children: [ + _searchWidget(), + SizedBox( + height: 20.h, + ), + Obx(() => Expanded(child: _buildMainUI())), + SizedBox( + width: ScreenUtil().screenWidth - 40.w, + height: 90.h, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + backgroundColor: Colors.white, + ), + onPressed: () { + Navigator.pushNamed( + context, Routers.massSendElectronicKeyManagePage) + .then((value) { + logic.lockUserListRequest(); + }); + }, + child: Text( + TranslationLoader.lanKeys!.sendGroupKey!.tr, + style: TextStyle( + color: AppColors.mainColor, + fontSize: 24.sp, + fontWeight: FontWeight.w600), + )), + ), + SizedBox( + height: 64.h, + ) + ], + ), + ); + } + + Widget _searchWidget() { + return Container( + height: 60.h, + margin: EdgeInsets.only(top: 20.w, left: 20.w, right: 20.w), + decoration: BoxDecoration( + color: Colors.white, borderRadius: BorderRadius.circular(5)), + child: TextField( + //输入框一行 + maxLines: 1, + controller: state.searchController, + autofocus: false, + onSubmitted: (value) { + logic.lockUserListRequest(); + }, + decoration: InputDecoration( + //输入里面输入文字内边距设置 + contentPadding: const EdgeInsets.only( + top: 12.0, left: -19.0, right: -15.0, bottom: 8.0), + hintText: TranslationLoader.lanKeys!.pleaseEnter!.tr, + hintStyle: TextStyle(fontSize: 22.sp, height: 3.0), + //不需要输入框下划线 + border: InputBorder.none, + //左边图标设置 + icon: Padding( + padding: EdgeInsets.only( + top: 20.h, bottom: 20.h, right: 20.w, left: 10.w), + child: Image.asset( + 'images/main/icon_main_search.png', + width: 40.w, + height: 40.w, + ), + ), + ), + ), + ); + } + + Widget _buildMainUI() { + return state.dataList.isEmpty + ? const NoData() + : ListView.separated( + itemCount: state.dataList.length, + itemBuilder: (c, index) { + LockUserData indexEntity = state.dataList[index]; + if (index < state.dataList.length) { + return LeftSlideActions( + key: Key(indexEntity.userid!), + actionsWidth: 60, + actions: [ + _buildDeleteBtn(indexEntity), + ], + decoration: const BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(1)), + ), + child: _electronicKeyItem(indexEntity), + ); + } + return const SizedBox.shrink(); + // return _electronicKeyItem(indexEntity); + }, + separatorBuilder: (BuildContext context, int index) { + return const Divider( + height: 1, + color: AppColors.greyLineColor, + ); + }, + ); + } + + Widget _electronicKeyItem(LockUserData itemData) { + return GestureDetector( + onTap: () { + Navigator.pushNamed(context, Routers.ownedKeyListPage, + arguments: {'uid': itemData.uid}); + }, + child: Container( + height: 90.h, + color: Colors.white, + // decoration: BoxDecoration( + // color: Colors.white, + // borderRadius: BorderRadius.circular(10.w), + // ), + child: Row( + children: [ + SizedBox( + width: 30.w, + ), + Image.asset( + 'images/controls_user.png', + width: 60.w, + height: 60.w, + ), + SizedBox( + width: 20.w, + ), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + itemData.nickname ?? '', + style: TextStyle( + fontSize: 24.sp, color: AppColors.blackColor), + ), + ], + ), + SizedBox(height: 5.h), + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + itemData.userid ?? '', + style: TextStyle( + fontSize: 18.sp, + color: AppColors.placeholderTextColor), + ), + ], + ), + SizedBox(width: 20.h), + ], + ), + ), + Image.asset( + 'images/icon_right_grey.png', + width: 12.w, + height: 21.w, + ), + SizedBox(width: 20.w), + ], + ), + ), + ); + } + + Widget _buildDeleteBtn(LockUserData passwordKeyListItem) { + return GestureDetector( + onTap: () { + // 省略: 弹出是否删除的确认对话框。 + showIosTipViewDialog(context, passwordKeyListItem); + }, + child: Container( + width: 60, + color: const Color(0xFFF20101), + alignment: Alignment.center, + child: const Text( + '删除', + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w500, + color: Colors.white, + height: 1, + ), + ), + ), + ); + } + + void showIosTipViewDialog(BuildContext context, LockUserData lockUserData) { + showDialog( + context: context, + builder: (BuildContext context) { + return ShowIosTipView( + title: "提示", + tipTitle: "确定要删除吗?", + sureClick: () { + Get.back(); + logic.deletelockUserRequest(lockUserData.uid!); + }, + cancelClick: () { + Get.back(); + }, + ); + } + ); + } + +} diff --git a/star_lock/lib/mine/mineSet/lockUserManage/lockUserManageList/lockUserManageList_state.dart b/star_lock/lib/mine/mineSet/lockUserManage/lockUserManageList/lockUserManageList_state.dart new file mode 100644 index 00000000..e3f06885 --- /dev/null +++ b/star_lock/lib/mine/mineSet/lockUserManage/lockUserManageList/lockUserManageList_state.dart @@ -0,0 +1,11 @@ + +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; + +import '../../../../main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserListEntity.dart'; + +class LockUserManageListState { + final dataList = [].obs; + final TextEditingController searchController = TextEditingController(); + +} \ No newline at end of file diff --git a/star_lock/lib/mine/mineSet/lockUserManage/ownedKeyList/ownedKeyList_page.dart b/star_lock/lib/mine/mineSet/lockUserManage/ownedKeyList/ownedKeyList_page.dart new file mode 100644 index 00000000..c359100c --- /dev/null +++ b/star_lock/lib/mine/mineSet/lockUserManage/ownedKeyList/ownedKeyList_page.dart @@ -0,0 +1,198 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get_utils/get_utils.dart'; +import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart'; +import 'package:star_lock/mine/mineSet/lockUserManage/lockUserManageList/keyListByUserEntity.dart'; +import 'package:star_lock/network/api_repository.dart'; +import 'package:star_lock/tools/baseGetXController.dart'; +import 'package:star_lock/translations/trans_lib.dart'; + +import '../../../../../app_settings/app_colors.dart'; +import '../../../../../tools/titleAppBar.dart'; + +class OwnedKeyListPage extends StatefulWidget { + const OwnedKeyListPage({Key? key}) : super(key: key); + + @override + State createState() => _OwnedKeyListPageState(); +} + +class _OwnedKeyListPageState extends State { + String getUidStr = ''; + List dataList = []; + + @override + void initState() { + super.initState(); + } + + @override + Widget build(BuildContext context) { + dynamic obj = ModalRoute.of(context)?.settings.arguments; + if (obj != null && (obj["uid"] != null)) { + getUidStr = obj["uid"].toString(); + } + + return Scaffold( + backgroundColor: AppColors.mainBackgroundColor, + appBar: TitleAppBar( + barTitle: TranslationLoader.lanKeys!.ownedKey!.tr, + haveBack: true, + backgroundColor: AppColors.mainColor, + ), + body: FutureBuilder>( + future: mockNetworkDataRequest(), + builder: (BuildContext context, + AsyncSnapshot> snapshot) { + //请求结束 + if (snapshot.connectionState == ConnectionState.done) { + if (snapshot.hasError) { + //请求失败 + return const Text('请求失败'); + } else { + //请求成功 + final List itemList = snapshot.data!; + + return Column( + children: [ + _topOwnedKeyText(), + Expanded(child: _buildMainUI(itemList)), + ], + ); + } + } else { + //请求未结束 显示loading + return Container(); + } + })); + } + + Widget _topOwnedKeyText() { + return Container( + color: Colors.white, + width: ScreenUtil().screenWidth, + // margin: EdgeInsets.only(left: 30.w, top: 30.w, right: 30.w, bottom: 30.w), + child: Padding( + padding: + EdgeInsets.only(left: 30.w, top: 20.w, right: 20.w, bottom: 10.w), + child: Text( + TranslationLoader.lanKeys!.ownedKey!.tr, + style: TextStyle(fontSize: 24.sp), + ), + ), + ); + } + + //请求用户拥有的锁 + Future> mockNetworkDataRequest() async { + KeyListByUserEntity entity = + await ApiRepository.to.keyListByUser('1', '20', getUidStr); + if (entity.errorCode!.codeIsSuccessful) { + print("请求用户拥有的锁:${entity.data!.keyList}"); + } + if (entity.data != null) { + return entity.data!.keyList!; + } else { + List dataList = []; + return dataList; + } + } + + //使用期限 + String getUseDateStr(KeyListItem indexEntity) { + String useDateStr = ''; + if (indexEntity.keyType == XSConstantMacro.keyTypeTime) { + //限期 + if (indexEntity.startDate != null && indexEntity.endDate != null) { + DateTime startDateStr = + DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!); + DateTime endDateStr = + DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!); + useDateStr = + '${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}'; + } else { + useDateStr = '限期'; + } + } else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) { + //永久 + useDateStr = '永久'; + } else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) { + //单次 + useDateStr = '单次'; + } else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) { + //循环 + useDateStr = '循环'; + } + + return useDateStr; + } + + Widget _buildMainUI(List itemList) { + return ListView.builder( + itemCount: itemList.length, + itemBuilder: (c, index) { + KeyListItem itemData = itemList[index]; + return _electronicKeyItem(itemData); + }); + } + + Widget _electronicKeyItem(KeyListItem itemData) { + return GestureDetector( + onTap: () {}, + child: Container( + height: 90.h, + margin: const EdgeInsets.only(top: 1), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(10.w), + ), + child: Row( + children: [ + SizedBox( + width: 30.w, + ), + Image.asset( + 'images/icon_lockGroup_item.png', + width: 60.w, + height: 60.w, + ), + SizedBox( + width: 20.w, + ), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + itemData.lockAlias ?? '', + style: TextStyle( + fontSize: 24.sp, color: AppColors.blackColor), + ), + ], + ), + SizedBox(height: 5.h), + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + getUseDateStr(itemData), + style: TextStyle( + fontSize: 18.sp, + color: AppColors.placeholderTextColor), + ), + ], + ), + SizedBox(width: 20.h), + ], + ), + ), + SizedBox(width: 20.h), + ], + ), + ), + ); + } +} diff --git a/star_lock/lib/mine/mineSet/mineSet/mineSet_logic.dart b/star_lock/lib/mine/mineSet/mineSet/mineSet_logic.dart index b881f792..a8831ed0 100644 --- a/star_lock/lib/mine/mineSet/mineSet/mineSet_logic.dart +++ b/star_lock/lib/mine/mineSet/mineSet/mineSet_logic.dart @@ -8,6 +8,7 @@ import 'package:star_lock/tools/storage.dart'; import '../../../../network/api_repository.dart'; import '../../../../tools/baseGetXController.dart'; import '../../../tools/eventBusEventManage.dart'; +import '../../../tools/toast.dart'; class MineSetLogic extends BaseGetXController { final MineSetState state = MineSetState(); @@ -41,6 +42,7 @@ class MineSetLogic extends BaseGetXController { ExpireLockListEntity entity = await ApiRepository.to .setAlertMode('1', state.isPrompTone.value == true ? '1' : '2'); if (entity.errorCode!.codeIsSuccessful) { + Toast.show(msg: "设置成功"); userSettingsInfoRequest(); } } @@ -64,6 +66,7 @@ class MineSetLogic extends BaseGetXController { ExpireLockListEntity entity = await ApiRepository.to .setTouchUnlockFlag(state.isTouchUnlock.value == true ? '1' : '2'); if (entity.errorCode!.codeIsSuccessful) { + Toast.show(msg: "设置成功"); userSettingsInfoRequest(); } } diff --git a/star_lock/lib/mine/mineSet/mineSet/mineSet_page.dart b/star_lock/lib/mine/mineSet/mineSet/mineSet_page.dart index a7d45a91..12a49b33 100644 --- a/star_lock/lib/mine/mineSet/mineSet/mineSet_page.dart +++ b/star_lock/lib/mine/mineSet/mineSet/mineSet_page.dart @@ -73,9 +73,7 @@ class _MineSetPageState extends State { width: 60.w, height: 50.h, child: Obx(() => _isPushNotificationSwitch()))), - SizedBox( - height: 10.h, - ), + SizedBox(height: 10.h), CommonItem( leftTitel: TranslationLoader.lanKeys!.lockUserManagement!.tr, rightTitle: "", diff --git a/star_lock/lib/network/api.dart b/star_lock/lib/network/api.dart index 66c20e94..14869ab0 100644 --- a/star_lock/lib/network/api.dart +++ b/star_lock/lib/network/api.dart @@ -49,18 +49,12 @@ abstract class Api { final String addlockGroupURL = '/keyGroup/add'; //创建锁分组 final String setlockGroupURL = '/keyGroup/setGroup'; //设置锁分组 final String lockGroupListURL = '/authorizedAdmin/listGroup'; //锁分组列表 - final String listLockByGroupURL = - '/authorizedAdmin/listLockByGroup'; //获取分组下的锁列表 - final String updateSettingURL = '/room/updateSetting'; //标记房态 + final String listLockByGroupURL = '/authorizedAdmin/listLockByGroup'; //获取分组下的锁列表 + final String setRoomStatusURL = '/lock/updateLockStatus'; //标记房态 final String keyGroupListURL = '/keyGroup/list'; //分组列表 final String lockListByGroupURL = '/room/listByGroup'; //分组下的锁 final String getWifiServiceIpURL = '/wifiLock/getWifiServiceIp'; // 获取Wifi锁服务器 - final String updateLockSettingUrl = '/lockSetting/updateLockSetting'; // 开启/关闭 远程开锁 - final String setAutoLockTimeUrl = '/room/setAutoLockTime'; // 自动闭锁 - - final String getPassageModeConfigUrl = '/room/getPassageModeConfig'; // 获取锁的常开模式设置 - final String configPassageModeUrl = '/room/configPassageMode'; // 配置锁的常开模式 - final String updateSettingUrl = '/room/updateSetting'; // 锁声音/防撬报警/重置键/考勤 + final String updateLockSettingUrl = '/lockSetting/updateLockSetting'; // 锁设置里面所有的设置 final String roomQueryDateUrl = '/room/queryDate'; // 获取网关时间 final String lockDiagnoseUrl = '/room/uploadLockInfo'; // 锁诊断 @@ -70,8 +64,6 @@ abstract class Api { '/attendanceCompany/isExistenceCompany'; // 开启考勤获取是否有公司 final String setCheckInCreateCompanyURL = '/attendanceCompany/add'; // 设置考勤时创建公司 - final String setLockPickingReminderDataURL = - '/key/updateMonitorFlag'; // 设置开锁提醒 final String getAttendanceRecordListByDateURL = '/attendanceRecord/listByDate'; // 获取考勤列表-早到榜日榜 final String getAttendanceRecordListByMonthURL = '/attendanceRecord/earlyListByMonth'; // 获取考勤列表-早到榜月榜 @@ -111,6 +103,7 @@ abstract class Api { final String getKeyDetailURL = '/key/get'; //获取单把钥匙详情信息 final String lockUserListURL = '/keyUser/listKeyUser'; //锁用户列表 + final String deletLockUserURL = '/keyUser/deleteKeyUser'; //删除锁用户 final String canSendKeyURL = '/keyUser/canSendKey'; //群发钥匙检查 final String batchSendKeyURL = '/key/batchSend'; //批处理群发钥匙 final String addAuthorizedAdminURL = '/authorizedAdmin/add'; //增加授权管理员 diff --git a/star_lock/lib/network/api_provider.dart b/star_lock/lib/network/api_provider.dart index 99f3c2ee..12f446f2 100644 --- a/star_lock/lib/network/api_provider.dart +++ b/star_lock/lib/network/api_provider.dart @@ -376,7 +376,8 @@ class ApiProvider extends BaseProvider { String startDate, String timezoneRawOffSet, int startHours, - int endHours) => + int endHours, + int isCoerced) => post( passwordKeyGetURL.toUrl, jsonEncode({ @@ -390,7 +391,8 @@ class ApiProvider extends BaseProvider { 'startDate': startDate, 'timezoneRawOffSet': timezoneRawOffSet, 'hoursStart': startHours, - 'hoursEnd': endHours + 'hoursEnd': endHours, + 'isCoerced': isCoerced, })); Future addKeyboardPwd( @@ -495,9 +497,9 @@ class ApiProvider extends BaseProvider { 'deleteType': deleteType })); - Future updateSetting(String lockId, String isOn, String type) => - post(updateSettingURL.toUrl, - jsonEncode({'lockId': lockId, 'isOn': isOn, 'type': type})); + // Future updateSetting(String lockId, String isOn, String type) => + // post(updateSettingURL.toUrl, + // jsonEncode({'lockId': lockId, 'isOn': isOn, 'type': type})); Future keyGroupList(String type) => post(keyGroupListURL.toUrl, jsonEncode({'type': type})); @@ -508,13 +510,13 @@ class ApiProvider extends BaseProvider { /// 锁设置模块 // 自动闭锁 - Future setAutoUnlockLoadData(int lockId, int autoLockTime, int type) => + Future setAutoUnlockLoadData(int lockId, int autoLock, int autoLockSecond) => post( - setAutoLockTimeUrl.toUrl, + updateLockSettingUrl.toUrl, jsonEncode({ 'lockId': lockId, - 'autoLockTime': autoLockTime, - 'type': type, + 'autoLock': autoLock, + 'autoLockSecond': autoLockSecond, })); // 锁声音 @@ -555,46 +557,32 @@ class ApiProvider extends BaseProvider { 'resetSwitch': resetSwitch, })); - // 获取锁的常开模式设置 - Future getPassageModeConfigLoadData(String lockId) => post( - getPassageModeConfigUrl.toUrl, - jsonEncode({ - 'lockId': lockId, - })); - - // 获取锁的常开模式设置 - Future configPassageMode( - String lockId, - String passageMode, - String autoUnlock, - String type, - String startDate, - String endDate, - String isAllDay, - List weekDays) => + // 设置考勤 + Future setCheckInData(int lockId, int resetSwitch) => post( - configPassageModeUrl.toUrl, + updateLockSettingUrl.toUrl, + jsonEncode({ + 'lockId': lockId, + 'attendance': resetSwitch, + })); + + // 设置标记房态 + Future setRoomStatusData(int lockId, int roomStatus) => + post( + setRoomStatusURL.toUrl, + jsonEncode({ + 'lockId': lockId, + 'roomStatus': roomStatus, + })); + + // 设置常开模式 + Future setNormallyModeData(int lockId, int passageMode, Map passageModeConfig) => + post( + updateLockSettingUrl.toUrl, jsonEncode({ 'lockId': lockId, 'passageMode': passageMode, - 'autoUnlock': autoUnlock, - 'type': type, - 'startDate': startDate, - 'endDate': endDate, - 'isAllDay': isAllDay, - 'weekDays': weekDays, - })); - - // 获取锁的常开模式设置 - Future setLockSetGeneralSetting( - String lockId, String changeType, String isOn, String type) => - post( - updateSettingUrl.toUrl, - jsonEncode({ - 'lockId': lockId, - 'changeType': changeType, - 'isOn': isOn, - 'type': type, + 'passageModeConfig': passageModeConfig, })); // 通过网关获取锁的时间 @@ -680,14 +668,11 @@ class ApiProvider extends BaseProvider { })); // 获取开锁提醒 - Future setLockPickingReminderData( - String lockId, String keyId, String monitorFlag) => - post( - setLockPickingReminderDataURL.toUrl, + Future setLockPickingReminderData(int lockId, int unlockReminderPush) => + post(updateLockSettingUrl.toUrl, jsonEncode({ 'lockId': lockId, - 'keyId': keyId, - 'monitorFlag': monitorFlag, + 'unlockReminderPush': unlockReminderPush, })); // 获取员工列表 @@ -1096,6 +1081,13 @@ class ApiProvider extends BaseProvider { 'searchStr': searchStr })); + Future deletLockUser(int uid) => + post( + deletLockUserURL.toUrl, + jsonEncode({ + 'uid': uid, + })); + Future keyListByUser(String pageNo, String pageSize, String uid) => post(keyListByUserURL.toUrl, jsonEncode({'pageNo': pageNo, 'pageSize': pageSize, 'uid': uid})); diff --git a/star_lock/lib/network/api_repository.dart b/star_lock/lib/network/api_repository.dart index ec798b58..891cf2df 100644 --- a/star_lock/lib/network/api_repository.dart +++ b/star_lock/lib/network/api_repository.dart @@ -15,7 +15,7 @@ import 'package:star_lock/mine/mineSet/appUnlockNeedMobileNetworkingLock/selectL import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorDetails/administratorDetailEntity.dart'; import 'package:star_lock/mine/mineSet/authorizedAdministrator/authorizedAdminListEntity.dart'; import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockListEntity.dart'; -import 'package:star_lock/mine/mineSet/lockUserManage/keyListByUserEntity.dart'; +import 'package:star_lock/mine/mineSet/lockUserManage/lockUserManageList/keyListByUserEntity.dart'; import 'package:star_lock/mine/mineSet/mineSet/userSettingInfoEntity.dart'; import '../common/safetyVerification/entity/CheckSafetyVerificationEntity.dart'; import '../common/safetyVerification/entity/SafetyVerificationEntity.dart'; @@ -33,7 +33,6 @@ import '../main/lockDetail/lcokSet/configuringWifi/configuringWifiEntity.dart'; import '../main/lockDetail/lcokSet/lockSet/checkingInInfoData_entity.dart'; import '../main/lockDetail/lcokSet/lockSet/lockSetInfo_entity.dart'; import '../main/lockDetail/lcokSet/lockTime/getServerDatetime_entity.dart'; -import '../main/lockDetail/lcokSet/normallyOpenMode/getPassageModeConfig_entity.dart'; import '../main/lockDetail/lockOperatingRecord/lockOperatingRecordGetLastRecordTime_entity.dart'; import '../main/lockDetail/otherTypeKey/addFingerprint/addFingerprint/addFingerprint_entity.dart'; import '../main/lockDetail/otherTypeKey/addICCard/addICCard_entity.dart'; @@ -380,7 +379,8 @@ class ApiRepository { String startDate, String timezoneRawOffSet, int startHours, - int endHours) async { + int endHours, + int isCoerced) async { final res = await apiProvider.getKeyboardPwd( endDate, isExclusive, @@ -392,7 +392,8 @@ class ApiRepository { startDate, timezoneRawOffSet, startHours, - endHours); + endHours, + isCoerced); return PasswordKeyEntity.fromJson(res.body); } @@ -504,13 +505,6 @@ class ApiRepository { return PasswordKeyEntity.fromJson(res.body); } - //标记房态 - Future updateSetting( - String lockId, String isOn, String type) async { - final res = await apiProvider.updateSetting(lockId, isOn, type); - return PasswordKeyEntity.fromJson(res.body); - } - //分组列表 Future keyGroupList(String type) async { final res = await apiProvider.keyGroupList(type); @@ -534,11 +528,11 @@ class ApiRepository { // 自动闭锁 Future setAutoUnlock({ required int lockId, - required int autoLockTime, - required int type, + required int autoLock, + required int autoLockSecond, }) async { final res = - await apiProvider.setAutoUnlockLoadData(lockId, autoLockTime, type); + await apiProvider.setAutoUnlockLoadData(lockId, autoLock, autoLockSecond); return LoginEntity.fromJson(res.body); } @@ -582,48 +576,53 @@ class ApiRepository { return LoginEntity.fromJson(res.body); } - // 获取锁的常开模式设置 configPassageMode - Future getPassageModeConfig({ - required String lockId, + // 设置考勤 + Future setCheckInData({ + required int lockId, + required int attendance, }) async { - final res = await apiProvider.getPassageModeConfigLoadData(lockId); - return GetPassageModeConfigEntity.fromJson(res.body); - } - - // 配置锁的常开模式 - Future configPassageModeLoadData({ - required String lockId, - required String passageMode, - required String autoUnlock, - required String type, - required String startDate, - required String endDate, - required String isAllDay, - required List weekDays, - }) async { - final res = await apiProvider.configPassageMode(lockId, passageMode, - autoUnlock, type, startDate, endDate, isAllDay, weekDays); - return GetPassageModeConfigEntity.fromJson(res.body); - } - - // 配置锁的常规设置 - Future setLockSetGeneralSettingData({ - required String lockId, - required String changeType, - required String isOn, - required String type, - }) async { - final res = await apiProvider.setLockSetGeneralSetting( - lockId, changeType, isOn, type); + final res = await apiProvider.setCheckInData(lockId, attendance); return LoginEntity.fromJson(res.body); } + // 设置房态 + Future setRoomStatusData({ + required int lockId, + required int roomStatus, + }) async { + final res = await apiProvider.setRoomStatusData(lockId, roomStatus); + return LoginEntity.fromJson(res.body); + } + + // 配置锁的常开模式 + Future setNormallyModeData({ + required int lockId, + required int passageMode, + required Map passageModeConfig, + }) async { + final res = + await apiProvider.setNormallyModeData(lockId, passageMode, passageModeConfig); + return LoginEntity.fromJson(res.body); + } + + // 配置锁的常规设置 + // Future setLockSetGeneralSettingData({ + // required String lockId, + // required String changeType, + // required String isOn, + // required String type, + // }) async { + // final res = await apiProvider.setLockSetGeneralSetting( + // lockId, changeType, isOn, type); + // return LoginEntity.fromJson(res.body); + // } + // 获取锁时间 通过网关 - Future getLockTimeFromGateway({ + Future getLockTimeFromGateway({ required String lockId, }) async { final res = await apiProvider.getLockTimeFromGatewayLoadData(lockId); - return GetPassageModeConfigEntity.fromJson(res.body); + return GetServerDatetimeEntity.fromJson(res.body); } // 获取服务器当前时间 @@ -685,6 +684,12 @@ class ApiRepository { return LockUserListEntity.fromJson(res.body); } + //锁用户列表 + Future deletLockUser(int uid) async { + final res = await apiProvider.deletLockUser(uid); + return LockUserListEntity.fromJson(res.body); + } + //用户拥有的钥匙 Future keyListByUser( String pageNo, String pageSize, String uid) async { @@ -833,12 +838,10 @@ class ApiRepository { // 设置锁开锁提醒 Future setLockPickingReminderData({ - required String lockId, - required String keyId, - required String monitorFlag, + required int lockId, + required int unlockReminderPush, }) async { - final res = await apiProvider.setLockPickingReminderData( - lockId, keyId, monitorFlag); + final res = await apiProvider.setLockPickingReminderData(lockId, unlockReminderPush); return LoginEntity.fromJson(res.body); } diff --git a/star_lock/lib/tools/commonItem.dart b/star_lock/lib/tools/commonItem.dart index ad1ce621..78f6cc18 100644 --- a/star_lock/lib/tools/commonItem.dart +++ b/star_lock/lib/tools/commonItem.dart @@ -41,7 +41,7 @@ class CommonItem extends StatelessWidget { children: [ SizedBox(width: 20.w), SizedBox( - width: isHaveRightWidget! ? 100.w : 300.w, + // width: isHaveRightWidget! ? 100.w : 300.w, child: Text(leftTitel!, style: TextStyle(fontSize: 22.sp)) ), SizedBox(width: 6.w),