From c4739c9f46f7d2ee70c346893600743a963c4b8c Mon Sep 17 00:00:00 2001 From: Daisy <> Date: Fri, 19 Apr 2024 13:47:56 +0800 Subject: [PATCH] =?UTF-8?q?1=EF=BC=8C=E6=96=B0=E5=A2=9E=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E6=9C=89=E4=BA=BA=E6=8C=89=E9=97=A8=E9=93=83=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=AF=B9=E6=8E=A5=202=EF=BC=8C=E6=96=B0=E5=A2=9E=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E6=9C=89=E4=BA=BA=E5=87=BA=E7=8E=B0=E5=9C=A8=E9=97=A8?= =?UTF-8?q?=E5=8F=A3=E6=8E=A5=E5=8F=A3=E5=AF=B9=E6=8E=A5=203=EF=BC=8C?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=AE=BE=E7=BD=AE=E9=98=B2=E6=92=AC=E6=8A=A5?= =?UTF-8?q?=E8=AD=A6=E9=80=9A=E7=9F=A5=E6=8E=A5=E5=8F=A3=E5=AF=B9=E6=8E=A5?= =?UTF-8?q?=204=EF=BC=8C=E9=94=81=E7=94=A8=E6=88=B7=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=BB=93=E6=9E=84=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- star_lock/images/lan/lan_en.json | 4 +- star_lock/images/lan/lan_keys.json | 6 +- star_lock/images/lan/lan_zh.json | 5 +- star_lock/lib/appRouters.dart | 2 +- .../lockSet/lockUser/lockUser_logic.dart | 6 - .../addFamily/addFamily_logic.dart | 6 + .../messageWarn/addFamily/addFamily_page.dart | 7 +- .../addFamily/addFamily_state.dart | 12 + .../familyDetails/familyDetails_state.dart | 8 + .../messageWarn/lockUser/lockUser_entity.dart | 312 ++++++++++++++++++ .../messageWarn/lockUser/lockUser_logic.dart | 16 + .../lockUser/lockUser_page.dart | 9 +- .../lockUser/lockUser_state.dart | 8 + .../coerceFingerprintList_logic.dart | 6 + .../coerceFingerprintList_page.dart | 6 +- .../coerceFingerprintList_state.dart | 7 + .../msgNotification_entity.dart | 10 +- .../msgNotification_logic.dart | 45 ++- .../msgNotification/msgNotification_page.dart | 41 ++- .../msgNotification_state.dart | 5 +- .../openDoorNotify/openDoorNotify_page.dart | 10 +- .../openDoorNotify/openDoorNotify_state.dart | 14 +- .../notificationMode_page.dart | 10 +- star_lock/lib/network/api.dart | 1 + star_lock/lib/network/api_provider.dart | 40 +++ star_lock/lib/network/api_repository.dart | 37 +++ 26 files changed, 577 insertions(+), 56 deletions(-) delete mode 100644 star_lock/lib/main/lockDetail/lockSet/lockUser/lockUser_logic.dart create mode 100644 star_lock/lib/main/lockDetail/messageWarn/lockUser/lockUser_entity.dart create mode 100644 star_lock/lib/main/lockDetail/messageWarn/lockUser/lockUser_logic.dart rename star_lock/lib/main/lockDetail/{lockSet => messageWarn}/lockUser/lockUser_page.dart (96%) rename star_lock/lib/main/lockDetail/{lockSet => messageWarn}/lockUser/lockUser_state.dart (57%) diff --git a/star_lock/images/lan/lan_en.json b/star_lock/images/lan/lan_en.json index 2a415d3a..7048fe21 100644 --- a/star_lock/images/lan/lan_en.json +++ b/star_lock/images/lan/lan_en.json @@ -726,5 +726,7 @@ "微信公众号推送":"Wechat public account", "开启微信接收报警消息需要先关注斯凯智能锁微信公众号,请保存二维码并使用微信扫一扫设置":"To open wechat to receive alarm messages, you need to pay attention to Skye Smart Lock wechat public account first, please save the QR code and use wechat to scan the Settings", "蓝牙":"Bluetooth", - "需要访问蓝牙权限才能使用添加钥匙功能的位置信息":"Access to Bluetooth permissions is required to use the location information of the add key function" + "需要访问蓝牙权限才能使用添加钥匙功能的位置信息":"Access to Bluetooth permissions is required to use the location information of the add key function", + "请输入Email":"Please enter Email", + "请输入手机号":"Please enter mobile phone number" } diff --git a/star_lock/images/lan/lan_keys.json b/star_lock/images/lan/lan_keys.json index 6c9c5263..5d88a3ad 100644 --- a/star_lock/images/lan/lan_keys.json +++ b/star_lock/images/lan/lan_keys.json @@ -725,7 +725,7 @@ "微信公众号推送":"微信公众号推送", "开启微信接收报警消息需要先关注斯凯智能锁微信公众号,请保存二维码并使用微信扫一扫设置":"开启微信接收报警消息需要先关注斯凯智能锁微信公众号,请保存二维码并使用微信扫一扫设置", "蓝牙":"蓝牙", - "需要访问蓝牙权限才能使用添加钥匙功能的位置信息":"需要访问蓝牙权限才能使用添加钥匙功能的位置信息" - - + "需要访问蓝牙权限才能使用添加钥匙功能的位置信息":"需要访问蓝牙权限才能使用添加钥匙功能的位置信息", + "请输入Email":"请输入Email", + "请输入手机号":"请输入手机号" } diff --git a/star_lock/images/lan/lan_zh.json b/star_lock/images/lan/lan_zh.json index 52ecc6c0..a99fa1c9 100644 --- a/star_lock/images/lan/lan_zh.json +++ b/star_lock/images/lan/lan_zh.json @@ -727,6 +727,7 @@ "微信公众号推送":"微信公众号推送", "开启微信接收报警消息需要先关注斯凯智能锁微信公众号,请保存二维码并使用微信扫一扫设置":"开启微信接收报警消息需要先关注斯凯智能锁微信公众号,请保存二维码并使用微信扫一扫设置", "蓝牙":"蓝牙", - "需要访问蓝牙权限才能使用添加钥匙功能的位置信息":"需要访问蓝牙权限才能使用添加钥匙功能的位置信息" - + "需要访问蓝牙权限才能使用添加钥匙功能的位置信息":"需要访问蓝牙权限才能使用添加钥匙功能的位置信息", + "请输入Email":"请输入Email", + "请输入手机号":"请输入手机号" } diff --git a/star_lock/lib/appRouters.dart b/star_lock/lib/appRouters.dart index d6e210aa..f7e1ef52 100644 --- a/star_lock/lib/appRouters.dart +++ b/star_lock/lib/appRouters.dart @@ -18,12 +18,12 @@ import 'package:star_lock/main/lockDetail/lockSet/catEyeSet/catEyeSet/catEyeSet_ import 'package:star_lock/main/lockDetail/lockSet/catEyeSet/videoSlot/videoSlot_page.dart'; import 'package:star_lock/main/lockDetail/lockSet/faceUnlock/faceUnlock_page.dart'; import 'package:star_lock/main/lockDetail/lockSet/liveVideo/liveVideo_page.dart'; -import 'package:star_lock/main/lockDetail/lockSet/lockUser/lockUser_page.dart'; import 'package:star_lock/main/lockDetail/lockSet/motorPower/motorPower_page.dart'; import 'package:star_lock/main/lockDetail/lockSet/openDoorDirection/openDoorDirection_page.dart'; import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_main_page.dart'; import 'package:star_lock/main/lockDetail/messageWarn/addFamily/addFamily_page.dart'; import 'package:star_lock/main/lockDetail/messageWarn/familyDetails/familyDetails_page.dart'; +import 'package:star_lock/main/lockDetail/messageWarn/lockUser/lockUser_page.dart'; import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/coerceOpenDoor/coerceFingerprint/coerceFingerprint_page.dart'; import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/coerceOpenDoor/coerceFingerprintList/coerceFingerprintList_page.dart'; import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/coerceOpenDoor/coerceOpenDoor/coerceOpenDoor_page.dart'; diff --git a/star_lock/lib/main/lockDetail/lockSet/lockUser/lockUser_logic.dart b/star_lock/lib/main/lockDetail/lockSet/lockUser/lockUser_logic.dart deleted file mode 100644 index c3eb30db..00000000 --- a/star_lock/lib/main/lockDetail/lockSet/lockUser/lockUser_logic.dart +++ /dev/null @@ -1,6 +0,0 @@ -import 'package:star_lock/main/lockDetail/lockSet/lockUser/lockUser_state.dart'; -import 'package:star_lock/tools/baseGetXController.dart'; - -class LockUserLogic extends BaseGetXController { - final LockUserState state = LockUserState(); -} diff --git a/star_lock/lib/main/lockDetail/messageWarn/addFamily/addFamily_logic.dart b/star_lock/lib/main/lockDetail/messageWarn/addFamily/addFamily_logic.dart index e69de29b..897a42e0 100644 --- a/star_lock/lib/main/lockDetail/messageWarn/addFamily/addFamily_logic.dart +++ b/star_lock/lib/main/lockDetail/messageWarn/addFamily/addFamily_logic.dart @@ -0,0 +1,6 @@ +import 'package:star_lock/main/lockDetail/messageWarn/addFamily/addFamily_state.dart'; +import 'package:star_lock/tools/baseGetXController.dart'; + +class AddFamilyLogic extends BaseGetXController { + final AddFamilyState state = AddFamilyState(); +} diff --git a/star_lock/lib/main/lockDetail/messageWarn/addFamily/addFamily_page.dart b/star_lock/lib/main/lockDetail/messageWarn/addFamily/addFamily_page.dart index 31fb87f9..0ab589d5 100644 --- a/star_lock/lib/main/lockDetail/messageWarn/addFamily/addFamily_page.dart +++ b/star_lock/lib/main/lockDetail/messageWarn/addFamily/addFamily_page.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/appRouters.dart'; +import 'package:star_lock/main/lockDetail/messageWarn/addFamily/addFamily_logic.dart'; import 'package:star_lock/tools/commonItem.dart'; import 'package:star_lock/tools/submitBtn.dart'; @@ -16,6 +17,9 @@ class AddFamilyPage extends StatefulWidget { } class _AddFamilyPageState extends State { + final logic = Get.put(AddFamilyLogic()); + final state = Get.find().state; + @override Widget build(BuildContext context) { return Scaffold( @@ -35,7 +39,8 @@ class _AddFamilyPageState extends State { isHaveDirection: true, action: () { //锁用户 - Get.toNamed(Routers.lockUserPage); + Get.toNamed(Routers.lockUserPage, + arguments: {'getLockId': state.getLockId.value}); }), CommonItem( leftTitel: '家人', diff --git a/star_lock/lib/main/lockDetail/messageWarn/addFamily/addFamily_state.dart b/star_lock/lib/main/lockDetail/messageWarn/addFamily/addFamily_state.dart index e69de29b..526d6ba3 100644 --- a/star_lock/lib/main/lockDetail/messageWarn/addFamily/addFamily_state.dart +++ b/star_lock/lib/main/lockDetail/messageWarn/addFamily/addFamily_state.dart @@ -0,0 +1,12 @@ +import 'package:get/get.dart'; + +class AddFamilyState { + var getLockId = 0.obs; + + AddFamilyState() { + Map map = Get.arguments; + if (map['getLockId'] != null) { + getLockId.value = map['getLockId']; + } + } +} diff --git a/star_lock/lib/main/lockDetail/messageWarn/familyDetails/familyDetails_state.dart b/star_lock/lib/main/lockDetail/messageWarn/familyDetails/familyDetails_state.dart index f809fa22..c3acf13a 100644 --- a/star_lock/lib/main/lockDetail/messageWarn/familyDetails/familyDetails_state.dart +++ b/star_lock/lib/main/lockDetail/messageWarn/familyDetails/familyDetails_state.dart @@ -4,4 +4,12 @@ import 'package:get/get.dart'; class FamilyDetailsState { TextEditingController changeNameController = TextEditingController(); //修改名称 var familyName = '我'.obs; + var getLockId = 0.obs; + + FamilyDetailsState() { + Map map = Get.arguments; + if (map['lockId'] != null) { + getLockId.value = map['lockId']; + } + } } diff --git a/star_lock/lib/main/lockDetail/messageWarn/lockUser/lockUser_entity.dart b/star_lock/lib/main/lockDetail/messageWarn/lockUser/lockUser_entity.dart new file mode 100644 index 00000000..71de3b6f --- /dev/null +++ b/star_lock/lib/main/lockDetail/messageWarn/lockUser/lockUser_entity.dart @@ -0,0 +1,312 @@ +class LockUserEntity { + int? errorCode; + String? description; + String? errorMsg; + List? data; + + LockUserEntity({this.errorCode, this.description, this.errorMsg, this.data}); + + LockUserEntity.fromJson(Map json) { + errorCode = json['errorCode']; + description = json['description']; + errorMsg = json['errorMsg']; + if (json['data'] != null) { + data = []; + json['data'].forEach((v) { + data!.add(LockUserData.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = {}; + data['errorCode'] = errorCode; + data['description'] = description; + data['errorMsg'] = errorMsg; + if (this.data != null) { + data['data'] = this.data!.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class LockUserData { + int? openLockType; + String? openLockTypeName; + List? lockUserList; + + LockUserData({this.openLockType, this.openLockTypeName, this.lockUserList}); + + LockUserData.fromJson(Map json) { + openLockType = json['openLockType']; + openLockTypeName = json['openLockTypeName']; + if (json['keys'] != null) { + lockUserList = []; + json['keys'].forEach((v) { + lockUserList!.add(LockUserListKeys.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = {}; + data['openLockType'] = openLockType; + data['openLockTypeName'] = openLockTypeName; + if (lockUserList != null) { + data['keys'] = lockUserList!.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class LockUserListKeys { + int? id; + String? clientId; + int? lockOwnerId; + int? apiUserId; + int? lockId; + int? senderUserId; + int? receiverUsernameType; + String? keyName; + int? keyType; + int? startDate; + int? endDate; + List? weekDays; + String? remarks; + int? remoteEnable; + int? isCameraEnable; + int? faceAuthentication; + int? lastFaceValidateTime; + int? keyRight; + int? remoteUnlockSwitch; + int? userType; + int? keyStatus; + int? groupId; + int? lockUserNo; + int? businessId; + String? createdAt; + String? updatedAt; + int? isOnlyManageSelf; + UserInfo? userInfo; + UserInfo? userSender; + int? keyboardPwdType; + int? keyboardPwdStatus; + String? keyboardPwdName; + String? keyboardPwd; + String? keyboardPwdHash; + int? addType; + int? pwdRight; + int? isCustom; + int? isCoerced; + int? hoursStart; + int? hoursEnd; + int? pwdUserNo; + String? senderUsername; + int? keyboardPwdId; + int? sendDate; + + LockUserListKeys( + {this.id, + this.clientId, + this.lockOwnerId, + this.apiUserId, + this.lockId, + this.senderUserId, + this.receiverUsernameType, + this.keyName, + this.keyType, + this.startDate, + this.endDate, + this.weekDays, + this.remarks, + this.remoteEnable, + this.isCameraEnable, + this.faceAuthentication, + this.lastFaceValidateTime, + this.keyRight, + this.remoteUnlockSwitch, + this.userType, + this.keyStatus, + this.groupId, + this.lockUserNo, + this.businessId, + this.createdAt, + this.updatedAt, + this.isOnlyManageSelf, + this.userInfo, + this.userSender, + this.keyboardPwdType, + this.keyboardPwdStatus, + this.keyboardPwdName, + this.keyboardPwd, + this.keyboardPwdHash, + this.addType, + this.pwdRight, + this.isCustom, + this.isCoerced, + this.hoursStart, + this.hoursEnd, + this.pwdUserNo, + this.senderUsername, + this.keyboardPwdId, + this.sendDate}); + + LockUserListKeys.fromJson(Map json) { + id = json['id']; + clientId = json['clientId']; + lockOwnerId = json['lockOwnerId']; + apiUserId = json['apiUserId']; + lockId = json['lockId']; + senderUserId = json['senderUserId']; + receiverUsernameType = json['receiverUsernameType']; + 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']; + lastFaceValidateTime = json['lastFaceValidateTime']; + keyRight = json['keyRight']; + remoteUnlockSwitch = json['remoteUnlockSwitch']; + userType = json['userType']; + keyStatus = json['keyStatus']; + groupId = json['groupId']; + lockUserNo = json['lockUserNo']; + businessId = json['businessId']; + createdAt = json['created_at']; + updatedAt = json['updated_at']; + isOnlyManageSelf = json['isOnlyManageSelf']; + userInfo = + json['user_info'] != null ? UserInfo.fromJson(json['user_info']) : null; + userSender = json['user_sender'] != null + ? UserInfo.fromJson(json['user_sender']) + : null; + keyboardPwdType = json['keyboardPwdType']; + keyboardPwdStatus = json['keyboardPwdStatus']; + keyboardPwdName = json['keyboardPwdName']; + keyboardPwd = json['keyboardPwd']; + keyboardPwdHash = json['keyboardPwdHash']; + addType = json['addType']; + pwdRight = json['pwdRight']; + isCustom = json['isCustom']; + isCoerced = json['isCoerced']; + hoursStart = json['hoursStart']; + hoursEnd = json['hoursEnd']; + pwdUserNo = json['pwdUserNo']; + senderUsername = json['senderUsername']; + keyboardPwdId = json['keyboardPwdId']; + sendDate = json['sendDate']; + } + + Map toJson() { + final Map data = {}; + data['id'] = id; + data['clientId'] = clientId; + data['lockOwnerId'] = lockOwnerId; + data['apiUserId'] = apiUserId; + data['lockId'] = lockId; + data['senderUserId'] = senderUserId; + data['receiverUsernameType'] = receiverUsernameType; + data['keyName'] = keyName; + data['keyType'] = keyType; + data['startDate'] = startDate; + data['endDate'] = endDate; + if (weekDays != null) { + data['weekDays'] = weekDays!.map((v) => v).toList(); + } + data['remarks'] = remarks; + data['remoteEnable'] = remoteEnable; + data['isCameraEnable'] = isCameraEnable; + data['faceAuthentication'] = faceAuthentication; + data['lastFaceValidateTime'] = lastFaceValidateTime; + data['keyRight'] = keyRight; + data['remoteUnlockSwitch'] = remoteUnlockSwitch; + data['userType'] = userType; + data['keyStatus'] = keyStatus; + data['groupId'] = groupId; + data['lockUserNo'] = lockUserNo; + data['businessId'] = businessId; + data['created_at'] = createdAt; + data['updated_at'] = updatedAt; + data['isOnlyManageSelf'] = isOnlyManageSelf; + if (userInfo != null) { + data['user_info'] = userInfo!.toJson(); + } + if (userSender != null) { + data['user_sender'] = userSender!.toJson(); + } + data['keyboardPwdType'] = keyboardPwdType; + data['keyboardPwdStatus'] = keyboardPwdStatus; + data['keyboardPwdName'] = keyboardPwdName; + data['keyboardPwd'] = keyboardPwd; + data['keyboardPwdHash'] = keyboardPwdHash; + data['addType'] = addType; + data['pwdRight'] = pwdRight; + data['isCustom'] = isCustom; + data['isCoerced'] = isCoerced; + data['hoursStart'] = hoursStart; + data['hoursEnd'] = hoursEnd; + data['pwdUserNo'] = pwdUserNo; + data['senderUsername'] = senderUsername; + data['keyboardPwdId'] = keyboardPwdId; + data['sendDate'] = sendDate; + return data; + } +} + +class UserInfo { + int? id; + String? clientId; + String? username; + String? accountName; + String? businessQueryStr; + String? password; + int? date; + String? createdAt; + String? updatedAt; + + UserInfo( + {this.id, + this.clientId, + this.username, + this.accountName, + this.businessQueryStr, + this.password, + this.date, + this.createdAt, + this.updatedAt}); + + UserInfo.fromJson(Map json) { + id = json['id']; + clientId = json['client_id']; + username = json['username']; + accountName = json['account_name']; + businessQueryStr = json['businessQueryStr']; + password = json['password']; + date = json['date']; + createdAt = json['created_at']; + updatedAt = json['updated_at']; + } + + Map toJson() { + final Map data = {}; + data['id'] = id; + data['client_id'] = clientId; + data['username'] = username; + data['account_name'] = accountName; + data['businessQueryStr'] = businessQueryStr; + data['password'] = password; + data['date'] = date; + data['created_at'] = createdAt; + data['updated_at'] = updatedAt; + return data; + } +} diff --git a/star_lock/lib/main/lockDetail/messageWarn/lockUser/lockUser_logic.dart b/star_lock/lib/main/lockDetail/messageWarn/lockUser/lockUser_logic.dart new file mode 100644 index 00000000..0592f491 --- /dev/null +++ b/star_lock/lib/main/lockDetail/messageWarn/lockUser/lockUser_logic.dart @@ -0,0 +1,16 @@ +import 'package:star_lock/main/lockDetail/messageWarn/lockUser/lockUser_entity.dart'; +import 'package:star_lock/main/lockDetail/messageWarn/lockUser/lockUser_state.dart'; +import 'package:star_lock/network/api_repository.dart'; +import 'package:star_lock/tools/baseGetXController.dart'; + +class LockUserLogic extends BaseGetXController { + final LockUserState state = LockUserState(); + + // 锁用户列表 + void getLockNoticeSetting() async { + LockUserEntity entity = await ApiRepository.to.getLockKeysList( + lockId: state.getLockId.value, + ); + if (entity.errorCode!.codeIsSuccessful) {} + } +} diff --git a/star_lock/lib/main/lockDetail/lockSet/lockUser/lockUser_page.dart b/star_lock/lib/main/lockDetail/messageWarn/lockUser/lockUser_page.dart similarity index 96% rename from star_lock/lib/main/lockDetail/lockSet/lockUser/lockUser_page.dart rename to star_lock/lib/main/lockDetail/messageWarn/lockUser/lockUser_page.dart index d04d6aee..32f102e3 100644 --- a/star_lock/lib/main/lockDetail/lockSet/lockUser/lockUser_page.dart +++ b/star_lock/lib/main/lockDetail/messageWarn/lockUser/lockUser_page.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; -import 'package:star_lock/main/lockDetail/lockSet/lockUser/lockUser_logic.dart'; +import 'package:star_lock/main/lockDetail/messageWarn/lockUser/lockUser_logic.dart'; import '../../../../app_settings/app_colors.dart'; import '../../../../tools/submitBtn.dart'; import '../../../../tools/titleAppBar.dart'; @@ -18,6 +18,13 @@ class _LockUserPageState extends State { final logic = Get.put(LockUserLogic()); final state = Get.find().state; + @override + initState() { + super.initState(); + + logic.getLockNoticeSetting(); + } + @override Widget build(BuildContext context) { return Scaffold( diff --git a/star_lock/lib/main/lockDetail/lockSet/lockUser/lockUser_state.dart b/star_lock/lib/main/lockDetail/messageWarn/lockUser/lockUser_state.dart similarity index 57% rename from star_lock/lib/main/lockDetail/lockSet/lockUser/lockUser_state.dart rename to star_lock/lib/main/lockDetail/messageWarn/lockUser/lockUser_state.dart index 8365618c..6f56953d 100644 --- a/star_lock/lib/main/lockDetail/lockSet/lockUser/lockUser_state.dart +++ b/star_lock/lib/main/lockDetail/messageWarn/lockUser/lockUser_state.dart @@ -4,4 +4,12 @@ import 'package:get/get.dart'; class LockUserState { TextEditingController searchController = TextEditingController(); //邮箱/手机号输入框 var isCheck = false.obs; + var getLockId = 0.obs; + + LockUserState() { + Map map = Get.arguments; + if (map['getLockId'] != null) { + getLockId.value = map['getLockId']; + } + } } diff --git a/star_lock/lib/main/lockDetail/messageWarn/msgNotification/coerceOpenDoor/coerceFingerprintList/coerceFingerprintList_logic.dart b/star_lock/lib/main/lockDetail/messageWarn/msgNotification/coerceOpenDoor/coerceFingerprintList/coerceFingerprintList_logic.dart index e69de29b..038090c1 100644 --- a/star_lock/lib/main/lockDetail/messageWarn/msgNotification/coerceOpenDoor/coerceFingerprintList/coerceFingerprintList_logic.dart +++ b/star_lock/lib/main/lockDetail/messageWarn/msgNotification/coerceOpenDoor/coerceFingerprintList/coerceFingerprintList_logic.dart @@ -0,0 +1,6 @@ +import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/coerceOpenDoor/coerceFingerprintList/coerceFingerprintList_state.dart'; +import 'package:star_lock/tools/baseGetXController.dart'; + +class CoerceFingerprintListLogic extends BaseGetXController { + final CoerceFingerprintListState state = CoerceFingerprintListState(); +} diff --git a/star_lock/lib/main/lockDetail/messageWarn/msgNotification/coerceOpenDoor/coerceFingerprintList/coerceFingerprintList_page.dart b/star_lock/lib/main/lockDetail/messageWarn/msgNotification/coerceOpenDoor/coerceFingerprintList/coerceFingerprintList_page.dart index feda7712..5fcf84e0 100644 --- a/star_lock/lib/main/lockDetail/messageWarn/msgNotification/coerceOpenDoor/coerceFingerprintList/coerceFingerprintList_page.dart +++ b/star_lock/lib/main/lockDetail/messageWarn/msgNotification/coerceOpenDoor/coerceFingerprintList/coerceFingerprintList_page.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; -import 'package:star_lock/main/lockDetail/lockSet/lockUser/lockUser_logic.dart'; +import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/coerceOpenDoor/coerceFingerprintList/coerceFingerprintList_logic.dart'; import '../../../../../../app_settings/app_colors.dart'; import '../../../../../../tools/submitBtn.dart'; @@ -17,8 +17,8 @@ class CoerceFingerprintListPage extends StatefulWidget { } class _CoerceFingerprintListPageState extends State { - final logic = Get.put(LockUserLogic()); - final state = Get.find().state; + final logic = Get.put(CoerceFingerprintListLogic()); + final state = Get.find().state; @override Widget build(BuildContext context) { diff --git a/star_lock/lib/main/lockDetail/messageWarn/msgNotification/coerceOpenDoor/coerceFingerprintList/coerceFingerprintList_state.dart b/star_lock/lib/main/lockDetail/messageWarn/msgNotification/coerceOpenDoor/coerceFingerprintList/coerceFingerprintList_state.dart index e69de29b..4778129c 100644 --- a/star_lock/lib/main/lockDetail/messageWarn/msgNotification/coerceOpenDoor/coerceFingerprintList/coerceFingerprintList_state.dart +++ b/star_lock/lib/main/lockDetail/messageWarn/msgNotification/coerceOpenDoor/coerceFingerprintList/coerceFingerprintList_state.dart @@ -0,0 +1,7 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; + +class CoerceFingerprintListState { + TextEditingController searchController = TextEditingController(); //邮箱/手机号输入框 + var isCheck = false.obs; +} diff --git a/star_lock/lib/main/lockDetail/messageWarn/msgNotification/msgNotification/msgNotification_entity.dart b/star_lock/lib/main/lockDetail/messageWarn/msgNotification/msgNotification/msgNotification_entity.dart index f6f4622f..34ccd392 100644 --- a/star_lock/lib/main/lockDetail/messageWarn/msgNotification/msgNotification/msgNotification_entity.dart +++ b/star_lock/lib/main/lockDetail/messageWarn/msgNotification/msgNotification/msgNotification_entity.dart @@ -2,7 +2,7 @@ class MsgNotificationEntity { int? errorCode; String? description; String? errorMsg; - Data? data; + MsgNoticeData? data; MsgNotificationEntity( {this.errorCode, this.description, this.errorMsg, this.data}); @@ -11,7 +11,7 @@ class MsgNotificationEntity { errorCode = json['errorCode']; description = json['description']; errorMsg = json['errorMsg']; - data = json['data'] != null ? Data.fromJson(json['data']) : null; + data = json['data'] != null ? MsgNoticeData.fromJson(json['data']) : null; } Map toJson() { @@ -26,7 +26,7 @@ class MsgNotificationEntity { } } -class Data { +class MsgNoticeData { List? openDoorNoticeList; int? dayNotOpenDoorState; int? dayNotOpenDoorValue; @@ -39,7 +39,7 @@ class Data { int? doorbellNoticeState; int? someoneAtDoorNoticeState; - Data( + MsgNoticeData( {this.openDoorNoticeList, this.dayNotOpenDoorState, this.dayNotOpenDoorValue, @@ -52,7 +52,7 @@ class Data { this.doorbellNoticeState, this.someoneAtDoorNoticeState}); - Data.fromJson(Map json) { + MsgNoticeData.fromJson(Map json) { if (json['openDoorNoticeList'] != null) { openDoorNoticeList = []; json['openDoorNoticeList'].forEach((v) { diff --git a/star_lock/lib/main/lockDetail/messageWarn/msgNotification/msgNotification/msgNotification_logic.dart b/star_lock/lib/main/lockDetail/messageWarn/msgNotification/msgNotification/msgNotification_logic.dart index 88f154a0..5beac582 100644 --- a/star_lock/lib/main/lockDetail/messageWarn/msgNotification/msgNotification/msgNotification_logic.dart +++ b/star_lock/lib/main/lockDetail/messageWarn/msgNotification/msgNotification/msgNotification_logic.dart @@ -12,14 +12,15 @@ class MsgNotificationLogic extends BaseGetXController { lockId: state.getLockId.value, ); if (entity.errorCode!.codeIsSuccessful) { + state.msgNoticeInfo.value = entity.data!; state.nDaysNotOpenDoor.value = - entity.data!.dayNotOpenDoorState! == 0 ? '未启用' : '已启用'; + entity.data!.dayNotOpenDoorState! == 0 ? '未启用' : '已启用'; //N天未开门 state.isDoorNotShut.value = - entity.data!.doorNotCloseState! == 0 ? false : true; + entity.data!.doorNotCloseState! == 0 ? false : true; //门未关好 state.isTamperAlarm.value = - entity.data!.tamperAlarmState! == 0 ? '未启用' : '已启用'; + entity.data!.tamperAlarmState! == 0 ? false : true; //防拆报警 state.isLowBattery.value = - entity.data!.lowElecNoticeState! == 0 ? '未启用' : '已启用'; + entity.data!.lowElecNoticeState! == 0 ? '未启用' : '已启用'; //低电量提醒 state.isSomeoneRing.value = entity.data!.doorbellNoticeState! == 0 ? false : true; //有人按门铃 state.isSomeoneAppeared.value = @@ -38,4 +39,40 @@ class MsgNotificationLogic extends BaseGetXController { showToast('设置成功'); } } + + //有人按门铃 + void updateDoorbellNoticeStateSetting() async { + MsgNotificationEntity entity = + await ApiRepository.to.updateDoorbellNoticeStateSetting( + lockId: state.getLockId.value, + doorbellNoticeState: state.isSomeoneRing.value ? 1 : 0, + ); + if (entity.errorCode!.codeIsSuccessful) { + showToast('设置成功'); + } + } + + //有人出现在门口 + void updateSomeoneAtDoorNoticeStateSetting() async { + MsgNotificationEntity entity = + await ApiRepository.to.updateSomeoneAtDoorNoticeStateSetting( + lockId: state.getLockId.value, + someoneAtDoorNoticeState: state.isSomeoneAppeared.value ? 1 : 0, + ); + if (entity.errorCode!.codeIsSuccessful) { + showToast('设置成功'); + } + } + + //设置防拆报警通知 + void updateTamperAlarmStateSetting() async { + MsgNotificationEntity entity = + await ApiRepository.to.updateTamperAlarmStateSetting( + lockId: state.getLockId.value, + tamperAlarmState: state.isTamperAlarm.value ? 1 : 0, + ); + if (entity.errorCode!.codeIsSuccessful) { + showToast('设置成功'); + } + } } diff --git a/star_lock/lib/main/lockDetail/messageWarn/msgNotification/msgNotification/msgNotification_page.dart b/star_lock/lib/main/lockDetail/messageWarn/msgNotification/msgNotification/msgNotification_page.dart index e9426bad..c446f788 100644 --- a/star_lock/lib/main/lockDetail/messageWarn/msgNotification/msgNotification/msgNotification_page.dart +++ b/star_lock/lib/main/lockDetail/messageWarn/msgNotification/msgNotification/msgNotification_page.dart @@ -77,7 +77,10 @@ class _MsgNotificationPageState extends State { isHaveLine: true, isHaveDirection: true, action: () { - Get.toNamed(Routers.openDoorNotifyPage); + Get.toNamed(Routers.openDoorNotifyPage, arguments: { + 'lockSetInfoData': state.msgNoticeInfo.value, + 'lockId': state.getLockId.value + }); }, ), Obx(() => CommonItem( @@ -107,11 +110,15 @@ class _MsgNotificationPageState extends State { rightWidget: SizedBox(width: 60.w, height: 50.h, child: _switch(2)))), Obx(() => CommonItem( - leftTitel: '防拆报警', - rightTitle: state.isTamperAlarm.value, - isHaveLine: true, - isHaveDirection: true, - )), + leftTitel: '防拆报警', + rightTitle: '', + isHaveLine: true, + isHaveRightWidget: true, + rightWidget: SizedBox( + width: 60.w, + height: 50.h, + child: _switch(5), + ))), Obx(() => CommonItem( leftTitel: '低电量提醒', rightTitle: state.isLowBattery.value, @@ -192,6 +199,11 @@ class _MsgNotificationPageState extends State { case 4: isCheck = state.isSomeoneAppeared.value; break; + //防拆报警 + case 5: + isCheck = state.isTamperAlarm.value; + break; + //低电量提醒 default: } @@ -215,11 +227,24 @@ class _MsgNotificationPageState extends State { break; //有人按门铃 case 3: - state.isSomeoneRing.value = value; + { + state.isSomeoneRing.value = value; + logic.updateDoorbellNoticeStateSetting(); + } break; //有人出现在门口 case 4: - state.isSomeoneAppeared.value = value; + { + state.isSomeoneAppeared.value = value; + logic.updateSomeoneAtDoorNoticeStateSetting(); + } + break; + //防拆报警 + case 5: + { + state.isTamperAlarm.value = value; + logic.updateTamperAlarmStateSetting(); + } break; default: diff --git a/star_lock/lib/main/lockDetail/messageWarn/msgNotification/msgNotification/msgNotification_state.dart b/star_lock/lib/main/lockDetail/messageWarn/msgNotification/msgNotification/msgNotification_state.dart index eba68dcb..11e61d47 100644 --- a/star_lock/lib/main/lockDetail/messageWarn/msgNotification/msgNotification/msgNotification_state.dart +++ b/star_lock/lib/main/lockDetail/messageWarn/msgNotification/msgNotification/msgNotification_state.dart @@ -1,11 +1,12 @@ import 'package:get/get.dart'; +import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/msgNotification/msgNotification_entity.dart'; class MsgNotificationState { - // var lockSetInfoData = LockSetInfoData().obs; + var msgNoticeInfo = MsgNoticeData().obs; var getLockId = 0.obs; var isCheck = false.obs; var nDaysNotOpenDoor = '已启用'.obs; //N天未开门 - var isTamperAlarm = '已启用'.obs; //防拆报警 + var isTamperAlarm = false.obs; //防拆报警 var isLowBattery = '已启用'.obs; //低电量提醒 var isLeaveHomeOpenDoor = false.obs; //离家开门 var isDoorNotShut = false.obs; //门未关好 diff --git a/star_lock/lib/main/lockDetail/messageWarn/msgNotification/openDoorNotify/openDoorNotify_page.dart b/star_lock/lib/main/lockDetail/messageWarn/msgNotification/openDoorNotify/openDoorNotify_page.dart index c24a07e3..22517e5c 100644 --- a/star_lock/lib/main/lockDetail/messageWarn/msgNotification/openDoorNotify/openDoorNotify_page.dart +++ b/star_lock/lib/main/lockDetail/messageWarn/msgNotification/openDoorNotify/openDoorNotify_page.dart @@ -40,14 +40,11 @@ class _OpenDoorNotifyPageState extends State { height: 20.h, ), Expanded(child: _buildMainUI()), - // Expanded( - // child: Obx(() => state.itemDataList.value.isEmpty - // ? const NoData() - // : _buildMainUI(state.itemDataList.value))), AddBottomWhiteBtn( btnName: '添加家人', onClick: () { - Get.toNamed(Routers.addFamilyPage); + Get.toNamed(Routers.addFamilyPage, + arguments: {'getLockId': state.getLockId.value}); }, ), SizedBox( @@ -70,7 +67,7 @@ class _OpenDoorNotifyPageState extends State { Widget _buildMainUI() { return ListView.separated( shrinkWrap: true, - itemCount: 3, + itemCount: state.msgNoticeInfo.value.openDoorNoticeList?.length ?? 0, itemBuilder: (c, index) { return _electronicKeyItem( 'images/controls_user.png', '18682150237', '电子钥匙', () { @@ -111,7 +108,6 @@ class _OpenDoorNotifyPageState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( familyAccount, diff --git a/star_lock/lib/main/lockDetail/messageWarn/msgNotification/openDoorNotify/openDoorNotify_state.dart b/star_lock/lib/main/lockDetail/messageWarn/msgNotification/openDoorNotify/openDoorNotify_state.dart index 08e520d9..fb749d19 100644 --- a/star_lock/lib/main/lockDetail/messageWarn/msgNotification/openDoorNotify/openDoorNotify_state.dart +++ b/star_lock/lib/main/lockDetail/messageWarn/msgNotification/openDoorNotify/openDoorNotify_state.dart @@ -1,16 +1,20 @@ import 'package:get/get.dart'; -import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart'; +import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/msgNotification/msgNotification_entity.dart'; class OpenDoorNotifyState { - var lockSetInfoData = LockSetInfoData().obs; + var msgNoticeInfo = MsgNoticeData().obs; var pageNum = 1.obs; //请求页码 final pageSize = 20.obs; //请求每页数据条数 - final itemDataList = [].obs; + var itemDataList = [].obs; + var getLockId = 0.obs; OpenDoorNotifyState() { Map map = Get.arguments; - if (map['lockSetInfoData'] != null) { - lockSetInfoData.value = map['lockSetInfoData']; + if (map['msgNoticeInfo'] != null) { + msgNoticeInfo.value = map['msgNoticeInfo']; + } + if (map['lockId'] != null) { + getLockId.value = map['lockId']; } } } diff --git a/star_lock/lib/main/lockDetail/messageWarn/notificationMode/notificationMode_page.dart b/star_lock/lib/main/lockDetail/messageWarn/notificationMode/notificationMode_page.dart index 6b38c758..bf76d011 100644 --- a/star_lock/lib/main/lockDetail/messageWarn/notificationMode/notificationMode_page.dart +++ b/star_lock/lib/main/lockDetail/messageWarn/notificationMode/notificationMode_page.dart @@ -128,7 +128,7 @@ class _NotificationModePageState extends State { height: 60.h, ), SubmitBtn( - btnName: '确定', + btnName: '确定'.tr, onClick: () {}, ) ], @@ -175,8 +175,8 @@ class _NotificationModePageState extends State { isHaveLine: true, isHaveRightWidget: true, rightWidget: isEmail - ? getEmailTFWidget('请输入Email', 1) - : getPhoneWidget('请输入手机号', 1)), + ? getEmailTFWidget('请输入Email'.tr, 1) + : getPhoneWidget('请输入手机号'.tr, 1)), Divider( color: AppColors.greyLineColor, indent: 20.w, @@ -216,8 +216,6 @@ class _NotificationModePageState extends State { autofocus: false, textAlign: TextAlign.end, decoration: InputDecoration( - //输入里面输入文字内边距设置 - contentPadding: const EdgeInsets.only(top: -12.0, bottom: 0.0), hintText: tfStr, hintStyle: TextStyle(fontSize: 22.sp), //不需要输入框下划线 @@ -282,8 +280,6 @@ class _NotificationModePageState extends State { autofocus: false, textAlign: TextAlign.end, decoration: InputDecoration( - //输入里面输入文字内边距设置 - contentPadding: const EdgeInsets.only(top: -12.0, bottom: 0.0), hintText: tfStr, hintStyle: TextStyle(fontSize: 22.sp), //不需要输入框下划线 diff --git a/star_lock/lib/network/api.dart b/star_lock/lib/network/api.dart index 2d8f0c23..dda5e6f9 100644 --- a/star_lock/lib/network/api.dart +++ b/star_lock/lib/network/api.dart @@ -198,6 +198,7 @@ abstract class Api { '/lockSetting/getLockNoticeSetting'; //获取锁消息设置 final String updateLockNoticeSettingURL = '/lockSetting/updateLockNoticeSetting'; //设置开门通知 + final String lockKeysListURL = '/lock/lockKeysList'; //锁钥匙列表 final String setWechatPushSwitchURL = '/user/setMpWechatPushSwitch'; //设置微信公众号推送 diff --git a/star_lock/lib/network/api_provider.dart b/star_lock/lib/network/api_provider.dart index b9933145..89512ab9 100644 --- a/star_lock/lib/network/api_provider.dart +++ b/star_lock/lib/network/api_provider.dart @@ -1813,6 +1813,46 @@ class ApiProvider extends BaseProvider { 'doorNotCloseState': doorNotCloseState, })); + // 设置有人按门铃状态 + Future updateDoorbellNoticeStateSetting( + int lockId, + int doorbellNoticeState, + ) => + post( + updateLockNoticeSettingURL.toUrl, + jsonEncode({ + 'lockId': lockId, + 'doorbellNoticeState': doorbellNoticeState, + })); + + // 设置有人出现在门口 + Future updateSomeoneAtDoorNoticeStateSetting( + int lockId, + int someoneAtDoorNoticeState, + ) => + post( + updateLockNoticeSettingURL.toUrl, + jsonEncode({ + 'lockId': lockId, + 'someoneAtDoorNoticeState': someoneAtDoorNoticeState, + })); + + // 设置防拆报警通知 + Future updaTetamperAlarmStateSetting( + int lockId, + int tamperAlarmState, + ) => + post( + updateLockNoticeSettingURL.toUrl, + jsonEncode({ + 'lockId': lockId, + 'tamperAlarmState': tamperAlarmState, + })); + + // 锁用户列表 + Future getLockKeysList(int lockId) => + post(lockKeysListURL.toUrl, jsonEncode({'lockId': lockId})); + // 设置微信公众号推送 Future setMpWechatPushSwitch(int mpWechatPushSwitch) => post( setWechatPushSwitchURL.toUrl, diff --git a/star_lock/lib/network/api_repository.dart b/star_lock/lib/network/api_repository.dart index abc584c1..b18d3e92 100644 --- a/star_lock/lib/network/api_repository.dart +++ b/star_lock/lib/network/api_repository.dart @@ -7,6 +7,7 @@ import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/ma import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart'; import 'package:star_lock/main/lockDetail/face/addFace/addFace_entity.dart'; import 'package:star_lock/main/lockDetail/lockSet/basicInformation/basicInformation/KeyDetailEntity.dart'; +import 'package:star_lock/main/lockDetail/messageWarn/lockUser/lockUser_entity.dart'; import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/msgNotification/msgNotification_entity.dart'; import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart'; import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart'; @@ -1839,6 +1840,42 @@ class ApiRepository { return MsgNotificationEntity.fromJson(res.body); } + // 设置有人按门铃状态 + Future updateDoorbellNoticeStateSetting({ + required int lockId, + required int doorbellNoticeState, + }) async { + final res = await apiProvider.updateDoorbellNoticeStateSetting( + lockId, doorbellNoticeState); + return MsgNotificationEntity.fromJson(res.body); + } + +// 设置有人出现在门口 + Future updateSomeoneAtDoorNoticeStateSetting({ + required int lockId, + required int someoneAtDoorNoticeState, + }) async { + final res = await apiProvider.updateSomeoneAtDoorNoticeStateSetting( + lockId, someoneAtDoorNoticeState); + return MsgNotificationEntity.fromJson(res.body); + } + + // 设置防拆报警通知 + Future updateTamperAlarmStateSetting({ + required int lockId, + required int tamperAlarmState, + }) async { + final res = await apiProvider.updaTetamperAlarmStateSetting( + lockId, tamperAlarmState); + return MsgNotificationEntity.fromJson(res.body); + } + + // 锁用户列表 + Future getLockKeysList({required int lockId}) async { + final res = await apiProvider.getLockKeysList(lockId); + return LockUserEntity.fromJson(res.body); + } + // 设置微信公众号推送 Future setMpWechatPushSwitch( {required int mpWechatPushSwitch}) async {