From 496145a6b343c513dd5a62490af585db2730f0b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AD=8F=E5=B0=91=E9=98=B3?= <786612630@qq.com> Date: Mon, 1 Apr 2024 16:21:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9TAPD=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/starLock.iml | 84 +++++++++++++++++++ star_lock/lib/blue/blue_manage.dart | 8 +- .../starLock_forgetPassword_page.dart | 2 +- .../card/cardDetail/cardDetail_logic.dart | 6 +- .../card/cardList/cardList_logic.dart | 2 +- .../otherTypeKeyChangeDate_logic.dart | 12 +-- .../fingerprintList_logic.dart | 2 +- .../lockDetail/lockDetail_logic.dart | 34 ++++---- .../lockDetail/lockDetail_page.dart | 32 +++---- .../lockDetail/lockDetail_state.dart | 4 +- .../basicInformation_page.dart | 19 ++++- .../lockSet/lockSet/lockSetInfo_entity.dart | 6 +- .../passwordKey_perpetual_page.dart | 5 ++ .../main/lockMian/lockList/lockList_page.dart | 35 ++++++-- .../main/lockMian/lockMain/lockMain_page.dart | 3 + star_lock/lib/tools/baseGetXController.dart | 5 +- 16 files changed, 197 insertions(+), 62 deletions(-) diff --git a/.idea/starLock.iml b/.idea/starLock.iml index 5164eec4..43102452 100644 --- a/.idea/starLock.iml +++ b/.idea/starLock.iml @@ -252,6 +252,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/star_lock/lib/blue/blue_manage.dart b/star_lock/lib/blue/blue_manage.dart index 995e847a..4eda5f68 100644 --- a/star_lock/lib/blue/blue_manage.dart +++ b/star_lock/lib/blue/blue_manage.dart @@ -559,9 +559,11 @@ class BlueManage { // 断开连接 Future disconnect() async { try { - connectDeviceMacAddress = ""; - await bluetoothConnectDevice!.disconnect(); - Get.log("断开连接成功"); + // if(bluetoothConnectDevice != null && bluetoothConnectDevice!.connectionState == BluetoothConnectionState.connected){ + connectDeviceMacAddress = ""; + await bluetoothConnectDevice!.disconnect(); + Get.log("断开连接成功"); + // } } on Exception catch (e, _) { Get.log("Error disconnecting from a device: $e"); } finally { diff --git a/star_lock/lib/login/forgetPassword/starLock_forgetPassword_page.dart b/star_lock/lib/login/forgetPassword/starLock_forgetPassword_page.dart index 0cc93a53..cf80fdd2 100644 --- a/star_lock/lib/login/forgetPassword/starLock_forgetPassword_page.dart +++ b/star_lock/lib/login/forgetPassword/starLock_forgetPassword_page.dart @@ -186,7 +186,7 @@ class _StarLockForgetPasswordPageState var result = await Navigator.pushNamed( context, Routers.safetyVerificationPage, arguments: { - "countryCode": "+86", + "countryCode": "86", "account": state.phoneStr.value }); logic.state.xWidth.value = diff --git a/star_lock/lib/main/lockDetail/card/cardDetail/cardDetail_logic.dart b/star_lock/lib/main/lockDetail/card/cardDetail/cardDetail_logic.dart index f40f54cd..9b188733 100644 --- a/star_lock/lib/main/lockDetail/card/cardDetail/cardDetail_logic.dart +++ b/star_lock/lib/main/lockDetail/card/cardDetail/cardDetail_logic.dart @@ -144,8 +144,8 @@ class CardDetailLogic extends BaseGetXController{ cardId: state.keyId.value.toString(), lockId: state.fingerprintItemData.value.lockId.toString(), weekDay: state.weekDay.value, - startDate: state.starDate.value, - endDate: state.endDate.value, + startDate: state.starDate.value*1000, + endDate: state.endDate.value*1000, isCoerced: state.isStressFingerprint.value ? "2" : "1", cardName: state.changeNameController.text, changeType: "1", @@ -182,7 +182,7 @@ class CardDetailLogic extends BaseGetXController{ }else if(state.keyType.value == 2){ useDateStr = "${DateTool().dateToYMDHNString(state.starDate.value)}\n${DateTool().dateToYMDHNString(state.endDate.value)}"; } else if(state.keyType.value == 4){ - useDateStr = "${DateTool().dateToYMDString(state.starDate.value)}-${DateTool().dateToYMDString(state.endDate.value)}"; + useDateStr = "${DateTool().dateToYMDString(state.starDate.value)}\n${DateTool().dateToYMDString(state.endDate.value)}"; } return useDateStr; } diff --git a/star_lock/lib/main/lockDetail/card/cardList/cardList_logic.dart b/star_lock/lib/main/lockDetail/card/cardList/cardList_logic.dart index 24f85514..7b6525e8 100644 --- a/star_lock/lib/main/lockDetail/card/cardList/cardList_logic.dart +++ b/star_lock/lib/main/lockDetail/card/cardList/cardList_logic.dart @@ -372,7 +372,7 @@ class CardListLogic extends BaseGetXController { }else if(fingerprintItemData.cardType! == 2){ keyDateTypeStr = "${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())} 限时"; }else if(fingerprintItemData.cardType! == 4){ - keyDateTypeStr = "循环"; + keyDateTypeStr = "${DateTool().dateToYMDString(fingerprintItemData.startDate.toString())}-${DateTool().dateToYMDString(fingerprintItemData.endDate.toString())} 循环"; } return keyDateTypeStr; } diff --git a/star_lock/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_logic.dart b/star_lock/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_logic.dart index 6cb48f87..183bac90 100644 --- a/star_lock/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_logic.dart +++ b/star_lock/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_logic.dart @@ -11,14 +11,14 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{ // 修改指纹信息 void editFingerprintsData() async{ - var beginTimeTimestamp = DateTool().dateToTimestamp(state.beginTime.value, 1) ~/ 1000; - var endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 1) ~/ 1000; + var beginTimeTimestamp = DateTool().dateToTimestamp(state.beginTime.value, 1); + var endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 1); if (beginTimeTimestamp > endTimeTimestamp || beginTimeTimestamp == endTimeTimestamp) { showToast("失效时间需大于生效时间"); return; } - if (endTimeTimestamp < DateTime.now().millisecondsSinceEpoch ~/ 1000) { + if (endTimeTimestamp < DateTime.now().millisecondsSinceEpoch) { showToast("生效时间需大于当前时间"); return; } @@ -48,14 +48,14 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{ // 编辑iC卡 void editICCardData() async{ - var beginTimeTimestamp = DateTool().dateToTimestamp(state.beginTime.value, 1) ~/ 1000; - var endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 1) ~/ 1000; + var beginTimeTimestamp = DateTool().dateToTimestamp(state.beginTime.value, 1); + var endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 1); if (beginTimeTimestamp > endTimeTimestamp || beginTimeTimestamp == endTimeTimestamp) { showToast("失效时间需大于生效时间"); return; } - if (endTimeTimestamp < DateTime.now().millisecondsSinceEpoch ~/ 1000) { + if (endTimeTimestamp < DateTime.now().millisecondsSinceEpoch) { showToast("生效时间需大于当前时间"); return; } diff --git a/star_lock/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_logic.dart b/star_lock/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_logic.dart index d5f67f08..cdcc484f 100644 --- a/star_lock/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_logic.dart +++ b/star_lock/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_logic.dart @@ -405,7 +405,7 @@ class FingerprintListLogic extends BaseGetXController{ }else if(fingerprintItemData.fingerprintType! == 2){ keyDateTypeStr = "${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())} 限时"; }else if(fingerprintItemData.fingerprintType! == 4){ - keyDateTypeStr = "循环"; + keyDateTypeStr = "${DateTool().dateToYMDString(fingerprintItemData.startDate.toString())}-${DateTool().dateToYMDString(fingerprintItemData.endDate.toString())} 循环"; } return keyDateTypeStr; } diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart index cbd7a8e6..b6e3d0ee 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart @@ -117,7 +117,7 @@ class LockDetailLogic extends BaseGetXController { IoSenderManage.senderOpenLock( keyID: BlueManage().connectDeviceName, userID: await Storage.getUid(), - openMode: 1, + openMode: state.openDoorModel, openTime: DateTime.now().millisecondsSinceEpoch ~/ 1000, onlineToken: state.lockNetToken, token: tokenData, @@ -323,12 +323,12 @@ class LockDetailLogic extends BaseGetXController { state.lockUserNo = reply.data[47]; _updateLockUserNo(); - if (state.isOpenLockNeedOnline.value == 0) { - openDoorAction(1); - } else { - getLockNetToken(); - } - eventBus.fire(RefreshLockDetailInfoDataEvent()); + // if (state.isOpenLockNeedOnline.value == 0) { + // openDoorAction(1); + // } else { + // getLockNetToken(); + // } + // eventBus.fire(RefreshLockDetailInfoDataEvent()); // clickPushBtnAction(); break; case 0x06: @@ -428,7 +428,7 @@ class LockDetailLogic extends BaseGetXController { } // 点击开门事件 - Future openDoorAction(int openMode) async { + Future openDoorAction() async { showBlueConnetctToastTimer(action: () { state.openLockBtnState.value = 0; BlueManage().stopScan(); @@ -456,7 +456,7 @@ class LockDetailLogic extends BaseGetXController { // privateKey: getPrivateKeyList, // ); - Get.log("openMode:$openMode"); + Get.log("openMode:${state.openDoorModel}"); BlueManage() .bludSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!, (BluetoothConnectionState deviceConnectionState) async { @@ -464,7 +464,7 @@ class LockDetailLogic extends BaseGetXController { IoSenderManage.senderOpenLock( keyID: BlueManage().connectDeviceName, userID: await Storage.getUid(), - openMode: openMode, + openMode: state.openDoorModel, openTime: DateTime.now().millisecondsSinceEpoch ~/ 1000, onlineToken: state.lockNetToken, token: getTokenList, @@ -647,7 +647,7 @@ class LockDetailLogic extends BaseGetXController { if (entity.errorCode!.codeIsSuccessful) { state.lockNetToken = entity.data!.token!; Get.log("state.lockNetToken:${state.lockNetToken}"); - openDoorAction(1); + openDoorAction(); } } @@ -657,11 +657,15 @@ class LockDetailLogic extends BaseGetXController { keyId: state.keyInfos.value.keyId.toString(), lockUserNo: state.lockUserNo.toString()); if (entity.errorCode!.codeIsSuccessful) { - if (state.isOpenLockNeedOnline.value == 0) { - state.bottomBtnisEable.value = true; - eventBus.fire(RefreshLockDetailInfoDataEvent()); + // state.keyInfos.value.lockUserNo = state.lockUserNo; + // state.bottomBtnisEable.value = true; + // print("state.bottomBtnisEable.value:${state.bottomBtnisEable.value} state.keyInfos.value.lockUserNo:${state.keyInfos.value.lockUserNo}"); + eventBus.fire(RefreshLockDetailInfoDataEvent()); + SchedulerBinding.instance.addPostFrameCallback((_) { eventBus.fire(RefreshLockListInfoDataEvent()); - openDoorAction(1); + }); + if (state.isOpenLockNeedOnline.value == 0) { + openDoorAction(); } else { getLockNetToken(); } diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart index 9cee013e..c6988dd0 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart @@ -71,16 +71,12 @@ class _LockDetailPageState extends State StreamSubscription? _lockRefreshLockDetailInfoDataEvent; void _initRefreshLockDetailInfoDataEventAction() { // 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus - _lockRefreshLockDetailInfoDataEvent = - eventBus.on().listen((event) { + _lockRefreshLockDetailInfoDataEvent = eventBus.on().listen((event) { setState(() {}); }); } void loadData() { - // print("widget.lockListInfoItemEntity.lockUserNo:${widget.lockListInfoItemEntity.lockUserNo}"); - // print("state.lockUserNo:${state.lockUserNo}"); - state.keyInfos.value = widget.lockListInfoItemEntity; state.lockUserNo = state.keyInfos.value.lockUserNo!; if (state.lockUserNo == 0) { @@ -146,10 +142,7 @@ class _LockDetailPageState extends State visible: ((state.keyInfos.value.keyType == XSConstantMacro.keyTypeTime || state.keyInfos.value.keyType == XSConstantMacro.keyTypeLoop) && // 限时、循环 (DateTool().compareTimeGetDaysFromNow(state.keyInfos.value.endDate!) <= 15 && DateTool().compareTimeGetDaysFromNow(state.keyInfos.value.endDate!) >= 0) && // 0到30天 - (state.keyInfos.value.keyStatus == - XSConstantMacro.keyStatusNormalUse || - state.keyInfos.value.keyStatus == - XSConstantMacro.keyStatusWaitReceive) // 正常使用、待接收 + (state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusNormalUse || state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusWaitReceive) // 正常使用、待接收 ) ? true : false, @@ -188,7 +181,7 @@ class _LockDetailPageState extends State controller: state.pageController, // child: Row( children: [ - bottomWidget(), + Obx(() => bottomWidget()), attachmentWidget(), ], // ), @@ -272,16 +265,11 @@ class _LockDetailPageState extends State Row( mainAxisAlignment: MainAxisAlignment.end, children: [ - Image.asset(showElectricIcon(state.electricQuantity.value), - width: 30.w, height: 24.w), + Image.asset(showElectricIcon(state.electricQuantity.value), width: 30.w, height: 24.w), SizedBox(width: 2.w), - Text("--%", - style: TextStyle( - fontSize: 18.sp, - color: AppColors.darkGrayTextColor)), + Text("--%", style: TextStyle(fontSize: 18.sp, color: AppColors.darkGrayTextColor)), SizedBox(width: 2.w), - Icon( - Icons.info, // 使用内置的 warning 图标,它是一个叹号 + Icon(Icons.info, // 使用内置的 warning 图标,它是一个叹号 color: AppColors.mainColor, // 设置图标颜色为红色 size: 25.w, // 设置图标大小为 30 ), @@ -949,7 +937,9 @@ class _LockDetailPageState extends State // print("state.isOpenLockNeedOnline.value:${state.isOpenLockNeedOnline.value}"); if (state.isOpenLockNeedOnline.value == 0) { // 不需要联网 - logic.openDoorAction(1); + print("开锁开锁开锁开锁开锁开锁开锁开锁"); + state.openDoorModel = 1; + logic.openDoorAction(); } else { // 需要联网 logic.getLockNetToken(); @@ -971,7 +961,9 @@ class _LockDetailPageState extends State // 电子钥匙lockUserNo为0 要先添加用户 logic.addUserConnectBlue(); } else { - logic.openDoorAction(32); + print("闭锁闭锁闭锁闭锁闭锁闭锁闭锁闭锁"); + state.openDoorModel = 32; + logic.openDoorAction(); } } diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_state.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_state.dart index bb13da46..4ccd21c1 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_state.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_state.dart @@ -22,7 +22,7 @@ class LockDetailState { StreamSubscription? lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent; String lockNetToken = ""; - var lockUserNo = 0; + int lockUserNo = 0; var senderUserId = 0; var isOnlyOneData = false; @@ -42,6 +42,8 @@ class LockDetailState { var bottomBtnisEable = true.obs; // 是否不可用 用于限制底部按钮是否可用 var openDoorBtnisUneable = true.obs; // 当钥匙状态不能使用的情况下开锁按钮禁止使用,默认可用 + var openDoorModel = 0; + //过渡动画控制器 AnimationController? animationController; // var lockState = 0.obs;// 0未连接普通状态 1连接开锁中(展示动画) 2已连接开锁成功 3检测可用性 4连接失败 5连接失败重连中 diff --git a/star_lock/lib/main/lockDetail/lockSet/basicInformation/basicInformation/basicInformation_page.dart b/star_lock/lib/main/lockDetail/lockSet/basicInformation/basicInformation/basicInformation_page.dart index 901440e1..f236ea0b 100644 --- a/star_lock/lib/main/lockDetail/lockSet/basicInformation/basicInformation/basicInformation_page.dart +++ b/star_lock/lib/main/lockDetail/lockSet/basicInformation/basicInformation/basicInformation_page.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import 'package:star_lock/tools/dateTool.dart'; import '../../../../../appRouters.dart'; import '../../../../../app_settings/app_colors.dart'; @@ -71,7 +72,23 @@ class _BasicInformationPageState extends State { state.lockBasicInfo.value.endDate, state.lockBasicInfo.value.keyType), allHeight: 70.h, - isHaveLine: false)), + isHaveLine: true)), + Obx(() => Visibility( + visible: state.lockBasicInfo.value.keyType == 4 ? true : false, + child: CommonItem( + leftTitel: "有效日".tr, + rightTitle: state.lockBasicInfo.value!.weekDays!.join(",").toString(), + allHeight: 70.h, + isHaveLine: true), + )), + Obx(() => Visibility( + visible: state.lockBasicInfo.value.keyType == 4 ? true : false, + child: CommonItem( + leftTitel: "有效时间", + rightTitle: "${DateTool().dateToHNString(state.lockBasicInfo.value.startDate.toString())}-${DateTool().dateToHNString(state.lockBasicInfo.value.endDate.toString())}", + allHeight: 70.h, + isHaveLine: true), + )), SizedBox(height: 10.h), Obx(() => Visibility( visible: (state.lockBasicInfo.value.isLockOwner == 1 || diff --git a/star_lock/lib/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart b/star_lock/lib/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart index a341a000..f0bb3197 100644 --- a/star_lock/lib/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart +++ b/star_lock/lib/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart @@ -334,6 +334,7 @@ class LockBasicInfo { int? keyRight; int? senderUserId; int? lockUserNo; + List? weekDays; LockBasicInfo( {this.lockId, @@ -355,7 +356,8 @@ class LockBasicInfo { this.mac, this.keyRight, this.senderUserId, - this.lockUserNo}); + this.lockUserNo, + this.weekDays}); LockBasicInfo.fromJson(Map json) { lockId = json['lockId']; @@ -383,6 +385,7 @@ class LockBasicInfo { keyRight = json['keyRight']; senderUserId = json['senderUserId']; lockUserNo = json['lockUserNo']; + weekDays = json['weekDays']; } Map toJson() { @@ -409,6 +412,7 @@ class LockBasicInfo { data['keyRight'] = keyRight; data['senderUserId'] = senderUserId; data['lockUserNo'] = lockUserNo; + data['weekDays'] = weekDays; return data; } } 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 b13aa194..aef2a045 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 @@ -448,6 +448,11 @@ class _PasswordKeyPerpetualPageState extends State wit } } + if (state.pwdController.text.length < 6 || state.pwdController.text.length > 9) { + logic.showToast("请输入6-9位数字密码"); + return; + } + logic.senderCustomPasswords(); } else { if (state.nameController.text.isEmpty) { diff --git a/star_lock/lib/main/lockMian/lockList/lockList_page.dart b/star_lock/lib/main/lockMian/lockList/lockList_page.dart index 7aacf070..9e0ef8f2 100644 --- a/star_lock/lib/main/lockMian/lockList/lockList_page.dart +++ b/star_lock/lib/main/lockMian/lockList/lockList_page.dart @@ -99,14 +99,29 @@ class _LockListPageState extends State { } // print("lockItemList.length:${lockItemList.length} == ${index+1} $isLast"); return lockInfoListItem(keyInfo, isLast, () { - if(DateTool().compareTimeIsOvertime(keyInfo.endDate!) && keyInfo.keyType == XSConstantMacro.keyTypeTime){ - logic.showToast("钥匙已过期"); - return; - } + // if(DateTool().compareTimeIsOvertime(keyInfo.endDate!) && keyInfo.keyType == XSConstantMacro.keyTypeTime){ + // logic.showToast("钥匙已过期"); + // return; + // } + // var lockCount = 0; // for(GroupList itemData in groupDataList){ // lockCount+=itemData.lockList!.length; // } + + // || keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen || keyInfo.keyStatus == XSConstantMacro.keyStatusExpired + if((keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) && (keyInfo.keyStatus == XSConstantMacro.keyStatusWaitIneffective)){ + logic.showToast("您的钥匙未生效"); + return; + } + if((keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) && (keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen)){ + logic.showToast("您的钥匙已冻结"); + return; + } + if((keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) && (keyInfo.keyStatus == XSConstantMacro.keyStatusExpired)){ + logic.showToast("您的钥匙已过期"); + return; + } Get.toNamed(Routers.lockDetailMainPage, arguments: { // "lockMainEntity": widget.lockMainEntity, "keyInfo": keyInfo, @@ -124,7 +139,9 @@ class _LockListPageState extends State { // height: 122.h, margin: isLast ? EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w, bottom: 20.w) : EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w), decoration: BoxDecoration( - color: (DateTool().compareTimeIsOvertime(keyInfo.endDate!) && keyInfo.keyType == XSConstantMacro.keyTypeTime) ? AppColors.greyBackgroundColor : Colors.white, + color: ((keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) && + (keyInfo.keyStatus == XSConstantMacro.keyStatusWaitIneffective || keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen || keyInfo.keyStatus == XSConstantMacro.keyStatusExpired)) + ? AppColors.greyBackgroundColor : Colors.white, borderRadius: BorderRadius.circular(20.w), ), child: Column( @@ -194,7 +211,11 @@ class _LockListPageState extends State { )), SizedBox(height: 20.h), Visibility( - visible: ((keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) && (DateTool().compareTimeGetDaysFromNow(keyInfo.endDate!) <= 15 && DateTool().compareTimeGetDaysFromNow(keyInfo.endDate!) >= 0)) ? true : false, + visible: ( + (keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) && + (keyInfo.keyStatus == XSConstantMacro.keyStatusWaitIneffective || keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen || keyInfo.keyStatus == XSConstantMacro.keyStatusExpired)) + ? true + : false, // visible: true, child:Row( children: [ @@ -216,7 +237,7 @@ class _LockListPageState extends State { children: [ SizedBox(width: 30.w), Text( - "${logic.getUseKeyTypeStr(keyInfo.startDate, keyInfo.endDate, keyInfo.keyType)}/${keyInfo.isLockOwner == 1 ? '超级管理员' : (keyInfo.keyRight == 1 ? "授权管理员" : "普通用户")}", + "${logic.getUseKeyTypeStr(keyInfo.startDate, keyInfo.endDate, keyInfo.keyType)} ${keyInfo.isLockOwner == 1 ? '超级管理员' : (keyInfo.keyRight == 1 ? "授权管理员" : "普通用户")}", style: TextStyle( fontSize: 18.sp, color: AppColors.darkGrayTextColor), ), diff --git a/star_lock/lib/main/lockMian/lockMain/lockMain_page.dart b/star_lock/lib/main/lockMian/lockMain/lockMain_page.dart index f75b807f..b21a469a 100644 --- a/star_lock/lib/main/lockMian/lockMain/lockMain_page.dart +++ b/star_lock/lib/main/lockMian/lockMain/lockMain_page.dart @@ -47,6 +47,7 @@ class _StarLockMainPageState extends State with BaseWidget { void initState() { super.initState(); WidgetsBinding.instance!.addPostFrameCallback((_) { + logic.pageNo = 1; getHttpData(); }); @@ -235,8 +236,10 @@ class _StarLockMainPageState extends State with BaseWidget { late StreamSubscription _teamEvent; void _initLoadDataAction() { + print("监听刷新首页数据消息"); _teamEvent = eventBus.on().listen((event) { // getLockInfo(); + logic.pageNo = 1; getHttpData(); print("收到刷新首页数据消息"); }); diff --git a/star_lock/lib/tools/baseGetXController.dart b/star_lock/lib/tools/baseGetXController.dart index 3c941079..9b62f098 100644 --- a/star_lock/lib/tools/baseGetXController.dart +++ b/star_lock/lib/tools/baseGetXController.dart @@ -11,6 +11,7 @@ import 'package:url_launcher/url_launcher.dart'; import '../common/XSConstantMacro/XSConstantMacro.dart'; import 'NativeInteractionTool.dart'; +import 'dateTool.dart'; import 'manager/client_manager.dart'; import 'showIosTipView.dart'; @@ -172,7 +173,7 @@ class BaseGetXController extends GetxController { DateTime startDateStr = DateTime.fromMillisecondsSinceEpoch(startDate!); DateTime endDateStr = DateTime.fromMillisecondsSinceEpoch(endDate!); useDateStr = - '${startDateStr.toLocal().toString().substring(0, 16)} - ${endDateStr.toLocal().toString().substring(0, 16)}'; + '${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}'; } else if (keyType == XSConstantMacro.keyTypeLong) { //永久 // DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); @@ -185,7 +186,7 @@ class BaseGetXController extends GetxController { useDateStr = '单次'; } else if (keyType == XSConstantMacro.keyTypeLoop) { //循环 - useDateStr = '循环'; + useDateStr = "${DateTool().dateToYMDString(startDate.toString())}-${DateTool().dateToYMDString(endDate.toString())}"; } return useDateStr;