From 22423607d13072b7b61e7a150ced4abb2d411806 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, 26 Feb 2024 11:07:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=89=93=E5=BC=80APP?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E6=9D=83=E9=99=90=E9=97=AE=E9=A2=98=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=B7=B2=E7=9F=A5bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- star_lock/images/lan/lan_zh.json | 2 +- .../ios/Runner.xcodeproj/project.pbxproj | 45 +++- star_lock/lib/app.dart | 2 +- star_lock/lib/blue/blue_manage.dart | 1 + .../authorizedAdmin_logic.dart | 247 ++++++++++-------- .../authorizedAdmin/authorizedAdmin_page.dart | 13 +- .../authorizedAdminList_logic.dart | 17 ++ .../authorizedAdminList_page.dart | 63 ++--- .../card/cardList/cardList_logic.dart | 1 + .../card/cardList/cardList_page.dart | 23 +- .../electronicKeyList_page.dart | 50 ++-- .../sendElectronicKey_logic.dart | 1 + .../fingerprintList_logic.dart | 1 + .../fingerprintList/fingerprintList_page.dart | 20 +- .../editLockName/editLockName_page.dart | 2 +- .../lockSet/lockSet/lockSet_page.dart | 6 +- .../lockSoundSet/lockSoundSet_logic.dart | 5 +- .../passwordKeyList/passwordKeyList_page.dart | 23 +- .../authorizedAdministratorList_page.dart | 30 ++- star_lock/lib/tools/commonItem.dart | 17 +- star_lock/lib/tools/eventBusEventManage.dart | 5 + 21 files changed, 343 insertions(+), 231 deletions(-) diff --git a/star_lock/images/lan/lan_zh.json b/star_lock/images/lan/lan_zh.json index fece2dbb..5d8a5aef 100644 --- a/star_lock/images/lan/lan_zh.json +++ b/star_lock/images/lan/lan_zh.json @@ -1,6 +1,6 @@ { "starLock":"星锁", - "clickUnlockAndHoldDownClose":"点击开锁,长按关闭", + "clickUnlockAndHoldDownClose":"点击开锁,长按闭锁", "checkingIn":"考勤", "electronicKey":"电子钥匙", "password":"密码", diff --git a/star_lock/ios/Runner.xcodeproj/project.pbxproj b/star_lock/ios/Runner.xcodeproj/project.pbxproj index ee0de8e8..31908fb0 100644 --- a/star_lock/ios/Runner.xcodeproj/project.pbxproj +++ b/star_lock/ios/Runner.xcodeproj/project.pbxproj @@ -695,7 +695,9 @@ isa = XCBuildConfiguration; baseConfigurationReference = D28DFC3BEA6D46B5F5B5E55F /* Pods-Runner.debug-dev.xcconfig */; buildSettings = { - DEVELOPMENT_TEAM = SF86QP26TZ; + CODE_SIGN_IDENTITY = "Apple Development: Tian Sky (33RZ5UJ9WP)"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 7D53BZAN75; PRODUCT_NAME = Runner; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; @@ -708,7 +710,9 @@ isa = XCBuildConfiguration; baseConfigurationReference = 6285D102821F3D2FB7B09E43 /* Pods-Runner.profile-dev.xcconfig */; buildSettings = { - DEVELOPMENT_TEAM = SF86QP26TZ; + CODE_SIGN_IDENTITY = "Apple Development: Tian Sky (33RZ5UJ9WP)"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 7D53BZAN75; PRODUCT_NAME = Runner; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; @@ -721,6 +725,9 @@ isa = XCBuildConfiguration; baseConfigurationReference = 295A8AFEEC4806105FAA13B5 /* Pods-Runner.release-dev.xcconfig */; buildSettings = { + CODE_SIGN_IDENTITY = "Apple Development: Tian Sky (33RZ5UJ9WP)"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 7D53BZAN75; PRODUCT_NAME = Runner; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; @@ -733,6 +740,9 @@ isa = XCBuildConfiguration; baseConfigurationReference = 51086737647B9B5E510020C6 /* Pods-Runner.debug-pre.xcconfig */; buildSettings = { + CODE_SIGN_IDENTITY = "Apple Development: Tian Sky (33RZ5UJ9WP)"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 7D53BZAN75; PRODUCT_NAME = Runner; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; @@ -745,7 +755,9 @@ isa = XCBuildConfiguration; baseConfigurationReference = D001CDA3D7BF065A0C6E3B64 /* Pods-Runner.profile-pre.xcconfig */; buildSettings = { - DEVELOPMENT_TEAM = SF86QP26TZ; + CODE_SIGN_IDENTITY = "Apple Development: Tian Sky (33RZ5UJ9WP)"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 7D53BZAN75; PRODUCT_NAME = Runner; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; @@ -758,6 +770,9 @@ isa = XCBuildConfiguration; baseConfigurationReference = 68C41ACED6A779BAAA0A51A7 /* Pods-Runner.release-pre.xcconfig */; buildSettings = { + CODE_SIGN_IDENTITY = "Apple Development: Tian Sky (33RZ5UJ9WP)"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 7D53BZAN75; PRODUCT_NAME = Runner; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; @@ -770,6 +785,9 @@ isa = XCBuildConfiguration; baseConfigurationReference = 4A63B2C308CB401731950EC8 /* Pods-Runner.debug-sky.xcconfig */; buildSettings = { + CODE_SIGN_IDENTITY = "Apple Development: Tian Sky (33RZ5UJ9WP)"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 7D53BZAN75; PRODUCT_NAME = Runner; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; @@ -782,6 +800,9 @@ isa = XCBuildConfiguration; baseConfigurationReference = 8CD96970DEA44F6CC71DEECE /* Pods-Runner.profile-sky.xcconfig */; buildSettings = { + CODE_SIGN_IDENTITY = "Apple Development: Tian Sky (33RZ5UJ9WP)"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 7D53BZAN75; PRODUCT_NAME = Runner; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; @@ -794,6 +815,9 @@ isa = XCBuildConfiguration; baseConfigurationReference = 16A83D21DFB231D8453DC681 /* Pods-Runner.release-sky.xcconfig */; buildSettings = { + CODE_SIGN_IDENTITY = "Apple Development: Tian Sky (33RZ5UJ9WP)"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 7D53BZAN75; PRODUCT_NAME = Runner; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; @@ -806,6 +830,9 @@ isa = XCBuildConfiguration; baseConfigurationReference = 22D858E988707FF26E068457 /* Pods-Runner.debug-xhj.xcconfig */; buildSettings = { + CODE_SIGN_IDENTITY = "Apple Development: Tian Sky (33RZ5UJ9WP)"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 7D53BZAN75; PRODUCT_NAME = Runner; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; @@ -818,6 +845,9 @@ isa = XCBuildConfiguration; baseConfigurationReference = D62237D2D011BDC27FB2BC28 /* Pods-Runner.profile-xhj.xcconfig */; buildSettings = { + CODE_SIGN_IDENTITY = "Apple Development: Tian Sky (33RZ5UJ9WP)"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 7D53BZAN75; PRODUCT_NAME = Runner; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; @@ -830,6 +860,9 @@ isa = XCBuildConfiguration; baseConfigurationReference = CDC2B8ED804B514A774F187D /* Pods-Runner.release-xhj.xcconfig */; buildSettings = { + CODE_SIGN_IDENTITY = "Apple Development: Tian Sky (33RZ5UJ9WP)"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 7D53BZAN75; PRODUCT_NAME = Runner; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; @@ -966,7 +999,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_IDENTITY = "Apple Development: Tian Sky (33RZ5UJ9WP)"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; DEVELOPMENT_TEAM = 7D53BZAN75; @@ -1641,7 +1674,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_IDENTITY = "Apple Development: Tian Sky (33RZ5UJ9WP)"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; DEVELOPMENT_TEAM = 7D53BZAN75; @@ -1786,7 +1819,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_IDENTITY = "Apple Development: Tian Sky (33RZ5UJ9WP)"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; DEVELOPMENT_TEAM = 7D53BZAN75; diff --git a/star_lock/lib/app.dart b/star_lock/lib/app.dart index b5308d9f..ec474a95 100644 --- a/star_lock/lib/app.dart +++ b/star_lock/lib/app.dart @@ -102,7 +102,7 @@ class _MyAppState extends State with WidgetsBindingObserver, BaseWidget { super.initState(); WidgetsBinding.instance.addObserver(this); - openBlueScan(); + // openBlueScan(); initAliyunPush(); } diff --git a/star_lock/lib/blue/blue_manage.dart b/star_lock/lib/blue/blue_manage.dart index b5480d4d..0258d7d8 100644 --- a/star_lock/lib/blue/blue_manage.dart +++ b/star_lock/lib/blue/blue_manage.dart @@ -110,6 +110,7 @@ class BlueManage { /// 调用发送数据 Future bludSendData(String deviceName, ConnectStateCallBack stateCallBack, {bool isAddEquipment = false}) async { _flutterReactiveBle!.statusStream.listen((status) { + Get.log("_flutterReactiveBle.status:$status"); if (status == BleStatus.ready) { // 蓝牙已开启,可以进行蓝牙操作 if(deviceConnectionState != DeviceConnectionState.connected){ diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart index 51934ce7..a5039a66 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart @@ -17,6 +17,7 @@ import '../../../../blue/io_tool/manager_event_bus.dart'; import '../../../../blue/sender_manage.dart'; import '../../../../network/api_repository.dart'; import '../../../../tools/baseGetXController.dart'; +import '../../../../tools/eventBusEventManage.dart'; import '../../../../tools/storage.dart'; import 'authorizedAdmin_state.dart'; @@ -89,76 +90,76 @@ class AuthorizedAdminLogic extends BaseGetXController { } } - if (reply is AddUserReply) { - _replyAddUserKey(reply); - } + // if (reply is AddUserReply) { + // _replyAddUserKey(reply); + // } }); } - Future _replyAddUserKey(Reply reply) async { - var lockId = reply.data.sublist(2, 42); - print("lockId:$lockId"); - - var token = reply.data.sublist(42, 46); - List strTokenList = changeIntListToStringList(token); - Storage.setStringList(saveBlueToken, strTokenList); - print("token:$token"); - - int status = reply.data[46]; - print("status:$status"); - - // userNo = reply.data[46]; - // print("status:$status"); - switch (status) { - case 0x00: - //成功 - print("添加用户数据解析成功"); - state.isSendSuccess.value = true; - showToast("添加成功"); - // bindBlueAdmin(); - break; - case 0x06: - //无权限 - print("需要鉴权"); - var privateKey = await Storage.getStringList(saveBluePrivateKey); - List getPrivateKeyList = changeStringListToIntList(privateKey!); - - var publicKey = await Storage.getStringList(saveBluePublicKey); - List publicKeyDataList = changeStringListToIntList(publicKey!); - - IoSenderManage.senderAddUser( - lockID: BlueManage().connectDeviceName, - authUserID: await Storage.getUid(), - keyID: "1", - userID: state.addUserId.value, - openMode: 1, - keyType: (state.type.value == "1") ? 0 : 1, - startDate: state.effectiveDateTime.value.millisecondsSinceEpoch, - expireDate: state.failureDateTime.value.millisecondsSinceEpoch, - role: 0, - password: "123456", - needAuthor: 1, - publicKey: publicKeyDataList, - privateKey: getPrivateKeyList, - token: token); - break; - case 0x07: - //无权限 - print("用户无权限"); - - break; - case 0x09: - // 权限校验错误 - print("添加用户权限校验错误"); - - break; - default: - //失败 - print("领锁失败"); - - break; - } - } + // Future _replyAddUserKey(Reply reply) async { + // var lockId = reply.data.sublist(2, 42); + // print("lockId:$lockId"); + // + // var token = reply.data.sublist(42, 46); + // List strTokenList = changeIntListToStringList(token); + // Storage.setStringList(saveBlueToken, strTokenList); + // print("token:$token"); + // + // int status = reply.data[46]; + // print("status:$status"); + // + // // userNo = reply.data[46]; + // // print("status:$status"); + // switch (status) { + // case 0x00: + // //成功 + // print("添加用户数据解析成功"); + // state.isSendSuccess.value = true; + // showToast("添加成功"); + // // bindBlueAdmin(); + // break; + // case 0x06: + // //无权限 + // print("需要鉴权"); + // var privateKey = await Storage.getStringList(saveBluePrivateKey); + // List getPrivateKeyList = changeStringListToIntList(privateKey!); + // + // var publicKey = await Storage.getStringList(saveBluePublicKey); + // List publicKeyDataList = changeStringListToIntList(publicKey!); + // + // IoSenderManage.senderAddUser( + // lockID: BlueManage().connectDeviceName, + // authUserID: await Storage.getUid(), + // keyID: "1", + // userID: state.addUserId.value, + // openMode: 1, + // keyType: (state.type.value == "1") ? 0 : 1, + // startDate: state.effectiveDateTime.value.millisecondsSinceEpoch, + // expireDate: state.failureDateTime.value.millisecondsSinceEpoch, + // role: 0, + // password: "123456", + // needAuthor: 1, + // publicKey: publicKeyDataList, + // privateKey: getPrivateKeyList, + // token: token); + // break; + // case 0x07: + // //无权限 + // print("用户无权限"); + // + // break; + // case 0x09: + // // 权限校验错误 + // print("添加用户权限校验错误"); + // + // break; + // default: + // //失败 + // print("领锁失败"); + // + // break; + // } + // } // 转移权限 Future transferPermissionsAction() async { @@ -189,53 +190,74 @@ class AuthorizedAdminLogic extends BaseGetXController { } // 添加用户 - Future addUserConnectBlue(String receiveId) async { - // 进来之后首先连接 - BlueManage().bludSendData(BlueManage().connectDeviceName, (DeviceConnectionState connecteState) async { - if (connecteState == DeviceConnectionState.connected) { - // 私钥 - var privateKey = await Storage.getStringList(saveBluePrivateKey); - List getPrivateKeyList = changeStringListToIntList(privateKey!); - - var publicKey = await Storage.getStringList(saveBluePublicKey); - List publicKeyDataList = changeStringListToIntList(publicKey!); - - var token = await Storage.getStringList(saveBlueToken); - List getTokenList = [0, 0, 0, 0]; - if (token != null) { - getTokenList = changeStringListToIntList(token); - } - - IoSenderManage.senderAddUser( - lockID: BlueManage().connectDeviceName, - authUserID: await Storage.getUid(), - keyID: "1", - userID: receiveId, - openMode: 1, - keyType: (state.type.value == "1") ? 0 : 1, - startDate: state.effectiveDateTime.value.millisecondsSinceEpoch, - expireDate: state.failureDateTime.value.millisecondsSinceEpoch, - role: 0, - password: "123456", - needAuthor: 1, - publicKey: publicKeyDataList, - privateKey: getPrivateKeyList, - token: getTokenList); - } - }); - } + // Future addUserConnectBlue(String receiveId) async { + // // 进来之后首先连接 + // BlueManage().bludSendData(BlueManage().connectDeviceName, (DeviceConnectionState connecteState) async { + // if (connecteState == DeviceConnectionState.connected) { + // // 私钥 + // var privateKey = await Storage.getStringList(saveBluePrivateKey); + // List getPrivateKeyList = changeStringListToIntList(privateKey!); + // + // var publicKey = await Storage.getStringList(saveBluePublicKey); + // List publicKeyDataList = changeStringListToIntList(publicKey!); + // + // var token = await Storage.getStringList(saveBlueToken); + // List getTokenList = [0, 0, 0, 0]; + // if (token != null) { + // getTokenList = changeStringListToIntList(token); + // } + // + // IoSenderManage.senderAddUser( + // lockID: BlueManage().connectDeviceName, + // authUserID: await Storage.getUid(), + // keyID: "1", + // userID: receiveId, + // openMode: 1, + // keyType: (state.type.value == "1") ? 0 : 1, + // startDate: state.effectiveDateTime.value.millisecondsSinceEpoch, + // expireDate: state.failureDateTime.value.millisecondsSinceEpoch, + // role: 0, + // password: "123456", + // needAuthor: 1, + // publicKey: publicKeyDataList, + // privateKey: getPrivateKeyList, + // token: getTokenList); + // } + // }); + // } //发送授权管理员列表请求 - Future sendElectronicKeyRequest(BuildContext widgetContext) async { + Future sendElectronicKeyRequest() async { + if(state.emailOrPhoneController.text.isEmpty){ + showToast("请输入接收者账号"); + return; + } + if(state.keyNameController.text.isEmpty){ + showToast("请输入接收者姓名"); + return; + } + String getFailureDateTime = '0'; String getEffectiveDateTime = '0'; String lockID = state.keyInfo.value.lockId.toString(); - String getKeyType = (int.parse(state.type.value) + 1).toString(); + Get.log("state.type.value:${state.type.value}"); + String getKeyType = "1"; if (state.type.value == '0') { - getFailureDateTime = - state.failureDateTime.value.millisecondsSinceEpoch.toString(); - getEffectiveDateTime = - state.effectiveDateTime.value.millisecondsSinceEpoch.toString(); + getKeyType = "2"; + getFailureDateTime = state.failureDateTime.value.millisecondsSinceEpoch.toString(); + getEffectiveDateTime = state.effectiveDateTime.value.millisecondsSinceEpoch.toString(); + + DateTime startDateTime = DateTime(state.effectiveDateTime.value.year, state.effectiveDateTime.value.month, state.effectiveDateTime.value.day, state.effectiveDateTime.value.hour, state.effectiveDateTime.value.minute); + DateTime endDateTime = DateTime(state.failureDateTime.value.year, state.failureDateTime.value.month, state.failureDateTime.value.day, state.failureDateTime.value.hour, state.failureDateTime.value.minute); + if (!startDateTime.isBefore(endDateTime) || startDateTime.isAtSameMomentAs(endDateTime)) { + showToast("失效时间需大于生效时间"); + return; + } + + if (!startDateTime.isBefore(DateTime.now()) || startDateTime.isAtSameMomentAs(DateTime.now())) { + showToast("生效时间需大于当前时间"); + return; + } } var entity = await ApiRepository.to.sendElectronicKey( @@ -260,19 +282,20 @@ class AuthorizedAdminLogic extends BaseGetXController { state.isSendSuccess.value = true; // Toast.show(msg: "添加成功"); state.addUserId.value = entity.data!.receiverUser!.id.toString(); - addUserConnectBlue(state.addUserId.value); + // addUserConnectBlue(state.addUserId.value); + eventBus.fire(AuthorizedAdminPageRefreshUI()); } else { if (entity.errorCode == 425) { //用户未注册 - _showDialog(widgetContext, '${entity.errorMsg}'); + _showDialog('${entity.errorMsg}'); } } } //用户未注册确认弹窗 - void _showDialog(widgetContext, String errMsg) { + void _showDialog(String errMsg) { showCupertinoDialog( - context: widgetContext, + context: Get.context!, builder: (context) { return CupertinoAlertDialog( title: const Text('接收者号码未注册,请选择号码所在的国家并重新发送'), 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 4da0974d..15a1ecc4 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart @@ -37,6 +37,7 @@ class _AuthorizedAdminPageState extends State { @override Widget build(BuildContext context) { state.type.value = widget.type; + Get.log("widget.type:${widget.type}"); return SingleChildScrollView( child: Obx(() => indexChangeWidget()), @@ -202,11 +203,7 @@ class _AuthorizedAdminPageState extends State { var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); if (isDemoMode == false) { //发送钥匙请求 - if (state.emailOrPhoneController.text.isNotEmpty && - state.keyNameController.value.text.isNotEmpty) { - // logic.addUserConnectBlue(); - logic.sendElectronicKeyRequest(context); - } + logic.sendElectronicKeyRequest(); } else { logic.showToast("演示模式"); } @@ -221,8 +218,8 @@ class _AuthorizedAdminPageState extends State { onPressed: () async { var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); if (isDemoMode == false) { - Navigator.pushNamed( - context, Routers.volumeAuthorizationLockManagePage); + Get.toNamed(Routers.volumeAuthorizationLockManagePage); + // Navigator.pushNamed(context, Routers.volumeAuthorizationLockManagePage); } else { logic.showToast("演示模式"); } @@ -304,7 +301,7 @@ class _AuthorizedAdminPageState extends State { height: 10.h, ), OutLineBtn( - btnName: '标记为已入住', + btnName: '标记为:已入住', onClick: () { updateRoomCheckIn(); }, diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_logic.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_logic.dart index 79e6b3bb..a7c3fda8 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_logic.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_logic.dart @@ -1,8 +1,12 @@ +import 'dart:async'; + import 'package:star_lock/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_state.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart'; import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/tools/baseGetXController.dart'; +import '../../../../tools/eventBusEventManage.dart'; + class AuthorizedAdminListLogic extends BaseGetXController { final AuthorizedAdminListState state = AuthorizedAdminListState(); @@ -42,10 +46,21 @@ class AuthorizedAdminListLogic extends BaseGetXController { } } + /// 刷新电子钥匙列表 + StreamSubscription? _getAuthorizedAdminPageRefreshUIEvent; + void _getAuthorizedAdminPageRefreshUIAction() { + // 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus + _getAuthorizedAdminPageRefreshUIEvent = eventBus.on().listen((event) { + pageNo = 1; + mockNetworkDataRequest(); + }); + } + @override void onReady() { // TODO: implement onReady super.onReady(); + _getAuthorizedAdminPageRefreshUIAction(); } @override @@ -57,5 +72,7 @@ class AuthorizedAdminListLogic extends BaseGetXController { @override void onClose() { // TODO: implement onClose + super.onClose(); + _getAuthorizedAdminPageRefreshUIEvent?.cancel(); } } diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart index ea04859c..cc769f96 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart @@ -206,6 +206,7 @@ class _AuthorizedAdminListPageState extends State { //使用期限 String getUseDateStr(ElectronicKeyListItem indexEntity) { String useDateStr = ''; + if (indexEntity.keyType == XSConstantMacro.keyTypeTime) { //限期 DateTime startDateStr = @@ -219,15 +220,16 @@ class _AuthorizedAdminListPageState extends State { // DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); // useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 永久'; useDateStr = "永久"; - } else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) { - //单次 - // DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); - // useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 单次'; - useDateStr = "单次"; - } else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) { - //循环 - useDateStr = '循环'; } + // else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) { + // //单次 + // // DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); + // // useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 单次'; + // useDateStr = "单次"; + // } else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) { + // //循环 + // useDateStr = '循环'; + // } return useDateStr; } @@ -265,41 +267,32 @@ class _AuthorizedAdminListPageState extends State { height: 100.h, child: Row( children: [ - SizedBox( - width: 30.w, - ), - Image.asset( - avatarURL, - width: 60.w, - height: 60.w, - ), - SizedBox( - width: 20.w, - ), + SizedBox(width: 30.w), + Image.asset(avatarURL, width: 60.w, height: 60.w,), + SizedBox(width: 20.w), Expanded( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - receiveUser, - style: TextStyle( - fontSize: 24.sp, color: AppColors.blackColor), + SizedBox( + width: 1.sw - 110.w - 100.w, + child: Row( + children: [ + Flexible( + child: Text( + receiveUser, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor) + ), + ), + + ], + ), ), SizedBox(width: 10.w), - // isAdminKey - // ? Image.asset( - // 'images/icon_electronicKey_admin.png', - // width: 24.w, - // height: 20.w, - // ) - // : Container(), - Expanded( - child: SizedBox( - width: 20.w, - )), Text( keyStatus, style: TextStyle(fontSize: 18.sp, color: Colors.red), 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 e4b47186..a5073dc0 100644 --- a/star_lock/lib/main/lockDetail/card/cardList/cardList_logic.dart +++ b/star_lock/lib/main/lockDetail/card/cardList/cardList_logic.dart @@ -353,6 +353,7 @@ class CardListLogic extends BaseGetXController { late StreamSubscription _teamEvent; void _initRefreshAction() { _teamEvent = eventBus.on().listen((event) { + pageNo = 1; getICCardListData(); }); } diff --git a/star_lock/lib/main/lockDetail/card/cardList/cardList_page.dart b/star_lock/lib/main/lockDetail/card/cardList/cardList_page.dart index 12c997c9..cd23ae40 100644 --- a/star_lock/lib/main/lockDetail/card/cardList/cardList_page.dart +++ b/star_lock/lib/main/lockDetail/card/cardList/cardList_page.dart @@ -209,13 +209,24 @@ class _CardListPageState extends State with RouteAware { Row( // mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text(lockTypeTitle, - style: TextStyle( - fontSize: 24.sp, color: AppColors.blackColor)), - Expanded(child: Container()), + SizedBox( + width: 1.sw - 110.w - 100.w, + child: Row( + children: [ + Flexible( + child: Text( + lockTypeTitle, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor) + ), + ), + + ], + ), + ), Text(ifInvalidation, - style: TextStyle( - fontSize: 22.sp, color: Colors.red)), + style: TextStyle(fontSize: 22.sp, color: Colors.red)), SizedBox(width: 10.w), ], ), diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart index 97253cf4..48c80968 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart @@ -290,17 +290,9 @@ class _ElectronicKeyListPageState extends State { height: 90.h, child: Row( children: [ - SizedBox( - width: 30.w, - ), - Image.asset( - avatarURL, - width: 60.w, - height: 60.w, - ), - SizedBox( - width: 20.w, - ), + SizedBox(width: 30.w), + Image.asset(avatarURL, width: 60.w, height: 60.w,), + SizedBox(width: 20.w), Expanded( child: Column( mainAxisAlignment: MainAxisAlignment.center, @@ -308,22 +300,28 @@ class _ElectronicKeyListPageState extends State { Row( // mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - receiveUser, - style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor), + SizedBox( + width: 1.sw - 110.w - 34.w - 60.w, + child: Row( + children: [ + Flexible( + child: Text( + receiveUser, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor) + ), + ), + SizedBox(width: 10.w), + isAdminKey + ? Image.asset('images/icon_electronicKey_admin.png', width: 24.w, height: 20.w,) + : Container(), + ], + ), ), + + // Expanded(child: SizedBox(width: 20.w,)), SizedBox(width: 10.w), - isAdminKey - ? Image.asset( - 'images/icon_electronicKey_admin.png', - width: 24.w, - height: 20.w, - ) - : Container(), - Expanded( - child: SizedBox( - width: 20.w, - )), Text( keyStatus, style: TextStyle(fontSize: 18.sp, color: Colors.red), @@ -342,7 +340,7 @@ class _ElectronicKeyListPageState extends State { ), ], ), - SizedBox(width: 20.h), + // SizedBox(width: 20.h), ], ), ), diff --git a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_logic.dart b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_logic.dart index fe161625..96a859c5 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_logic.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_logic.dart @@ -28,6 +28,7 @@ class SendElectronicKeyLogic extends BaseGetXController { //发送钥匙请求 if (state.type.value == "0" || state.type.value == "3") { + print("startDateTime:$startDateTime endDateTime:$endDateTime DateTime.now():${DateTime.now()} startDateTime.isBefore(endDateTime):${startDateTime.isBefore(endDateTime)}"); if (!startDateTime.isBefore(endDateTime) || startDateTime.isAtSameMomentAs(endDateTime)) { 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 33aed524..3185ddcf 100644 --- a/star_lock/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_logic.dart +++ b/star_lock/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_logic.dart @@ -385,6 +385,7 @@ class FingerprintListLogic extends BaseGetXController{ late StreamSubscription _teamEvent; void _initRefreshAction() { _teamEvent = eventBus.on().listen((event) { + pageNo = 1; getFingerprintsListData(); }); } diff --git a/star_lock/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_page.dart b/star_lock/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_page.dart index a7da1586..01893bad 100644 --- a/star_lock/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_page.dart +++ b/star_lock/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_page.dart @@ -213,10 +213,22 @@ class _FingerprintListPageState extends State with RouteAwa Row( // mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text(lockTypeTitle, - style: TextStyle( - fontSize: 24.sp, color: AppColors.blackColor)), - Expanded(child: Container()), + SizedBox( + width: ifInvalidation.isNotEmpty ? 1.sw - 110.w - 100.w : 1.sw - 110.w - 50.w, + child: Row( + children: [ + Flexible( + child: Text( + lockTypeTitle, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor) + ), + ), + + ], + ), + ), Text(ifInvalidation, style: TextStyle( fontSize: 22.sp, color: Colors.red)), diff --git a/star_lock/lib/main/lockDetail/lockSet/basicInformation/editLockName/editLockName_page.dart b/star_lock/lib/main/lockDetail/lockSet/basicInformation/editLockName/editLockName_page.dart index 0bcb21e4..9795027b 100644 --- a/star_lock/lib/main/lockDetail/lockSet/basicInformation/editLockName/editLockName_page.dart +++ b/star_lock/lib/main/lockDetail/lockSet/basicInformation/editLockName/editLockName_page.dart @@ -47,7 +47,7 @@ class _EditLockNamePageState extends State { leftWidget: const SizedBox(), hintText: TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr, inputFormatters: [ - LengthLimitingTextInputFormatter(20), + LengthLimitingTextInputFormatter(50), ]), )); } diff --git a/star_lock/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart b/star_lock/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart index e5e5a368..d4d7e625 100644 --- a/star_lock/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart +++ b/star_lock/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart @@ -73,10 +73,8 @@ class _LockSetPageState extends State with RouteAware { // 根据权限显示不同的列表 List getListWidget() { - print( - "state.lockBasicInfo.value.isLockOwner:${state.lockBasicInfo.value.isLockOwner} state.lockBasicInfo.value.keyRight:${state.lockBasicInfo.value.keyRight}"); - if (state.lockBasicInfo.value.isLockOwner == 1 || - state.lockBasicInfo.value.keyRight == 1) { + // print("state.lockBasicInfo.value.isLockOwner:${state.lockBasicInfo.value.isLockOwner} state.lockBasicInfo.value.keyRight:${state.lockBasicInfo.value.keyRight}"); + if (state.lockBasicInfo.value.isLockOwner == 1 || state.lockBasicInfo.value.keyRight == 1) { // 超级管理员、授权管理员 return getAllWidget(); } else { diff --git a/star_lock/lib/main/lockDetail/lockSet/lockSoundSet/lockSoundSet_logic.dart b/star_lock/lib/main/lockDetail/lockSet/lockSoundSet/lockSoundSet_logic.dart index c88ffb42..03bebe5a 100644 --- a/star_lock/lib/main/lockDetail/lockSet/lockSoundSet/lockSoundSet_logic.dart +++ b/star_lock/lib/main/lockDetail/lockSet/lockSoundSet/lockSoundSet_logic.dart @@ -29,9 +29,10 @@ class LockSoundSetLogic extends BaseGetXController { // eventBus.fire(RefreshLockListInfoDataEvent()); state.lockSetInfoData.value.lockSettingInfo!.lockSound = state.isOpenLockSound.value == true ? 1 :0; state.lockSetInfoData.value.lockSettingInfo!.lockSoundVolume = state.lockSoundLevel.value; - eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value)); ifCanNext(); - showToast("操作成功"); + showToast("操作成功", something: (){ + eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value)); + }); } } diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart index 01de800c..199a9a08 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart @@ -200,19 +200,22 @@ class _PasswordKeyListPageState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ Row( - mainAxisAlignment: MainAxisAlignment.start, children: [ - Expanded( - child: Text( - lockTypeTitle, - style: TextStyle( - fontSize: 24.sp, color: AppColors.blackColor), + SizedBox( + width: passwordKeyListItem.keyboardPwdStatus == 2 ? 1.sw - 110.w - 100.w : 1.sw - 110.w - 50.w, + child: Row( + children: [ + Flexible( + child: Text( + lockTypeTitle, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor) + ), + ) + ] ), ), - // Expanded( - // child: SizedBox( - // width: 20.w, - // )), SizedBox(width: 10.w), passwordKeyListItem.keyboardPwdStatus == 2 ? Text('已过期', style: TextStyle(color: Colors.red, fontSize: 20.sp),) : Container(), SizedBox(width: 15.w) diff --git a/star_lock/lib/mine/mineSet/authorizedAdministrator/authorizedAdministratorList_page.dart b/star_lock/lib/mine/mineSet/authorizedAdministrator/authorizedAdministratorList_page.dart index 99ef93b1..ef496a98 100644 --- a/star_lock/lib/mine/mineSet/authorizedAdministrator/authorizedAdministratorList_page.dart +++ b/star_lock/lib/mine/mineSet/authorizedAdministrator/authorizedAdministratorList_page.dart @@ -47,9 +47,7 @@ class _AuthorizedAdministratorListPageState ), onPressed: () { // 处理操作按钮的点击事件 - Navigator.pushNamed( - context, Routers.addAuthorizedAdministratorPage) - .then((value) { + Navigator.pushNamed(context, Routers.addAuthorizedAdministratorPage).then((value) { setState(() { mockNetworkDataRequest(); }); @@ -208,10 +206,26 @@ class _AuthorizedAdministratorListPageState Row( mainAxisAlignment: MainAxisAlignment.start, children: [ - Text( - itemData.name ?? '', - style: TextStyle( - fontSize: 24.sp, color: AppColors.blackColor), + // Text( + // itemData.name ?? '', + // style: TextStyle( + // fontSize: 24.sp, color: AppColors.blackColor), + // ), + SizedBox( + width: 1.sw - 110.w - 100.w, + child: Row( + children: [ + Flexible( + child: Text( + itemData.name ?? '', + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor) + ), + ), + + ], + ), ), ], ), @@ -220,7 +234,7 @@ class _AuthorizedAdministratorListPageState mainAxisAlignment: MainAxisAlignment.start, children: [ Text( - "2023.6.21 11.15 永久", + getUseDateStr(itemData), style: TextStyle( fontSize: 18.sp, color: AppColors.placeholderTextColor), diff --git a/star_lock/lib/tools/commonItem.dart b/star_lock/lib/tools/commonItem.dart index 8880c51c..5765d1de 100644 --- a/star_lock/lib/tools/commonItem.dart +++ b/star_lock/lib/tools/commonItem.dart @@ -59,13 +59,16 @@ class CommonItem extends StatelessWidget { children: [ isHaveRightWidget! ? rightWidget! - : Text( - rightTitle ?? "", - textAlign: TextAlign.right, - overflow: TextOverflow.ellipsis, - maxLines: 2, - style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor), - ), + : SizedBox( + width: 250.w, + child: Text( + rightTitle ?? "", + textAlign: TextAlign.right, + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor), + ), + ), ], ), isHaveDirection! ? SizedBox(width: 3.w) : Container(), diff --git a/star_lock/lib/tools/eventBusEventManage.dart b/star_lock/lib/tools/eventBusEventManage.dart index eac42f8b..94de21c8 100644 --- a/star_lock/lib/tools/eventBusEventManage.dart +++ b/star_lock/lib/tools/eventBusEventManage.dart @@ -94,3 +94,8 @@ class ReadMessageRefreshUI { class ElectronicKeyListRefreshUI { ElectronicKeyListRefreshUI(); } + +/// 刷新授权管理员列表 +class AuthorizedAdminPageRefreshUI { + AuthorizedAdminPageRefreshUI(); +}