1,新增手掌列表页面
2,新增添加永久、限时、循环类型手掌界面 3,新增添加手掌手势过程页面
This commit is contained in:
parent
945e24aa37
commit
eab54c1494
@ -25,6 +25,9 @@ import 'package:star_lock/main/lockDetail/lockSet/msgNotification/msgNotificatio
|
|||||||
import 'package:star_lock/main/lockDetail/lockSet/notificationMode/notificationMode_page.dart';
|
import 'package:star_lock/main/lockDetail/lockSet/notificationMode/notificationMode_page.dart';
|
||||||
import 'package:star_lock/main/lockDetail/lockSet/openDoorDirection/openDoorDirection_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/lockDetail/lockDetail_main_page.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/palm/addPalm/addPalm_page.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/palm/addPalmType/addPalmTypeManage/addPalmTypeManage_page.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/palm/palmList/palmList_page.dart';
|
||||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyDetailChangeDate/passwordKeyDetailChangeDate_page.dart';
|
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyDetailChangeDate/passwordKeyDetailChangeDate_page.dart';
|
||||||
import 'package:star_lock/mine/about/webviewShow_page.dart';
|
import 'package:star_lock/mine/about/webviewShow_page.dart';
|
||||||
import 'package:star_lock/mine/mine/safeVerify/safeVerify_page.dart';
|
import 'package:star_lock/mine/mine/safeVerify/safeVerify_page.dart';
|
||||||
@ -423,7 +426,11 @@ abstract class Routers {
|
|||||||
|
|
||||||
static const irisListPage = '/IrisListPage'; // 虹膜列表
|
static const irisListPage = '/IrisListPage'; // 虹膜列表
|
||||||
static const addIrisTypeManagePage = '/AddIrisTypeManagePage'; // 添加虹膜
|
static const addIrisTypeManagePage = '/AddIrisTypeManagePage'; // 添加虹膜
|
||||||
static const addIrisPage = '/AddIrisPage'; // 添加虹膜
|
static const addIrisPage = '/AddIrisPage'; // 添加虹膜过程
|
||||||
|
|
||||||
|
static const palmListPage = '/PalmListPage'; // 手掌列表
|
||||||
|
static const addPalmTypeManagePage = '/AddPalmTypeManagePage'; // 添加手掌
|
||||||
|
static const addPalmPage = '/AddPalmPage'; // 添加手掌过程
|
||||||
|
|
||||||
static const passwordKeyDetailChangeDatePage =
|
static const passwordKeyDetailChangeDatePage =
|
||||||
'/passwordKeyDetailChangeDatePage'; //密码更改时间
|
'/passwordKeyDetailChangeDatePage'; //密码更改时间
|
||||||
@ -1044,6 +1051,11 @@ abstract class AppRouters {
|
|||||||
GetPage(
|
GetPage(
|
||||||
name: Routers.addIrisTypeManagePage,
|
name: Routers.addIrisTypeManagePage,
|
||||||
page: (() => const AddIrisTypeManagePage())),
|
page: (() => const AddIrisTypeManagePage())),
|
||||||
GetPage(name: Routers.addIrisPage, page: (() => const AddIrisPage()))
|
GetPage(name: Routers.addIrisPage, page: (() => const AddIrisPage())),
|
||||||
|
GetPage(name: Routers.palmListPage, page: (() => const PalmListPage())),
|
||||||
|
GetPage(
|
||||||
|
name: Routers.addPalmTypeManagePage,
|
||||||
|
page: (() => const AddPalmTypeManagePage())),
|
||||||
|
GetPage(name: Routers.addPalmPage, page: (() => const AddPalmPage()))
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,24 +1,9 @@
|
|||||||
import 'dart:async';
|
import 'package:star_lock/main/lockDetail/iris/addIris/addIris_state.dart';
|
||||||
|
|
||||||
// import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
|
||||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
|
||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:star_lock/blue/io_protocol/io_addFace.dart';
|
|
||||||
import 'package:star_lock/blue/io_type.dart';
|
|
||||||
import 'package:star_lock/main/lockDetail/face/addFace/addFace_state.dart';
|
|
||||||
import 'package:star_lock/tools/eventBusEventManage.dart';
|
|
||||||
|
|
||||||
import '../../../../../blue/blue_manage.dart';
|
|
||||||
import '../../../../../blue/io_reply.dart';
|
|
||||||
import '../../../../../blue/io_tool/io_tool.dart';
|
|
||||||
import '../../../../../blue/io_tool/manager_event_bus.dart';
|
|
||||||
import '../../../../../blue/sender_manage.dart';
|
|
||||||
import '../../../../../network/api_repository.dart';
|
|
||||||
import '../../../../../tools/baseGetXController.dart';
|
import '../../../../../tools/baseGetXController.dart';
|
||||||
import '../../../../../tools/storage.dart';
|
|
||||||
|
|
||||||
class AddIrisLogic extends BaseGetXController {
|
class AddIrisLogic extends BaseGetXController {
|
||||||
final AddFaceState state = AddFaceState();
|
final AddIrisState state = AddIrisState();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() {
|
void onReady() {
|
||||||
|
|||||||
@ -22,10 +22,10 @@ class AddIrisTypeManageTabbar extends StatefulWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
State<AddIrisTypeManageTabbar> createState() =>
|
State<AddIrisTypeManageTabbar> createState() =>
|
||||||
_AddFaceTypeManageTabbarState();
|
_AddIrisTypeManageTabbarState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _AddFaceTypeManageTabbarState extends State<AddIrisTypeManageTabbar>
|
class _AddIrisTypeManageTabbarState extends State<AddIrisTypeManageTabbar>
|
||||||
with SingleTickerProviderStateMixin {
|
with SingleTickerProviderStateMixin {
|
||||||
late TabController _tabController;
|
late TabController _tabController;
|
||||||
|
|
||||||
|
|||||||
@ -1,29 +1,40 @@
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/face/addFaceType/addFaceType_state.dart';
|
import 'package:star_lock/main/lockDetail/iris/addIrisType/addIrisType_state.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import 'package:star_lock/tools/dateTool.dart';
|
||||||
import '../../../../appRouters.dart';
|
import '../../../../appRouters.dart';
|
||||||
import '../../../../network/api_repository.dart';
|
import '../../../../network/api_repository.dart';
|
||||||
|
|
||||||
class AddIrisTypeLogic extends BaseGetXController {
|
class AddIrisTypeLogic extends BaseGetXController {
|
||||||
AddFaceTypeState state = AddFaceTypeState();
|
AddIrisTypeState state = AddIrisTypeState();
|
||||||
|
|
||||||
// 添加指纹
|
// 添加虹膜
|
||||||
void addFaceData() async {
|
void addIrisData() async {
|
||||||
var faceType = 0; // 永久:1;限时2,单次3,循环:4
|
var irisType = 0; // 永久:1;限时2,单次3,循环:4
|
||||||
var startDate = "";
|
var startDate = "";
|
||||||
var endDate = "";
|
var endDate = "";
|
||||||
if (state.seletType.value == "0") {
|
var startTime = "";
|
||||||
faceType = 1;
|
var endTime = "";
|
||||||
|
if (state.selectType.value == "0") {
|
||||||
|
irisType = 1;
|
||||||
startDate = "0";
|
startDate = "0";
|
||||||
endDate = "0";
|
endDate = "0";
|
||||||
} else if (state.seletType.value == "1") {
|
startTime = "0";
|
||||||
faceType = 2;
|
endTime = "0";
|
||||||
if (state.beginTimeTimestamp.value.isEmpty) {
|
} else if (state.selectType.value == "1") {
|
||||||
showToast("请选择开始时间");
|
irisType = 2;
|
||||||
|
startDate =
|
||||||
|
DateTool().dateToTimestamp(state.beginTime.value, 1).toString();
|
||||||
|
endDate = DateTool().dateToTimestamp(state.endTime.value, 1).toString();
|
||||||
|
startTime = "0";
|
||||||
|
endTime = "0";
|
||||||
|
|
||||||
|
if (startDate.isEmpty) {
|
||||||
|
showToast("请选择开始时间".tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (state.endTimeTimestamp.value.isEmpty) {
|
if (endDate.isEmpty) {
|
||||||
showToast("请选择结束时间");
|
showToast("请选择结束时间".tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,53 +43,33 @@ class AddIrisTypeLogic extends BaseGetXController {
|
|||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (int.parse(state.beginTimeTimestamp.value) >=
|
if (int.parse(startDate) >= int.parse(endDate)) {
|
||||||
int.parse(state.endTimeTimestamp.value)) {
|
showToast("失效时间要大于生效时间".tr);
|
||||||
showToast("失效时间要大于生效时间");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
} else if (state.selectType.value == "2") {
|
||||||
startDate = state.beginTimeTimestamp.value;
|
if (state.beginTime.value.isEmpty) {
|
||||||
endDate = state.endTimeTimestamp.value;
|
showToast("请选择有效期".tr);
|
||||||
} else if (state.seletType.value == "2") {
|
|
||||||
if (state.effectiveDateTime.value <= 0) {
|
|
||||||
showToast("请选择生效时间");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (state.failureDateTime.value <= 0) {
|
startDate =
|
||||||
showToast("请选择失效时间");
|
DateTool().dateToTimestamp(state.beginTime.value, 1).toString();
|
||||||
return;
|
endDate = DateTool().dateToTimestamp(state.endTime.value, 1).toString();
|
||||||
}
|
startTime = DateTool()
|
||||||
|
.dateToTimestamp(state.effectiveDateTime.value, 0)
|
||||||
if (state.weekdaysList.value.isEmpty) {
|
.toString();
|
||||||
showToast("请选择有效日");
|
endTime =
|
||||||
return;
|
DateTool().dateToTimestamp(state.failureDateTime.value, 0).toString();
|
||||||
}
|
irisType = 4;
|
||||||
|
|
||||||
// if(DateTime.now().millisecondsSinceEpoch >= state.effectiveDateTime.value){
|
|
||||||
// Toast.show(msg: "生效时间要大于当前时间");
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (state.effectiveDateTime.value >= state.failureDateTime.value) {
|
|
||||||
showToast("失效时间要大于生效时间");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
startDate = state.effectiveDateTime.value.toString();
|
|
||||||
endDate = state.failureDateTime.value.toString();
|
|
||||||
faceType = 4;
|
|
||||||
}
|
}
|
||||||
|
// 虹膜
|
||||||
print(
|
|
||||||
"传出去的给你限时人脸开始时间:${int.parse(startDate) ~/ 1000} 限时人脸结束时间:${int.parse(endDate) ~/ 1000}");
|
|
||||||
// 人脸
|
|
||||||
Get.toNamed(Routers.addIrisPage, arguments: {
|
Get.toNamed(Routers.addIrisPage, arguments: {
|
||||||
"lockId": state.lockId.value,
|
"lockId": state.lockId.value,
|
||||||
"endDate": int.parse(endDate),
|
"endDate": int.parse(endDate),
|
||||||
"addType": "1",
|
"addType": "1",
|
||||||
"faceName": state.nameController.text,
|
"faceName": state.nameController.text,
|
||||||
"faceNumber": "123456",
|
"faceNumber": "123456",
|
||||||
"faceType": faceType,
|
"faceType": irisType,
|
||||||
"startDate": int.parse(startDate),
|
"startDate": int.parse(startDate),
|
||||||
"cyclicConfig": state.weekdaysList.value,
|
"cyclicConfig": state.weekdaysList.value,
|
||||||
"fromType": state.fromType.value,
|
"fromType": state.fromType.value,
|
||||||
@ -87,13 +78,13 @@ class AddIrisTypeLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 校验指纹名字是否重复
|
// 校验指纹名字是否重复
|
||||||
void checkFaceNameDuplicated(String faceName) async {
|
void checkIrisNameDuplicated(String irisName) async {
|
||||||
var entity = await ApiRepository.to.checkFaceNameDuplicatedData(
|
var entity = await ApiRepository.to.checkFaceNameDuplicatedData(
|
||||||
lockId: state.lockId.value.toString(),
|
lockId: state.lockId.value.toString(),
|
||||||
faceName: faceName,
|
faceName: irisName,
|
||||||
);
|
);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
addFaceData();
|
addIrisData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/iris/addIrisType/addIrisType_logic.dart';
|
import 'package:star_lock/main/lockDetail/iris/addIrisType/addIrisType_logic.dart';
|
||||||
|
import 'package:star_lock/tools/dateTool.dart';
|
||||||
import 'package:star_lock/tools/pickers/pickers.dart';
|
import 'package:star_lock/tools/pickers/pickers.dart';
|
||||||
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
||||||
|
|
||||||
@ -28,16 +30,16 @@ class AddIrisTypePage extends StatefulWidget {
|
|||||||
: super(key: key);
|
: super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<AddIrisTypePage> createState() => _AddFaceTypePageState();
|
State<AddIrisTypePage> createState() => _AddIrisTypePageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _AddFaceTypePageState extends State<AddIrisTypePage> {
|
class _AddIrisTypePageState extends State<AddIrisTypePage> {
|
||||||
final logic = Get.put(AddIrisTypeLogic());
|
final logic = Get.put(AddIrisTypeLogic());
|
||||||
final state = Get.find<AddIrisTypeLogic>().state;
|
final state = Get.find<AddIrisTypeLogic>().state;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
state.seletType.value = widget.selectType;
|
state.selectType.value = widget.selectType;
|
||||||
state.lockId.value = widget.lockId;
|
state.lockId.value = widget.lockId;
|
||||||
if (widget.fromTypeTwoStaffName.isNotEmpty) {
|
if (widget.fromTypeTwoStaffName.isNotEmpty) {
|
||||||
state.nameController.text = widget.fromTypeTwoStaffName;
|
state.nameController.text = widget.fromTypeTwoStaffName;
|
||||||
@ -47,12 +49,29 @@ class _AddFaceTypePageState extends State<AddIrisTypePage> {
|
|||||||
return indexChangeWidget();
|
return indexChangeWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
// TODO: implement initState
|
||||||
|
super.initState();
|
||||||
|
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
if (state.selectType.value == "1") {
|
||||||
|
state.beginTime.value = DateTool().dateToYMDHNString(
|
||||||
|
DateTime.now().millisecondsSinceEpoch.toString()); //默认为当前时间
|
||||||
|
state.endTime.value = DateTool().dateToYMDHNString(
|
||||||
|
DateTime.now().millisecondsSinceEpoch.toString()); //默认为当前时间
|
||||||
|
} else {
|
||||||
|
state.beginTime.value = ""; //默认为当前时间
|
||||||
|
state.endTime.value = ""; //默认为当前时间
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
Widget indexChangeWidget() {
|
Widget indexChangeWidget() {
|
||||||
switch (int.parse(widget.selectType)) {
|
switch (int.parse(widget.selectType)) {
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
// 永久
|
// 永久
|
||||||
// return sendElectronicKeySucceed();
|
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
perpetualKeyWidget(
|
perpetualKeyWidget(
|
||||||
@ -86,21 +105,7 @@ class _AddFaceTypePageState extends State<AddIrisTypePage> {
|
|||||||
TranslationLoader.lanKeys!.name!.tr,
|
TranslationLoader.lanKeys!.name!.tr,
|
||||||
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||||
state.nameController),
|
state.nameController),
|
||||||
CommonItem(
|
keyCyclicDate(),
|
||||||
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
|
||||||
rightTitle: "",
|
|
||||||
isHaveDirection: true,
|
|
||||||
action: () async {
|
|
||||||
Map result = await Get.toNamed(
|
|
||||||
Routers.electronicKeyPeriodValidityPage);
|
|
||||||
state.weekdaysList.value = result['validityValue'];
|
|
||||||
state.effectiveDateTime.value =
|
|
||||||
result['starDate'].millisecondsSinceEpoch;
|
|
||||||
state.failureDateTime.value =
|
|
||||||
result['endDate'].millisecondsSinceEpoch;
|
|
||||||
print(
|
|
||||||
'得到的有效期数据:${state.weekdaysList.value} == ${state.effectiveDateTime.value} == ${state.failureDateTime.value}');
|
|
||||||
}),
|
|
||||||
SizedBox(height: 10.h),
|
SizedBox(height: 10.h),
|
||||||
keyBottomWidget()
|
keyBottomWidget()
|
||||||
],
|
],
|
||||||
@ -139,12 +144,7 @@ class _AddFaceTypePageState extends State<AddIrisTypePage> {
|
|||||||
action: () async {
|
action: () async {
|
||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
state.beginTime.value =
|
state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||||
'${p.year}-${p.month!.toString().padLeft(2, '0')}-${p.day!.toString().padLeft(2, '0')} ${p.hour!.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}';
|
|
||||||
state.beginTimeTimestamp.value =
|
|
||||||
DateTime.parse(state.beginTime.value)
|
|
||||||
.millisecondsSinceEpoch
|
|
||||||
.toString();
|
|
||||||
});
|
});
|
||||||
})),
|
})),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
@ -154,12 +154,7 @@ class _AddFaceTypePageState extends State<AddIrisTypePage> {
|
|||||||
action: () {
|
action: () {
|
||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
state.endTime.value =
|
state.endTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||||
'${p.year}-${p.month!.toString().padLeft(2, '0')}-${p.day!.toString().padLeft(2, '0')} ${p.hour!.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}';
|
|
||||||
state.endTimeTimestamp.value =
|
|
||||||
DateTime.parse(state.endTime.value)
|
|
||||||
.millisecondsSinceEpoch
|
|
||||||
.toString();
|
|
||||||
});
|
});
|
||||||
})),
|
})),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
@ -167,16 +162,90 @@ class _AddFaceTypePageState extends State<AddIrisTypePage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 循环顶部选择日期
|
||||||
|
Widget keyCyclicDate() {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||||
|
rightTitle: "${state.beginTime.value}\n${state.endTime.value}",
|
||||||
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () async {
|
||||||
|
var result =
|
||||||
|
await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
|
||||||
|
'validityValue': state.weekdaysList.value,
|
||||||
|
'starDate': state.beginTime.value,
|
||||||
|
'endDate': state.endTime.value,
|
||||||
|
'starTime': state.effectiveDateTime.value,
|
||||||
|
'endTime': state.failureDateTime.value
|
||||||
|
});
|
||||||
|
if (result != null && result.isNotEmpty) {
|
||||||
|
state.weekdaysList.value = result['validityValue'];
|
||||||
|
state.beginTime.value = result['starDate'];
|
||||||
|
state.endTime.value = result['endDate'];
|
||||||
|
state.effectiveDateTime.value = result['starTime'];
|
||||||
|
state.failureDateTime.value = result['endTime'];
|
||||||
|
Get.log(
|
||||||
|
'得到的有效期数据:${state.weekdaysList.value} == ${state.beginTime.value} == ${state.endTime.value}== ${state.effectiveDateTime.value} == ${state.failureDateTime.value}');
|
||||||
|
}
|
||||||
|
})),
|
||||||
|
Obx(() => Visibility(
|
||||||
|
visible: state.weekdaysList.isNotEmpty ? true : false,
|
||||||
|
child: CommonItem(
|
||||||
|
leftTitel: "有效日",
|
||||||
|
rightTitle: state.weekdaysList.value.join(",").toString(),
|
||||||
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () async {
|
||||||
|
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
||||||
|
arguments: {
|
||||||
|
'validityValue': state.weekdaysList.value,
|
||||||
|
'starDate': state.beginTime.value,
|
||||||
|
'endDate': state.endTime.value,
|
||||||
|
'starTime': state.effectiveDateTime.value,
|
||||||
|
'endTime': state.failureDateTime.value
|
||||||
|
});
|
||||||
|
if (result != null && result.isNotEmpty) {
|
||||||
|
state.weekdaysList.value = result['validityValue'];
|
||||||
|
state.beginTime.value = result['starDate'];
|
||||||
|
state.endTime.value = result['endDate'];
|
||||||
|
state.effectiveDateTime.value = result['starTime'];
|
||||||
|
state.failureDateTime.value = result['endTime'];
|
||||||
|
}
|
||||||
|
}))),
|
||||||
|
Obx(() => Visibility(
|
||||||
|
visible: state.effectiveDateTime.value.isNotEmpty,
|
||||||
|
child: CommonItem(
|
||||||
|
leftTitel: "有效时间".tr,
|
||||||
|
rightTitle:
|
||||||
|
"${state.effectiveDateTime.value}-${state.failureDateTime.value}",
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () async {
|
||||||
|
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
||||||
|
arguments: {
|
||||||
|
'validityValue': state.weekdaysList.value,
|
||||||
|
'starDate': state.beginTime.value,
|
||||||
|
'endDate': state.endTime.value,
|
||||||
|
'starTime': state.effectiveDateTime.value,
|
||||||
|
'endTime': state.failureDateTime.value
|
||||||
|
});
|
||||||
|
if (result != null && result.isNotEmpty) {
|
||||||
|
state.weekdaysList.value = result['validityValue'];
|
||||||
|
state.beginTime.value = result['starDate'];
|
||||||
|
state.endTime.value = result['endDate'];
|
||||||
|
state.effectiveDateTime.value = result['starTime'];
|
||||||
|
state.failureDateTime.value = result['endTime'];
|
||||||
|
Get.back(result: result);
|
||||||
|
}
|
||||||
|
}))),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Widget keyBottomWidget() {
|
Widget keyBottomWidget() {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
// CommonItem(
|
|
||||||
// leftTitel: TranslationLoader.lanKeys!.face!.tr,
|
|
||||||
// rightTitle: "",
|
|
||||||
// isTipsImg: false,
|
|
||||||
// isHaveRightWidget: true,
|
|
||||||
// rightWidget: SizedBox(
|
|
||||||
// width: 60.w, height: 50.h, child: _isStressFingerprint())),
|
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: "是否是管理员",
|
leftTitel: "是否是管理员",
|
||||||
rightTitle: "",
|
rightTitle: "",
|
||||||
@ -195,7 +264,7 @@ class _AddFaceTypePageState extends State<AddIrisTypePage> {
|
|||||||
logic.showToast("请输入姓名");
|
logic.showToast("请输入姓名");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
logic.checkFaceNameDuplicated(state.nameController.text);
|
logic.checkIrisNameDuplicated(state.nameController.text);
|
||||||
} else {
|
} else {
|
||||||
// Get.toNamed(Routers.selectLockTypePage);
|
// Get.toNamed(Routers.selectLockTypePage);
|
||||||
logic.showToast("演示模式");
|
logic.showToast("演示模式");
|
||||||
@ -205,97 +274,48 @@ class _AddFaceTypePageState extends State<AddIrisTypePage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 发送电子钥匙成功
|
|
||||||
Widget sendElectronicKeySucceed() {
|
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
height: 300.h,
|
|
||||||
width: 1.sw,
|
|
||||||
color: Colors.white,
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
height: 30.h,
|
|
||||||
),
|
|
||||||
Image.asset(
|
|
||||||
'images/main/icon_main_addLock.png',
|
|
||||||
width: 150.w,
|
|
||||||
height: 150.w,
|
|
||||||
color: AppColors.mainColor,
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 20.h,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
"操作成功,密码为",
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 32.sp,
|
|
||||||
color: Colors.black,
|
|
||||||
fontWeight: FontWeight.w500),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 10.h,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
"62689876",
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 60.sp,
|
|
||||||
color: Colors.black,
|
|
||||||
fontWeight: FontWeight.w500),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 20.h,
|
|
||||||
),
|
|
||||||
SubmitBtn(
|
|
||||||
btnName: '完成',
|
|
||||||
fontSize: 28.sp,
|
|
||||||
borderRadius: 20.w,
|
|
||||||
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
|
|
||||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
|
||||||
onClick: () {}),
|
|
||||||
SubmitBtn(
|
|
||||||
btnName: '分享',
|
|
||||||
fontSize: 28.sp,
|
|
||||||
borderRadius: 20.w,
|
|
||||||
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
|
|
||||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
|
||||||
onClick: () {}),
|
|
||||||
SubmitBtn(
|
|
||||||
btnName: '标记为:已入住',
|
|
||||||
fontSize: 28.sp,
|
|
||||||
borderRadius: 20.w,
|
|
||||||
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
|
|
||||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
|
||||||
onClick: () {}),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 接受者信息输入框
|
// 接受者信息输入框
|
||||||
Widget getTFWidget(String tfStr) {
|
Widget getTFWidget(String tfStr) {
|
||||||
return Container(
|
return Container(
|
||||||
height: 50.h,
|
// color: Colors.red,
|
||||||
|
height: 65.h,
|
||||||
width: 300.w,
|
width: 300.w,
|
||||||
|
padding: EdgeInsets.only(top: 5.h),
|
||||||
child: Row(
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: TextField(
|
child: TextField(
|
||||||
//输入框一行
|
//输入框一行
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
|
inputFormatters: <TextInputFormatter>[
|
||||||
|
FilteringTextInputFormatter.deny('\n'),
|
||||||
|
LengthLimitingTextInputFormatter(18),
|
||||||
|
],
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||||
controller: state.nameController,
|
controller: state.nameController,
|
||||||
autofocus: false,
|
autofocus: false,
|
||||||
textAlign: TextAlign.end,
|
textAlign: TextAlign.end,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
//输入里面输入文字内边距设置
|
//输入里面输入文字内边距设置
|
||||||
contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
|
// contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
|
||||||
hintText: tfStr,
|
hintText: tfStr,
|
||||||
hintStyle: TextStyle(fontSize: 24.sp),
|
hintStyle: TextStyle(fontSize: 22.sp),
|
||||||
//不需要输入框下划线
|
focusedBorder: const OutlineInputBorder(
|
||||||
border: InputBorder.none,
|
borderSide:
|
||||||
|
BorderSide(width: 0, color: Colors.transparent)),
|
||||||
|
disabledBorder: const OutlineInputBorder(
|
||||||
|
borderSide:
|
||||||
|
BorderSide(width: 0, color: Colors.transparent)),
|
||||||
|
enabledBorder: const OutlineInputBorder(
|
||||||
|
borderSide:
|
||||||
|
BorderSide(width: 0, color: Colors.transparent)),
|
||||||
|
border: const OutlineInputBorder(
|
||||||
|
borderSide:
|
||||||
|
BorderSide(width: 0, color: Colors.transparent)),
|
||||||
|
contentPadding: const EdgeInsets.symmetric(vertical: 0),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
class AddFaceTypeState {
|
class AddIrisTypeState {
|
||||||
final lockId = 0.obs;
|
final lockId = 0.obs;
|
||||||
final seletType = "0".obs; // 0永久 1显示 2循环
|
final selectType = "0".obs; // 0永久 1显示 2循环
|
||||||
final fromType = 1.obs; // // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
final fromType = 1.obs; // // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||||
var fromTypeTwoStaffName = "".obs; // 考勤添加人脸员工名字
|
var fromTypeTwoStaffName = "".obs; // 考勤添加人脸员工名字
|
||||||
final isStressFingerprint = false.obs;
|
final isStressFingerprint = false.obs;
|
||||||
@ -11,15 +11,12 @@ class AddFaceTypeState {
|
|||||||
|
|
||||||
var beginTime = "".obs; // 开始时间
|
var beginTime = "".obs; // 开始时间
|
||||||
var endTime = "".obs; // 结束时间
|
var endTime = "".obs; // 结束时间
|
||||||
var beginTimeTimestamp = "".obs; // 开始时间时间戳
|
var effectiveDateTime = "".obs; // 生效时间
|
||||||
var endTimeTimestamp = "".obs; // 结束时间时间戳
|
var failureDateTime = "".obs; // 失效时间
|
||||||
|
|
||||||
var effectiveDateTime = 0.obs; // 生效时间
|
|
||||||
var failureDateTime = 0.obs; // 失效时间
|
|
||||||
var weekdaysList = [].obs;
|
var weekdaysList = [].obs;
|
||||||
|
|
||||||
final TextEditingController nameController = TextEditingController();
|
final TextEditingController nameController = TextEditingController();
|
||||||
AddFaceTypeState() {
|
AddIrisTypeState() {
|
||||||
// Map map = Get.arguments;
|
// Map map = Get.arguments;
|
||||||
// lockId.value = map["lockId"];
|
// lockId.value = map["lockId"];
|
||||||
// fromType.value = map["fromType"];
|
// fromType.value = map["fromType"];
|
||||||
|
|||||||
@ -299,7 +299,7 @@ class IrisListLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 删除人脸
|
// 删除人脸
|
||||||
Future<void> senderAddFace() async {
|
Future<void> senderAddIris() async {
|
||||||
showEasyLoading();
|
showEasyLoading();
|
||||||
showBlueConnetctToastTimer(action: () {
|
showBlueConnetctToastTimer(action: () {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
@ -339,8 +339,8 @@ class IrisListLogic extends BaseGetXController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取人脸列表
|
// 获取虹膜列表
|
||||||
void getFaceListData() async {
|
void getIrisListData() async {
|
||||||
var entity = await ApiRepository.to.getFaceListData(
|
var entity = await ApiRepository.to.getFaceListData(
|
||||||
lockId: state.lockId.value.toString(),
|
lockId: state.lockId.value.toString(),
|
||||||
pageNo: '1',
|
pageNo: '1',
|
||||||
@ -368,7 +368,7 @@ class IrisListLogic extends BaseGetXController {
|
|||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast("删除成功");
|
showToast("删除成功");
|
||||||
state.isDeletFaceData = false;
|
state.isDeletFaceData = false;
|
||||||
getFaceListData();
|
getIrisListData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -387,7 +387,7 @@ class IrisListLogic extends BaseGetXController {
|
|||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast("重置成功");
|
showToast("重置成功");
|
||||||
state.isDeletFaceData = false;
|
state.isDeletFaceData = false;
|
||||||
getFaceListData();
|
getIrisListData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -395,7 +395,7 @@ class IrisListLogic extends BaseGetXController {
|
|||||||
late StreamSubscription _teamEvent;
|
late StreamSubscription _teamEvent;
|
||||||
void _initRefreshAction() {
|
void _initRefreshAction() {
|
||||||
_teamEvent = eventBus.on<OtherTypeRefreshListEvent>().listen((event) {
|
_teamEvent = eventBus.on<OtherTypeRefreshListEvent>().listen((event) {
|
||||||
getFaceListData();
|
getIrisListData();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -409,11 +409,11 @@ class IrisListLogic extends BaseGetXController {
|
|||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
// print("aaaaaaa:$isDemoMode");
|
// print("aaaaaaa:$isDemoMode");
|
||||||
if (isDemoMode == false) {
|
if (isDemoMode == false) {
|
||||||
_initReplySubscription();
|
// _initReplySubscription();
|
||||||
|
|
||||||
_initRefreshAction();
|
// _initRefreshAction();
|
||||||
|
|
||||||
getFaceListData();
|
// getFaceListData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -58,7 +58,7 @@ class _IrisListPageState extends State<IrisListPage> {
|
|||||||
KeySearchWidget(
|
KeySearchWidget(
|
||||||
editingController: state.searchController,
|
editingController: state.searchController,
|
||||||
onSubmittedAction: () {
|
onSubmittedAction: () {
|
||||||
logic.getFaceListData();
|
// logic.getFaceListData();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
@ -79,7 +79,7 @@ class _IrisListPageState extends State<IrisListPage> {
|
|||||||
"fromType": 1 // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
"fromType": 1 // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||||
});
|
});
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
logic.getFaceListData();
|
// logic.getFaceListData();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -127,7 +127,7 @@ class _IrisListPageState extends State<IrisListPage> {
|
|||||||
"faceItemData": getFaceItemData,
|
"faceItemData": getFaceItemData,
|
||||||
});
|
});
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
logic.getFaceListData();
|
// logic.getFaceListData();
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -182,7 +182,7 @@ class _IrisListPageState extends State<IrisListPage> {
|
|||||||
state.isDeletFaceData = true;
|
state.isDeletFaceData = true;
|
||||||
state.isDeletAll = false;
|
state.isDeletAll = false;
|
||||||
state.deletUserID = (await Storage.getUid())!;
|
state.deletUserID = (await Storage.getUid())!;
|
||||||
logic.senderAddFace();
|
// logic.senderAddFace();
|
||||||
},
|
},
|
||||||
cancelClick: () {
|
cancelClick: () {
|
||||||
Get.back();
|
Get.back();
|
||||||
@ -269,7 +269,7 @@ class _IrisListPageState extends State<IrisListPage> {
|
|||||||
state.deletKeyID = "1";
|
state.deletKeyID = "1";
|
||||||
state.deletUserID = "DeleteAll!@#";
|
state.deletUserID = "DeleteAll!@#";
|
||||||
state.deletFaceNo = 255;
|
state.deletFaceNo = 255;
|
||||||
logic.senderAddFace();
|
// logic.senderAddFace();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -688,12 +688,12 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
);
|
);
|
||||||
|
|
||||||
showWidgetArr.add(
|
showWidgetArr.add(
|
||||||
bottomItem(
|
bottomItem('images/main/icon_face.png', '手掌',
|
||||||
'images/main/icon_face.png',
|
state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
|
||||||
'手掌',
|
Get.toNamed(Routers.palmListPage, arguments: {
|
||||||
state.openDoorBtnisUneable.value,
|
"lockId": state.keyInfos.value.lockId,
|
||||||
state.bottomBtnisEable.value,
|
});
|
||||||
() {}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
//可视对讲门锁新增->监控
|
//可视对讲门锁新增->监控
|
||||||
|
|||||||
@ -0,0 +1,31 @@
|
|||||||
|
import 'package:star_lock/main/lockDetail/palm/addPalm/addPalm_state.dart';
|
||||||
|
|
||||||
|
import '../../../../../tools/baseGetXController.dart';
|
||||||
|
|
||||||
|
class AddPalmLogic extends BaseGetXController {
|
||||||
|
final AddPalmState state = AddPalmState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onReady() {
|
||||||
|
// TODO: implement onReady
|
||||||
|
super.onReady();
|
||||||
|
|
||||||
|
// _initReplySubscription();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
// TODO: implement onInit
|
||||||
|
super.onInit();
|
||||||
|
//开始添加后发送指令
|
||||||
|
// senderAddFace();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onClose() {
|
||||||
|
// TODO: implement onClose
|
||||||
|
super.onClose();
|
||||||
|
|
||||||
|
// _replySubscription.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
94
star_lock/lib/main/lockDetail/palm/addPalm/addPalm_page.dart
Normal file
94
star_lock/lib/main/lockDetail/palm/addPalm/addPalm_page.dart
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/palm/addPalm/addPalm_logic.dart';
|
||||||
|
|
||||||
|
import '../../../../../app_settings/app_colors.dart';
|
||||||
|
import '../../../../../tools/submitBtn.dart';
|
||||||
|
import '../../../../../tools/titleAppBar.dart';
|
||||||
|
import '../../../../../translations/trans_lib.dart';
|
||||||
|
|
||||||
|
class AddPalmPage extends StatefulWidget {
|
||||||
|
const AddPalmPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<AddPalmPage> createState() => _AddPalmPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AddPalmPageState extends State<AddPalmPage> {
|
||||||
|
final logic = Get.put(AddPalmLogic());
|
||||||
|
final state = Get.find<AddPalmLogic>().state;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
appBar: TitleAppBar(
|
||||||
|
barTitle: "${TranslationLoader.lanKeys!.addTip!.tr}手掌",
|
||||||
|
haveBack: true,
|
||||||
|
backgroundColor: AppColors.mainColor),
|
||||||
|
body: ListView(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
height: 50.h,
|
||||||
|
),
|
||||||
|
Obx(() => Image.asset(
|
||||||
|
state.isClickAddFace.value == false
|
||||||
|
? 'images/main/icon_addFace_step1.png'
|
||||||
|
: 'images/main/icon_addFace_step2.png',
|
||||||
|
width: 100.w,
|
||||||
|
height: 457.h,
|
||||||
|
fit: BoxFit.fitHeight,
|
||||||
|
)),
|
||||||
|
SizedBox(
|
||||||
|
height: 60.h,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.only(left: 20.w, right: 20.w),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
"请单人正对门锁,距离一个成年人手臂长度\n(约0.6米)。\n保持脸部无遮挡,露出五官。",
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
maxLines: null,
|
||||||
|
style:
|
||||||
|
TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w600),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 120.h,
|
||||||
|
),
|
||||||
|
Obx(
|
||||||
|
() => state.isClickAddFace.value == false
|
||||||
|
? Container(
|
||||||
|
padding: EdgeInsets.only(left: 20.w, right: 20.w),
|
||||||
|
child: SubmitBtn(
|
||||||
|
btnName: "准备好了,开始添加",
|
||||||
|
borderRadius: 20.w,
|
||||||
|
onClick: () {
|
||||||
|
state.isClickAddFace.value = true;
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'正在录入中...',
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppColors.darkGrayTextColor,
|
||||||
|
fontSize: 22.sp),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
class AddPalmState {
|
||||||
|
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||||
|
|
||||||
|
var ifConnectScuess = false.obs;
|
||||||
|
var maxRegCount = 0.obs; // 最大注册次数
|
||||||
|
var regIndex = 0.obs; // 当前注册次数
|
||||||
|
|
||||||
|
var faceNumber = "".obs;
|
||||||
|
|
||||||
|
final lockId = 0.obs;
|
||||||
|
final endDate = 0.obs;
|
||||||
|
final addType = "".obs;
|
||||||
|
final faceName = "".obs;
|
||||||
|
final faceType = 0.obs;
|
||||||
|
final startDate = 0.obs;
|
||||||
|
final cyclicConfig = [].obs;
|
||||||
|
final fromType = 1.obs;
|
||||||
|
final featureData = ''.obs;
|
||||||
|
final isClickAddFace = false.obs;
|
||||||
|
final isAdministrator = false.obs;
|
||||||
|
|
||||||
|
AddPalmState() {
|
||||||
|
Map map = Get.arguments;
|
||||||
|
lockId.value = map["lockId"];
|
||||||
|
endDate.value = map["endDate"];
|
||||||
|
addType.value = map["addType"];
|
||||||
|
faceName.value = map["faceName"];
|
||||||
|
faceType.value = map["faceType"];
|
||||||
|
startDate.value = map["startDate"];
|
||||||
|
lockId.value = map["lockId"];
|
||||||
|
cyclicConfig.value = map["cyclicConfig"];
|
||||||
|
fromType.value = map["fromType"];
|
||||||
|
isAdministrator.value = map["isAdministrator"];
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,45 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/palm/addPalmType/addPalmTypeManage/addPalmTypeManage_tabbar.dart';
|
||||||
|
|
||||||
|
import '../../../../../app_settings/app_colors.dart';
|
||||||
|
import '../../../../../tools/titleAppBar.dart';
|
||||||
|
import '../../../../../translations/trans_lib.dart';
|
||||||
|
|
||||||
|
class AddPalmTypeManagePage extends StatefulWidget {
|
||||||
|
const AddPalmTypeManagePage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<AddPalmTypeManagePage> createState() => _AddPalmTypeManagePageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AddPalmTypeManagePageState extends State<AddPalmTypeManagePage> {
|
||||||
|
var index = 0;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
Map map = Get.arguments;
|
||||||
|
var lockId = map["lockId"];
|
||||||
|
var fromType = map["fromType"]; // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||||
|
var fromTypeTwoStaffName = "";
|
||||||
|
if (fromType == 2) {
|
||||||
|
fromTypeTwoStaffName = map["fromTypeTwoStaffName"]; // 从添加员工进入 传入员工名字
|
||||||
|
}
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
|
appBar: TitleAppBar(
|
||||||
|
barTitle: "${TranslationLoader.lanKeys!.addTip!.tr}手掌",
|
||||||
|
haveBack: true,
|
||||||
|
backgroundColor: AppColors.mainColor),
|
||||||
|
body: Column(
|
||||||
|
children: [
|
||||||
|
AddPalmTypeManageTabbar(
|
||||||
|
lockId: lockId,
|
||||||
|
fromType: fromType,
|
||||||
|
fromTypeTwoStaffName: fromTypeTwoStaffName,
|
||||||
|
initialIndex: index),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,138 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/palm/addPalmType/addPalmType_page.dart';
|
||||||
|
|
||||||
|
import '../../../../../app_settings/app_colors.dart';
|
||||||
|
import '../../../../../tools/CustomUnderlineTabIndicator.dart';
|
||||||
|
import '../../../../../translations/trans_lib.dart';
|
||||||
|
|
||||||
|
class AddPalmTypeManageTabbar extends StatefulWidget {
|
||||||
|
var initialIndex = 1;
|
||||||
|
var lockId = 0;
|
||||||
|
var fromType = 1; // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||||
|
var fromTypeTwoStaffName = ""; // 从添加员工进入 传入员工名字
|
||||||
|
AddPalmTypeManageTabbar(
|
||||||
|
{Key? key,
|
||||||
|
required this.lockId,
|
||||||
|
required this.fromType,
|
||||||
|
required this.fromTypeTwoStaffName,
|
||||||
|
required this.initialIndex})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<AddPalmTypeManageTabbar> createState() =>
|
||||||
|
_AddPalmTypeManageTabbarState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AddPalmTypeManageTabbarState extends State<AddPalmTypeManageTabbar>
|
||||||
|
with SingleTickerProviderStateMixin {
|
||||||
|
late TabController _tabController;
|
||||||
|
|
||||||
|
final List<ItemView> _itemTabs = <ItemView>[
|
||||||
|
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
|
||||||
|
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
|
||||||
|
ItemView(
|
||||||
|
title: TranslationLoader.lanKeys!.circulation!.tr, selectType: "2"),
|
||||||
|
];
|
||||||
|
|
||||||
|
final List<ItemView> _fromCheckInTypeItemTabs = <ItemView>[
|
||||||
|
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
|
||||||
|
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
|
||||||
|
];
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
// TODO: implement initState
|
||||||
|
super.initState();
|
||||||
|
_tabController = TabController(
|
||||||
|
vsync: this,
|
||||||
|
length: _itemTabs.length,
|
||||||
|
initialIndex: widget.initialIndex);
|
||||||
|
|
||||||
|
_tabController.addListener(() {
|
||||||
|
// print("_tabController.animation!.value:${_tabController.animation!.value} _tabController.index:${_tabController.index}");
|
||||||
|
if (_tabController.animation!.value == _tabController.index) {
|
||||||
|
FocusScope.of(context).requestFocus(FocusNode());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Expanded(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
_tabBar(),
|
||||||
|
_pageWidget(),
|
||||||
|
],
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
TabBar _tabBar() {
|
||||||
|
return TabBar(
|
||||||
|
controller: _tabController,
|
||||||
|
tabs: widget.fromType == 1
|
||||||
|
? _itemTabs.map((ItemView item) => _tab(item)).toList()
|
||||||
|
: _fromCheckInTypeItemTabs
|
||||||
|
.map((ItemView item) => _tab(item))
|
||||||
|
.toList(),
|
||||||
|
isScrollable: true,
|
||||||
|
indicatorColor: Colors.red,
|
||||||
|
unselectedLabelColor: Colors.black,
|
||||||
|
unselectedLabelStyle: TextStyle(
|
||||||
|
color: AppColors.mainColor,
|
||||||
|
fontSize: 24.sp,
|
||||||
|
),
|
||||||
|
automaticIndicatorColorAdjustment: true,
|
||||||
|
labelColor: AppColors.mainColor,
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
color: AppColors.mainColor,
|
||||||
|
fontSize: 24.sp,
|
||||||
|
fontWeight: FontWeight.w600),
|
||||||
|
indicator: CustomUnderlineTabIndicator(
|
||||||
|
borderSide: BorderSide(color: AppColors.mainColor, width: 4.w),
|
||||||
|
strokeCap: StrokeCap.round,
|
||||||
|
width: 30.w),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Tab _tab(ItemView item) {
|
||||||
|
return Tab(
|
||||||
|
child: SizedBox(
|
||||||
|
width: 1.sw / 5,
|
||||||
|
child: Text(item.title, textAlign: TextAlign.center)));
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _pageWidget() {
|
||||||
|
return Expanded(
|
||||||
|
child: TabBarView(
|
||||||
|
controller: _tabController,
|
||||||
|
children: widget.fromType == 1
|
||||||
|
? _itemTabs
|
||||||
|
.map((ItemView item) => AddPalmTypePage(
|
||||||
|
selectType: item.selectType,
|
||||||
|
lockId: widget.lockId,
|
||||||
|
fromType: widget.fromType,
|
||||||
|
fromTypeTwoStaffName: widget.fromTypeTwoStaffName))
|
||||||
|
.toList()
|
||||||
|
: _itemTabs
|
||||||
|
.map((ItemView item) => AddPalmTypePage(
|
||||||
|
selectType: item.selectType,
|
||||||
|
lockId: widget.lockId,
|
||||||
|
fromType: widget.fromType,
|
||||||
|
fromTypeTwoStaffName: widget.fromTypeTwoStaffName))
|
||||||
|
.toList(),
|
||||||
|
|
||||||
|
// _itemTabs.map((ItemView item) => AddFaceTypePage(selectType: item.selectType, lockId: widget.lockId, fromType: widget.fromType, fromTypeTwoStaffName:widget.fromTypeTwoStaffName)).toList(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ItemView {
|
||||||
|
const ItemView({required this.title, required this.selectType});
|
||||||
|
|
||||||
|
final String title;
|
||||||
|
final String selectType;
|
||||||
|
}
|
||||||
@ -0,0 +1,90 @@
|
|||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/palm/addPalmType/addPalmType_state.dart';
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import 'package:star_lock/tools/dateTool.dart';
|
||||||
|
import '../../../../appRouters.dart';
|
||||||
|
import '../../../../network/api_repository.dart';
|
||||||
|
|
||||||
|
class AddPalmTypeLogic extends BaseGetXController {
|
||||||
|
AddPalmTypeState state = AddPalmTypeState();
|
||||||
|
|
||||||
|
// 添加指纹
|
||||||
|
void addPalmData() async {
|
||||||
|
var palmType = 0; // 永久:1;限时2,单次3,循环:4
|
||||||
|
var startDate = "";
|
||||||
|
var endDate = "";
|
||||||
|
var startTime = "";
|
||||||
|
var endTime = "";
|
||||||
|
if (state.selectType.value == "0") {
|
||||||
|
palmType = 1;
|
||||||
|
startDate = "0";
|
||||||
|
endDate = "0";
|
||||||
|
startTime = "0";
|
||||||
|
endTime = "0";
|
||||||
|
} else if (state.selectType.value == "1") {
|
||||||
|
palmType = 2;
|
||||||
|
startDate =
|
||||||
|
DateTool().dateToTimestamp(state.beginTime.value, 1).toString();
|
||||||
|
endDate = DateTool().dateToTimestamp(state.endTime.value, 1).toString();
|
||||||
|
startTime = "0";
|
||||||
|
endTime = "0";
|
||||||
|
|
||||||
|
if (startDate.isEmpty) {
|
||||||
|
showToast("请选择开始时间".tr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (endDate.isEmpty) {
|
||||||
|
showToast("请选择结束时间".tr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if(DateTime.now().millisecondsSinceEpoch > int.parse(state.beginTimeTimestamp.value)){
|
||||||
|
// Toast.show(msg: "生效时间要大于当前时间");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (int.parse(startDate) >= int.parse(endDate)) {
|
||||||
|
showToast("失效时间要大于生效时间".tr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else if (state.selectType.value == "2") {
|
||||||
|
if (state.beginTime.value.isEmpty) {
|
||||||
|
showToast("请选择有效期".tr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
startDate =
|
||||||
|
DateTool().dateToTimestamp(state.beginTime.value, 1).toString();
|
||||||
|
endDate = DateTool().dateToTimestamp(state.endTime.value, 1).toString();
|
||||||
|
startTime = DateTool()
|
||||||
|
.dateToTimestamp(state.effectiveDateTime.value, 0)
|
||||||
|
.toString();
|
||||||
|
endTime =
|
||||||
|
DateTool().dateToTimestamp(state.failureDateTime.value, 0).toString();
|
||||||
|
palmType = 4;
|
||||||
|
}
|
||||||
|
// 人脸
|
||||||
|
Get.toNamed(Routers.addPalmPage, arguments: {
|
||||||
|
"lockId": state.lockId.value,
|
||||||
|
"endDate": int.parse(endDate),
|
||||||
|
"addType": "1",
|
||||||
|
"faceName": state.nameController.text,
|
||||||
|
"faceNumber": "123456",
|
||||||
|
"faceType": palmType,
|
||||||
|
"startDate": int.parse(startDate),
|
||||||
|
"cyclicConfig": state.weekdaysList.value,
|
||||||
|
"fromType": state.fromType.value,
|
||||||
|
"isAdministrator": state.isAdministrator.value,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验手掌名字是否重复
|
||||||
|
void checkPalmNameDuplicated(String palmName) async {
|
||||||
|
var entity = await ApiRepository.to.checkFaceNameDuplicatedData(
|
||||||
|
lockId: state.lockId.value.toString(),
|
||||||
|
faceName: palmName,
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
addPalmData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,342 @@
|
|||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/palm/addPalmType/addPalmType_logic.dart';
|
||||||
|
import 'package:star_lock/tools/dateTool.dart';
|
||||||
|
import 'package:star_lock/tools/pickers/pickers.dart';
|
||||||
|
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
||||||
|
|
||||||
|
import '../../../../appRouters.dart';
|
||||||
|
import '../../../../app_settings/app_colors.dart';
|
||||||
|
import '../../../../tools/commonItem.dart';
|
||||||
|
import '../../../../tools/storage.dart';
|
||||||
|
import '../../../../tools/submitBtn.dart';
|
||||||
|
import '../../../../translations/trans_lib.dart';
|
||||||
|
|
||||||
|
class AddPalmTypePage extends StatefulWidget {
|
||||||
|
final String selectType; // 永久限时循环下标
|
||||||
|
final int lockId;
|
||||||
|
final int fromType; // // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||||
|
final String fromTypeTwoStaffName; // 从添加员工进入 传入员工名字
|
||||||
|
|
||||||
|
const AddPalmTypePage(
|
||||||
|
{Key? key,
|
||||||
|
required this.selectType,
|
||||||
|
required this.lockId,
|
||||||
|
required this.fromType,
|
||||||
|
required this.fromTypeTwoStaffName})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<AddPalmTypePage> createState() => _AddPalmTypePageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AddPalmTypePageState extends State<AddPalmTypePage> {
|
||||||
|
final logic = Get.put(AddPalmTypeLogic());
|
||||||
|
final state = Get.find<AddPalmTypeLogic>().state;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
state.selectType.value = widget.selectType;
|
||||||
|
state.lockId.value = widget.lockId;
|
||||||
|
if (widget.fromTypeTwoStaffName.isNotEmpty) {
|
||||||
|
state.nameController.text = widget.fromTypeTwoStaffName;
|
||||||
|
}
|
||||||
|
state.fromType.value = widget.fromType;
|
||||||
|
|
||||||
|
return indexChangeWidget();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
// TODO: implement initState
|
||||||
|
super.initState();
|
||||||
|
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
if (state.selectType.value == "1") {
|
||||||
|
state.beginTime.value = DateTool().dateToYMDHNString(
|
||||||
|
DateTime.now().millisecondsSinceEpoch.toString()); //默认为当前时间
|
||||||
|
state.endTime.value = DateTool().dateToYMDHNString(
|
||||||
|
DateTime.now().millisecondsSinceEpoch.toString()); //默认为当前时间
|
||||||
|
} else {
|
||||||
|
state.beginTime.value = ""; //默认为当前时间
|
||||||
|
state.endTime.value = ""; //默认为当前时间
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget indexChangeWidget() {
|
||||||
|
switch (int.parse(widget.selectType)) {
|
||||||
|
case 0:
|
||||||
|
{
|
||||||
|
// 永久
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
perpetualKeyWidget(
|
||||||
|
TranslationLoader.lanKeys!.name!.tr,
|
||||||
|
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||||
|
state.nameController),
|
||||||
|
keyBottomWidget()
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
// 限时
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
perpetualKeyWidget(
|
||||||
|
TranslationLoader.lanKeys!.name!.tr,
|
||||||
|
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||||
|
state.nameController),
|
||||||
|
keyTimeLimitWidget(),
|
||||||
|
keyBottomWidget()
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
// 循环
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
perpetualKeyWidget(
|
||||||
|
TranslationLoader.lanKeys!.name!.tr,
|
||||||
|
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||||
|
state.nameController),
|
||||||
|
keyCyclicDate(),
|
||||||
|
SizedBox(height: 10.h),
|
||||||
|
keyBottomWidget()
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return Container();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 密码命名输入框
|
||||||
|
Widget perpetualKeyWidget(
|
||||||
|
String titleStr, String rightTitle, TextEditingController controller) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Container(height: 10.h),
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: titleStr,
|
||||||
|
rightTitle: "",
|
||||||
|
isHaveRightWidget: true,
|
||||||
|
rightWidget: getTFWidget(rightTitle)),
|
||||||
|
Container(height: 10.h),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 限时顶部选择日期
|
||||||
|
Widget keyTimeLimitWidget() {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||||
|
rightTitle: state.beginTime.value,
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () async {
|
||||||
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
|
onConfirm: (p) {
|
||||||
|
state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||||
|
});
|
||||||
|
})),
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
||||||
|
rightTitle: state.endTime.value,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
|
onConfirm: (p) {
|
||||||
|
state.endTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||||
|
});
|
||||||
|
})),
|
||||||
|
Container(height: 10.h),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 循环顶部选择日期
|
||||||
|
Widget keyCyclicDate() {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||||
|
rightTitle: "${state.beginTime.value}\n${state.endTime.value}",
|
||||||
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () async {
|
||||||
|
var result =
|
||||||
|
await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
|
||||||
|
'validityValue': state.weekdaysList.value,
|
||||||
|
'starDate': state.beginTime.value,
|
||||||
|
'endDate': state.endTime.value,
|
||||||
|
'starTime': state.effectiveDateTime.value,
|
||||||
|
'endTime': state.failureDateTime.value
|
||||||
|
});
|
||||||
|
if (result != null && result.isNotEmpty) {
|
||||||
|
state.weekdaysList.value = result['validityValue'];
|
||||||
|
state.beginTime.value = result['starDate'];
|
||||||
|
state.endTime.value = result['endDate'];
|
||||||
|
state.effectiveDateTime.value = result['starTime'];
|
||||||
|
state.failureDateTime.value = result['endTime'];
|
||||||
|
Get.log(
|
||||||
|
'得到的有效期数据:${state.weekdaysList.value} == ${state.beginTime.value} == ${state.endTime.value}== ${state.effectiveDateTime.value} == ${state.failureDateTime.value}');
|
||||||
|
}
|
||||||
|
})),
|
||||||
|
Obx(() => Visibility(
|
||||||
|
visible: state.weekdaysList.isNotEmpty ? true : false,
|
||||||
|
child: CommonItem(
|
||||||
|
leftTitel: "有效日",
|
||||||
|
rightTitle: state.weekdaysList.value.join(",").toString(),
|
||||||
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () async {
|
||||||
|
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
||||||
|
arguments: {
|
||||||
|
'validityValue': state.weekdaysList.value,
|
||||||
|
'starDate': state.beginTime.value,
|
||||||
|
'endDate': state.endTime.value,
|
||||||
|
'starTime': state.effectiveDateTime.value,
|
||||||
|
'endTime': state.failureDateTime.value
|
||||||
|
});
|
||||||
|
if (result != null && result.isNotEmpty) {
|
||||||
|
state.weekdaysList.value = result['validityValue'];
|
||||||
|
state.beginTime.value = result['starDate'];
|
||||||
|
state.endTime.value = result['endDate'];
|
||||||
|
state.effectiveDateTime.value = result['starTime'];
|
||||||
|
state.failureDateTime.value = result['endTime'];
|
||||||
|
}
|
||||||
|
}))),
|
||||||
|
Obx(() => Visibility(
|
||||||
|
visible: state.effectiveDateTime.value.isNotEmpty,
|
||||||
|
child: CommonItem(
|
||||||
|
leftTitel: "有效时间".tr,
|
||||||
|
rightTitle:
|
||||||
|
"${state.effectiveDateTime.value}-${state.failureDateTime.value}",
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () async {
|
||||||
|
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
||||||
|
arguments: {
|
||||||
|
'validityValue': state.weekdaysList.value,
|
||||||
|
'starDate': state.beginTime.value,
|
||||||
|
'endDate': state.endTime.value,
|
||||||
|
'starTime': state.effectiveDateTime.value,
|
||||||
|
'endTime': state.failureDateTime.value
|
||||||
|
});
|
||||||
|
if (result != null && result.isNotEmpty) {
|
||||||
|
state.weekdaysList.value = result['validityValue'];
|
||||||
|
state.beginTime.value = result['starDate'];
|
||||||
|
state.endTime.value = result['endDate'];
|
||||||
|
state.effectiveDateTime.value = result['starTime'];
|
||||||
|
state.failureDateTime.value = result['endTime'];
|
||||||
|
Get.back(result: result);
|
||||||
|
}
|
||||||
|
}))),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget keyBottomWidget() {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: "是否是管理员",
|
||||||
|
rightTitle: "",
|
||||||
|
isTipsImg: false,
|
||||||
|
isHaveRightWidget: true,
|
||||||
|
rightWidget: SizedBox(
|
||||||
|
width: 60.w, height: 50.h, child: Obx(() => _isAdmin()))),
|
||||||
|
SizedBox(height: 30.h),
|
||||||
|
SubmitBtn(
|
||||||
|
btnName: TranslationLoader.lanKeys!.next!.tr,
|
||||||
|
onClick: () async {
|
||||||
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
|
if (isDemoMode == false) {
|
||||||
|
// print("state.selectType:${state.selectType.value}");
|
||||||
|
if (state.nameController.text.isEmpty) {
|
||||||
|
logic.showToast("请输入姓名");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
logic.checkPalmNameDuplicated(state.nameController.text);
|
||||||
|
} else {
|
||||||
|
// Get.toNamed(Routers.selectLockTypePage);
|
||||||
|
logic.showToast("演示模式");
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 接受者信息输入框
|
||||||
|
Widget getTFWidget(String tfStr) {
|
||||||
|
return Container(
|
||||||
|
// color: Colors.red,
|
||||||
|
height: 65.h,
|
||||||
|
width: 300.w,
|
||||||
|
padding: EdgeInsets.only(top: 5.h),
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: TextField(
|
||||||
|
//输入框一行
|
||||||
|
maxLines: 1,
|
||||||
|
inputFormatters: <TextInputFormatter>[
|
||||||
|
FilteringTextInputFormatter.deny('\n'),
|
||||||
|
LengthLimitingTextInputFormatter(18),
|
||||||
|
],
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||||
|
controller: state.nameController,
|
||||||
|
autofocus: false,
|
||||||
|
textAlign: TextAlign.end,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
//输入里面输入文字内边距设置
|
||||||
|
// contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
|
||||||
|
hintText: tfStr,
|
||||||
|
hintStyle: TextStyle(fontSize: 22.sp),
|
||||||
|
focusedBorder: const OutlineInputBorder(
|
||||||
|
borderSide:
|
||||||
|
BorderSide(width: 0, color: Colors.transparent)),
|
||||||
|
disabledBorder: const OutlineInputBorder(
|
||||||
|
borderSide:
|
||||||
|
BorderSide(width: 0, color: Colors.transparent)),
|
||||||
|
enabledBorder: const OutlineInputBorder(
|
||||||
|
borderSide:
|
||||||
|
BorderSide(width: 0, color: Colors.transparent)),
|
||||||
|
border: const OutlineInputBorder(
|
||||||
|
borderSide:
|
||||||
|
BorderSide(width: 0, color: Colors.transparent)),
|
||||||
|
contentPadding: const EdgeInsets.symmetric(vertical: 0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 10.w,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 是否是管理员
|
||||||
|
CupertinoSwitch _isAdmin() {
|
||||||
|
return CupertinoSwitch(
|
||||||
|
activeColor: CupertinoColors.activeBlue,
|
||||||
|
trackColor: CupertinoColors.systemGrey5,
|
||||||
|
thumbColor: CupertinoColors.white,
|
||||||
|
value: state.isAdministrator.value,
|
||||||
|
onChanged: (value) {
|
||||||
|
state.isAdministrator.value = value;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
class AddPalmTypeState {
|
||||||
|
final lockId = 0.obs;
|
||||||
|
final selectType = "0".obs; // 0永久 1显示 2循环
|
||||||
|
final fromType = 1.obs; // // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||||
|
var fromTypeTwoStaffName = "".obs; // 考勤添加人脸员工名字
|
||||||
|
final isStressFingerprint = false.obs;
|
||||||
|
final isAdministrator = false.obs; // 是否是管理员
|
||||||
|
|
||||||
|
var beginTime = "".obs; // 开始时间
|
||||||
|
var endTime = "".obs; // 结束时间
|
||||||
|
var effectiveDateTime = "".obs; // 生效时间
|
||||||
|
var failureDateTime = "".obs; // 失效时间
|
||||||
|
var weekdaysList = [].obs;
|
||||||
|
|
||||||
|
final TextEditingController nameController = TextEditingController();
|
||||||
|
AddPalmTypeState() {
|
||||||
|
// Map map = Get.arguments;
|
||||||
|
// lockId.value = map["lockId"];
|
||||||
|
// fromType.value = map["fromType"];
|
||||||
|
// if(fromType.value == 2){
|
||||||
|
// fromTypeTwoStaffName = map["fromTypeTwoStaffName"]; // 从添加员工进入 传入员工名字
|
||||||
|
// // nameController.text = fromTypeTwoStaffName.value;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// print("lockId:${lockId.value} fromType:${fromType.value}");
|
||||||
|
}
|
||||||
|
}
|
||||||
445
star_lock/lib/main/lockDetail/palm/palmList/palmList_logic.dart
Normal file
445
star_lock/lib/main/lockDetail/palm/palmList/palmList_logic.dart
Normal file
@ -0,0 +1,445 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||||
|
import 'package:star_lock/blue/io_protocol/io_addFace.dart';
|
||||||
|
import 'package:star_lock/blue/io_protocol/io_queryingFaceStatus.dart';
|
||||||
|
import 'package:star_lock/blue/io_type.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/palm/palmList/palmList_state.dart';
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import '../../../../blue/blue_manage.dart';
|
||||||
|
import '../../../../blue/io_protocol/io_checkingUserInfoCount.dart';
|
||||||
|
import '../../../../blue/io_reply.dart';
|
||||||
|
import '../../../../blue/io_tool/io_tool.dart';
|
||||||
|
import '../../../../blue/io_tool/manager_event_bus.dart';
|
||||||
|
import '../../../../blue/sender_manage.dart';
|
||||||
|
import '../../../../network/api_repository.dart';
|
||||||
|
import '../../../../tools/eventBusEventManage.dart';
|
||||||
|
import '../../../../tools/storage.dart';
|
||||||
|
|
||||||
|
class PalmListLogic extends BaseGetXController {
|
||||||
|
PalmListState state = PalmListState();
|
||||||
|
|
||||||
|
// 获取解析后的数据
|
||||||
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
|
void _initReplySubscription() {
|
||||||
|
_replySubscription =
|
||||||
|
EventBusManager().eventBus!.on<Reply>().listen((reply) {
|
||||||
|
// 添加人脸开始(此处用作删除人脸)
|
||||||
|
if ((reply is SenderAddFaceReply) && (state.isDeletFaceData == true)) {
|
||||||
|
_replyAddFaceBegin(reply);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reply is SenderQueryingFaceStatusReply) {
|
||||||
|
// 获取人脸状态
|
||||||
|
_replyQueryingFaceStatus(reply);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reply is SenderCheckingUserInfoCountReply) {
|
||||||
|
_replyCheckingUserInfoCount(reply);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加人脸开始---这里用作删除人脸
|
||||||
|
Future<void> _replyAddFaceBegin(Reply reply) async {
|
||||||
|
int status = reply.data[2];
|
||||||
|
print("status:$status");
|
||||||
|
|
||||||
|
switch (status) {
|
||||||
|
case 0x00:
|
||||||
|
//成功
|
||||||
|
print("${reply.commandType!.typeValue} list人脸数据解析成功");
|
||||||
|
state.isDeletFaceData = false;
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
dismissEasyLoading();
|
||||||
|
if (state.isDeletAll == false) {
|
||||||
|
deletFacesData();
|
||||||
|
} else {
|
||||||
|
clearAllFacesData();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 0x06:
|
||||||
|
//无权限
|
||||||
|
print("${reply.commandType!.typeValue} 需要鉴权");
|
||||||
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
|
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||||
|
|
||||||
|
var token = await Storage.getStringList(saveBlueToken);
|
||||||
|
List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
|
IoSenderManage.senderAddFaceCommand(
|
||||||
|
keyID: state.deletKeyID,
|
||||||
|
userID: state.deletUserID,
|
||||||
|
faceNo: state.deletFaceNo,
|
||||||
|
useCountLimit: 0,
|
||||||
|
startTime: 0x11223344,
|
||||||
|
endTime: 0x11223344,
|
||||||
|
needAuthor: 1,
|
||||||
|
publicKey: publicKeyDataList,
|
||||||
|
privateKey: getPrivateKeyList,
|
||||||
|
token: getTokenList,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case 0x07:
|
||||||
|
//无权限
|
||||||
|
print("${reply.commandType!.typeValue} 用户无权限");
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 0x09:
|
||||||
|
// 权限校验错误
|
||||||
|
print("${reply.commandType!.typeValue} 权限校验错误");
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//失败
|
||||||
|
print("${reply.commandType!.typeValue} list人脸失败");
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取人脸状态
|
||||||
|
Future<void> _replyQueryingFaceStatus(Reply reply) async {
|
||||||
|
int status = reply.data[2];
|
||||||
|
|
||||||
|
switch (status) {
|
||||||
|
case 0x00:
|
||||||
|
//成功
|
||||||
|
print("${reply.commandType}数据解析成功");
|
||||||
|
// _getLockStatus();
|
||||||
|
break;
|
||||||
|
case 0x06:
|
||||||
|
//无权限
|
||||||
|
print("${reply.commandType}需要鉴权");
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 0x07:
|
||||||
|
//无权限
|
||||||
|
print("${reply.commandType}用户无权限");
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 0x09:
|
||||||
|
// 权限校验错误
|
||||||
|
print("${reply.commandType}权限校验错误");
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//失败
|
||||||
|
print("${reply.commandType}失败");
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取卡片状态
|
||||||
|
Future<void> _replyReferEventRecordNumber(Reply reply) async {
|
||||||
|
int status = reply.data[2];
|
||||||
|
switch (status) {
|
||||||
|
case 0x00:
|
||||||
|
//成功
|
||||||
|
print("${reply.commandType}数据解析成功");
|
||||||
|
// _getLockStatus();
|
||||||
|
break;
|
||||||
|
case 0x06:
|
||||||
|
//无权限
|
||||||
|
print("${reply.commandType}需要鉴权");
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 0x07:
|
||||||
|
//无权限
|
||||||
|
print("${reply.commandType}用户无权限");
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 0x09:
|
||||||
|
// 权限校验错误
|
||||||
|
print("${reply.commandType}权限校验错误");
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//失败
|
||||||
|
print("${reply.commandType}失败");
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询用户、指纹、密码、卡片数量(用于判断是否同步)
|
||||||
|
Future<void> _replyCheckingUserInfoCount(Reply reply) async {
|
||||||
|
int status = reply.data[2];
|
||||||
|
|
||||||
|
// 用户数量
|
||||||
|
int userNum = reply.data[5];
|
||||||
|
// print("userNum:$userNum");
|
||||||
|
|
||||||
|
// 指纹数量
|
||||||
|
int fingerNum = reply.data[6];
|
||||||
|
// print("fingerNum:$fingerNum");
|
||||||
|
|
||||||
|
// 密码数量
|
||||||
|
int pwdNum = reply.data[7];
|
||||||
|
|
||||||
|
// 卡片数量
|
||||||
|
int cardNum = reply.data[8];
|
||||||
|
|
||||||
|
// 记录数量
|
||||||
|
int logsNum = reply.data[9];
|
||||||
|
|
||||||
|
// 版本
|
||||||
|
int verNo = reply.data[10];
|
||||||
|
|
||||||
|
// 最大管理员指纹数量
|
||||||
|
int maxAdminFingerNum = reply.data[11];
|
||||||
|
|
||||||
|
// 最大用户指纹数量
|
||||||
|
int maxUserFingerNum = reply.data[12];
|
||||||
|
|
||||||
|
// 最大管理员密码数量
|
||||||
|
int maxAdminPassNum = reply.data[13];
|
||||||
|
|
||||||
|
// 最大用户密码数量
|
||||||
|
int maxUserPassNum = reply.data[14];
|
||||||
|
|
||||||
|
// 最大管理员卡片数量
|
||||||
|
int maxAdminCardNum = reply.data[15];
|
||||||
|
|
||||||
|
// 最大用户卡片数量
|
||||||
|
int maxUserCardNum = reply.data[16];
|
||||||
|
|
||||||
|
// 序列号
|
||||||
|
var serialNo = reply.data.sublist(17, 21);
|
||||||
|
print("serialNo:$serialNo");
|
||||||
|
|
||||||
|
switch (status) {
|
||||||
|
case 0x00:
|
||||||
|
//成功
|
||||||
|
print("${reply.commandType}数据解析成功");
|
||||||
|
// _getLockStatus();
|
||||||
|
break;
|
||||||
|
case 0x06:
|
||||||
|
//无权限
|
||||||
|
print("${reply.commandType}需要鉴权");
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 0x07:
|
||||||
|
//无权限
|
||||||
|
print("${reply.commandType}用户无权限");
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 0x09:
|
||||||
|
// 权限校验错误
|
||||||
|
print("${reply.commandType}权限校验错误");
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//失败
|
||||||
|
print("${reply.commandType}失败");
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取人脸状态
|
||||||
|
Future<void> senderQueryingFaceStatus() async {
|
||||||
|
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
||||||
|
(BluetoothConnectionState state) async {
|
||||||
|
if (state == BluetoothConnectionState.connected) {
|
||||||
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
var token = await Storage.getStringList(saveBlueToken);
|
||||||
|
List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
|
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
|
List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
|
||||||
|
|
||||||
|
IoSenderManage.senderQueryingFaceStatusCommand(
|
||||||
|
keyID: BlueManage().connectDeviceName,
|
||||||
|
userID: await Storage.getUid(),
|
||||||
|
role: 0xff,
|
||||||
|
faceCount: 20,
|
||||||
|
faceNo: 1,
|
||||||
|
token: getTokenList,
|
||||||
|
needAuthor: 1,
|
||||||
|
publicKey: getPublicKeyList,
|
||||||
|
privateKey: getPrivateKeyList,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询用户、指纹、密码、卡片数量(用于判断是否同步)
|
||||||
|
Future<void> senderCheckingUserInfoCount() async {
|
||||||
|
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
||||||
|
(BluetoothConnectionState state) async {
|
||||||
|
if (state == BluetoothConnectionState.connected) {
|
||||||
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
var token = await Storage.getStringList(saveBlueToken);
|
||||||
|
List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
|
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
|
List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
|
||||||
|
|
||||||
|
IoSenderManage.senderCheckingUserInfoCountCommand(
|
||||||
|
keyID: BlueManage().connectDeviceName,
|
||||||
|
userID: await Storage.getUid(),
|
||||||
|
role: 0xff,
|
||||||
|
nowTime: DateTime.now().millisecondsSinceEpoch ~/ 1000,
|
||||||
|
token: getTokenList,
|
||||||
|
needAuthor: 1,
|
||||||
|
publicKey: getPublicKeyList,
|
||||||
|
privateKey: getPrivateKeyList,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除人脸
|
||||||
|
Future<void> senderAddFace() async {
|
||||||
|
showEasyLoading();
|
||||||
|
showBlueConnetctToastTimer(action: () {
|
||||||
|
dismissEasyLoading();
|
||||||
|
});
|
||||||
|
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
||||||
|
(BluetoothConnectionState deviceConnectionState) async {
|
||||||
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
|
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
|
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||||
|
|
||||||
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
var token = await Storage.getStringList(saveBlueToken);
|
||||||
|
List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
|
IoSenderManage.senderAddFaceCommand(
|
||||||
|
keyID: state.deletKeyID,
|
||||||
|
userID: state.deletUserID,
|
||||||
|
faceNo: state.deletFaceNo,
|
||||||
|
useCountLimit: 0,
|
||||||
|
startTime: 0x11223344,
|
||||||
|
endTime: 0x11223344,
|
||||||
|
needAuthor: 1,
|
||||||
|
publicKey: publicKeyDataList,
|
||||||
|
privateKey: getPrivateKeyList,
|
||||||
|
token: getTokenList,
|
||||||
|
);
|
||||||
|
} else if (deviceConnectionState ==
|
||||||
|
BluetoothConnectionState.disconnected) {
|
||||||
|
dismissEasyLoading();
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
if (state.ifCurrentScreen.value == true) {
|
||||||
|
showBlueConnetctToast();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取人脸列表
|
||||||
|
void getFaceListData() async {
|
||||||
|
var entity = await ApiRepository.to.getFaceListData(
|
||||||
|
lockId: state.lockId.value.toString(),
|
||||||
|
pageNo: '1',
|
||||||
|
pageSize: '20',
|
||||||
|
searchStr: state.searchController.text,
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
state.faceItemListData.value = entity.data!.list!;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除的人脸
|
||||||
|
void deletFacesData() async {
|
||||||
|
var faceId = "";
|
||||||
|
var type = "1";
|
||||||
|
if (state.isDeletAll == false) {
|
||||||
|
faceId = state.deletKeyID;
|
||||||
|
type = "0";
|
||||||
|
}
|
||||||
|
print("delet faceId $faceId");
|
||||||
|
var entity = await ApiRepository.to.deleteFaceData(
|
||||||
|
faceId: int.parse(faceId),
|
||||||
|
lockId: state.lockId.value,
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
showToast("删除成功");
|
||||||
|
state.isDeletFaceData = false;
|
||||||
|
getFaceListData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重置所有的人脸
|
||||||
|
void clearAllFacesData() async {
|
||||||
|
var faceId = "";
|
||||||
|
var type = "1";
|
||||||
|
if (state.isDeletAll == false) {
|
||||||
|
faceId = state.deletKeyID;
|
||||||
|
type = "0";
|
||||||
|
}
|
||||||
|
print("delet faceId $faceId");
|
||||||
|
var entity = await ApiRepository.to.clearFaceData(
|
||||||
|
lockId: state.lockId.value,
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
showToast("重置成功");
|
||||||
|
state.isDeletFaceData = false;
|
||||||
|
getFaceListData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 监听修改完详情之后刷新列表
|
||||||
|
late StreamSubscription _teamEvent;
|
||||||
|
void _initRefreshAction() {
|
||||||
|
_teamEvent = eventBus.on<OtherTypeRefreshListEvent>().listen((event) {
|
||||||
|
getFaceListData();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> onReady() async {
|
||||||
|
// TODO: implement onReady
|
||||||
|
super.onReady();
|
||||||
|
print("onReady()");
|
||||||
|
|
||||||
|
// 获取是否是演示模式 演示模式不获取接口
|
||||||
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
|
// print("aaaaaaa:$isDemoMode");
|
||||||
|
if (isDemoMode == false) {
|
||||||
|
// _initReplySubscription();
|
||||||
|
|
||||||
|
// _initRefreshAction();
|
||||||
|
|
||||||
|
// getFaceListData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> onInit() async {
|
||||||
|
// TODO: implement onInit
|
||||||
|
super.onInit();
|
||||||
|
print("onInit()");
|
||||||
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
|
if (isDemoMode == false) {
|
||||||
|
// senderQueryingFingerprintStatus();
|
||||||
|
// senderCheckingCardStatus();
|
||||||
|
|
||||||
|
// senderCheckingUserInfoCount();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> onClose() async {
|
||||||
|
// TODO: implement onClose
|
||||||
|
super.onClose();
|
||||||
|
|
||||||
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
|
if (isDemoMode == false) {
|
||||||
|
_replySubscription.cancel();
|
||||||
|
_teamEvent.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
280
star_lock/lib/main/lockDetail/palm/palmList/palmList_page.dart
Normal file
280
star_lock/lib/main/lockDetail/palm/palmList/palmList_page.dart
Normal file
@ -0,0 +1,280 @@
|
|||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/fingerprint/fingerprintList/fingerprintListData_entity.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/palm/palmList/palmList_logic.dart';
|
||||||
|
import 'package:star_lock/tools/keySearchWidget.dart';
|
||||||
|
import 'package:star_lock/tools/left_slide_actions.dart';
|
||||||
|
|
||||||
|
import '../../../../appRouters.dart';
|
||||||
|
import '../../../../app_settings/app_colors.dart';
|
||||||
|
import '../../../../tools/noData.dart';
|
||||||
|
import '../../../../tools/showIosTipView.dart';
|
||||||
|
import '../../../../tools/storage.dart';
|
||||||
|
import '../../../../tools/submitBtn.dart';
|
||||||
|
import '../../../../tools/titleAppBar.dart';
|
||||||
|
import '../../../../translations/trans_lib.dart';
|
||||||
|
|
||||||
|
class PalmListPage extends StatefulWidget {
|
||||||
|
const PalmListPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<PalmListPage> createState() => _PalmListPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _PalmListPageState extends State<PalmListPage> {
|
||||||
|
final logic = Get.put(PalmListLogic());
|
||||||
|
final state = Get.find<PalmListLogic>().state;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
|
appBar: TitleAppBar(
|
||||||
|
barTitle: '手掌',
|
||||||
|
haveBack: true,
|
||||||
|
backgroundColor: AppColors.mainColor,
|
||||||
|
actionsList: [
|
||||||
|
TextButton(
|
||||||
|
child: Text(
|
||||||
|
TranslationLoader.lanKeys!.reset!.tr,
|
||||||
|
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||||
|
),
|
||||||
|
onPressed: () async {
|
||||||
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
|
if (isDemoMode == false) {
|
||||||
|
showDeletAlertDialog(context);
|
||||||
|
} else {
|
||||||
|
// Get.toNamed(Routers.selectLockTypePage);
|
||||||
|
logic.showToast("演示模式");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
body: Column(
|
||||||
|
children: [
|
||||||
|
KeySearchWidget(
|
||||||
|
editingController: state.searchController,
|
||||||
|
onSubmittedAction: () {
|
||||||
|
// logic.getFaceListData();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20.h,
|
||||||
|
),
|
||||||
|
Expanded(child: _buildMainUI()),
|
||||||
|
AddBottomWhiteBtn(
|
||||||
|
btnName: '${TranslationLoader.lanKeys!.add!.tr}手掌',
|
||||||
|
onClick: () async {
|
||||||
|
// var data =
|
||||||
|
// await Get.toNamed(Routers.addFaceTypeManagePage, arguments: {
|
||||||
|
// "lockId": state.lockId.value,
|
||||||
|
// "fromType": 1 // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||||
|
// });
|
||||||
|
var data =
|
||||||
|
await Get.toNamed(Routers.addPalmTypeManagePage, arguments: {
|
||||||
|
"lockId": state.lockId.value,
|
||||||
|
"fromType": 1 // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||||
|
});
|
||||||
|
if (data != null) {
|
||||||
|
// logic.getFaceListData();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(height: 64.h)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildMainUI() {
|
||||||
|
{
|
||||||
|
return Obx(() => state.faceItemListData.value.isNotEmpty
|
||||||
|
? ListView.separated(
|
||||||
|
itemCount: state.faceItemListData.value.length,
|
||||||
|
itemBuilder: (c, index) {
|
||||||
|
FingerprintItemData getFaceItemData =
|
||||||
|
state.faceItemListData.value[index];
|
||||||
|
// 人脸
|
||||||
|
if (index < state.faceItemListData.value.length) {
|
||||||
|
return LeftSlideActions(
|
||||||
|
key: Key(getFaceItemData.faceName!),
|
||||||
|
actionsWidth: 60,
|
||||||
|
actions: [
|
||||||
|
_buildDeleteBtn(getFaceItemData),
|
||||||
|
],
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(1)),
|
||||||
|
),
|
||||||
|
child: _keyItem(
|
||||||
|
'images/icon_face.png',
|
||||||
|
getFaceItemData.faceName!,
|
||||||
|
(getFaceItemData.faceType! != 1)
|
||||||
|
? (getFaceItemData.endDate! <
|
||||||
|
DateTime.now().millisecondsSinceEpoch
|
||||||
|
? "已失效"
|
||||||
|
: "")
|
||||||
|
: "",
|
||||||
|
getFaceItemData.validTimeStr!,
|
||||||
|
// fingerprintItemData.fingerprintType! == 1
|
||||||
|
// ? "永久"
|
||||||
|
// : "${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())}",
|
||||||
|
() async {
|
||||||
|
var data =
|
||||||
|
await Get.toNamed(Routers.faceDetailPage, arguments: {
|
||||||
|
"faceItemData": getFaceItemData,
|
||||||
|
});
|
||||||
|
if (data != null) {
|
||||||
|
// logic.getFaceListData();
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return const SizedBox.shrink();
|
||||||
|
},
|
||||||
|
separatorBuilder: (BuildContext context, int index) {
|
||||||
|
return const Divider(
|
||||||
|
height: 1,
|
||||||
|
color: AppColors.greyLineColor,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
)
|
||||||
|
: NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - 170.h));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildDeleteBtn(FingerprintItemData faceItemData) {
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
// 省略: 弹出是否删除的确认对话框。
|
||||||
|
state.deletKeyID = faceItemData.faceId.toString();
|
||||||
|
state.deletFaceNo = int.parse(faceItemData.faceNumber!);
|
||||||
|
showIosTipViewDialog(context);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
width: 60,
|
||||||
|
color: const Color(0xFFF20101),
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: const Text(
|
||||||
|
'删除',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: Colors.white,
|
||||||
|
height: 1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void showIosTipViewDialog(BuildContext context) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return ShowIosTipView(
|
||||||
|
title: "提示",
|
||||||
|
tipTitle: "确定要删除吗?",
|
||||||
|
sureClick: () async {
|
||||||
|
Get.back();
|
||||||
|
state.isDeletFaceData = true;
|
||||||
|
state.isDeletAll = false;
|
||||||
|
state.deletUserID = (await Storage.getUid())!;
|
||||||
|
// logic.senderAddFace();
|
||||||
|
},
|
||||||
|
cancelClick: () {
|
||||||
|
Get.back();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _keyItem(String lockTypeIcon, String lockTypeTitle,
|
||||||
|
String ifInvalidation, String showTime, Function() action) {
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: action,
|
||||||
|
child: Container(
|
||||||
|
height: 90.h,
|
||||||
|
// margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
|
||||||
|
color: Colors.white,
|
||||||
|
// decoration: BoxDecoration(
|
||||||
|
// color: Colors.white,
|
||||||
|
// // borderRadius: BorderRadius.circular(10.w),
|
||||||
|
// ),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
SizedBox(width: 30.w),
|
||||||
|
Image.asset(lockTypeIcon, width: 60.w, height: 60.w),
|
||||||
|
SizedBox(width: 20.w),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(lockTypeTitle,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 24.sp, color: AppColors.blackColor)),
|
||||||
|
Expanded(child: Container()),
|
||||||
|
Text(ifInvalidation,
|
||||||
|
style: TextStyle(fontSize: 22.sp, color: Colors.red)),
|
||||||
|
SizedBox(width: 10.w),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(height: 5.h),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(showTime,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18.sp,
|
||||||
|
color: AppColors.placeholderTextColor)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(width: 20.h),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(width: 20.h),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void showDeletAlertDialog(BuildContext context) {
|
||||||
|
showCupertinoDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return CupertinoAlertDialog(
|
||||||
|
title: const Text("提示"),
|
||||||
|
content: const Text('重置后,该锁的人脸都将被删除哦,确认要重置吗?'),
|
||||||
|
actions: [
|
||||||
|
CupertinoDialogAction(
|
||||||
|
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
CupertinoDialogAction(
|
||||||
|
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
state.isDeletFaceData = true;
|
||||||
|
state.isDeletAll = true;
|
||||||
|
state.deletKeyID = "1";
|
||||||
|
state.deletUserID = "DeleteAll!@#";
|
||||||
|
state.deletFaceNo = 255;
|
||||||
|
// logic.senderAddFace();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/fingerprint/fingerprintList/fingerprintListData_entity.dart';
|
||||||
|
|
||||||
|
class PalmListState {
|
||||||
|
final TextEditingController searchController = TextEditingController();
|
||||||
|
final lockId = 0.obs;
|
||||||
|
|
||||||
|
// 因为删除跟添加人脸用的同一个协议 所以这里用做判断
|
||||||
|
var isDeletFaceData = false;
|
||||||
|
var isDeletAll = false;
|
||||||
|
var deletKeyID = "";
|
||||||
|
var deletUserID = "DeleteAll!@#";
|
||||||
|
var deletFaceNo = 0;
|
||||||
|
|
||||||
|
final faceItemListData = <FingerprintItemData>[].obs;
|
||||||
|
|
||||||
|
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||||
|
|
||||||
|
PalmListState() {
|
||||||
|
Map map = Get.arguments;
|
||||||
|
lockId.value = map["lockId"];
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user