1,新增胁迫开门接口对接

2,新增胁迫指纹接口对接
3,胁迫开门相关提醒及逻辑处理
4,新增删除胁迫开门接口对接
5,新增低电量模块接口对接
6,低电量提醒模块逻辑处理
This commit is contained in:
Daisy 2024-04-24 17:11:42 +08:00
parent b15aa20f80
commit 4944658e60
26 changed files with 1025 additions and 340 deletions

View File

@ -772,5 +772,12 @@
"关锁":"关锁",
"功能":"功能",
"配件":"配件",
"N天未开门提醒":"N days did not open the door reminder"
"N天未开门提醒":"N days did not open the door reminder",
"当被胁迫要求强行开锁时,使用胁迫指纹会触发报警,报警消息会推送给管理员,该功能需要锁联网":"When forced to open the lock, the use of coercive fingerprint will trigger the alarm, the alarm message will be pushed to the administrator, the function requires the lock network",
"胁迫指纹":"Stress fingerprint",
"指纹列表":"Fingerprint list",
"经过以上设定的时间,锁没有被开启,系统会给指定对象发送提醒消息,该功能需要锁联网":"After the above set time, the lock is not opened, the system will send a reminder message to the specified object, this function requires the lock network",
"打开提醒后当锁电量低于20%、10%和5%系统会给指定对象发送提醒消息。电量读取方式网关读取或APP读取。":"After the reminder is enabled, when the lock power is below 20%, 10%, and 5%, the system will send a reminder message to the specified object. Power reading mode: gateway reading or APP reading.",
"门未开时间":"Door not open time",
"添加和使用面容开锁时:":"Add and use Face when unlocking:"
}

View File

@ -771,5 +771,12 @@
"关锁":"Close Lock",
"功能":"Function",
"配件":"Parts",
"N天未开门提醒":"N天未开门提醒"
"N天未开门提醒":"N天未开门提醒",
"当被胁迫要求强行开锁时,使用胁迫指纹会触发报警,报警消息会推送给管理员,该功能需要锁联网":"当被胁迫要求强行开锁时,使用胁迫指纹会触发报警,报警消息会推送给管理员,该功能需要锁联网",
"胁迫指纹":"胁迫指纹",
"指纹列表":"指纹列表",
"经过以上设定的时间,锁没有被开启,系统会给指定对象发送提醒消息,该功能需要锁联网":"经过以上设定的时间,锁没有被开启,系统会给指定对象发送提醒消息,该功能需要锁联网",
"打开提醒后当锁电量低于20%、10%和5%系统会给指定对象发送提醒消息。电量读取方式网关读取或APP读取。":"打开提醒后当锁电量低于20%、10%和5%系统会给指定对象发送提醒消息。电量读取方式网关读取或APP读取。",
"门未开时间":"门未开时间",
"添加和使用面容开锁时:":"添加和使用面容开锁时:"
}

View File

@ -774,5 +774,12 @@
"关锁":"关锁",
"功能":"功能",
"配件":"配件",
"N天未开门提醒":"N天未开门提醒"
"N天未开门提醒":"N天未开门提醒",
"当被胁迫要求强行开锁时,使用胁迫指纹会触发报警,报警消息会推送给管理员,该功能需要锁联网":"当被胁迫要求强行开锁时,使用胁迫指纹会触发报警,报警消息会推送给管理员,该功能需要锁联网",
"胁迫指纹":"胁迫指纹",
"指纹列表":"指纹列表",
"经过以上设定的时间,锁没有被开启,系统会给指定对象发送提醒消息,该功能需要锁联网":"经过以上设定的时间,锁没有被开启,系统会给指定对象发送提醒消息,该功能需要锁联网",
"打开提醒后当锁电量低于20%、10%和5%系统会给指定对象发送提醒消息。电量读取方式网关读取或APP读取。":"打开提醒后当锁电量低于20%、10%和5%系统会给指定对象发送提醒消息。电量读取方式网关读取或APP读取。",
"门未开时间":"门未开时间",
"添加和使用面容开锁时:":"添加和使用面容开锁时:"
}

View File

@ -116,7 +116,6 @@ class _LockUserPageState extends State<LockUserPage> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
lockUserKeys.currentKeyName ?? '',

View File

@ -0,0 +1,147 @@
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/coerceOpenDoor/coerceFingerprint/coerceFingerprint_state.dart';
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/openDoorNotify/openDoorNotify_entity.dart';
import 'package:star_lock/main/lockDetail/messageWarn/notificationMode/notificationMode_data.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
class CoerceFingerprintLogic extends BaseGetXController {
final CoerceFingerprintState state = CoerceFingerprintState();
//
void addLockNoticeSetting() async {
var entity = await ApiRepository.to.addLockNoticeSetting(
lockId: state.getLockId.value,
noticeType: 20,
settingValue: {
'openDoorId': state.fingerprintData.value.fingerprintId,
'openDoorType': 4,
'remark': state.fingerprintData.value.fingerprintName ?? '',
'noticeWay': [
{'type': 'mail', 'accounts': getEmailAndSMSAccountList(true)},
{'type': 'sms', 'accounts': getEmailAndSMSAccountList(false)}
]
},
);
if (entity.errorCode!.codeIsSuccessful) {
showToast('添加成功'.tr);
Get.back(result: true);
}
}
//
void deleteLockNoticeSetting() async {
var entity = await ApiRepository.to.deleteLockNoticeSettingAccount(
lockNoticeSettingAccountId: state.familyData.value.id!,
);
if (entity.errorCode!.codeIsSuccessful) {
showToast('删除成功'.tr);
Get.back(result: true);
}
}
//
List getEmailAndSMSAccountList(bool isEmail) {
List list = [];
List accountList = [];
isEmail
? accountList = state.emailReceiverList.value
: accountList = state.phoneReceiverList.value;
for (int i = 0; i < accountList.length; i++) {
MsgNoticeModeData item = accountList[i];
Map map = {};
map['countryCode'] = isEmail ? 0 : item.countryCode;
map['account'] = isEmail ? item.receiveEmail : item.receivePhone;
list.add(map);
}
return list;
}
String getEmailListStr(Map val) {
String emailListStr = '';
if (val['emailReceiverList'] != null) {
state.emailReceiverList.value = val['emailReceiverList'];
List emailReceiverList = state.emailReceiverList.value;
for (int i = 0; i < emailReceiverList.length; i++) {
MsgNoticeModeData item = emailReceiverList[i];
emailListStr += item.receiveEmail;
//
if (i < emailReceiverList.length - 1) {
emailListStr += ',';
}
}
}
return emailListStr;
}
String getPhoneListStr(Map val) {
String phoneListStr = '';
if (val['phoneReceiverList'] != null) {
state.phoneReceiverList.value = val['phoneReceiverList'];
List phoneReceiverList = state.phoneReceiverList.value;
for (int i = 0; i < phoneReceiverList.length; i++) {
MsgNoticeModeData item = phoneReceiverList[i];
phoneListStr += item.receivePhone;
//
if (i < phoneReceiverList.length - 1) {
phoneListStr += ',';
}
}
}
return phoneListStr;
}
//
bool checkBtnDisable() {
// if ((state.emailListStr.value.isEmpty ||
// state.phontListStr.value.isEmpty)) {
// return false;
// } else {
// return true;
// }
return true;
}
//
Map<String, List<MsgNoticeModeData>> getAccountsMap() {
List<MsgNoticeModeData> mailAccounts = [];
List<MsgNoticeModeData> smsAccounts = [];
if (state.familyData.value.settingValue != null) {
for (NoticeWay item
in state.familyData.value.settingValue!.noticeWayList!) {
if (item.type == 'mail' && item.accounts != null) {
for (Accounts account in item.accounts!) {
if (account.account != null) {
MsgNoticeModeData msgNoticeModeData = MsgNoticeModeData();
msgNoticeModeData.receiveEmail = account.account!;
mailAccounts.add(msgNoticeModeData);
}
}
} else if (item.type == 'sms' && item.accounts != null) {
for (Accounts account in item.accounts!) {
if (account.account != null && account.countryCode != null) {
MsgNoticeModeData msgNoticeModeData = MsgNoticeModeData();
msgNoticeModeData.receivePhone = account.account!;
msgNoticeModeData.countryCode = account.countryCode!;
smsAccounts.add(msgNoticeModeData);
}
}
}
}
}
return {
'emailReceiverList': mailAccounts,
'phoneReceiverList': smsAccounts,
};
}
@override
onInit() {
super.onInit();
state.emailListStr.value = getEmailListStr(getAccountsMap());
state.phontListStr.value = getPhoneListStr(getAccountsMap());
}
}

