1,新增锁用户接口对接及差异化处理
2,根据返回的不同类型钥匙用户来进行统一化管理 3,选择开门方式及家人的逻辑处理及同步 4,全自动锁视频对讲改为全屏 5,新增消息提醒模块部分国际化
This commit is contained in:
parent
f78e95d6d5
commit
3a6906f233
@ -728,5 +728,18 @@
|
||||
"蓝牙":"Bluetooth",
|
||||
"需要访问蓝牙权限才能使用添加钥匙功能的位置信息":"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"
|
||||
"请输入手机号":"Please enter mobile phone number",
|
||||
"家人到家":"Family gets home",
|
||||
"添加家人":"Add family",
|
||||
"若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择":"If the lock is not connected to the Internet, in addition to the electronic key, the password, card, fingerprint and other door reminders can not be sent in time, please choose according to your actual situation",
|
||||
"消息提醒":"Message reminder",
|
||||
"开门通知":"Opening notice",
|
||||
"N天未开门":"N days without opening the door",
|
||||
"门未关好":"The door is not closed",
|
||||
"防拆报警":"Tamper alarm",
|
||||
"低电量提醒":"Low power reminder",
|
||||
"胁迫开门":"Forced door opening",
|
||||
"有人按门铃":"Someone rings the doorbell",
|
||||
"有人出现在门口":"Someone appears at the door",
|
||||
"提醒方式":"Reminder mode"
|
||||
}
|
||||
|
||||
@ -727,5 +727,18 @@
|
||||
"蓝牙":"蓝牙",
|
||||
"需要访问蓝牙权限才能使用添加钥匙功能的位置信息":"需要访问蓝牙权限才能使用添加钥匙功能的位置信息",
|
||||
"请输入Email":"请输入Email",
|
||||
"请输入手机号":"请输入手机号"
|
||||
"请输入手机号":"请输入手机号",
|
||||
"家人到家":"家人到家",
|
||||
"添加家人":"添加家人",
|
||||
"若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择":"若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择",
|
||||
"消息提醒":"消息提醒",
|
||||
"开门通知":"开门通知",
|
||||
"N天未开门":"N天未开门",
|
||||
"门未关好":"门未关好",
|
||||
"防拆报警":"防拆报警",
|
||||
"低电量提醒":"低电量提醒",
|
||||
"胁迫开门":"胁迫开门",
|
||||
"有人按门铃":"有人按门铃",
|
||||
"有人出现在门口":"有人出现在门口",
|
||||
"提醒方式":"提醒方式"
|
||||
}
|
||||
|
||||
@ -729,5 +729,19 @@
|
||||
"蓝牙":"蓝牙",
|
||||
"需要访问蓝牙权限才能使用添加钥匙功能的位置信息":"需要访问蓝牙权限才能使用添加钥匙功能的位置信息",
|
||||
"请输入Email":"请输入Email",
|
||||
"请输入手机号":"请输入手机号"
|
||||
"请输入手机号":"请输入手机号",
|
||||
"家人到家":"家人到家",
|
||||
"添加家人":"添加家人",
|
||||
"若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择":"若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择",
|
||||
"消息提醒":"消息提醒",
|
||||
"开门通知":"开门通知",
|
||||
"N天未开门":"N天未开门",
|
||||
"门未关好":"门未关好",
|
||||
"防拆报警":"防拆报警",
|
||||
"低电量提醒":"低电量提醒",
|
||||
"胁迫开门":"胁迫开门",
|
||||
"有人按门铃":"有人按门铃",
|
||||
"有人出现在门口":"有人出现在门口",
|
||||
"提醒方式":"提醒方式",
|
||||
"电子钥匙":"电子钥匙"
|
||||
}
|
||||
|
||||
@ -32,24 +32,32 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
|
||||
padding: EdgeInsets.all(30.w),
|
||||
child: Column(
|
||||
children: [
|
||||
CommonItem(
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: '开门方式',
|
||||
rightTitle: '请选择',
|
||||
rightTitle: state.lockUserKeys.value.currentKeyTypeStr ?? '请选择',
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
//锁用户
|
||||
Get.toNamed(Routers.lockUserPage,
|
||||
arguments: {'getLockId': state.getLockId.value});
|
||||
}),
|
||||
CommonItem(
|
||||
leftTitel: '家人',
|
||||
rightTitle: '',
|
||||
isHaveLine: true,
|
||||
isHaveRightWidget: true,
|
||||
isHaveDirection: false,
|
||||
rightWidget: getFamilyWidget('请输入'),
|
||||
),
|
||||
arguments: {'getLockId': state.getLockId.value})
|
||||
?.then((val) {
|
||||
if (val != null) {
|
||||
state.lockUserKeys.value = val;
|
||||
}
|
||||
});
|
||||
})),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: '家人',
|
||||
rightTitle: state.lockUserKeys.value.currentKeyName ?? '',
|
||||
isHaveLine: true,
|
||||
isHaveRightWidget:
|
||||
state.lockUserKeys.value.currentKeyName == null
|
||||
? true
|
||||
: false,
|
||||
isHaveDirection: false,
|
||||
rightWidget: getFamilyWidget('请输入'),
|
||||
)),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/messageWarn/lockUser/lockUser_entity.dart';
|
||||
|
||||
class AddFamilyState {
|
||||
var getLockId = 0.obs;
|
||||
var lockUserKeys = LockUserListKeys().obs;
|
||||
|
||||
AddFamilyState() {
|
||||
Map map = Get.arguments;
|
||||
|
||||
@ -60,13 +60,13 @@ class LockUserData {
|
||||
}
|
||||
|
||||
class LockUserListKeys {
|
||||
int? id;
|
||||
// int? id;
|
||||
String? clientId;
|
||||
int? lockOwnerId;
|
||||
int? apiUserId;
|
||||
int? lockId;
|
||||
int? senderUserId;
|
||||
int? receiverUsernameType;
|
||||
// int? senderUserId;
|
||||
// int? receiverUsernameType;
|
||||
String? keyName;
|
||||
int? keyType;
|
||||
int? startDate;
|
||||
@ -90,8 +90,14 @@ class LockUserListKeys {
|
||||
UserInfo? userInfo;
|
||||
UserInfo? userSender;
|
||||
int? keyboardPwdType;
|
||||
int? fingerprintType;
|
||||
int? cardType;
|
||||
int? faceType;
|
||||
int? keyboardPwdStatus;
|
||||
String? keyboardPwdName;
|
||||
String? fingerprintName;
|
||||
String? cardName;
|
||||
String? faceName;
|
||||
String? keyboardPwd;
|
||||
String? keyboardPwdHash;
|
||||
int? addType;
|
||||
@ -104,15 +110,22 @@ class LockUserListKeys {
|
||||
String? senderUsername;
|
||||
int? keyboardPwdId;
|
||||
int? sendDate;
|
||||
int? currentKeyType; //当前钥匙类型 1:电子钥匙 2:密码钥匙 3:指纹钥匙 4:卡钥匙 5:人脸钥匙
|
||||
String? currentKeyTypeStr; //当前钥匙类型名称
|
||||
String? currentTypeImg; //当前钥匙类型图片
|
||||
String? currentKeyName; //当前钥匙名称
|
||||
bool? isCurrentSelect; //当前是否选中
|
||||
int? currentDateType; //钥匙日期类型 1:永久 2:限期 3:单次 4:循环
|
||||
|
||||
LockUserListKeys(
|
||||
{this.id,
|
||||
{
|
||||
// this.id,
|
||||
this.clientId,
|
||||
this.lockOwnerId,
|
||||
this.apiUserId,
|
||||
this.lockId,
|
||||
this.senderUserId,
|
||||
this.receiverUsernameType,
|
||||
// this.senderUserId,
|
||||
// this.receiverUsernameType,
|
||||
this.keyName,
|
||||
this.keyType,
|
||||
this.startDate,
|
||||
@ -136,8 +149,14 @@ class LockUserListKeys {
|
||||
this.userInfo,
|
||||
this.userSender,
|
||||
this.keyboardPwdType,
|
||||
this.fingerprintType,
|
||||
this.cardType,
|
||||
this.faceType,
|
||||
this.keyboardPwdStatus,
|
||||
this.keyboardPwdName,
|
||||
this.fingerprintName,
|
||||
this.cardName,
|
||||
this.faceName,
|
||||
this.keyboardPwd,
|
||||
this.keyboardPwdHash,
|
||||
this.addType,
|
||||
@ -149,16 +168,21 @@ class LockUserListKeys {
|
||||
this.pwdUserNo,
|
||||
this.senderUsername,
|
||||
this.keyboardPwdId,
|
||||
this.sendDate});
|
||||
this.sendDate,
|
||||
this.currentKeyType,
|
||||
this.currentTypeImg,
|
||||
this.currentKeyName,
|
||||
this.isCurrentSelect,
|
||||
this.currentDateType});
|
||||
|
||||
LockUserListKeys.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
// id = json['id'];
|
||||
clientId = json['clientId'];
|
||||
lockOwnerId = json['lockOwnerId'];
|
||||
apiUserId = json['apiUserId'];
|
||||
lockId = json['lockId'];
|
||||
senderUserId = json['senderUserId'];
|
||||
receiverUsernameType = json['receiverUsernameType'];
|
||||
// senderUserId = json['senderUserId'];
|
||||
// receiverUsernameType = json['receiverUsernameType'];
|
||||
keyName = json['keyName'];
|
||||
keyType = json['keyType'];
|
||||
startDate = json['startDate'];
|
||||
@ -190,8 +214,14 @@ class LockUserListKeys {
|
||||
? UserInfo.fromJson(json['user_sender'])
|
||||
: null;
|
||||
keyboardPwdType = json['keyboardPwdType'];
|
||||
fingerprintType = json['fingerprintType'];
|
||||
cardType = json['cardType'];
|
||||
faceType = json['faceType'];
|
||||
keyboardPwdStatus = json['keyboardPwdStatus'];
|
||||
keyboardPwdName = json['keyboardPwdName'];
|
||||
fingerprintName = json['fingerprintName'];
|
||||
cardName = json['cardName'];
|
||||
faceName = json['faceName'];
|
||||
keyboardPwd = json['keyboardPwd'];
|
||||
keyboardPwdHash = json['keyboardPwdHash'];
|
||||
addType = json['addType'];
|
||||
@ -204,17 +234,22 @@ class LockUserListKeys {
|
||||
senderUsername = json['senderUsername'];
|
||||
keyboardPwdId = json['keyboardPwdId'];
|
||||
sendDate = json['sendDate'];
|
||||
currentKeyType = json['currentKeyType'];
|
||||
currentTypeImg = json['currentTypeImg'];
|
||||
currentKeyName = json['currentKeyName'];
|
||||
isCurrentSelect = json['isCurrentSelect'];
|
||||
currentDateType = json['currentDateType'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['id'] = id;
|
||||
// data['id'] = id;
|
||||
data['clientId'] = clientId;
|
||||
data['lockOwnerId'] = lockOwnerId;
|
||||
data['apiUserId'] = apiUserId;
|
||||
data['lockId'] = lockId;
|
||||
data['senderUserId'] = senderUserId;
|
||||
data['receiverUsernameType'] = receiverUsernameType;
|
||||
// data['senderUserId'] = senderUserId;
|
||||
// data['receiverUsernameType'] = receiverUsernameType;
|
||||
data['keyName'] = keyName;
|
||||
data['keyType'] = keyType;
|
||||
data['startDate'] = startDate;
|
||||
@ -244,8 +279,14 @@ class LockUserListKeys {
|
||||
data['user_sender'] = userSender!.toJson();
|
||||
}
|
||||
data['keyboardPwdType'] = keyboardPwdType;
|
||||
data['fingerprintType'] = fingerprintType;
|
||||
data['cardType'] = cardType;
|
||||
data['faceType'] = faceType;
|
||||
data['keyboardPwdStatus'] = keyboardPwdStatus;
|
||||
data['keyboardPwdName'] = keyboardPwdName;
|
||||
data['fingerprintName'] = fingerprintName;
|
||||
data['cardName'] = cardName;
|
||||
data['faceName'] = faceName;
|
||||
data['keyboardPwd'] = keyboardPwd;
|
||||
data['keyboardPwdHash'] = keyboardPwdHash;
|
||||
data['addType'] = addType;
|
||||
@ -258,6 +299,12 @@ class LockUserListKeys {
|
||||
data['senderUsername'] = senderUsername;
|
||||
data['keyboardPwdId'] = keyboardPwdId;
|
||||
data['sendDate'] = sendDate;
|
||||
data['currentKeyType'] = currentKeyType;
|
||||
data['currentTypeImg'] = currentTypeImg;
|
||||
data['currentKeyName'] = currentKeyName;
|
||||
data['isCurrentSelect'] = isCurrentSelect;
|
||||
data['currentDateType'] = currentDateType;
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,16 +1,242 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||
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';
|
||||
import 'package:star_lock/tools/dateTool.dart';
|
||||
|
||||
class LockUserLogic extends BaseGetXController {
|
||||
final LockUserState state = LockUserState();
|
||||
|
||||
// 锁用户列表
|
||||
void getLockNoticeSetting() async {
|
||||
void getLockKeysList() async {
|
||||
LockUserEntity entity = await ApiRepository.to.getLockKeysList(
|
||||
lockId: state.getLockId.value,
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {}
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
//当前钥匙类型 1:电子钥匙 2:密码钥匙 3:指纹钥匙 4:卡钥匙 5:人脸钥匙
|
||||
LockUserData data1 = entity.data![0];
|
||||
data1.lockUserList?.forEach((element) {
|
||||
element.currentKeyType = 1;
|
||||
element.currentKeyTypeStr = '电子钥匙'.tr;
|
||||
element.currentTypeImg = 'images/controls_user.png';
|
||||
element.currentKeyName = element.keyName;
|
||||
element.isCurrentSelect = false;
|
||||
element.currentDateType = element.keyType;
|
||||
});
|
||||
LockUserData data2 = entity.data![1];
|
||||
data2.lockUserList?.forEach((element) {
|
||||
element.currentKeyType = 2;
|
||||
element.currentKeyTypeStr = '密码'.tr;
|
||||
element.currentTypeImg = 'images/icon_password.png';
|
||||
element.currentKeyName = element.keyboardPwdName;
|
||||
element.isCurrentSelect = false;
|
||||
element.currentDateType = element.keyboardPwdType;
|
||||
});
|
||||
LockUserData data3 = entity.data![2];
|
||||
data3.lockUserList?.forEach((element) {
|
||||
element.currentKeyType = 3;
|
||||
element.currentKeyTypeStr = '指纹'.tr;
|
||||
element.currentTypeImg = 'images/icon_fingerprint.png';
|
||||
element.currentKeyName = element.fingerprintName;
|
||||
element.isCurrentSelect = false;
|
||||
element.currentDateType = element.fingerprintType;
|
||||
});
|
||||
LockUserData data4 = entity.data![3];
|
||||
data4.lockUserList?.forEach((element) {
|
||||
element.currentKeyType = 4;
|
||||
element.currentKeyTypeStr = '卡'.tr;
|
||||
element.currentTypeImg = 'images/icon_card.png';
|
||||
element.currentKeyName = element.cardName;
|
||||
element.isCurrentSelect = false;
|
||||
element.currentDateType = element.cardType;
|
||||
});
|
||||
LockUserData data5 = entity.data![4];
|
||||
data5.lockUserList?.forEach((element) {
|
||||
element.currentKeyType = 5;
|
||||
element.currentKeyTypeStr = '人脸'.tr;
|
||||
element.currentTypeImg = 'images/icon_face.png';
|
||||
element.currentKeyName = element.faceName;
|
||||
element.isCurrentSelect = false;
|
||||
element.currentDateType = element.faceType;
|
||||
});
|
||||
|
||||
state.lockUserList.value.addAll(data1.lockUserList!);
|
||||
state.lockUserList.value.addAll(data2.lockUserList!);
|
||||
state.lockUserList.value.addAll(data3.lockUserList!);
|
||||
state.lockUserList.value.addAll(data4.lockUserList!);
|
||||
state.lockUserList.value.addAll(data5.lockUserList!);
|
||||
|
||||
state.lockUserList.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
String getKeyUseDateStr(LockUserListKeys itemData) {
|
||||
var keyDateTypeStr = "";
|
||||
switch (itemData.currentKeyType) {
|
||||
case 1: //电子钥匙
|
||||
keyDateTypeStr = getElectronicKeyUseDateStr(itemData);
|
||||
break;
|
||||
case 2: //密码钥匙
|
||||
keyDateTypeStr = getPasswordUseDateStr(itemData);
|
||||
break;
|
||||
case 3: //指纹钥匙
|
||||
keyDateTypeStr = getfingerprintUseDateStr(itemData);
|
||||
break;
|
||||
case 4: //卡钥匙
|
||||
case 5: //人脸钥匙
|
||||
keyDateTypeStr = getCardAndFaceDateType(itemData);
|
||||
break;
|
||||
default:
|
||||
keyDateTypeStr = "".tr;
|
||||
break;
|
||||
}
|
||||
|
||||
return keyDateTypeStr;
|
||||
}
|
||||
|
||||
//获取电子钥匙使用期限
|
||||
String getElectronicKeyUseDateStr(LockUserListKeys indexEntity) {
|
||||
String useDateStr = '';
|
||||
if (indexEntity.keyType == XSConstantMacro.keyTypeTime) {
|
||||
//限期
|
||||
DateTime startDateStr =
|
||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
|
||||
DateTime endDateStr =
|
||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
|
||||
useDateStr =
|
||||
'${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}';
|
||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) {
|
||||
//永久
|
||||
useDateStr = "永久".tr;
|
||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) {
|
||||
//单次
|
||||
useDateStr = "单次".tr;
|
||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) {
|
||||
//循环
|
||||
useDateStr = '循环'.tr;
|
||||
}
|
||||
|
||||
return useDateStr;
|
||||
}
|
||||
|
||||
//获取密码有效期
|
||||
String getPasswordUseDateStr(LockUserListKeys itemData) {
|
||||
int? getPwdType = itemData.keyboardPwdType;
|
||||
String useDateStr = '';
|
||||
DateTime sendDateStr =
|
||||
DateTime.fromMillisecondsSinceEpoch(itemData.sendDate!);
|
||||
DateTime startDateStr =
|
||||
DateTime.fromMillisecondsSinceEpoch(itemData.startDate!);
|
||||
DateTime endDateStr =
|
||||
DateTime.fromMillisecondsSinceEpoch(itemData.endDate!);
|
||||
int starHour = startDateStr.hour;
|
||||
int endHour = endDateStr.hour;
|
||||
|
||||
// print("sendDateStr.toLocal().toString():${sendDateStr.toLocal().toString()}");
|
||||
switch (getPwdType) {
|
||||
case 1:
|
||||
//单次 1 只能在开始时间后6小时内使用一次
|
||||
useDateStr = "单次".tr;
|
||||
break;
|
||||
case 2:
|
||||
//永久 2 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效
|
||||
useDateStr = "永久".tr;
|
||||
break;
|
||||
case 3:
|
||||
//限期 3 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效
|
||||
useDateStr =
|
||||
'${startDateStr.toLocal().toString().substring(0, 16)} - ${endDateStr.toLocal().toString().substring(0, 16)} ${"限时".tr} ${itemData.isCustom! == 1 ? "自定义".tr : ""}';
|
||||
break;
|
||||
case 4:
|
||||
//删除 4 在锁上使用后会删除之前在锁上使用过的密码
|
||||
useDateStr =
|
||||
'${endDateStr.toLocal().toString().substring(0, 16)} ${"清空码".tr}';
|
||||
break;
|
||||
case 5:
|
||||
//周未循环 5 在周未开始和结束时间指定时间段内有效
|
||||
useDateStr =
|
||||
'${endDateStr.toLocal().toString().substring(0, 16)} ${"周末".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
||||
break;
|
||||
case 6:
|
||||
//每日循环 6 每天开始和结束时间指定时间段内有效
|
||||
useDateStr =
|
||||
'${endDateStr.toLocal().toString().substring(0, 16)} ${"每日".tr}$starHour:00-$endHour:00 ${"循环"}';
|
||||
break;
|
||||
case 7:
|
||||
//工作日循环 7 工作日开始和结束时间指定的时间段内有效
|
||||
useDateStr =
|
||||
'${endDateStr.toLocal().toString().substring(0, 16)} ${"工作日".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
||||
break;
|
||||
case 8:
|
||||
//周一循环 8 每周一开始和结束时间指定时间段内有效
|
||||
useDateStr =
|
||||
'${endDateStr.toLocal().toString().substring(0, 16)} ${"周一".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
||||
break;
|
||||
case 9:
|
||||
//周二循环 9 每周二开始和结束时间指定时间段内有效
|
||||
useDateStr =
|
||||
'${endDateStr.toLocal().toString().substring(0, 16)} ${"周二".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
||||
break;
|
||||
case 10:
|
||||
//周三循环 10 每周三开始和结束时间指定时间段内有效
|
||||
useDateStr =
|
||||
'${endDateStr.toLocal().toString().substring(0, 16)} ${"周三".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
||||
break;
|
||||
case 11:
|
||||
//周四循环 11 每周四开始和结束时间指定时间段内有效
|
||||
useDateStr =
|
||||
'${endDateStr.toLocal().toString().substring(0, 16)} ${"周四".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
||||
break;
|
||||
case 12:
|
||||
//周五循环 12 每周五开始和结束时间指定时间段内有效
|
||||
useDateStr =
|
||||
'${endDateStr.toLocal().toString().substring(0, 16)} ${"周五".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
||||
break;
|
||||
case 13:
|
||||
//周六循环 13 每周六开始和结束时间指定时间段内有效
|
||||
useDateStr =
|
||||
'${endDateStr.toLocal().toString().substring(0, 16)} ${"周六".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
||||
break;
|
||||
case 14:
|
||||
//周天循环 14 每周日开始和结束时间指定时间段内有效
|
||||
useDateStr =
|
||||
'${endDateStr.toLocal().toString().substring(0, 16)} ${"周日".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
||||
break;
|
||||
|
||||
default:
|
||||
}
|
||||
return useDateStr;
|
||||
}
|
||||
|
||||
//获取指纹有效期
|
||||
String getfingerprintUseDateStr(LockUserListKeys fingerprintItemData) {
|
||||
var keyDateTypeStr = ""; // 永久:1;限时2,单次3,循环:4
|
||||
if (fingerprintItemData.fingerprintType! == 1) {
|
||||
keyDateTypeStr = "永久".tr;
|
||||
} else if (fingerprintItemData.fingerprintType! == 2) {
|
||||
keyDateTypeStr =
|
||||
"${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())} 限时";
|
||||
} else if (fingerprintItemData.fingerprintType! == 4) {
|
||||
keyDateTypeStr =
|
||||
"${DateTool().dateToYMDString(fingerprintItemData.startDate.toString())}-${DateTool().dateToYMDString(fingerprintItemData.endDate.toString())} 循环";
|
||||
}
|
||||
return keyDateTypeStr;
|
||||
}
|
||||
|
||||
//获取卡片/人脸有效期
|
||||
String getCardAndFaceDateType(LockUserListKeys fingerprintItemData) {
|
||||
var keyDateTypeStr = ""; // 永久:1;限时2,单次3,循环:4
|
||||
if (fingerprintItemData.cardType! == 1) {
|
||||
keyDateTypeStr = "永久".tr;
|
||||
} else if (fingerprintItemData.cardType! == 2) {
|
||||
keyDateTypeStr =
|
||||
"${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())} 限时";
|
||||
} else if (fingerprintItemData.cardType! == 4) {
|
||||
keyDateTypeStr =
|
||||
"${DateTool().dateToYMDString(fingerprintItemData.startDate.toString())}-${DateTool().dateToYMDString(fingerprintItemData.endDate.toString())} 循环";
|
||||
}
|
||||
return keyDateTypeStr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/messageWarn/lockUser/lockUser_entity.dart';
|
||||
import 'package:star_lock/main/lockDetail/messageWarn/lockUser/lockUser_logic.dart';
|
||||
import 'package:star_lock/tools/keySearchWidget.dart';
|
||||
import '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../tools/submitBtn.dart';
|
||||
import '../../../../tools/titleAppBar.dart';
|
||||
import '../../../../translations/trans_lib.dart';
|
||||
|
||||
class LockUserPage extends StatefulWidget {
|
||||
const LockUserPage({Key? key}) : super(key: key);
|
||||
@ -22,7 +23,7 @@ class _LockUserPageState extends State<LockUserPage> {
|
||||
initState() {
|
||||
super.initState();
|
||||
|
||||
logic.getLockNoticeSetting();
|
||||
logic.getLockKeysList();
|
||||
}
|
||||
|
||||
@override
|
||||
@ -36,14 +37,24 @@ class _LockUserPageState extends State<LockUserPage> {
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
_searchWidget(),
|
||||
KeySearchWidget(
|
||||
editingController: state.searchController,
|
||||
onSubmittedAction: () {
|
||||
logic.pageNo = 1;
|
||||
logic.getLockKeysList();
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
Expanded(child: _buildMainUI()),
|
||||
SubmitBtn(
|
||||
btnName: '确定'.tr,
|
||||
onClick: () {},
|
||||
onClick: () {
|
||||
Get.back(
|
||||
result:
|
||||
state.lockUserList.value[state.isSelectIndex.value]);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 64.h,
|
||||
@ -52,66 +63,40 @@ class _LockUserPageState extends State<LockUserPage> {
|
||||
));
|
||||
}
|
||||
|
||||
Widget _searchWidget() {
|
||||
return Container(
|
||||
height: 60.h,
|
||||
margin: EdgeInsets.only(top: 20.w, left: 20.w, right: 10.w),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white, borderRadius: BorderRadius.circular(5)),
|
||||
child: TextField(
|
||||
//输入框一行
|
||||
maxLines: 1,
|
||||
// controller: _controller,
|
||||
autofocus: false,
|
||||
controller: state.searchController,
|
||||
onSubmitted: (value) {},
|
||||
decoration: InputDecoration(
|
||||
//输入里面输入文字内边距设置
|
||||
contentPadding: const EdgeInsets.only(
|
||||
top: 12.0, left: -19.0, right: -15.0, bottom: 8.0),
|
||||
hintText: TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||
hintStyle: TextStyle(fontSize: 22.sp, height: 3.0),
|
||||
//不需要输入框下划线
|
||||
border: InputBorder.none,
|
||||
//左边图标设置
|
||||
icon: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 20.h, bottom: 20.h, right: 20.w, left: 10.w),
|
||||
child: Image.asset(
|
||||
'images/main/icon_main_search.png',
|
||||
width: 40.w,
|
||||
height: 40.w,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
Widget _buildMainUI() {
|
||||
return Obx(() => ListView.separated(
|
||||
shrinkWrap: true,
|
||||
itemCount: state.lockUserList.value.length,
|
||||
itemBuilder: (c, index) {
|
||||
return _electronicKeyItem(state.lockUserList.value[index], index);
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return const Divider(
|
||||
height: 1,
|
||||
color: AppColors.greyLineColor,
|
||||
);
|
||||
},
|
||||
));
|
||||
}
|
||||
|
||||
Widget _buildMainUI() {
|
||||
return ListView.separated(
|
||||
shrinkWrap: true,
|
||||
itemCount: 3,
|
||||
itemBuilder: (c, index) {
|
||||
return _electronicKeyItem('images/controls_user.png', '我', '永久', () {
|
||||
state.isCheck.value = !state.isCheck.value;
|
||||
Widget _electronicKeyItem(LockUserListKeys lockUserKeys, int selectIndex) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
for (int i = 0; i < state.lockUserList.value.length; i++) {
|
||||
LockUserListKeys item = state.lockUserList.value[i];
|
||||
if (selectIndex == i) {
|
||||
item.isCurrentSelect = true;
|
||||
} else {
|
||||
item.isCurrentSelect = true;
|
||||
}
|
||||
}
|
||||
setState(() {
|
||||
state.isSelectIndex.value = selectIndex;
|
||||
});
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return const Divider(
|
||||
height: 1,
|
||||
color: AppColors.greyLineColor,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _electronicKeyItem(
|
||||
String avatarURL, String receiveUser, String useDate, Function() action) {
|
||||
return GestureDetector(
|
||||
onTap: action,
|
||||
child: Container(
|
||||
color: Colors.white,
|
||||
width: 1.sw,
|
||||
height: 90.h,
|
||||
child: Row(
|
||||
children: [
|
||||
@ -119,7 +104,7 @@ class _LockUserPageState extends State<LockUserPage> {
|
||||
width: 30.w,
|
||||
),
|
||||
Image.asset(
|
||||
avatarURL,
|
||||
lockUserKeys.currentTypeImg ?? 'images/controls_user.png',
|
||||
width: 60.w,
|
||||
height: 60.w,
|
||||
),
|
||||
@ -134,7 +119,7 @@ class _LockUserPageState extends State<LockUserPage> {
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
receiveUser,
|
||||
lockUserKeys.currentKeyName ?? '未知',
|
||||
style: TextStyle(
|
||||
fontSize: 24.sp, color: AppColors.blackColor),
|
||||
),
|
||||
@ -150,7 +135,7 @@ class _LockUserPageState extends State<LockUserPage> {
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
useDate,
|
||||
logic.getKeyUseDateStr(lockUserKeys),
|
||||
style: TextStyle(
|
||||
fontSize: 18.sp,
|
||||
color: AppColors.placeholderTextColor),
|
||||
@ -161,13 +146,13 @@ class _LockUserPageState extends State<LockUserPage> {
|
||||
],
|
||||
),
|
||||
),
|
||||
Obx(() => Image.asset(
|
||||
state.isCheck.value == true
|
||||
? 'images/icon_round_select.png'
|
||||
: 'images/icon_round_unSelect.png',
|
||||
width: 30.w,
|
||||
height: 30.w,
|
||||
)),
|
||||
Image.asset(
|
||||
state.isSelectIndex.value == selectIndex
|
||||
? 'images/icon_round_select.png'
|
||||
: 'images/icon_round_unSelect.png',
|
||||
width: 30.w,
|
||||
height: 30.w,
|
||||
),
|
||||
SizedBox(width: 20.h),
|
||||
],
|
||||
),
|
||||
|
||||
@ -1,10 +1,14 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/messageWarn/lockUser/lockUser_entity.dart';
|
||||
|
||||
class LockUserState {
|
||||
TextEditingController searchController = TextEditingController(); //邮箱/手机号输入框
|
||||
var isCheck = false.obs;
|
||||
var isSelectUser = false.obs;
|
||||
var isSelectIndex = 0.obs;
|
||||
|
||||
var getLockId = 0.obs;
|
||||
var lockUserList = <LockUserListKeys>[].obs; //锁所有用户列表
|
||||
|
||||
LockUserState() {
|
||||
Map map = Get.arguments;
|
||||
|
||||
@ -26,7 +26,7 @@ class _LowBatteryReminderPageState extends State<LowBatteryReminderPage> {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: '低电量提醒',
|
||||
barTitle: '低电量提醒'.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Container(
|
||||
@ -48,7 +48,7 @@ class _LowBatteryReminderPageState extends State<LowBatteryReminderPage> {
|
||||
height: 20.h,
|
||||
),
|
||||
CommonItem(
|
||||
leftTitel: '低电量提醒',
|
||||
leftTitel: '低电量提醒'.tr,
|
||||
rightTitle: '',
|
||||
isHaveLine: true,
|
||||
isHaveDirection: false,
|
||||
@ -68,7 +68,7 @@ class _LowBatteryReminderPageState extends State<LowBatteryReminderPage> {
|
||||
child: Column(
|
||||
children: [
|
||||
CommonItem(
|
||||
leftTitel: '提醒方式',
|
||||
leftTitel: '提醒方式'.tr,
|
||||
rightTitle: "",
|
||||
isHaveLine: false,
|
||||
isHaveRightWidget: false,
|
||||
@ -104,7 +104,7 @@ class _LowBatteryReminderPageState extends State<LowBatteryReminderPage> {
|
||||
height: 20.h,
|
||||
)),
|
||||
SubmitBtn(
|
||||
btnName: '保存',
|
||||
btnName: '保存'.tr,
|
||||
onClick: () {},
|
||||
),
|
||||
SizedBox(
|
||||
|
||||
@ -46,7 +46,7 @@ class _MsgNotificationPageState extends State<MsgNotificationPage> {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: '消息提醒',
|
||||
barTitle: '消息提醒'.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: SingleChildScrollView(
|
||||
@ -72,7 +72,7 @@ class _MsgNotificationPageState extends State<MsgNotificationPage> {
|
||||
// height: 1,
|
||||
// ),
|
||||
CommonItem(
|
||||
leftTitel: '开门通知',
|
||||
leftTitel: '开门通知'.tr,
|
||||
rightTitle: "",
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
@ -84,7 +84,7 @@ class _MsgNotificationPageState extends State<MsgNotificationPage> {
|
||||
},
|
||||
),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: 'N天未开门',
|
||||
leftTitel: 'N天未开门'.tr,
|
||||
rightTitle: state.nDaysNotOpenDoor.value,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
@ -103,14 +103,14 @@ class _MsgNotificationPageState extends State<MsgNotificationPage> {
|
||||
// rightWidget:
|
||||
// SizedBox(width: 60.w, height: 50.h, child: _switch(1)))),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: '门未关好',
|
||||
leftTitel: '门未关好'.tr,
|
||||
rightTitle: "",
|
||||
isHaveLine: true,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget:
|
||||
SizedBox(width: 60.w, height: 50.h, child: _switch(2)))),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: '防拆报警',
|
||||
leftTitel: '防拆报警'.tr,
|
||||
rightTitle: '',
|
||||
isHaveLine: true,
|
||||
isHaveRightWidget: true,
|
||||
@ -120,7 +120,7 @@ class _MsgNotificationPageState extends State<MsgNotificationPage> {
|
||||
child: _switch(5),
|
||||
))),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: '低电量提醒',
|
||||
leftTitel: '低电量提醒'.tr,
|
||||
rightTitle: state.isLowBattery.value,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
@ -129,7 +129,7 @@ class _MsgNotificationPageState extends State<MsgNotificationPage> {
|
||||
},
|
||||
)),
|
||||
CommonItem(
|
||||
leftTitel: '胁迫开门',
|
||||
leftTitel: '胁迫开门'.tr,
|
||||
rightTitle: "",
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
@ -149,7 +149,7 @@ class _MsgNotificationPageState extends State<MsgNotificationPage> {
|
||||
height: 10.h,
|
||||
),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: '有人按门铃',
|
||||
leftTitel: '有人按门铃'.tr,
|
||||
rightTitle: "",
|
||||
isHaveLine: true,
|
||||
isHaveRightWidget: true,
|
||||
@ -167,7 +167,7 @@ class _MsgNotificationPageState extends State<MsgNotificationPage> {
|
||||
height: 10.h,
|
||||
),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: '有人出现在门口',
|
||||
leftTitel: '有人出现在门口'.tr,
|
||||
rightTitle: "",
|
||||
isHaveLine: true,
|
||||
isHaveRightWidget: true,
|
||||
|
||||
@ -29,7 +29,7 @@ class _OpenDoorNotifyPageState extends State<OpenDoorNotifyPage> {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: '家人到家',
|
||||
barTitle: '家人到家'.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
),
|
||||
@ -41,7 +41,7 @@ class _OpenDoorNotifyPageState extends State<OpenDoorNotifyPage> {
|
||||
),
|
||||
Expanded(child: _buildMainUI()),
|
||||
AddBottomWhiteBtn(
|
||||
btnName: '添加家人',
|
||||
btnName: '添加家人'.tr,
|
||||
onClick: () {
|
||||
Get.toNamed(Routers.addFamilyPage,
|
||||
arguments: {'getLockId': state.getLockId.value});
|
||||
@ -59,7 +59,7 @@ class _OpenDoorNotifyPageState extends State<OpenDoorNotifyPage> {
|
||||
alignment: Alignment.centerLeft,
|
||||
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
|
||||
child: Text(
|
||||
'若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择',
|
||||
'若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择'.tr,
|
||||
style: TextStyle(color: AppColors.darkGrayTextColor, fontSize: 20.sp),
|
||||
));
|
||||
}
|
||||
|
||||
@ -58,7 +58,7 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
|
||||
gaplessPlayback: true,
|
||||
width: 1.sw,
|
||||
height: 1.sh,
|
||||
fit: BoxFit.none,
|
||||
fit: BoxFit.cover, //contain-原比例 none-原始图片
|
||||
filterQuality: FilterQuality.high,
|
||||
errorBuilder: (context, error, stackTrace) {
|
||||
return Container(color: Colors.transparent);
|
||||
|
||||
@ -42,7 +42,6 @@ class UDPManage {
|
||||
int remoteUnlock = 0; // 是否远程开锁 1:开启 0:关闭
|
||||
|
||||
void initUdp() async {
|
||||
// if (host != '') {
|
||||
var listAddress = InternetAddress.lookup(host);
|
||||
listAddress.then((list) {
|
||||
list.forEach((element) {
|
||||
@ -50,17 +49,16 @@ class UDPManage {
|
||||
host = element.address;
|
||||
});
|
||||
});
|
||||
// }
|
||||
|
||||
await _initUdp();
|
||||
}
|
||||
|
||||
Future<Null> _initUdp() async {
|
||||
Future<void> _initUdp() async {
|
||||
if (port == 0) {
|
||||
print('❌ Udp ----> _port == 0');
|
||||
// print('❌ Udp ----> _port == 0');
|
||||
return;
|
||||
}
|
||||
print('Udp ----> host:$host port:$port');
|
||||
// print('Udp ----> host:$host port:$port');
|
||||
var addressIListenFrom = InternetAddress.anyIPv4;
|
||||
int portIListenOn = 62288;
|
||||
RawDatagramSocket.bind(addressIListenFrom, portIListenOn)
|
||||
@ -91,7 +89,7 @@ class UDPManage {
|
||||
void sendData(List<int> data) {
|
||||
if (null == _udpSocket || null == data || data.isEmpty || host == '') {
|
||||
if (null == _udpSocket) {
|
||||
print('❌ Udp ----> null == _udpSocket');
|
||||
// print('❌ Udp ----> null == _udpSocket');
|
||||
initUdp();
|
||||
}
|
||||
return;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user