diff --git a/star_lock/ios/Podfile.lock b/star_lock/ios/Podfile.lock index 2d0a0ce7..a072e55d 100644 --- a/star_lock/ios/Podfile.lock +++ b/star_lock/ios/Podfile.lock @@ -268,7 +268,7 @@ SPEC CHECKSUMS: ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825 reactive_ble_mobile: 9ce6723d37ccf701dbffd202d487f23f5de03b4c shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695 - sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a + sqflite: 50a33e1d72bd59ee092a519a35d107502757ebed SwiftProtobuf: 407a385e97fd206c4fbe880cc84123989167e0d1 Toast: 91b396c56ee72a5790816f40d3a94dd357abc196 url_launcher_ios: bbd758c6e7f9fd7b5b1d4cde34d2b95fcce5e812 diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart index b7d9343d..81f9f77e 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart @@ -6,6 +6,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:intl/intl.dart'; +import '../../../appRouters.dart'; import '../../../app_settings/app_colors.dart'; import '../../../blue/blue_manage.dart'; import '../../../blue/io_protocol/io_addUser.dart'; @@ -132,6 +133,11 @@ class LockDetailLogic extends BaseGetXController { // 权限校验错误 print("${reply.commandType}校验错误"); + break; + case 0x16: + // 正在开锁中... + print("${reply.commandType}正在开锁中..."); + showToast("正在开锁中..."); break; default: //失败 @@ -331,7 +337,7 @@ class LockDetailLogic extends BaseGetXController { keyType: 0, startDate: DateTime.now().millisecondsSinceEpoch, expireDate: 0x11223344, - role: 0, + role: state.keyInfos.value.keyRight == 1 ? 1 : 0, password: "123456", needAuthor: 1, publicKey: publicKeyDataList, @@ -388,7 +394,7 @@ class LockDetailLogic extends BaseGetXController { keyType: 0, startDate: DateTime.now().millisecondsSinceEpoch, expireDate: 0x11223344, - role: 0, + role: state.keyInfos.value.keyRight == 1 ? 1 : 0, password: "123456", needAuthor: 1, publicKey: publicKeyDataList, @@ -592,6 +598,39 @@ class LockDetailLogic extends BaseGetXController { } } + // 0开锁 1长按闭锁 2密码 3卡 4指纹 5遥控 6人脸 7监控 8操作记录 9消息提醒 10设置 + clickItemBtnAction(int type){ + state.clickNextType = type; + if (state.lockUserNo == 0) { + // 电子钥匙lockUserNo为0 要先添加用户 + addUserConnectBlue(); + } else { + clickPushBtnAction(); + } + } + + clickPushBtnAction(){ + // 0开锁 1长按闭锁 2密码 3卡 4指纹 5遥控 6人脸 7监控 8操作记录 9消息提醒 10设置 + switch(state.clickNextType){ + case 0: + // 开锁 + startOpenLock(); + break; + case 1: + // 长按闭锁 + startUnLock(); + break; + case 2: + // 密码 + Get.toNamed(Routers.passwordKeyListPage, arguments: {"keyInfo": state.keyInfos.value}); + break; + case 3: + // 卡 + Get.toNamed(Routers.passwordKeyListPage, arguments: {"keyInfo": state.keyInfos.value}); + break; + } + } + // 获取手机联网token,根据锁设置里面获取的开锁时是否联网来判断是否调用这个接口 void getLockNetToken() async { LockNetTokenEntity entity = await ApiRepository.to.getLockNetToken(lockId: state.keyInfos.value.lockId.toString()); diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart index cba25cba..ae1a5472 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart @@ -314,13 +314,13 @@ class _LockDetailPageState extends State var showWidgetArr = [ // 操作记录 bottomItem('images/main/icon_main_operatingRecord.png', TranslationLoader.lanKeys!.operatingRecord!.tr, () { - Get.toNamed(Routers.lockOperatingRecordPage, arguments: {"keyInfo": widget.lockListInfoItemEntity}); + Get.toNamed(Routers.lockOperatingRecordPage, arguments: {"keyInfo": state.keyInfos.value}); }), // 设置 bottomItem('images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr, () { Get.toNamed(Routers.lockSetPage, arguments: { - "lockId": widget.lockListInfoItemEntity.lockId, + "lockId": state.keyInfos.value.lockId, "isOnlyOneData": widget.isOnlyOneData, }); }), @@ -344,14 +344,14 @@ class _LockDetailPageState extends State showWidgetArr.add(bottomItem('images/main/icon_main_electronicKey.png', TranslationLoader.lanKeys!.electronicKey!.tr, () { Get.toNamed(Routers.electronicKeyListPage, - arguments: {"keyInfo": widget.lockListInfoItemEntity}); + arguments: {"keyInfo": state.keyInfos.value}); })); // 密码 showWidgetArr.add(bottomItem('images/main/icon_main_password.png', TranslationLoader.lanKeys!.password!.tr, () { Get.toNamed(Routers.passwordKeyListPage, - arguments: {"keyInfo": widget.lockListInfoItemEntity}); + arguments: {"keyInfo": state.keyInfos.value}); })); // ic卡 @@ -361,7 +361,7 @@ class _LockDetailPageState extends State // logic.showEasyLoading(); // }); Get.toNamed(Routers.cardListPage, arguments: { - "lockId": widget.lockListInfoItemEntity.lockId, + "lockId": state.keyInfos.value.lockId, }); })); } @@ -371,7 +371,7 @@ class _LockDetailPageState extends State showWidgetArr.add(bottomItem('images/main/icon_main_fingerprint.png', TranslationLoader.lanKeys!.fingerprint!.tr, () { Get.toNamed(Routers.fingerprintListPage, arguments: { - "lockId": widget.lockListInfoItemEntity.lockId, + "lockId": state.keyInfos.value.lockId, }); })); } @@ -390,7 +390,7 @@ class _LockDetailPageState extends State bottomItem('images/main/icon_face.png', TranslationLoader.lanKeys!.humanFace!.tr, () { Get.toNamed(Routers.faceList, arguments: { - "lockId": widget.lockListInfoItemEntity.lockId, + "lockId": state.keyInfos.value.lockId, }); // Toast.show(msg: "功能暂未开放"); }), ); @@ -402,7 +402,7 @@ class _LockDetailPageState extends State bottomItem('images/main/icon_catEyes.png', TranslationLoader.lanKeys!.monitoring!.tr, () { Get.toNamed(Routers.realTimePicturePage, arguments: { - "lockName": widget.lockListInfoItemEntity.lockName, + "lockName": state.keyInfos.value.lockName, "isMonitoring": true }); }), @@ -414,15 +414,15 @@ class _LockDetailPageState extends State bottomItem('images/main/icon_main_authorizedAdmin.png', TranslationLoader.lanKeys!.authorizedAdmin!.tr, () { Get.toNamed(Routers.authorizedAdminListPage, - arguments: {"keyInfo": widget.lockListInfoItemEntity}); + arguments: {"keyInfo": state.keyInfos.value}); }), // 操作记录 bottomItem('images/main/icon_main_operatingRecord.png', TranslationLoader.lanKeys!.operatingRecord!.tr, () { // Get.toNamed(Routers.lockOperatingRecordPage, - // arguments: {"keyInfo": widget.lockListInfoItemEntity}); + // arguments: {"keyInfo": state.keyInfos.value}); Get.toNamed(Routers.doorLockLogPage, - arguments: {"keyInfo": widget.lockListInfoItemEntity}); + arguments: {"keyInfo": state.keyInfos.value}); }), // 视频日志 bottomItem('images/main/icon_lockDetail_videoLog.png', @@ -441,7 +441,7 @@ class _LockDetailPageState extends State () { // BlueManage().stopScan(); Get.toNamed(Routers.lockSetPage, arguments: { - "lockId": widget.lockListInfoItemEntity.lockId, + "lockId": state.keyInfos.value.lockId, "isOnlyOneData": widget.isOnlyOneData, }); }), diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_state.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_state.dart index 4acdbaf2..7438c7b2 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_state.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_state.dart @@ -35,6 +35,9 @@ class LockDetailState { var iSOpenLock = true.obs; // 是开锁还是关锁 Timer? closedUnlockSuccessfulTimer; + // 0开锁 1长按闭锁 2密码 3卡 4指纹 5遥控 6人脸 7监控 8操作记录 9消息提醒 10设置 + var clickNextType = 0; + //过渡动画控制器 late AnimationController animationController; // var lockState = 0.obs;// 0未连接普通状态 1连接开锁中(展示动画) 2已连接开锁成功 3检测可用性 4连接失败 5连接失败重连中 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 059a7601..2e55d9b9 100644 --- a/star_lock/lib/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart +++ b/star_lock/lib/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart @@ -141,6 +141,9 @@ class LockFeature { int? appUnlockOnline; int? bluetoothBroadcast; int? attendance; + int? motorTorsion; + int? stayWarn; + int? abnormalWarn; LockFeature( {this.password, @@ -191,7 +194,10 @@ class LockFeature { this.hotelLockCardSystem, this.appUnlockOnline, this.bluetoothBroadcast, - this.attendance}); + this.attendance, + this.motorTorsion, + this.stayWarn, + this.abnormalWarn,}); LockFeature.fromJson(Map json) { password = json['password']; @@ -243,6 +249,9 @@ class LockFeature { appUnlockOnline = json['appUnlockOnline']; bluetoothBroadcast = json['bluetoothBroadcast']; attendance = json['attendance']; + motorTorsion = json['motorTorsion']; + stayWarn = json['stayWarn']; + abnormalWarn = json['abnormalWarn']; } Map toJson() { @@ -296,6 +305,9 @@ class LockFeature { data['appUnlockOnline'] = appUnlockOnline; data['bluetoothBroadcast'] = bluetoothBroadcast; data['attendance'] = attendance; + data['motorTorsion'] = motorTorsion; + data['stayWarn'] = stayWarn; + data['abnormalWarn'] = abnormalWarn; return data; } } diff --git a/star_lock/lib/main/lockDetail/lockSet/lockSet/lockSet_logic.dart b/star_lock/lib/main/lockDetail/lockSet/lockSet/lockSet_logic.dart index da55086b..915c18f9 100644 --- a/star_lock/lib/main/lockDetail/lockSet/lockSet/lockSet_logic.dart +++ b/star_lock/lib/main/lockDetail/lockSet/lockSet/lockSet_logic.dart @@ -21,6 +21,7 @@ import '../../../../tools/showTFView.dart'; import '../../../../tools/storage.dart'; import '../../../../translations/trans_lib.dart'; import 'checkingInInfoData_entity.dart'; +import 'lockSetInfo_entity.dart'; import 'lockSet_state.dart'; typedef BlockSetStateCallback = void Function(); @@ -421,8 +422,8 @@ class LockSetLogic extends BaseGetXController { } // 获取锁设置信息 - void getLockSettingInfoData() async { - var entity = await ApiRepository.to.getLockSettingInfoData( + Future getLockSettingInfoData() async { + LockSetInfoEntity entity = await ApiRepository.to.getLockSettingInfoData( lockId: state.lockId.toString(), ); if (entity.errorCode!.codeIsSuccessful) { @@ -441,6 +442,7 @@ class LockSetLogic extends BaseGetXController { // await _readSupportFunctionsNoParameters(56); // _readSupportFunctionsNoParameters(62); } + return entity; } // 当是锁拥有者的时候,删除锁 @@ -736,8 +738,6 @@ class LockSetLogic extends BaseGetXController { // TODO: implement onReady super.onReady(); - getLockSettingInfoData(); - _initReplySubscription(); _scanListDiscoveredDeviceSubscriptionAction(); } 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 ee06c7af..8c4bb3bb 100644 --- a/star_lock/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart +++ b/star_lock/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart @@ -7,12 +7,14 @@ import 'package:star_lock/blue/blue_manage.dart'; import '../../../../appRouters.dart'; import '../../../../app_settings/app_colors.dart'; +import '../../../../tools/EasyRefreshTool.dart'; import '../../../../tools/appRouteObserver.dart'; import '../../../../tools/commonItem.dart'; import '../../../../tools/submitBtn.dart'; import '../../../../tools/titleAppBar.dart'; import '../../../../translations/trans_lib.dart'; +import 'lockSetInfo_entity.dart'; import 'lockSet_logic.dart'; // final RouteObserver routeObserver = RouteObserver(); @@ -27,6 +29,12 @@ class _LockSetPageState extends State with RouteAware { final logic = Get.put(LockSetLogic()); final state = Get.find().state; + Future getHttpData() async { + logic.getLockSettingInfoData().then((LockSetInfoEntity value){ + setState(() {}); + }); + } + @override void initState() { // TODO: implement initState @@ -35,6 +43,8 @@ class _LockSetPageState extends State with RouteAware { logic.initLoadDataAction(() { setState(() {}); }); + + getHttpData(); } @override @@ -45,14 +55,19 @@ class _LockSetPageState extends State with RouteAware { barTitle: TranslationLoader.lanKeys!.set!.tr, haveBack: true, backgroundColor: AppColors.mainColor), - body: Column( - children: [ - Expanded( - child: Obx(() => ListView( - children: getListWidget(), - )), - ), - ], + body: EasyRefreshTool( + onRefresh: (){ + getHttpData(); + }, + child: Column( + children: [ + Expanded( + child: Obx(() => ListView( + children: getListWidget(), + )), + ), + ], + ), )); } @@ -201,7 +216,7 @@ class _LockSetPageState extends State with RouteAware { }))), // 开门器 Visibility( - visible: true, + visible: state.lockFeature.value.doorStatus == 1 ? true : false, child: CommonItem( leftTitel: TranslationLoader.lanKeys!.doorOpener!.tr, rightTitle: "", @@ -285,8 +300,7 @@ 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, child: CommonItem( leftTitel: TranslationLoader.lanKeys!.normallyOpenMode!.tr, rightTitle: (state.lockSettingInfo.value.passageMode ?? 0) == 1 @@ -334,7 +348,7 @@ class _LockSetPageState extends State with RouteAware { // Obx(() => // 面容开锁 Visibility( - visible: true, + visible: state.lockFeature.value.d3Face == 1 ? true : false, child: CommonItem( leftTitel: TranslationLoader.lanKeys!.faceUnlocks!.tr, rightTitle: "", @@ -394,7 +408,7 @@ class _LockSetPageState extends State with RouteAware { // Obx(() => // 开门方向设置 Visibility( - visible: true, + visible: state.lockFeature.value.openDirection == 1 ? true : false, child: CommonItem( leftTitel: TranslationLoader.lanKeys!.openingDirectionSet!.tr, rightTitle: "", @@ -408,7 +422,7 @@ class _LockSetPageState extends State with RouteAware { })), // 电机功率设置 Visibility( - visible: true, + visible: state.lockFeature.value.motorTorsion == 1 ? true : false, child: CommonItem( leftTitel: TranslationLoader.lanKeys!.motorPowerSetting!.tr, rightTitle: "", diff --git a/star_lock/lib/mine/about/about_page.dart b/star_lock/lib/mine/about/about_page.dart index 81abcdf3..82283c67 100644 --- a/star_lock/lib/mine/about/about_page.dart +++ b/star_lock/lib/mine/about/about_page.dart @@ -38,7 +38,7 @@ class _AboutPageState extends State { ), SizedBox(height: 20.h), Text( - "星锁 1.0.0.08(preRelease-20240123)", + "星锁 1.0.0.09(preRelease-20240126-1)", style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor), ), SizedBox(height: 20.h), diff --git a/star_lock/lib/network/api.dart b/star_lock/lib/network/api.dart index 5f658d46..0f0096cc 100644 --- a/star_lock/lib/network/api.dart +++ b/star_lock/lib/network/api.dart @@ -1,6 +1,6 @@ abstract class Api { - static String baseAddress = "https://pre.lock.star-lock.cn"; //预发布环境 - // static String baseAddress = "https://dev.lock.star-lock.cn"; //联调环境 + // static String baseAddress = "https://pre.lock.star-lock.cn"; //预发布环境 + static String baseAddress = "https://dev.lock.star-lock.cn"; //联调环境 // static String baseAddress = "http://192.168.1.15:8022"; //谢总本地 // static String baseAddress = "https://ge.lock.star-lock.cn"; //葛工开发环境地址