View File

@ -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/msgNotification/coerceOpenDoor/coerceFingerprint/coerceFingerprint_logic.dart';
import 'package:star_lock/tools/commonItem.dart';
import 'package:star_lock/tools/submitBtn.dart';
@ -16,27 +17,39 @@ class CoerceFingerprintPage extends StatefulWidget {
}
class _CoerceFingerprintPageState extends State<CoerceFingerprintPage> {
final logic = Get.put(CoerceFingerprintLogic());
final state = Get.find<CoerceFingerprintLogic>().state;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: '胁迫指纹',
barTitle: state.isDetail.value == true ? '指纹详情'.tr : '胁迫指纹'.tr,
haveBack: true,
backgroundColor: AppColors.mainColor),
body: Container(
padding: EdgeInsets.all(30.w),
child: Column(
children: [
CommonItem(
leftTitel: '胁迫指纹',
rightTitle: '请选择',
isHaveLine: true,
isHaveDirection: true,
action: () {
//
Get.toNamed(Routers.coerceFingerprintListPage);
}),
Obx(() => CommonItem(
leftTitel: '胁迫指纹'.tr,
rightTitle: state.isDetail.value == true
? state.familyData.value.settingValue!.remark!
: state.fingerprintData.value.fingerprintName ?? '请选择'.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
//
Get.toNamed(Routers.coerceFingerprintListPage,
arguments: {'lockId': state.getLockId.value})
?.then((val) {
if (val != null) {
state.fingerprintData.value = val;
}
});
},
)),
SizedBox(
height: 20.h,
),
@ -45,29 +58,44 @@ class _CoerceFingerprintPageState extends State<CoerceFingerprintPage> {
margin: EdgeInsets.only(bottom: 10.h),
child: Column(
children: [
CommonItem(
leftTitel: '提醒方式'.tr,
rightTitle: "",
isHaveLine: false,
isHaveRightWidget: false,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.notificationModePage);
GestureDetector(
onTap: () {
Get.toNamed(Routers.notificationModePage,
arguments: {'familyData': state.familyData.value})
?.then((val) {
if (val != null) {
state.emailListStr.value = logic.getEmailListStr(val);
state.phontListStr.value = logic.getPhoneListStr(val);
print(
'emailListStr:${state.emailListStr.value},phontListStr:${state.phontListStr.value}');
}
});
},
child: Container(
color: Colors.white,
margin: EdgeInsets.only(bottom: 10.h),
child: Column(
children: [
CommonItem(
leftTitel: '提醒方式'.tr,
rightTitle: "",
isHaveLine: false,
isHaveRightWidget: false,
isHaveDirection: true,
),
_buildNotifyContain('APP推送'.tr, '管理员'.tr),
Obx(() => state.emailListStr.value.isNotEmpty
? _buildNotifyContain(
'邮件提醒'.tr, state.emailListStr.value)
: Container()),
Obx(() => state.phontListStr.value.isNotEmpty
? _buildNotifyContain(
'短信提醒'.tr, state.phontListStr.value)
: Container()),
],
),
),
),
Container(
padding: EdgeInsets.only(
left: 10.w, right: 10.w, top: 12.h, bottom: 12.h),
margin: EdgeInsets.only(bottom: 20.h, top: 10.h),
decoration: BoxDecoration(
color: AppColors.mainBackgroundColor,
borderRadius: BorderRadius.circular(6.0.w),
),
child: Text(
'APP推送 管理员',
style: TextStyle(color: Colors.black, fontSize: 20.sp),
),
)
],
),
),
@ -75,11 +103,20 @@ class _CoerceFingerprintPageState extends State<CoerceFingerprintPage> {
child: SizedBox(
height: 40.h,
)),
SubmitBtn(
btnName: '保存',
isDisabled: false,
onClick: () {},
),
Obx(() => SubmitBtn(
btnName: state.isDetail.value == true ? '删除'.tr : '保存'.tr,
isDisabled: state.isDetail.value == true
? true
: logic.checkBtnDisable(),
isDelete: state.isDetail.value,
onClick: () {
if (state.isDetail.value) {
logic.deleteLockNoticeSetting();
} else {
logic.addLockNoticeSetting();
}
},
)),
SizedBox(
height: 60.h,
)
@ -88,4 +125,32 @@ class _CoerceFingerprintPageState extends State<CoerceFingerprintPage> {
),
);
}
Widget _buildNotifyContain(String notifyTitle, String notifyContent) {
return Container(
padding:
EdgeInsets.only(left: 10.w, right: 10.w, top: 12.h, bottom: 12.h),
margin: EdgeInsets.only(bottom: 20.h, top: 10.h, left: 20.w, right: 20.w),
decoration: BoxDecoration(
color: AppColors.mainBackgroundColor,
borderRadius: BorderRadius.circular(6.0.w),
),
child: Row(
children: [
Text(
notifyTitle,
style: TextStyle(color: Colors.black, fontSize: 20.sp),
),
Expanded(
child: SizedBox(
width: 20.w,
)),
Text(notifyContent,
textAlign: TextAlign.end,
style: TextStyle(
color: AppColors.placeholderTextColor, fontSize: 20.sp)),
],
),
);
}
}

