diff --git a/lib/main/lockDetail/lockDetail/lockDetail_logic.dart b/lib/main/lockDetail/lockDetail/lockDetail_logic.dart index 22609de7..b0728bf9 100755 --- a/lib/main/lockDetail/lockDetail/lockDetail_logic.dart +++ b/lib/main/lockDetail/lockDetail/lockDetail_logic.dart @@ -179,6 +179,7 @@ class LockDetailLogic extends BaseGetXController { Future loadData({ required LockListInfoItemEntity lockListInfoItemEntity,required bool isOnlyOneData}) async { state.keyInfos.value = lockListInfoItemEntity; CommonDataManage().currentLockUserNo = state.keyInfos.value.lockUserNo!; + CommonDataManage().initUserNo = state.keyInfos.value.initUserNo!; CommonDataManage().currentKeyInfo = state.keyInfos.value; state.lockUserNo = state.keyInfos.value.lockUserNo!; diff --git a/lib/main/lockDetail/lockDetail/lockDetail_page.dart b/lib/main/lockDetail/lockDetail/lockDetail_page.dart index 79e27ef0..9c235587 100755 --- a/lib/main/lockDetail/lockDetail/lockDetail_page.dart +++ b/lib/main/lockDetail/lockDetail/lockDetail_page.dart @@ -60,6 +60,7 @@ class _LockDetailPageState extends State _initRefreshLockDetailInfoDataEventAction(); logic.initReplySubscription(); logic.initLockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceAction(); + logic.loadData(lockListInfoItemEntity: widget.lockListInfoItemEntity, isOnlyOneData: widget.isOnlyOneData); } @override @@ -81,69 +82,8 @@ class _LockDetailPageState extends State }); } - Future loadData() async { - state.keyInfos.value = widget.lockListInfoItemEntity; - CommonDataManage().currentLockUserNo = state.keyInfos.value.lockUserNo!; - CommonDataManage().initUserNo = state.keyInfos.value.initUserNo!; - CommonDataManage().currentKeyInfo = state.keyInfos.value; - - state.lockUserNo = state.keyInfos.value.lockUserNo!; - - if (state.keyInfos.value.keyStatus == - XSConstantMacro.keyStatusWaitIneffective || - state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusFrozen || - state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusExpired || - state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusDeleted || - state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusReset) { - state.openDoorBtnisUneable.value = false; - state.bottomBtnisEable.value = false; - } else { - state.openDoorBtnisUneable.value = true; - state.bottomBtnisEable.value = true; - } - - state.isOnlyOneData = widget.isOnlyOneData; - state.senderUserId = state.keyInfos.value.senderUserId!; - state.isAttendance.value = state.keyInfos.value.lockSetting!.attendance!; - state.isOpenLockNeedOnline.value = - state.keyInfos.value.lockSetting!.appUnlockOnline!; - state.electricQuantity.value = state.keyInfos.value.electricQuantity!; - state.isOpenPassageMode.value = state.keyInfos.value.passageMode!; - state.lockAlias.value = state.keyInfos.value.lockAlias!; - Storage.setString(saveLockAlias, state.lockAlias.value); - - BlueManage().connectDeviceName = - state.keyInfos.value.bluetooth!.bluetoothDeviceName!; - - final List publicKeyData = - state.keyInfos.value.bluetooth!.publicKey!.cast(); - final List saveStrList = changeIntListToStringList(publicKeyData); - Storage.setStringList(saveBluePublicKey, saveStrList); - - // 私钥 - final List privateKeyData = - state.keyInfos.value.bluetooth!.privateKey!.cast(); - final List savePrivateKeyList = - changeIntListToStringList(privateKeyData); - Storage.setStringList(saveBluePrivateKey, savePrivateKeyList); - - // signKey - final List signKeyData = - state.keyInfos.value.bluetooth!.signKey!.cast(); - final List saveSignKeyList = changeIntListToStringList(signKeyData); - Storage.setStringList(saveBlueSignKey, saveSignKeyList); - - final bool ifHaveKey = await Storage.ifHaveKey(saveBlueToken); - if (!ifHaveKey) { - final List saveTokenList = - changeIntListToStringList([0, 0, 0, 0]); - Storage.setStringList(saveBlueToken, saveTokenList); - } - } - @override Widget build(BuildContext context) { - loadData(); return F.sw(skyCall: skWidget, xhjCall: xhjWidget); }