View File

@ -0,0 +1,32 @@
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/coerceOpenDoor/coerceFingerprintList/coerceFingerprintList_entity.dart';
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/openDoorNotify/openDoorNotify_entity.dart';
class CoerceFingerprintState {
var pageNum = 1.obs; //
final pageSize = 20.obs; //
final itemDataList = [].obs;
var getLockId = 0.obs;
var fingerprintData = CoerceFingerprintItemData().obs;
var emailReceiverList = [].obs;
var phoneReceiverList = [].obs;
var emailListStr = ''.obs;
var phontListStr = ''.obs;
var isDetail = false.obs;
var familyData = DataList().obs;
CoerceFingerprintState() {
Map map = Get.arguments;
if (map['lockId'] != null) {
getLockId.value = map['lockId'];
}
if (map['isDetail'] != null) {
isDetail.value = map['isDetail'];
}
if (map['itemData'] != null) {
familyData.value = map['itemData'];
}
}
}

View File

@ -0,0 +1,145 @@
import 'dart:core';
class CoerceFingerprintListEntity {
int? errorCode;
String? description;
String? errorMsg;
Data? data;
CoerceFingerprintListEntity(
{this.errorCode, this.description, this.errorMsg, this.data});
CoerceFingerprintListEntity.fromJson(Map<String, dynamic> json) {
errorCode = json['errorCode'];
description = json['description'];
errorMsg = json['errorMsg'];
data = json['data'] != null ? Data.fromJson(json['data']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['errorCode'] = errorCode;
data['description'] = description;
data['errorMsg'] = errorMsg;
if (this.data != null) {
data['data'] = this.data!.toJson();
}
return data;
}
}
class Data {
List<CoerceFingerprintItemData>? list;
int? pageNo;
int? pageSize;
int? pages;
int? total;
Data({this.list, this.pageNo, this.pageSize, this.pages, this.total});
Data.fromJson(Map<String, dynamic> json) {
if (json['list'] != null) {
list = <CoerceFingerprintItemData>[];
json['list'].forEach((v) {
list!.add(CoerceFingerprintItemData.fromJson(v));
});
}
pageNo = json['pageNo'];
pageSize = json['pageSize'];
pages = json['pages'];
total = json['total'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
if (list != null) {
data['list'] = list!.map((v) => v.toJson()).toList();
}
data['pageNo'] = pageNo;
data['pageSize'] = pageSize;
data['pages'] = pages;
data['total'] = total;
return data;
}
}
class CoerceFingerprintItemData {
int? lockId;
int? apiUserId;
String? fingerprintNumber;
int? fingerprintType;
String? fingerprintName;
int? startDate;
int? endDate;
List? weekDay;
int? fingerprintStatus;
int? isCoerced;
int? fingerRight;
int? fingerprintId;
String? senderUsername;
int? createDate;
String? validTimeStr;
bool? isCurrentSelect = false;
CoerceFingerprintItemData(
{this.lockId,
this.apiUserId,
this.fingerprintNumber,
this.fingerprintType,
this.fingerprintName,
this.startDate,
this.endDate,
this.weekDay,
this.fingerprintStatus,
this.isCoerced,
this.fingerRight,
this.fingerprintId,
this.senderUsername,
this.createDate,
this.validTimeStr});
CoerceFingerprintItemData.fromJson(Map<String, dynamic> json) {
lockId = json['lockId'];
apiUserId = json['apiUserId'];
fingerprintNumber = json['fingerprintNumber'];
fingerprintType = json['fingerprintType'];
fingerprintName = json['fingerprintName'];
startDate = json['startDate'];
endDate = json['endDate'];
if (json['weekDay'] != null) {
weekDay = [];
json['weekDay'].forEach((v) {
weekDay!.add(v);
});
}
fingerprintStatus = json['fingerprintStatus'];
isCoerced = json['isCoerced'];
fingerRight = json['fingerRight'];
fingerprintId = json['fingerprintId'];
senderUsername = json['senderUsername'];
createDate = json['createDate'];
validTimeStr = json['validTimeStr'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['lockId'] = lockId;
data['apiUserId'] = apiUserId;
data['fingerprintNumber'] = fingerprintNumber;
data['fingerprintType'] = fingerprintType;
data['fingerprintName'] = fingerprintName;
data['startDate'] = startDate;
data['endDate'] = endDate;
if (weekDay != null) {
data['weekDay'] = weekDay!.map((v) => v.toJson()).toList();
}
data['fingerprintStatus'] = fingerprintStatus;
data['isCoerced'] = isCoerced;
data['fingerRight'] = fingerRight;
data['fingerprintId'] = fingerprintId;
data['senderUsername'] = senderUsername;
data['createDate'] = createDate;
data['validTimeStr'] = validTimeStr;
return data;
}
}

View File

@ -1,6 +1,39 @@
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/coerceOpenDoor/coerceFingerprintList/coerceFingerprintList_entity.dart';
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/coerceOpenDoor/coerceFingerprintList/coerceFingerprintList_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 CoerceFingerprintListLogic extends BaseGetXController {
final CoerceFingerprintListState state = CoerceFingerprintListState();
//
void getCoercedFingerprintList() async {
var entity = await ApiRepository.to.getCoercedFingerprintList(
lockId: state.getLockId.value,
pageNo: state.pageNum.value,
pageSize: state.pageSize.value,
);
if (entity.errorCode!.codeIsSuccessful) {
state.fingerprintList.value = entity.data!.list!;
state.fingerprintList.refresh();
}
}
//
String getfingerprintUseDateStr(
CoerceFingerprintItemData fingerprintItemData) {
var keyDateTypeStr = ""; // :1;23: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;
}
}

View File

@ -1,12 +1,13 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/coerceOpenDoor/coerceFingerprintList/coerceFingerprintList_entity.dart';
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/coerceOpenDoor/coerceFingerprintList/coerceFingerprintList_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 CoerceFingerprintListPage extends StatefulWidget {
const CoerceFingerprintListPage({Key? key}) : super(key: key);
@ -20,25 +21,41 @@ class _CoerceFingerprintListPageState extends State<CoerceFingerprintListPage> {
final logic = Get.put(CoerceFingerprintListLogic());
final state = Get.find<CoerceFingerprintListLogic>().state;
@override
initState() {
super.initState();
logic.getCoercedFingerprintList();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: '指纹列表',
barTitle: '指纹列表'.tr,
haveBack: true,
backgroundColor: AppColors.mainColor,
),
body: Column(
children: [
_searchWidget(),
KeySearchWidget(
editingController: state.searchController,
onSubmittedAction: () {
logic.pageNo = 1;
logic.getCoercedFingerprintList();
},
),
SizedBox(
height: 20.h,
),
Expanded(child: _buildMainUI()),
Expanded(child: Obx(() => _buildMainUI())),
SubmitBtn(
btnName: '确定',
onClick: () {},
btnName: '确定'.tr,
onClick: () {
Get.back(
result:
state.fingerprintList.value[state.isSelectIndex.value]);
},
),
SizedBox(
height: 64.h,
@ -47,50 +64,12 @@ class _CoerceFingerprintListPageState extends State<CoerceFingerprintListPage> {
));
}
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 ListView.separated(
shrinkWrap: true,
itemCount: 3,
itemCount: state.fingerprintList.length,
itemBuilder: (c, index) {
return _electronicKeyItem('images/icon_fingerprint.png', '', '永久', () {
state.isCheck.value = !state.isCheck.value;
});
return _electronicKeyItem(state.fingerprintList[index], index);
},
separatorBuilder: (BuildContext context, int index) {
return const Divider(
@ -102,9 +81,21 @@ class _CoerceFingerprintListPageState extends State<CoerceFingerprintListPage> {
}
Widget _electronicKeyItem(
String avatarURL, String receiveUser, String useDate, Function() action) {
CoerceFingerprintItemData itemData, int selectIndex) {
return GestureDetector(
onTap: action,
onTap: () {
for (int i = 0; i < state.fingerprintList.value.length; i++) {
CoerceFingerprintItemData item = state.fingerprintList.value[i];
if (selectIndex == i) {
item.isCurrentSelect = true;
} else {
item.isCurrentSelect = true;
}
}
setState(() {
state.isSelectIndex.value = selectIndex;
});
},
child: Container(
color: Colors.white,
height: 90.h,
@ -114,7 +105,7 @@ class _CoerceFingerprintListPageState extends State<CoerceFingerprintListPage> {
width: 30.w,
),
Image.asset(
avatarURL,
'images/icon_fingerprint.png',
width: 60.w,
height: 60.w,
),
@ -126,10 +117,9 @@ class _CoerceFingerprintListPageState extends State<CoerceFingerprintListPage> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
receiveUser,
itemData.fingerprintName ?? '',
style: TextStyle(
fontSize: 24.sp, color: AppColors.blackColor),
),
@ -145,7 +135,7 @@ class _CoerceFingerprintListPageState extends State<CoerceFingerprintListPage> {
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
useDate,
logic.getfingerprintUseDateStr(itemData),
style: TextStyle(
fontSize: 18.sp,
color: AppColors.placeholderTextColor),
@ -156,13 +146,13 @@ class _CoerceFingerprintListPageState extends State<CoerceFingerprintListPage> {
],
),
),
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),
],
),

View File

@ -3,5 +3,16 @@ import 'package:get/get.dart';
class CoerceFingerprintListState {
TextEditingController searchController = TextEditingController(); ///
var isCheck = false.obs;
var isSelectIndex = 0.obs;
var getLockId = 0.obs;
var fingerprintList = [].obs; //
var pageNum = 1.obs; //
var pageSize = 20.obs; //
CoerceFingerprintListState() {
Map map = Get.arguments;
if (map['lockId'] != null) {
getLockId.value = map['lockId'];
}
}
}

View File

@ -1,7 +1,40 @@
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/openDoorNotify/openDoorNotify_entity.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'coerceOpenDoor_state.dart';
class CoerceOpenDoorLogic extends BaseGetXController {
final CoerceOpenDoorState state = CoerceOpenDoorState();
void lockNoticeSettingAccountList() async {
OpenDoorNotifyEntity entity =
await ApiRepository.to.lockNoticeSettingAccountList(
lockId: state.getLockId.value,
noticeType: 20,
);
if (entity.errorCode!.codeIsSuccessful) {
state.itemDataList.value = entity.data!.list!;
state.itemDataList.refresh();
}
}
// 1: 2: 3: 4: 5:
String getKeyTypeStr(DataList itemData) {
int keyType = itemData.settingValue!.openDoorType!;
switch (keyType) {
case 1:
return '电子钥匙';
case 2:
return '密码';
case 3:
return '指纹';
case 4:
return '';
case 5:
return '人脸';
default:
return '';
}
}
}

View File

@ -2,6 +2,8 @@ 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/msgNotification/openDoorNotify/openDoorNotify_entity.dart';
import 'package:star_lock/tools/noData.dart';
import '../../../../../../app_settings/app_colors.dart';
import '../../../../../../tools/submitBtn.dart';
@ -22,6 +24,8 @@ class _CoerceOpenDoorPageState extends State<CoerceOpenDoorPage> {
@override
void initState() {
super.initState();
logic.lockNoticeSettingAccountList();
}
@override
@ -29,7 +33,7 @@ class _CoerceOpenDoorPageState extends State<CoerceOpenDoorPage> {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: '胁迫开门',
barTitle: '胁迫开门'.tr,
haveBack: true,
backgroundColor: AppColors.mainColor,
),
@ -39,15 +43,21 @@ class _CoerceOpenDoorPageState extends State<CoerceOpenDoorPage> {
SizedBox(
height: 20.h,
),
Expanded(child: _buildMainUI()),
// Expanded(
// child: Obx(() => state.itemDataList.value.isEmpty
// ? const NoData()
// : _buildMainUI(state.itemDataList.value))),
Expanded(
child: Obx(() => state.itemDataList.value.isNotEmpty
? _buildMainUI()
: NoData())),
AddBottomWhiteBtn(
btnName: '胁迫指纹',
btnName: '胁迫指纹'.tr,
onClick: () {
Get.toNamed(Routers.coerceFingerprintPage);
Get.toNamed(Routers.coerceFingerprintPage, arguments: {
'lockId': state.getLockId.value,
'isDetail': false,
})?.then((value) {
if (value != null) {
logic.lockNoticeSettingAccountList();
}
});
},
),
SizedBox(
@ -62,7 +72,7 @@ class _CoerceOpenDoorPageState extends State<CoerceOpenDoorPage> {
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),
));
}
@ -70,12 +80,9 @@ class _CoerceOpenDoorPageState extends State<CoerceOpenDoorPage> {
Widget _buildMainUI() {
return ListView.separated(
shrinkWrap: true,
itemCount: 3,
itemCount: state.itemDataList.length,
itemBuilder: (c, index) {
return _electronicKeyItem(
'images/icon_fingerprint.png', '18682150237', '指纹', () {
//
});
return _electronicKeyItem(state.itemDataList.value[index]);
},
separatorBuilder: (BuildContext context, int index) {
return const Divider(
@ -86,10 +93,19 @@ class _CoerceOpenDoorPageState extends State<CoerceOpenDoorPage> {
);
}
Widget _electronicKeyItem(String avatarURL, String familyAccount,
String openDoorWay, Function() action) {
Widget _electronicKeyItem(DataList itemData) {
return GestureDetector(
onTap: action,
onTap: () {
Get.toNamed(Routers.coerceFingerprintPage, arguments: {
'itemData': itemData,
'lockId': state.getLockId.value,
'isDetail': true
})?.then((value) {
if (value != null) {
logic.lockNoticeSettingAccountList();
}
});
},
child: Container(
color: Colors.white,
height: 90.h,
@ -99,7 +115,7 @@ class _CoerceOpenDoorPageState extends State<CoerceOpenDoorPage> {
width: 30.w,
),
Image.asset(
avatarURL,
'images/controls_user.png',
width: 60.w,
height: 60.w,
),
@ -111,10 +127,9 @@ class _CoerceOpenDoorPageState extends State<CoerceOpenDoorPage> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
familyAccount,
itemData.settingValue!.remark ?? '',
style: TextStyle(
fontSize: 24.sp, color: AppColors.blackColor),
),
@ -130,7 +145,7 @@ class _CoerceOpenDoorPageState extends State<CoerceOpenDoorPage> {
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
openDoorWay,
logic.getKeyTypeStr(itemData),
style: TextStyle(
fontSize: 18.sp,
color: AppColors.placeholderTextColor),

View File

@ -4,4 +4,12 @@ class CoerceOpenDoorState {
var pageNum = 1.obs; //
final pageSize = 20.obs; //
final itemDataList = [].obs;
var getLockId = 0.obs;
CoerceOpenDoorState() {
Map map = Get.arguments;
if (map['lockId'] != null) {
getLockId.value = map['lockId'];
}
}
}

View File

@ -1,7 +1,118 @@
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/openDoorNotify/openDoorNotify_entity.dart';
import 'package:star_lock/main/lockDetail/messageWarn/notificationMode/notificationMode_data.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'lowBatteryReminder_state.dart';
class LowBatteryReminderLogic extends BaseGetXController {
LowBatteryReminderState state = LowBatteryReminderState();
void lockNoticeSettingAccountList() async {
var entity = await ApiRepository.to.updatelowElecNoticeStateSetting(
lockId: state.getLockId.value,
lowElecNoticeState: state.isLowBatteryNotify.value == true ? 1 : 0,
lowElecNoticeWayList: [
{'type': 'mail', 'accounts': getEmailAndSMSAccountList(true)},
{'type': 'sms', 'accounts': getEmailAndSMSAccountList(false)}
]);
if (entity.errorCode!.codeIsSuccessful) {
showToast('设置成功'.tr);
Get.back(result: true);
}
}
//
List getEmailAndSMSAccountList(bool isEmail) {
List list = [];
List accountList = [];
isEmail
? accountList = state.emailReceiverList.value
: accountList = state.phoneReceiverList.value;
for (int i = 0; i < accountList.length; i++) {
MsgNoticeModeData item = accountList[i];
Map map = {};
map['countryCode'] = isEmail ? 0 : item.countryCode;
map['account'] = isEmail ? item.receiveEmail : item.receivePhone;
list.add(map);
}
return list;
}
String getEmailListStr(Map val) {
String emailListStr = '';
if (val['emailReceiverList'] != null) {
state.emailReceiverList.value = val['emailReceiverList'];
List emailReceiverList = state.emailReceiverList.value;
for (int i = 0; i < emailReceiverList.length; i++) {
MsgNoticeModeData item = emailReceiverList[i];
emailListStr += item.receiveEmail;
//
if (i < emailReceiverList.length - 1) {
emailListStr += ',';
}
}
}
return emailListStr;
}
String getPhoneListStr(Map val) {
String phoneListStr = '';
if (val['phoneReceiverList'] != null) {
state.phoneReceiverList.value = val['phoneReceiverList'];
List phoneReceiverList = state.phoneReceiverList.value;
for (int i = 0; i < phoneReceiverList.length; i++) {
MsgNoticeModeData item = phoneReceiverList[i];
phoneListStr += item.receivePhone;
//
if (i < phoneReceiverList.length - 1) {
phoneListStr += ',';
}
}
}
return phoneListStr;
}
//
Map<String, List<MsgNoticeModeData>> getAccountsMap() {
List<MsgNoticeModeData> mailAccounts = [];
List<MsgNoticeModeData> smsAccounts = [];
if (state.msgNoticeInfo.value.lowElecNoticeWayList != null) {
for (NoticeWay item in state.msgNoticeInfo.value.lowElecNoticeWayList!) {
if (item.type == 'mail' && item.accounts != null) {
for (Accounts account in item.accounts!) {
if (account.account != null) {
MsgNoticeModeData msgNoticeModeData = MsgNoticeModeData();
msgNoticeModeData.receiveEmail = account.account!;
mailAccounts.add(msgNoticeModeData);
}
}
} else if (item.type == 'sms' && item.accounts != null) {
for (Accounts account in item.accounts!) {
if (account.account != null && account.countryCode != null) {
MsgNoticeModeData msgNoticeModeData = MsgNoticeModeData();
msgNoticeModeData.receivePhone = account.account!;
msgNoticeModeData.countryCode = account.countryCode!;
smsAccounts.add(msgNoticeModeData);
}
}
}
}
}
return {
'emailReceiverList': mailAccounts,
'phoneReceiverList': smsAccounts,
};
}
@override
onInit() {
super.onInit();
state.emailListStr.value = getEmailListStr(getAccountsMap());
state.phontListStr.value = getPhoneListStr(getAccountsMap());
}
}

View File

@ -29,94 +29,138 @@ class _LowBatteryReminderPageState extends State<LowBatteryReminderPage> {
barTitle: '低电量提醒'.tr,
haveBack: true,
backgroundColor: AppColors.mainColor),
body: Container(
padding: EdgeInsets.all(30.w),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Expanded(
child: Text(
"打开提醒后当锁电量低于20%、10%和5%系统会给指定对象发送提醒消息。电量读取方式网关读取或APP读取。",
style: TextStyle(
fontSize: 20.sp, color: AppColors.darkGrayTextColor),
)),
],
),
SizedBox(
height: 20.h,
),
CommonItem(
body: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.all(30.w),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Expanded(
child: Text(
"打开提醒后当锁电量低于20%、10%和5%系统会给指定对象发送提醒消息。电量读取方式网关读取或APP读取。"
.tr,
style: TextStyle(
fontSize: 20.sp,
color: AppColors.darkGrayTextColor,
),
softWrap: true,
))
],
),
SizedBox(
height: 20.h,
),
CommonItem(
leftTitel: '低电量提醒'.tr,
rightTitle: '',
isHaveLine: true,
isHaveDirection: false,
isHaveRightWidget: true,
rightWidget: _unOpenDoorSwitch(),
action: () {}),
Visibility(
rightWidget: _lowBatterySwitch(),
),
Visibility(
visible: state.isLowBatteryNotify.value,
child: Column(
children: [
SizedBox(
height: 20.h,
),
Container(
color: Colors.white,
margin: EdgeInsets.only(bottom: 10.h),
child: Column(
children: [
CommonItem(
leftTitel: '提醒方式'.tr,
rightTitle: "",
isHaveLine: false,
isHaveRightWidget: false,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.notificationModePage);
},
),
Container(
padding: EdgeInsets.only(
left: 10.w,
right: 10.w,
top: 12.h,
bottom: 12.h),
margin: EdgeInsets.only(bottom: 20.h, top: 10.h),
decoration: BoxDecoration(
color: AppColors.mainBackgroundColor,
borderRadius: BorderRadius.circular(6.0.w),
GestureDetector(
onTap: () {
Get.toNamed(Routers.notificationModePage, arguments: {
'msgNoticeInfo': state.msgNoticeInfo.value,
})?.then((val) {
if (val != null) {
state.emailListStr.value =
logic.getEmailListStr(val);
state.phontListStr.value =
logic.getPhoneListStr(val);
}
});
},
child: Container(
color: Colors.white,
margin: EdgeInsets.only(bottom: 10.h),
child: Column(
children: [
CommonItem(
leftTitel: '提醒方式'.tr,
rightTitle: "",
isHaveLine: false,
isHaveRightWidget: false,
isHaveDirection: true,
),
child: Text(
'APP推送 管理员',
style: TextStyle(
color: Colors.black, fontSize: 20.sp),
),
)
],
_buildNotifyContain('APP推送'.tr, '管理员'.tr),
Obx(() => state.emailListStr.value.isNotEmpty
? _buildNotifyContain(
'邮件提醒'.tr, state.emailListStr.value)
: Container()),
Obx(() => state.phontListStr.value.isNotEmpty
? _buildNotifyContain(
'短信提醒'.tr, state.phontListStr.value)
: Container()),
],
),
),
)
),
],
)),
Expanded(
child: SizedBox(
height: 20.h,
)),
SubmitBtn(
btnName: '保存'.tr,
onClick: () {},
),
SizedBox(
height: 60.h,
)
],
),
),
SizedBox(
height: 20.h,
),
SubmitBtn(
btnName: '保存'.tr,
onClick: () {
logic.lockNoticeSettingAccountList();
},
),
SizedBox(
height: 60.h,
),
],
),
),
),
);
}
CupertinoSwitch _unOpenDoorSwitch() {
Widget _buildNotifyContain(String notifyTitle, String notifyContent) {
return Container(
padding:
EdgeInsets.only(left: 10.w, right: 10.w, top: 12.h, bottom: 12.h),
margin: EdgeInsets.only(bottom: 20.h, top: 10.h, left: 20.w, right: 20.w),
decoration: BoxDecoration(
color: AppColors.mainBackgroundColor,
borderRadius: BorderRadius.circular(6.0.w),
),
child: Row(
children: [
Text(
notifyTitle,
style: TextStyle(color: Colors.black, fontSize: 20.sp),
),
Expanded(
child: SizedBox(
width: 20.w,
),
),
Text(
notifyContent,
textAlign: TextAlign.end,
style: TextStyle(
color: AppColors.placeholderTextColor,
fontSize: 20.sp,
),
),
],
),
);
}
CupertinoSwitch _lowBatterySwitch() {
return CupertinoSwitch(
activeColor: CupertinoColors.activeBlue,
trackColor: CupertinoColors.systemGrey5,

View File

@ -1,5 +1,29 @@
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/messageWarn/lockUser/lockUser_entity.dart';
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/msgNotification/msgNotification_entity.dart';
class LowBatteryReminderState {
var isLowBatteryNotify = false.obs; //
var getLockId = 0.obs;
var lockUserKeys = LockUserListKeys().obs;
var emailReceiverList = [].obs;
var phoneReceiverList = [].obs;
var emailListStr = ''.obs;
var phontListStr = ''.obs;
var msgNoticeInfo = MsgNoticeData().obs;
LowBatteryReminderState() {
Map map = Get.arguments;
if (map['lockId'] != null) {
getLockId.value = map['lockId'];
}
if (map['lockSetInfoData'] != null) {
msgNoticeInfo.value = map['lockSetInfoData'];
isLowBatteryNotify.value =
msgNoticeInfo.value.lowElecNoticeState == 1 ? true : false;
}
}
}

View File

@ -35,7 +35,7 @@ class MsgNoticeData {
int? doorNotCloseState;
int? tamperAlarmState;
int? lowElecNoticeState;
List? lowElecNoticeWayList;
List<NoticeWay>? lowElecNoticeWayList;
List? coercionOpenDoorNoticeList;
int? doorbellNoticeState;
int? someoneAtDoorNoticeState;
@ -65,11 +65,12 @@ class MsgNoticeData {
tamperAlarmState = json['tamperAlarmState'];
lowElecNoticeState = json['lowElecNoticeState'];
if (json['lowElecNoticeWayList'] != null) {
lowElecNoticeWayList = [];
lowElecNoticeWayList = <NoticeWay>[];
json['lowElecNoticeWayList'].forEach((v) {
lowElecNoticeWayList!.add(v);
lowElecNoticeWayList!.add(NoticeWay.fromJson(v));
});
}
if (json['coercionOpenDoorNoticeList'] != null) {
coercionOpenDoorNoticeList = [];
json['coercionOpenDoorNoticeList'].forEach((v) {

View File

@ -28,7 +28,7 @@ class _MsgNotificationPageState extends State<MsgNotificationPage> {
TextStyle(color: AppColors.placeholderTextColor, fontSize: 22.sp);
late InlineSpan tipsPreviewSpan = TextSpan(children: [
TextSpan(text: '添加和使用面容开锁时:\n', style: titleStyle),
TextSpan(text: '${'添加和使用面容开锁时:'.tr}\n', style: titleStyle),
TextSpan(
text:
'\n1、请尽量保持单人在门前操作\n2、请站立在门锁正前方约0.5~0.8米,面向门锁;\n3、请保持脸部无遮挡露出五官\n4、面容识别异常时可触摸数字键盘任意按键手动重启人脸识别。',
@ -57,20 +57,6 @@ class _MsgNotificationPageState extends State<MsgNotificationPage> {
Widget _buildMainItem() {
return Column(
children: [
// Container(
// alignment: Alignment.centerLeft,
// margin: EdgeInsets.only(left: 40.w, top: 20.h, bottom: 20.h),
// child: Text(
// '门锁通知',
// style: TextStyle(color: Colors.black, fontSize: 26.sp, fontWeight: FontWeight.w500),
// ),
// ),
// Divider(
// color: AppColors.greyLineColor,
// indent: 20.w,
// endIndent: 20.w,
// height: 1,
// ),
CommonItem(
leftTitel: '开门通知'.tr,
rightTitle: "",
@ -99,16 +85,6 @@ class _MsgNotificationPageState extends State<MsgNotificationPage> {
});
},
)),
// SizedBox(
// height: 20.h,
// ),
// Obx(() => CommonItem(
// leftTitel: '离家开门',
// rightTitle: "",
// isHaveLine: false,
// isHaveRightWidget: true,
// rightWidget:
// SizedBox(width: 60.w, height: 50.h, child: _switch(1)))),
Obx(() => CommonItem(
leftTitel: '门未关好'.tr,
rightTitle: "",
@ -132,7 +108,14 @@ class _MsgNotificationPageState extends State<MsgNotificationPage> {
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.lowBatteryReminderPage);
Get.toNamed(Routers.lowBatteryReminderPage, arguments: {
'lockSetInfoData': state.msgNoticeInfo.value,
'lockId': state.getLockId.value
})?.then((value) {
if (value != null) {
logic.getLockNoticeSetting();
}
});
},
)),
CommonItem(
@ -141,17 +124,12 @@ class _MsgNotificationPageState extends State<MsgNotificationPage> {
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.coerceOpenDoorPage);
Get.toNamed(Routers.coerceOpenDoorPage, arguments: {
'lockSetInfoData': state.msgNoticeInfo.value,
'lockId': state.getLockId.value
});
},
),
// Container(
// alignment: Alignment.centerLeft,
// margin: EdgeInsets.only(left: 40.w, top: 20.h, bottom: 20.h),
// child: Text(
// '门铃通知',
// style: TextStyle(color: Colors.black, fontSize: 26.sp, fontWeight: FontWeight.w500),
// ),
// ),
SizedBox(
height: 10.h,
),
@ -162,14 +140,6 @@ class _MsgNotificationPageState extends State<MsgNotificationPage> {
isHaveRightWidget: true,
rightWidget:
SizedBox(width: 60.w, height: 50.h, child: _switch(3)))),
// Container(
// alignment: Alignment.centerLeft,
// margin: EdgeInsets.only(left: 40.w, top: 40.h, bottom: 30.h),
// child: Text(
// '猫眼通知',
// style:TextStyle(color: Colors.black, fontSize: 26.sp, fontWeight: FontWeight.w500)
// ),
// ),
SizedBox(
height: 10.h,
),

View File

@ -32,111 +32,110 @@ class _NDaysUnopenedPageState extends State<NDaysUnopenedPage> {
barTitle: 'N天未开门'.tr,
haveBack: true,
backgroundColor: AppColors.mainColor),
body: Container(
body: ListView(
padding: EdgeInsets.all(30.w),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Expanded(
child: Text(
"经过以上设定的时间,锁没有被开启,系统会给指定对象发送提醒消息,该功能需要锁联网",
style: TextStyle(
fontSize: 20.sp, color: AppColors.darkGrayTextColor),
)),
],
),
SizedBox(
height: 20.h,
),
CommonItem(
leftTitel: 'N天未开门提醒'.tr,
rightTitle: '',
isHaveLine: true,
isHaveDirection: false,
isHaveRightWidget: true,
rightWidget: _unOpenDoorSwitch(),
action: () {}),
Visibility(
visible: state.isUnOpenNotice.value,
child: Column(
children: [
Obx(() => CommonItem(
leftTitel: '门未开时间',
rightTitle: '${state.unOpenDoorTime.value}',
isHaveLine: true,
isHaveRightWidget: false,
isHaveDirection: true,
action: () {
_openBottomItemSheet(
context, state.unopenDoorTimeList);
},
)),
SizedBox(
height: 20.h,
),
GestureDetector(
onTap: () {
Get.toNamed(Routers.notificationModePage, arguments: {
'msgNoticeInfo': state.msgNoticeInfo.value
})?.then((val) {
if (val != null) {
state.emailListStr.value =
logic.getEmailListStr(val);
state.phontListStr.value =
logic.getPhoneListStr(val);
print(
'emailListStr:${state.emailListStr.value},phontListStr:${state.phontListStr.value}');
}
});
},
child: Container(
color: Colors.white,
margin: EdgeInsets.only(bottom: 10.h),
child: Column(
children: [
CommonItem(
leftTitel: '提醒方式'.tr,
rightTitle: "",
isHaveLine: false,
isHaveRightWidget: false,
isHaveDirection: true,
),
_buildNotifyContain('APP推送'.tr, '管理员'.tr),
Obx(() => state.emailListStr.value.isNotEmpty
? _buildNotifyContain(
'邮件提醒'.tr, state.emailListStr.value)
: Container()),
Obx(() => state.phontListStr.value.isNotEmpty
? _buildNotifyContain(
'短信提醒'.tr, state.phontListStr.value)
: Container()),
],
),
),
),
],
)),
Expanded(
child: SizedBox(
height: 20.h,
)),
SubmitBtn(
btnName: '保存',
onClick: () {
logic.lockNoticeSettingAccountList();
},
),
SizedBox(
height: 60.h,
)
],
),
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Expanded(
child: Text(
"经过以上设定的时间,锁没有被开启,系统会给指定对象发送提醒消息,该功能需要锁联网".tr,
style: TextStyle(
fontSize: 20.sp, color: AppColors.darkGrayTextColor),
)),
],
),
SizedBox(
height: 20.h,
),
CommonItem(
leftTitel: 'N天未开门提醒'.tr,
rightTitle: '',
isHaveLine: true,
isHaveDirection: false,
isHaveRightWidget: true,
rightWidget: _unOpenDoorSwitch(),
action: () {}),
_buildOpenNoticeWidget(),
Expanded(
child: SizedBox(
height: 20.h,
)),
SubmitBtn(
btnName: '保存'.tr,
onClick: () {
logic.lockNoticeSettingAccountList();
},
),
SizedBox(
height: 60.h,
)
],
),
);
}
Widget _buildOpenNoticeWidget() {
return Visibility(
visible: state.isUnOpenNotice.value,
child: Column(
children: [
Obx(() => CommonItem(
leftTitel: '门未开时间'.tr,
rightTitle: '${state.unOpenDoorTime.value}${''.tr}',
isHaveLine: true,
isHaveRightWidget: false,
isHaveDirection: true,
action: () {
_openBottomItemSheet(context, state.unopenDoorTimeList);
},
)),
SizedBox(
height: 20.h,
),
GestureDetector(
onTap: () {
Get.toNamed(Routers.notificationModePage,
arguments: {'msgNoticeInfo': state.msgNoticeInfo.value})
?.then((val) {
if (val != null) {
state.emailListStr.value = logic.getEmailListStr(val);
state.phontListStr.value = logic.getPhoneListStr(val);
print(
'emailListStr:${state.emailListStr.value},phontListStr:${state.phontListStr.value}');
}
});
},
child: Container(
color: Colors.white,
margin: EdgeInsets.only(bottom: 10.h),
child: Column(
children: [
CommonItem(
leftTitel: '提醒方式'.tr,
rightTitle: "",
isHaveLine: false,
isHaveRightWidget: false,
isHaveDirection: true,
),
_buildNotifyContain('APP推送'.tr, '管理员'.tr),
Obx(() => state.emailListStr.value.isNotEmpty
? _buildNotifyContain(
'邮件提醒'.tr, state.emailListStr.value)
: Container()),
Obx(() => state.phontListStr.value.isNotEmpty
? _buildNotifyContain(
'短信提醒'.tr, state.phontListStr.value)
: Container()),
],
),
),
),
],
));
}
Widget _buildNotifyContain(String notifyTitle, String notifyContent) {
return Container(
padding:

View File

@ -1,7 +1,6 @@
import 'package:get/get.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/messageWarn/msgNotification/openDoorNotify/openDoorNotify_entity.dart';
class NDaysUnopenedState {
final List unopenDoorTimeList = [

View File

@ -1,5 +1,3 @@
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/msgNotification/msgNotification_entity.dart';
class OpenDoorNotifyEntity {
int? errorCode;
String? description;

View File

@ -196,7 +196,7 @@ class _NotificationModePageState extends State<NotificationModePage> {
},
)
: Container(),
getReceiverTFWidget(isEmail ? '请输入Email'.tr : '请输入手机号', index,
getReceiverTFWidget(isEmail ? '请输入Email'.tr : '请输入手机号'.tr, index,
isEmail: isEmail)
],
),

View File

@ -208,6 +208,8 @@ abstract class Api {
'/lockNoticeSettingAccount/delete'; //
final String updateLockNoticeSettingAccountURL =
'/lockNoticeSettingAccount/update'; //
final String getCoercedFingerprintListURL =
'/fingerprint/getCoercedList'; //
final String setWechatPushSwitchURL =
'/user/setMpWechatPushSwitch'; //

View File

@ -1837,6 +1837,17 @@ class ApiProvider extends BaseProvider {
'dayNotOpenDoorNoticeWayList': dayNotOpenDoorNoticeWayList
}));
//
Future<Response> updatelowElecNoticeStateSetting(
int lockId, int lowElecNoticeState, List lowElecNoticeWayList) =>
post(
updateLockNoticeSettingURL.toUrl,
jsonEncode({
'lockId': lockId,
'lowElecNoticeState': lowElecNoticeState,
'lowElecNoticeWayList': lowElecNoticeWayList
}));
//
Future<Response> updateDoorNotCloseSetting(
int lockId,
@ -1923,6 +1934,14 @@ class ApiProvider extends BaseProvider {
'settingValue': settingValue
}));
//
Future<Response> getCoercedFingerprintList(
int lockId, int pageNo, int pageSize) =>
post(
getCoercedFingerprintListURL.toUrl,
jsonEncode(
{'lockId': lockId, 'pageNo': pageNo, 'pageSize': pageSize}));
//
Future<Response> setMpWechatPushSwitch(int mpWechatPushSwitch) => post(
setWechatPushSwitchURL.toUrl,

View File

@ -8,6 +8,7 @@ import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/ma
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/coerceOpenDoor/coerceFingerprintList/coerceFingerprintList_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';
@ -1860,6 +1861,16 @@ class ApiRepository {
return OpenDoorNotifyEntity.fromJson(res.body);
}
//
Future<OpenDoorNotifyEntity> updatelowElecNoticeStateSetting(
{required int lockId,
required int lowElecNoticeState,
required List lowElecNoticeWayList}) async {
final res = await apiProvider.updatelowElecNoticeStateSetting(
lockId, lowElecNoticeState, lowElecNoticeWayList);
return OpenDoorNotifyEntity.fromJson(res.body);
}
//
Future<MsgNotificationEntity> updateDoorNotCloseSetting({
required int lockId,
@ -1941,6 +1952,14 @@ class ApiRepository {
return OpenDoorNotifyEntity.fromJson(res.body);
}
//
Future<CoerceFingerprintListEntity> getCoercedFingerprintList(
{required int lockId, required int pageNo, required int pageSize}) async {
final res =
await apiProvider.getCoercedFingerprintList(lockId, pageNo, pageSize);
return CoerceFingerprintListEntity.fromJson(res.body);
}
//
Future<VersionUndateEntity> setMpWechatPushSwitch(
{required int mpWechatPushSwitch}) async {