1,新增虹膜详情页面
2,新增手掌详情页面 3,修复人脸详情点击有效期页面报错问题
This commit is contained in:
parent
fa316cb889
commit
12d2c70da3
@ -7,6 +7,7 @@ import 'package:star_lock/blue/io_protocol/io_addFace.dart';
|
|||||||
import 'package:star_lock/blue/io_type.dart';
|
import 'package:star_lock/blue/io_type.dart';
|
||||||
import 'package:star_lock/main/lockDetail/face/faceDetail/faceDetail_state.dart';
|
import 'package:star_lock/main/lockDetail/face/faceDetail/faceDetail_state.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import 'package:star_lock/tools/dateTool.dart';
|
||||||
import '../../../../blue/blue_manage.dart';
|
import '../../../../blue/blue_manage.dart';
|
||||||
import '../../../../blue/io_reply.dart';
|
import '../../../../blue/io_reply.dart';
|
||||||
import '../../../../blue/io_tool/io_tool.dart';
|
import '../../../../blue/io_tool/io_tool.dart';
|
||||||
@ -30,6 +31,20 @@ class FaceDetailLogic extends BaseGetXController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getKeyTypeShowDateTime() {
|
||||||
|
String useDateStr = '';
|
||||||
|
if (state.keyType.value == 1) {
|
||||||
|
useDateStr = "永久";
|
||||||
|
} else if (state.keyType.value == 2) {
|
||||||
|
useDateStr =
|
||||||
|
"${DateTool().dateToYMDHNString(state.startDate.value)}\n${DateTool().dateToYMDHNString(state.endDate.value)}";
|
||||||
|
} else if (state.keyType.value == 4) {
|
||||||
|
useDateStr =
|
||||||
|
"${DateTool().dateToYMDString(state.startDate.value)}\n${DateTool().dateToYMDString(state.endDate.value)}";
|
||||||
|
}
|
||||||
|
return useDateStr;
|
||||||
|
}
|
||||||
|
|
||||||
// 添加人脸开始
|
// 添加人脸开始
|
||||||
Future<void> _replyAddFaceBegin(Reply reply) async {
|
Future<void> _replyAddFaceBegin(Reply reply) async {
|
||||||
int status = reply.data[2];
|
int status = reply.data[2];
|
||||||
@ -62,8 +77,8 @@ class FaceDetailLogic extends BaseGetXController {
|
|||||||
userID: userID,
|
userID: userID,
|
||||||
faceNo: int.parse(state.typeNumber.value),
|
faceNo: int.parse(state.typeNumber.value),
|
||||||
useCountLimit: 0,
|
useCountLimit: 0,
|
||||||
startTime: state.effectiveDateTime.value,
|
startTime: int.parse(state.startDate.value),
|
||||||
endTime: state.failureDateTime.value,
|
endTime: int.parse(state.endDate.value),
|
||||||
needAuthor: 1,
|
needAuthor: 1,
|
||||||
publicKey: publicKeyDataList,
|
publicKey: publicKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
@ -119,14 +134,15 @@ class FaceDetailLogic extends BaseGetXController {
|
|||||||
userID: userID,
|
userID: userID,
|
||||||
faceNo: int.parse(state.typeNumber.value),
|
faceNo: int.parse(state.typeNumber.value),
|
||||||
useCountLimit: 0,
|
useCountLimit: 0,
|
||||||
startTime: state.effectiveDateTime.value,
|
startTime: int.parse(state.startDate.value),
|
||||||
endTime: state.failureDateTime.value,
|
endTime: int.parse(state.endDate.value),
|
||||||
needAuthor: 1,
|
needAuthor: 1,
|
||||||
publicKey: publicKeyDataList,
|
publicKey: publicKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
token: getTokenList,
|
token: getTokenList,
|
||||||
);
|
);
|
||||||
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
} else if (deviceConnectionState ==
|
||||||
|
BluetoothConnectionState.disconnected) {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
@ -170,8 +186,8 @@ class FaceDetailLogic extends BaseGetXController {
|
|||||||
var entity = await ApiRepository.to.updateFaceValidity(
|
var entity = await ApiRepository.to.updateFaceValidity(
|
||||||
lockId: state.faceItemData.value.lockId!,
|
lockId: state.faceItemData.value.lockId!,
|
||||||
faceId: state.faceItemData.value.faceId!,
|
faceId: state.faceItemData.value.faceId!,
|
||||||
startDate: state.effectiveDateTime.value,
|
startDate: int.parse(state.startTime.value),
|
||||||
endDate: state.failureDateTime.value,
|
endDate: int.parse(state.endTime.value),
|
||||||
);
|
);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast("修改成功", something: () {
|
showToast("修改成功", something: () {
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import '../../../../tools/commonItem.dart';
|
|||||||
import '../../../../tools/dateTool.dart';
|
import '../../../../tools/dateTool.dart';
|
||||||
import '../../../../tools/showIosTipView.dart';
|
import '../../../../tools/showIosTipView.dart';
|
||||||
import '../../../../tools/showTFView.dart';
|
import '../../../../tools/showTFView.dart';
|
||||||
|
import '../../../../tools/storage.dart';
|
||||||
import '../../../../tools/submitBtn.dart';
|
import '../../../../tools/submitBtn.dart';
|
||||||
import '../../../../tools/titleAppBar.dart';
|
import '../../../../tools/titleAppBar.dart';
|
||||||
import '../../../../translations/trans_lib.dart';
|
import '../../../../translations/trans_lib.dart';
|
||||||
@ -35,16 +36,8 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
|
|||||||
barTitle: "人脸详情",
|
barTitle: "人脸详情",
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor,
|
backgroundColor: AppColors.mainColor,
|
||||||
// actionsList: [
|
|
||||||
// TextButton(
|
|
||||||
// child: Text(TranslationLoader.lanKeys!.share!.tr, style: TextStyle(color: Colors.white, fontSize: 24.sp),),
|
|
||||||
// onPressed: () {
|
|
||||||
//
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
),
|
),
|
||||||
body: Column(
|
body: ListView(
|
||||||
children: [
|
children: [
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: "人脸号",
|
leftTitel: "人脸号",
|
||||||
@ -60,40 +53,32 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
|
|||||||
showCupertinoAlertDialog(context);
|
showCupertinoAlertDialog(context);
|
||||||
})),
|
})),
|
||||||
Obx(() => Visibility(
|
Obx(() => Visibility(
|
||||||
visible: (state.keyType.value == 4 || state.keyType.value == 2)
|
visible: (state.keyType.value == 4 ||
|
||||||
|
state.keyType.value == 2 ||
|
||||||
|
state.keyType.value == 1)
|
||||||
? true
|
? true
|
||||||
: false,
|
: false,
|
||||||
child: CommonItem(
|
child: CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||||
allHeight: 70.h,
|
allHeight: 70.h,
|
||||||
// rightTitle:"2023.09.19 11:27\n2023.09.25 11:27",
|
// rightTitle:"2023.09.19 11:27\n2023.09.25 11:27",
|
||||||
rightTitle: state.keyType.value == 1
|
rightTitle: logic.getKeyTypeShowDateTime(),
|
||||||
? "永久"
|
|
||||||
: "${DateTool().dateToYMDHNString(state.effectiveDateTime.value.toString())}\n${DateTool().dateToYMDHNString(state.failureDateTime.value.toString())}",
|
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
action: () async {
|
action: () async {
|
||||||
// switch(state.type.value){
|
if (state.keyType.value == 2 || state.keyType.value == 1) {
|
||||||
// case 0:
|
|
||||||
// // 卡
|
|
||||||
//
|
|
||||||
// break;
|
|
||||||
// case 1:
|
|
||||||
// 当是指纹的时候
|
|
||||||
if (state.keyType.value == 2) {
|
|
||||||
// 限时
|
// 限时
|
||||||
var data = await Get.toNamed(
|
var data = await Get.toNamed(
|
||||||
Routers.otherTypeKeyChangeDatePage,
|
Routers.otherTypeKeyChangeDatePage,
|
||||||
arguments: {
|
arguments: {
|
||||||
"faceItemData": state.faceItemData.value,
|
"pushType": 0,
|
||||||
"pushType": 1,
|
"fingerprintItemData": state.faceItemData.value,
|
||||||
});
|
});
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.effectiveDateTime.value =
|
state.startDate.value = data["beginTimeTimestamp"];
|
||||||
data["beginTimeTimestamp"];
|
state.endDate.value = data["endTimeTimestamp"];
|
||||||
state.failureDateTime.value =
|
state.keyType.value = 2;
|
||||||
data["endTimeTimestamp"];
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else if (state.keyType.value == 4) {
|
} else if (state.keyType.value == 4) {
|
||||||
@ -101,14 +86,21 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
|
|||||||
var data = await Get.toNamed(
|
var data = await Get.toNamed(
|
||||||
Routers.otherTypeKeyChangeValidityDatePage,
|
Routers.otherTypeKeyChangeValidityDatePage,
|
||||||
arguments: {
|
arguments: {
|
||||||
"faceItemData": state.faceItemData.value,
|
"pushType": 0,
|
||||||
|
"fingerprintItemData": state.faceItemData.value,
|
||||||
});
|
});
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.effectiveDateTime.value =
|
print("state.starDate.value:${data["starDate"]} "
|
||||||
data["beginTimeTimestamp"];
|
"state.endDate.value:${data["endDate"]} "
|
||||||
state.failureDateTime.value =
|
"state.starTime.value:${data["starTime"]} "
|
||||||
data["endTimeTimestamp"];
|
"state.endTime.value:${data["endTime"]} "
|
||||||
|
"state.weekDay.value:${data["weekDay"]}");
|
||||||
|
|
||||||
|
state.startDate.value = data["starDate"];
|
||||||
|
state.endDate.value = data["endDate"];
|
||||||
|
state.startTime.value = data["starTime"];
|
||||||
|
state.endTime.value = data["endTime"];
|
||||||
state.weekDay.value = data["weekDay"];
|
state.weekDay.value = data["weekDay"];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -120,42 +112,64 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
|
|||||||
leftTitel: TranslationLoader.lanKeys!.effectiveDay!.tr,
|
leftTitel: TranslationLoader.lanKeys!.effectiveDay!.tr,
|
||||||
rightTitle: state.weekDay.value.join(','),
|
rightTitle: state.weekDay.value.join(','),
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
action: () async {
|
action: () async {
|
||||||
// 当是人脸的时候
|
|
||||||
var data = await Get.toNamed(
|
var data = await Get.toNamed(
|
||||||
Routers.otherTypeKeyChangeValidityDatePage,
|
Routers.otherTypeKeyChangeValidityDatePage,
|
||||||
arguments: {
|
arguments: {
|
||||||
"faceItemData": state.faceItemData.value,
|
"pushType": 0,
|
||||||
|
"fingerprintItemData": state.faceItemData.value,
|
||||||
});
|
});
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.effectiveDateTime.value =
|
state.startDate.value = data["starDate"];
|
||||||
data["beginTimeTimestamp"];
|
state.endDate.value = data["endDate"];
|
||||||
state.failureDateTime.value = data["endTimeTimestamp"];
|
state.startTime.value = data["starTime"];
|
||||||
|
state.endTime.value = data["endTime"];
|
||||||
state.weekDay.value = data["weekDay"];
|
state.weekDay.value = data["weekDay"];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})))),
|
})))),
|
||||||
|
Obx(() => Visibility(
|
||||||
|
visible: state.keyType.value == 4 ? true : false,
|
||||||
|
child: Obx(() => CommonItem(
|
||||||
|
leftTitel: "有效时间",
|
||||||
|
rightTitle:
|
||||||
|
"${DateTool().dateToHNString(state.startTime.value)}-${DateTool().dateToHNString(state.endTime.value)}",
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () async {
|
||||||
|
var data = await Get.toNamed(
|
||||||
|
Routers.otherTypeKeyChangeValidityDatePage,
|
||||||
|
arguments: {
|
||||||
|
"pushType": 0,
|
||||||
|
"fingerprintItemData": state.faceItemData.value,
|
||||||
|
});
|
||||||
|
if (data != null) {
|
||||||
|
setState(() {
|
||||||
|
state.startDate.value = data["starDate"];
|
||||||
|
state.endDate.value = data["endDate"];
|
||||||
|
state.startTime.value = data["starTime"];
|
||||||
|
state.endTime.value = data["endTime"];
|
||||||
|
state.weekDay.value = data["validityValue"];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})))),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.additive!.tr,
|
leftTitel: TranslationLoader.lanKeys!.additive!.tr,
|
||||||
rightTitle: state.adder.value,
|
rightTitle: state.adder.value,
|
||||||
isHaveLine: true,
|
)),
|
||||||
action: () {})),
|
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.addTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.addTime!.tr,
|
||||||
rightTitle:
|
rightTitle: DateTool()
|
||||||
DateTool().dateToYMDHNString(state.addTime.value.toString()),
|
.dateToYMDHNString(state.addTime.value.toString()),
|
||||||
action: () {})),
|
)),
|
||||||
SizedBox(height: 10.h),
|
SizedBox(height: 10.h),
|
||||||
|
|
||||||
Container(height: 10.h),
|
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.operatingRecord!.tr,
|
leftTitel: TranslationLoader.lanKeys!.operatingRecord!.tr,
|
||||||
rightTitle: "",
|
rightTitle: "",
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
// 人脸
|
|
||||||
Get.toNamed(Routers.keyOperationRecordPage, arguments: {
|
Get.toNamed(Routers.keyOperationRecordPage, arguments: {
|
||||||
'lockId': state.faceItemData.value.lockId.toString(),
|
'lockId': state.faceItemData.value.lockId.toString(),
|
||||||
'faceId': state.faceItemData.value.faceId.toString()
|
'faceId': state.faceItemData.value.faceId.toString()
|
||||||
@ -179,96 +193,6 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Widget addControlsBtn(int type) {
|
|
||||||
// List<Widget> widgetList = [];
|
|
||||||
// List<Map<String, dynamic>> routerList = [];
|
|
||||||
// //卡详情
|
|
||||||
// if (type == 0) {
|
|
||||||
// routerList.add({
|
|
||||||
// 'btnTitle': '设置密码',
|
|
||||||
// 'routerName': Routers.passwordKeyDetailPage,
|
|
||||||
// 'type': 9
|
|
||||||
// });
|
|
||||||
// routerList.add({
|
|
||||||
// 'btnTitle': '设置指纹',
|
|
||||||
// 'routerName': Routers.otherTypeKeyManagePage,
|
|
||||||
// 'type': 1
|
|
||||||
// });
|
|
||||||
// routerList.add({
|
|
||||||
// 'btnTitle': '设置遥控',
|
|
||||||
// 'routerName': Routers.otherTypeKeyManagePage,
|
|
||||||
// 'type': 2
|
|
||||||
// });
|
|
||||||
// } else if (type == 1) {
|
|
||||||
// //指纹详情
|
|
||||||
// routerList.add({
|
|
||||||
// 'btnTitle': '设置密码',
|
|
||||||
// 'routerName': Routers.passwordKeyDetailPage,
|
|
||||||
// 'type': 9
|
|
||||||
// });
|
|
||||||
// routerList.add({
|
|
||||||
// 'btnTitle': '设置卡',
|
|
||||||
// 'routerName': Routers.otherTypeKeyManagePage,
|
|
||||||
// 'type': 0
|
|
||||||
// });
|
|
||||||
// routerList.add({
|
|
||||||
// 'btnTitle': '设置遥控',
|
|
||||||
// 'routerName': Routers.otherTypeKeyManagePage,
|
|
||||||
// 'type': 2
|
|
||||||
// });
|
|
||||||
// } else if (type == 2) {
|
|
||||||
// //遥控详情
|
|
||||||
// routerList.add({
|
|
||||||
// 'btnTitle': '设置密码',
|
|
||||||
// 'routerName': Routers.passwordKeyDetailPage,
|
|
||||||
// 'type': 9
|
|
||||||
// });
|
|
||||||
// routerList.add({
|
|
||||||
// 'btnTitle': '设置卡',
|
|
||||||
// 'routerName': Routers.otherTypeKeyManagePage,
|
|
||||||
// 'type': 0
|
|
||||||
// });
|
|
||||||
// routerList.add({
|
|
||||||
// 'btnTitle': '设置指纹',
|
|
||||||
// 'routerName': Routers.otherTypeKeyManagePage,
|
|
||||||
// 'type': 1
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// for (int i = 0; i < routerList.length; i++) {
|
|
||||||
// widgetList.add(SizedBox(
|
|
||||||
// width: ScreenUtil().screenWidth - 40.w,
|
|
||||||
// height: 60.h,
|
|
||||||
// child: OutlinedButton(
|
|
||||||
// style: OutlinedButton.styleFrom(
|
|
||||||
// // backgroundColor: Colors.white,
|
|
||||||
// side: BorderSide(width: 1, color: AppColors.mainColor)),
|
|
||||||
// onPressed: () {
|
|
||||||
// if (routerList[i]['type'] == 9) {
|
|
||||||
// Navigator.pushNamed(context, Routers.passwordKeyManagePage);
|
|
||||||
// } else {
|
|
||||||
// Navigator.pushNamed(context, Routers.otherTypeKeyManagePage,
|
|
||||||
// arguments: routerList[i]['type']);
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// child: Text(
|
|
||||||
// routerList[i]['btnTitle'],
|
|
||||||
// style: TextStyle(color: AppColors.mainColor, fontSize: 24.sp),
|
|
||||||
// )),
|
|
||||||
// ));
|
|
||||||
//
|
|
||||||
// widgetList.add(
|
|
||||||
// SizedBox(
|
|
||||||
// height: 10.h,
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return Column(
|
|
||||||
// children: widgetList,
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
void showCupertinoAlertDialog(BuildContext context) {
|
void showCupertinoAlertDialog(BuildContext context) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
@ -284,8 +208,8 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Get.back();
|
Get.back();
|
||||||
// 面容
|
state.typeName.value = state.changeNameController.text;
|
||||||
logic.updateFaceNameData();
|
// logic.editFaceData();
|
||||||
},
|
},
|
||||||
cancelClick: () {
|
cancelClick: () {
|
||||||
Get.back();
|
Get.back();
|
||||||
@ -301,9 +225,9 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
|
|||||||
return ShowIosTipView(
|
return ShowIosTipView(
|
||||||
title: "提示",
|
title: "提示",
|
||||||
tipTitle: "确定要删除吗?",
|
tipTitle: "确定要删除吗?",
|
||||||
sureClick: () {
|
sureClick: () async {
|
||||||
Get.back();
|
Get.back();
|
||||||
// 人脸
|
String? idStr = await Storage.getUid();
|
||||||
logic.senderAddFace();
|
logic.senderAddFace();
|
||||||
},
|
},
|
||||||
cancelClick: () {
|
cancelClick: () {
|
||||||
|
|||||||
@ -9,8 +9,10 @@ class FaceDetailState {
|
|||||||
|
|
||||||
final typeNumber = "".obs; // 人脸号
|
final typeNumber = "".obs; // 人脸号
|
||||||
final typeName = "".obs; // 人脸名字
|
final typeName = "".obs; // 人脸名字
|
||||||
var effectiveDateTime = 0.obs; // 生效时间
|
var startDate = "".obs; // 开始时间
|
||||||
var failureDateTime = 0.obs; // 失效时间
|
var endDate = "".obs; // 结束时间
|
||||||
|
var startTime = "".obs; // 生效时间
|
||||||
|
var endTime = "".obs; // 失效时间
|
||||||
final keyType = 0.obs; // 永久:1;限时2,单次3,循环:4
|
final keyType = 0.obs; // 永久:1;限时2,单次3,循环:4
|
||||||
var weekDay = [].obs; // 有效日
|
var weekDay = [].obs; // 有效日
|
||||||
var adder = "".obs; // 添加者
|
var adder = "".obs; // 添加者
|
||||||
@ -27,8 +29,10 @@ class FaceDetailState {
|
|||||||
typeNumber.value = faceItemData.value.faceNumber!;
|
typeNumber.value = faceItemData.value.faceNumber!;
|
||||||
typeName.value = faceItemData.value.faceName!;
|
typeName.value = faceItemData.value.faceName!;
|
||||||
changeNameController.text = typeName.value;
|
changeNameController.text = typeName.value;
|
||||||
effectiveDateTime.value = faceItemData.value.startDate!;
|
startDate.value = faceItemData.value.startDate!.toString();
|
||||||
failureDateTime.value = faceItemData.value.endDate!;
|
endDate.value = faceItemData.value.endDate!.toString();
|
||||||
|
startTime.value = faceItemData.value.startDate!.toString();
|
||||||
|
endTime.value = faceItemData.value.endDate!.toString();
|
||||||
keyType.value = faceItemData.value.faceType!;
|
keyType.value = faceItemData.value.faceType!;
|
||||||
adder.value = faceItemData.value.senderUsername!;
|
adder.value = faceItemData.value.senderUsername!;
|
||||||
addTime.value = faceItemData.value.createDate!;
|
addTime.value = faceItemData.value.createDate!;
|
||||||
|
|||||||
@ -0,0 +1,214 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
// 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_type.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/iris/irisDetail/irisDetail_state.dart';
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import 'package:star_lock/tools/eventBusEventManage.dart';
|
||||||
|
|
||||||
|
import '../../../../blue/blue_manage.dart';
|
||||||
|
import '../../../../blue/io_protocol/io_addICCard.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/dateTool.dart';
|
||||||
|
import '../../../../tools/storage.dart';
|
||||||
|
|
||||||
|
class IrisDetailLogic extends BaseGetXController {
|
||||||
|
IrisDetailState state = IrisDetailState();
|
||||||
|
|
||||||
|
// 监听设备返回的数据
|
||||||
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
|
void _initReplySubscription() {
|
||||||
|
_replySubscription =
|
||||||
|
EventBusManager().eventBus!.on<Reply>().listen((reply) async {
|
||||||
|
// 添加卡片开始(重置锁里面所有卡)
|
||||||
|
if ((reply is SenderAddICCardReply)) {
|
||||||
|
_replyAddICCardBegin(reply);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加卡片开始(此处用作删除卡片)
|
||||||
|
Future<void> _replyAddICCardBegin(Reply reply) async {
|
||||||
|
int status = reply.data[2];
|
||||||
|
print("_replyAddFingerprintStatus:$status");
|
||||||
|
|
||||||
|
switch (status) {
|
||||||
|
case 0x00:
|
||||||
|
//成功
|
||||||
|
print("${reply.commandType!.typeValue} 数据解析成功");
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
dismissEasyLoading();
|
||||||
|
deletICCardData();
|
||||||
|
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!);
|
||||||
|
|
||||||
|
String? userID = await Storage.getUid();
|
||||||
|
IoSenderManage.senderAddICCardCommand(
|
||||||
|
keyID: state.keyId.value.toString(),
|
||||||
|
userID: userID,
|
||||||
|
cardNo: int.parse(state.typeNumber.value),
|
||||||
|
useCountLimit: 0,
|
||||||
|
startTime: int.parse(state.starDate.value),
|
||||||
|
endTime: int.parse(state.endDate.value),
|
||||||
|
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} 失败");
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加卡片
|
||||||
|
Future<void> senderAddICCard() async {
|
||||||
|
if (state.sureBtnState.value == 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
state.sureBtnState.value = 1;
|
||||||
|
|
||||||
|
showEasyLoading();
|
||||||
|
showBlueConnetctToastTimer(action: () {
|
||||||
|
dismissEasyLoading();
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
});
|
||||||
|
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!);
|
||||||
|
print("openDoorTokenPubToken:$getTokenList");
|
||||||
|
|
||||||
|
String? userID = await Storage.getUid();
|
||||||
|
IoSenderManage.senderAddICCardCommand(
|
||||||
|
keyID: state.keyId.value.toString(),
|
||||||
|
userID: userID,
|
||||||
|
cardNo: int.parse(state.typeNumber.value),
|
||||||
|
useCountLimit: 0,
|
||||||
|
startTime: int.parse(state.starDate.value),
|
||||||
|
endTime: int.parse(state.endDate.value),
|
||||||
|
needAuthor: 1,
|
||||||
|
publicKey: publicKeyDataList,
|
||||||
|
privateKey: getPrivateKeyList,
|
||||||
|
token: getTokenList,
|
||||||
|
);
|
||||||
|
} else if (deviceConnectionState ==
|
||||||
|
BluetoothConnectionState.disconnected) {
|
||||||
|
dismissEasyLoading();
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
if (state.ifCurrentScreen.value == true) {
|
||||||
|
showBlueConnetctToast();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 编辑iC卡
|
||||||
|
void editICCardData() async {
|
||||||
|
var entity = await ApiRepository.to.editICCardData(
|
||||||
|
cardId: state.keyId.value.toString(),
|
||||||
|
lockId: state.fingerprintItemData.value.lockId.toString(),
|
||||||
|
weekDay: state.weekDay.value,
|
||||||
|
startDate: state.starDate.value * 1000,
|
||||||
|
endDate: state.endDate.value * 1000,
|
||||||
|
isCoerced: state.isStressFingerprint.value ? "2" : "1",
|
||||||
|
cardName: state.changeNameController.text,
|
||||||
|
changeType: "1",
|
||||||
|
startTime: int.parse(state.starTime.value),
|
||||||
|
endTime: int.parse(state.endTime.value),
|
||||||
|
cardType: state.keyType.value,
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
showToast("修改成功", something: () {
|
||||||
|
eventBus.fire(OtherTypeRefreshListEvent());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除IC卡
|
||||||
|
void deletICCardData() async {
|
||||||
|
var entity = await ApiRepository.to.deletIcCardData(
|
||||||
|
cardId: state.fingerprintItemData.value.cardId.toString(),
|
||||||
|
lockId: state.fingerprintItemData.value.lockId.toString(),
|
||||||
|
type: "0",
|
||||||
|
deleteType: "1");
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
showToast("删除成功", something: () {
|
||||||
|
Get.back(result: "addScuess");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String getKeyTypeShowDateTime() {
|
||||||
|
String useDateStr = '';
|
||||||
|
if (state.keyType.value == 1) {
|
||||||
|
useDateStr = "永久";
|
||||||
|
} else if (state.keyType.value == 2) {
|
||||||
|
useDateStr =
|
||||||
|
"${DateTool().dateToYMDHNString(state.starDate.value)}\n${DateTool().dateToYMDHNString(state.endDate.value)}";
|
||||||
|
} else if (state.keyType.value == 4) {
|
||||||
|
useDateStr =
|
||||||
|
"${DateTool().dateToYMDString(state.starDate.value)}\n${DateTool().dateToYMDString(state.endDate.value)}";
|
||||||
|
}
|
||||||
|
return useDateStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onReady() {
|
||||||
|
// TODO: implement onReady
|
||||||
|
super.onReady();
|
||||||
|
|
||||||
|
_initReplySubscription();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
// TODO: implement onInit
|
||||||
|
super.onInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onClose() {
|
||||||
|
// TODO: implement onClose
|
||||||
|
super.onClose();
|
||||||
|
|
||||||
|
_replySubscription.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,416 @@
|
|||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/iris/irisDetail/irisDetail_logic.dart';
|
||||||
|
|
||||||
|
import '../../../../appRouters.dart';
|
||||||
|
import '../../../../app_settings/app_colors.dart';
|
||||||
|
import '../../../../blue/blue_manage.dart';
|
||||||
|
import '../../../../tools/appRouteObserver.dart';
|
||||||
|
import '../../../../tools/commonItem.dart';
|
||||||
|
import '../../../../tools/dateTool.dart';
|
||||||
|
import '../../../../tools/showIosTipView.dart';
|
||||||
|
import '../../../../tools/showTFView.dart';
|
||||||
|
import '../../../../tools/storage.dart';
|
||||||
|
import '../../../../tools/submitBtn.dart';
|
||||||
|
import '../../../../tools/titleAppBar.dart';
|
||||||
|
import '../../../../translations/trans_lib.dart';
|
||||||
|
|
||||||
|
class CardDetailPage extends StatefulWidget {
|
||||||
|
const CardDetailPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<CardDetailPage> createState() => _CardDetailPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
||||||
|
final logic = Get.put(IrisDetailLogic());
|
||||||
|
final state = Get.find<IrisDetailLogic>().state;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
|
appBar: TitleAppBar(
|
||||||
|
barTitle: "虹膜详情",
|
||||||
|
haveBack: true,
|
||||||
|
backgroundColor: AppColors.mainColor,
|
||||||
|
),
|
||||||
|
body: ListView(
|
||||||
|
children: [
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel:
|
||||||
|
"${TranslationLoader.lanKeys!.card!.tr}${TranslationLoader.lanKeys!.number!.tr}",
|
||||||
|
rightTitle: state.typeNumber.value,
|
||||||
|
isHaveDirection: false,
|
||||||
|
isHaveLine: true)),
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
||||||
|
rightTitle: state.typeName.value,
|
||||||
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () {
|
||||||
|
showCupertinoAlertDialog(context);
|
||||||
|
})),
|
||||||
|
Obx(() => Visibility(
|
||||||
|
visible: (state.keyType.value == 4 ||
|
||||||
|
state.keyType.value == 2 ||
|
||||||
|
state.keyType.value == 1)
|
||||||
|
? true
|
||||||
|
: false,
|
||||||
|
child: CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||||
|
allHeight: 70.h,
|
||||||
|
// rightTitle:"2023.09.19 11:27\n2023.09.25 11:27",
|
||||||
|
rightTitle: logic.getKeyTypeShowDateTime(),
|
||||||
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () async {
|
||||||
|
if (state.keyType.value == 2 || state.keyType.value == 1) {
|
||||||
|
// 限时
|
||||||
|
var data = await Get.toNamed(
|
||||||
|
Routers.otherTypeKeyChangeDatePage,
|
||||||
|
arguments: {
|
||||||
|
"pushType": 0,
|
||||||
|
"fingerprintItemData":
|
||||||
|
state.fingerprintItemData.value,
|
||||||
|
});
|
||||||
|
if (data != null) {
|
||||||
|
setState(() {
|
||||||
|
state.starDate.value = data["beginTimeTimestamp"];
|
||||||
|
state.endDate.value = data["endTimeTimestamp"];
|
||||||
|
state.keyType.value = 2;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else if (state.keyType.value == 4) {
|
||||||
|
// 循环
|
||||||
|
var data = await Get.toNamed(
|
||||||
|
Routers.otherTypeKeyChangeValidityDatePage,
|
||||||
|
arguments: {
|
||||||
|
"pushType": 0,
|
||||||
|
"fingerprintItemData":
|
||||||
|
state.fingerprintItemData.value,
|
||||||
|
});
|
||||||
|
if (data != null) {
|
||||||
|
setState(() {
|
||||||
|
print("state.starDate.value:${data["starDate"]} "
|
||||||
|
"state.endDate.value:${data["endDate"]} "
|
||||||
|
"state.starTime.value:${data["starTime"]} "
|
||||||
|
"state.endTime.value:${data["endTime"]} "
|
||||||
|
"state.weekDay.value:${data["weekDay"]}");
|
||||||
|
|
||||||
|
state.starDate.value = data["starDate"];
|
||||||
|
state.endDate.value = data["endDate"];
|
||||||
|
state.starTime.value = data["starTime"];
|
||||||
|
state.endTime.value = data["endTime"];
|
||||||
|
state.weekDay.value = data["weekDay"];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}))),
|
||||||
|
Obx(() => Visibility(
|
||||||
|
visible: state.keyType.value == 4 ? true : false,
|
||||||
|
child: Obx(() => CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.effectiveDay!.tr,
|
||||||
|
rightTitle: state.weekDay.value.join(','),
|
||||||
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () async {
|
||||||
|
var data = await Get.toNamed(
|
||||||
|
Routers.otherTypeKeyChangeValidityDatePage,
|
||||||
|
arguments: {
|
||||||
|
"pushType": 0,
|
||||||
|
"fingerprintItemData":
|
||||||
|
state.fingerprintItemData.value,
|
||||||
|
});
|
||||||
|
if (data != null) {
|
||||||
|
setState(() {
|
||||||
|
state.starDate.value = data["starDate"];
|
||||||
|
state.endDate.value = data["endDate"];
|
||||||
|
state.starTime.value = data["starTime"];
|
||||||
|
state.endTime.value = data["endTime"];
|
||||||
|
state.weekDay.value = data["weekDay"];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})))),
|
||||||
|
Obx(() => Visibility(
|
||||||
|
visible: state.keyType.value == 4 ? true : false,
|
||||||
|
child: Obx(() => CommonItem(
|
||||||
|
leftTitel: "有效时间",
|
||||||
|
rightTitle:
|
||||||
|
"${DateTool().dateToHNString(state.starTime.value)}-${DateTool().dateToHNString(state.endTime.value)}",
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () async {
|
||||||
|
var data = await Get.toNamed(
|
||||||
|
Routers.otherTypeKeyChangeValidityDatePage,
|
||||||
|
arguments: {
|
||||||
|
"pushType": 0,
|
||||||
|
"fingerprintItemData":
|
||||||
|
state.fingerprintItemData.value,
|
||||||
|
});
|
||||||
|
if (data != null) {
|
||||||
|
setState(() {
|
||||||
|
state.starDate.value = data["starDate"];
|
||||||
|
state.endDate.value = data["endDate"];
|
||||||
|
state.starTime.value = data["starTime"];
|
||||||
|
state.endTime.value = data["endTime"];
|
||||||
|
state.weekDay.value = data["validityValue"];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})))),
|
||||||
|
Container(height: 10.h),
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.additive!.tr,
|
||||||
|
rightTitle: state.adder.value,
|
||||||
|
)),
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.addTime!.tr,
|
||||||
|
rightTitle: DateTool()
|
||||||
|
.dateToYMDHNString(state.addTime.value.toString()),
|
||||||
|
)),
|
||||||
|
SizedBox(height: 10.h),
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.stressCard!.tr,
|
||||||
|
rightTitle: "",
|
||||||
|
isTipsImg: false,
|
||||||
|
isHaveRightWidget: true,
|
||||||
|
rightWidget: SizedBox(
|
||||||
|
width: 60.w, height: 50.h, child: _isStressFingerprint()))),
|
||||||
|
Container(height: 10.h),
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.operatingRecord!.tr,
|
||||||
|
rightTitle: "",
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
Get.toNamed(Routers.keyOperationRecordPage, arguments: {
|
||||||
|
'lockId': state.fingerprintItemData.value.lockId.toString(),
|
||||||
|
'cardId': state.fingerprintItemData.value.cardId.toString()
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
// SizedBox(height: 40.h),
|
||||||
|
// addControlsBtn(type),
|
||||||
|
SizedBox(height: 30.h),
|
||||||
|
SubmitBtn(
|
||||||
|
btnName: TranslationLoader.lanKeys!.delete!.tr,
|
||||||
|
isDelete: true,
|
||||||
|
borderRadius: 20.w,
|
||||||
|
margin: EdgeInsets.only(
|
||||||
|
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
|
||||||
|
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||||
|
onClick: () {
|
||||||
|
showIosTipViewDialog(context);
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//isStressFingerprint false:不是胁迫指纹 ture:胁迫指纹
|
||||||
|
CupertinoSwitch _isStressFingerprint() {
|
||||||
|
return CupertinoSwitch(
|
||||||
|
activeColor: CupertinoColors.activeBlue,
|
||||||
|
trackColor: CupertinoColors.systemGrey5,
|
||||||
|
thumbColor: CupertinoColors.white,
|
||||||
|
value: state.isStressFingerprint.value,
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
state.isStressFingerprint.value = value;
|
||||||
|
logic.editICCardData();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Widget addControlsBtn(int type) {
|
||||||
|
// List<Widget> widgetList = [];
|
||||||
|
// List<Map<String, dynamic>> routerList = [];
|
||||||
|
// //卡详情
|
||||||
|
// if (type == 0) {
|
||||||
|
// routerList.add({
|
||||||
|
// 'btnTitle': '设置密码',
|
||||||
|
// 'routerName': Routers.passwordKeyDetailPage,
|
||||||
|
// 'type': 9
|
||||||
|
// });
|
||||||
|
// routerList.add({
|
||||||
|
// 'btnTitle': '设置指纹',
|
||||||
|
// 'routerName': Routers.otherTypeKeyManagePage,
|
||||||
|
// 'type': 1
|
||||||
|
// });
|
||||||
|
// routerList.add({
|
||||||
|
// 'btnTitle': '设置遥控',
|
||||||
|
// 'routerName': Routers.otherTypeKeyManagePage,
|
||||||
|
// 'type': 2
|
||||||
|
// });
|
||||||
|
// } else if (type == 1) {
|
||||||
|
// //指纹详情
|
||||||
|
// routerList.add({
|
||||||
|
// 'btnTitle': '设置密码',
|
||||||
|
// 'routerName': Routers.passwordKeyDetailPage,
|
||||||
|
// 'type': 9
|
||||||
|
// });
|
||||||
|
// routerList.add({
|
||||||
|
// 'btnTitle': '设置卡',
|
||||||
|
// 'routerName': Routers.otherTypeKeyManagePage,
|
||||||
|
// 'type': 0
|
||||||
|
// });
|
||||||
|
// routerList.add({
|
||||||
|
// 'btnTitle': '设置遥控',
|
||||||
|
// 'routerName': Routers.otherTypeKeyManagePage,
|
||||||
|
// 'type': 2
|
||||||
|
// });
|
||||||
|
// } else if (type == 2) {
|
||||||
|
// //遥控详情
|
||||||
|
// routerList.add({
|
||||||
|
// 'btnTitle': '设置密码',
|
||||||
|
// 'routerName': Routers.passwordKeyDetailPage,
|
||||||
|
// 'type': 9
|
||||||
|
// });
|
||||||
|
// routerList.add({
|
||||||
|
// 'btnTitle': '设置卡',
|
||||||
|
// 'routerName': Routers.otherTypeKeyManagePage,
|
||||||
|
// 'type': 0
|
||||||
|
// });
|
||||||
|
// routerList.add({
|
||||||
|
// 'btnTitle': '设置指纹',
|
||||||
|
// 'routerName': Routers.otherTypeKeyManagePage,
|
||||||
|
// 'type': 1
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// for (int i = 0; i < routerList.length; i++) {
|
||||||
|
// widgetList.add(SizedBox(
|
||||||
|
// width: ScreenUtil().screenWidth - 40.w,
|
||||||
|
// height: 60.h,
|
||||||
|
// child: OutlinedButton(
|
||||||
|
// style: OutlinedButton.styleFrom(
|
||||||
|
// // backgroundColor: Colors.white,
|
||||||
|
// side: BorderSide(width: 1, color: AppColors.mainColor)),
|
||||||
|
// onPressed: () {
|
||||||
|
// if (routerList[i]['type'] == 9) {
|
||||||
|
// Navigator.pushNamed(context, Routers.passwordKeyManagePage);
|
||||||
|
// } else {
|
||||||
|
// Navigator.pushNamed(context, Routers.otherTypeKeyManagePage,
|
||||||
|
// arguments: routerList[i]['type']);
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// child: Text(
|
||||||
|
// routerList[i]['btnTitle'],
|
||||||
|
// style: TextStyle(color: AppColors.mainColor, fontSize: 24.sp),
|
||||||
|
// )),
|
||||||
|
// ));
|
||||||
|
//
|
||||||
|
// widgetList.add(
|
||||||
|
// SizedBox(
|
||||||
|
// height: 10.h,
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return Column(
|
||||||
|
// children: widgetList,
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
|
void showCupertinoAlertDialog(BuildContext context) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return ShowTFView(
|
||||||
|
title:
|
||||||
|
"${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}",
|
||||||
|
tipTitle: "",
|
||||||
|
controller: state.changeNameController,
|
||||||
|
sureClick: () {
|
||||||
|
if (state.changeNameController.text.isEmpty) {
|
||||||
|
logic.showToast("请输入姓名");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Get.back();
|
||||||
|
state.typeName.value = state.changeNameController.text;
|
||||||
|
logic.editICCardData();
|
||||||
|
},
|
||||||
|
cancelClick: () {
|
||||||
|
Get.back();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void showIosTipViewDialog(BuildContext context) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return ShowIosTipView(
|
||||||
|
title: "提示",
|
||||||
|
tipTitle: "确定要删除吗?",
|
||||||
|
sureClick: () async {
|
||||||
|
Get.back();
|
||||||
|
String? idStr = await Storage.getUid();
|
||||||
|
logic.senderAddICCard();
|
||||||
|
},
|
||||||
|
cancelClick: () {
|
||||||
|
Get.back();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() {
|
||||||
|
// TODO: implement didChangeDependencies
|
||||||
|
super.didChangeDependencies();
|
||||||
|
|
||||||
|
/// 路由订阅
|
||||||
|
AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
// TODO: implement dispose
|
||||||
|
/// 取消路由订阅
|
||||||
|
AppRouteObserver().routeObserver.unsubscribe(this);
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 从上级界面进入 当前界面即将出现
|
||||||
|
@override
|
||||||
|
void didPush() {
|
||||||
|
super.didPush();
|
||||||
|
print("lockSet===didPush");
|
||||||
|
state.ifCurrentScreen.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 返回上一个界面 当前界面即将消失
|
||||||
|
@override
|
||||||
|
void didPop() {
|
||||||
|
super.didPop();
|
||||||
|
print("lockSet===didPop");
|
||||||
|
logic.cancelBlueConnetctToastTimer();
|
||||||
|
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
|
||||||
|
BlueManage().stopScan();
|
||||||
|
state.ifCurrentScreen.value = false;
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 从下级返回 当前界面即将出现
|
||||||
|
@override
|
||||||
|
void didPopNext() {
|
||||||
|
super.didPopNext();
|
||||||
|
print("lockSet===didPopNext");
|
||||||
|
state.ifCurrentScreen.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 进入下级界面 当前界面即将消失
|
||||||
|
@override
|
||||||
|
void didPushNext() {
|
||||||
|
super.didPushNext();
|
||||||
|
print("lockSet===didPushNext");
|
||||||
|
logic.cancelBlueConnetctToastTimer();
|
||||||
|
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
|
||||||
|
BlueManage().stopScan();
|
||||||
|
state.ifCurrentScreen.value = false;
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
import '../../fingerprint/fingerprintList/fingerprintListData_entity.dart';
|
||||||
|
|
||||||
|
class IrisDetailState {
|
||||||
|
final fingerprintItemData = FingerprintItemData().obs;
|
||||||
|
|
||||||
|
final TextEditingController changeNameController = TextEditingController();
|
||||||
|
|
||||||
|
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||||
|
var sureBtnState = 0.obs; // 0普通状态(可用) 1连接中(不可用)
|
||||||
|
|
||||||
|
final typeNumber = "".obs; // 指纹号
|
||||||
|
final typeName = "".obs; // 指纹名字
|
||||||
|
var starDate = "".obs; // 开始时间
|
||||||
|
var endDate = "".obs; // 结束时间
|
||||||
|
var starTime = "".obs; // 生效时间
|
||||||
|
var endTime = "".obs; // 失效时间
|
||||||
|
final keyType = 0.obs; // 永久:1;限时2,单次3,循环:4
|
||||||
|
var weekDay = [].obs; // 有效日
|
||||||
|
var adder = "".obs; // 添加者
|
||||||
|
var addTime = 0.obs; // 添加时间
|
||||||
|
var keyId = 0.obs; // 卡id
|
||||||
|
|
||||||
|
final isStressFingerprint = false.obs;
|
||||||
|
IrisDetailState() {
|
||||||
|
Map map = Get.arguments;
|
||||||
|
if ((map["fingerprintItemData"] != null)) {
|
||||||
|
fingerprintItemData.value = map["fingerprintItemData"];
|
||||||
|
keyId.value = fingerprintItemData.value.cardId!;
|
||||||
|
typeNumber.value = fingerprintItemData.value.cardNumber!;
|
||||||
|
typeName.value = fingerprintItemData.value.cardName!;
|
||||||
|
changeNameController.text = typeName.value;
|
||||||
|
starDate.value = fingerprintItemData.value.startDate!.toString();
|
||||||
|
endDate.value = fingerprintItemData.value.endDate!.toString();
|
||||||
|
starTime.value = fingerprintItemData.value.startDate!.toString();
|
||||||
|
endTime.value = fingerprintItemData.value.endDate!.toString();
|
||||||
|
keyType.value = fingerprintItemData.value.cardType!;
|
||||||
|
adder.value = fingerprintItemData.value.senderUsername!;
|
||||||
|
addTime.value = fingerprintItemData.value.createDate!;
|
||||||
|
isStressFingerprint.value =
|
||||||
|
fingerprintItemData.value.isCoerced! == 2 ? true : false;
|
||||||
|
weekDay.value = fingerprintItemData.value.weekDay!;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -438,8 +438,8 @@ class IrisListLogic extends BaseGetXController {
|
|||||||
|
|
||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
if (isDemoMode == false) {
|
if (isDemoMode == false) {
|
||||||
_replySubscription.cancel();
|
// _replySubscription.cancel();
|
||||||
_teamEvent.cancel();
|
// _teamEvent.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,213 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/blue/io_type.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/palm/palmDetail/palmDetail_state.dart';
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import 'package:star_lock/tools/eventBusEventManage.dart';
|
||||||
|
|
||||||
|
import '../../../../blue/blue_manage.dart';
|
||||||
|
import '../../../../blue/io_protocol/io_addICCard.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/dateTool.dart';
|
||||||
|
import '../../../../tools/storage.dart';
|
||||||
|
|
||||||
|
class PalmDetailLogic extends BaseGetXController {
|
||||||
|
PalmDetailState state = PalmDetailState();
|
||||||
|
|
||||||
|
// 监听设备返回的数据
|
||||||
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
|
void _initReplySubscription() {
|
||||||
|
_replySubscription =
|
||||||
|
EventBusManager().eventBus!.on<Reply>().listen((reply) async {
|
||||||
|
// 添加卡片开始(重置锁里面所有卡)
|
||||||
|
if ((reply is SenderAddICCardReply)) {
|
||||||
|
_replyAddICCardBegin(reply);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加卡片开始(此处用作删除卡片)
|
||||||
|
Future<void> _replyAddICCardBegin(Reply reply) async {
|
||||||
|
int status = reply.data[2];
|
||||||
|
print("_replyAddFingerprintStatus:$status");
|
||||||
|
|
||||||
|
switch (status) {
|
||||||
|
case 0x00:
|
||||||
|
//成功
|
||||||
|
print("${reply.commandType!.typeValue} 数据解析成功");
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
dismissEasyLoading();
|
||||||
|
deletPalmData();
|
||||||
|
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!);
|
||||||
|
|
||||||
|
String? userID = await Storage.getUid();
|
||||||
|
IoSenderManage.senderAddICCardCommand(
|
||||||
|
keyID: state.keyId.value.toString(),
|
||||||
|
userID: userID,
|
||||||
|
cardNo: int.parse(state.typeNumber.value),
|
||||||
|
useCountLimit: 0,
|
||||||
|
startTime: int.parse(state.starDate.value),
|
||||||
|
endTime: int.parse(state.endDate.value),
|
||||||
|
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} 失败");
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加手掌
|
||||||
|
Future<void> senderAddPalm() async {
|
||||||
|
if (state.sureBtnState.value == 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
state.sureBtnState.value = 1;
|
||||||
|
|
||||||
|
showEasyLoading();
|
||||||
|
showBlueConnetctToastTimer(action: () {
|
||||||
|
dismissEasyLoading();
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
});
|
||||||
|
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!);
|
||||||
|
print("openDoorTokenPubToken:$getTokenList");
|
||||||
|
|
||||||
|
String? userID = await Storage.getUid();
|
||||||
|
IoSenderManage.senderAddICCardCommand(
|
||||||
|
keyID: state.keyId.value.toString(),
|
||||||
|
userID: userID,
|
||||||
|
cardNo: int.parse(state.typeNumber.value),
|
||||||
|
useCountLimit: 0,
|
||||||
|
startTime: int.parse(state.starDate.value),
|
||||||
|
endTime: int.parse(state.endDate.value),
|
||||||
|
needAuthor: 1,
|
||||||
|
publicKey: publicKeyDataList,
|
||||||
|
privateKey: getPrivateKeyList,
|
||||||
|
token: getTokenList,
|
||||||
|
);
|
||||||
|
} else if (deviceConnectionState ==
|
||||||
|
BluetoothConnectionState.disconnected) {
|
||||||
|
dismissEasyLoading();
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
if (state.ifCurrentScreen.value == true) {
|
||||||
|
showBlueConnetctToast();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 编辑iC卡
|
||||||
|
void editPalmData() async {
|
||||||
|
var entity = await ApiRepository.to.editICCardData(
|
||||||
|
cardId: state.keyId.value.toString(),
|
||||||
|
lockId: state.fingerprintItemData.value.lockId.toString(),
|
||||||
|
weekDay: state.weekDay.value,
|
||||||
|
startDate: state.starDate.value * 1000,
|
||||||
|
endDate: state.endDate.value * 1000,
|
||||||
|
isCoerced: state.isStressFingerprint.value ? "2" : "1",
|
||||||
|
cardName: state.changeNameController.text,
|
||||||
|
changeType: "1",
|
||||||
|
startTime: int.parse(state.starTime.value),
|
||||||
|
endTime: int.parse(state.endTime.value),
|
||||||
|
cardType: state.keyType.value,
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
showToast("修改成功", something: () {
|
||||||
|
eventBus.fire(OtherTypeRefreshListEvent());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除IC卡
|
||||||
|
void deletPalmData() async {
|
||||||
|
var entity = await ApiRepository.to.deletIcCardData(
|
||||||
|
cardId: state.fingerprintItemData.value.cardId.toString(),
|
||||||
|
lockId: state.fingerprintItemData.value.lockId.toString(),
|
||||||
|
type: "0",
|
||||||
|
deleteType: "1");
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
showToast("删除成功", something: () {
|
||||||
|
Get.back(result: "addScuess");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String getKeyTypeShowDateTime() {
|
||||||
|
String useDateStr = '';
|
||||||
|
if (state.keyType.value == 1) {
|
||||||
|
useDateStr = "永久";
|
||||||
|
} else if (state.keyType.value == 2) {
|
||||||
|
useDateStr =
|
||||||
|
"${DateTool().dateToYMDHNString(state.starDate.value)}\n${DateTool().dateToYMDHNString(state.endDate.value)}";
|
||||||
|
} else if (state.keyType.value == 4) {
|
||||||
|
useDateStr =
|
||||||
|
"${DateTool().dateToYMDString(state.starDate.value)}\n${DateTool().dateToYMDString(state.endDate.value)}";
|
||||||
|
}
|
||||||
|
return useDateStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onReady() {
|
||||||
|
// TODO: implement onReady
|
||||||
|
super.onReady();
|
||||||
|
|
||||||
|
_initReplySubscription();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
// TODO: implement onInit
|
||||||
|
super.onInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onClose() {
|
||||||
|
// TODO: implement onClose
|
||||||
|
super.onClose();
|
||||||
|
|
||||||
|
_replySubscription.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,301 @@
|
|||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/iris/irisDetail/irisDetail_logic.dart';
|
||||||
|
|
||||||
|
import '../../../../appRouters.dart';
|
||||||
|
import '../../../../app_settings/app_colors.dart';
|
||||||
|
import '../../../../blue/blue_manage.dart';
|
||||||
|
import '../../../../tools/appRouteObserver.dart';
|
||||||
|
import '../../../../tools/commonItem.dart';
|
||||||
|
import '../../../../tools/dateTool.dart';
|
||||||
|
import '../../../../tools/showIosTipView.dart';
|
||||||
|
import '../../../../tools/showTFView.dart';
|
||||||
|
import '../../../../tools/storage.dart';
|
||||||
|
import '../../../../tools/submitBtn.dart';
|
||||||
|
import '../../../../tools/titleAppBar.dart';
|
||||||
|
import '../../../../translations/trans_lib.dart';
|
||||||
|
|
||||||
|
class PalmDetailPage extends StatefulWidget {
|
||||||
|
const PalmDetailPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<PalmDetailPage> createState() => _PalmDetailPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _PalmDetailPageState extends State<PalmDetailPage> with RouteAware {
|
||||||
|
final logic = Get.put(IrisDetailLogic());
|
||||||
|
final state = Get.find<IrisDetailLogic>().state;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
|
appBar: TitleAppBar(
|
||||||
|
barTitle: "手掌详情",
|
||||||
|
haveBack: true,
|
||||||
|
backgroundColor: AppColors.mainColor,
|
||||||
|
),
|
||||||
|
body: ListView(
|
||||||
|
children: [
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: "手掌号",
|
||||||
|
rightTitle: state.typeNumber.value,
|
||||||
|
isHaveDirection: false,
|
||||||
|
isHaveLine: true)),
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
||||||
|
rightTitle: state.typeName.value,
|
||||||
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () {
|
||||||
|
showCupertinoAlertDialog(context);
|
||||||
|
})),
|
||||||
|
Obx(() => Visibility(
|
||||||
|
visible: (state.keyType.value == 4 ||
|
||||||
|
state.keyType.value == 2 ||
|
||||||
|
state.keyType.value == 1)
|
||||||
|
? true
|
||||||
|
: false,
|
||||||
|
child: CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||||
|
allHeight: 70.h,
|
||||||
|
// rightTitle:"2023.09.19 11:27\n2023.09.25 11:27",
|
||||||
|
rightTitle: logic.getKeyTypeShowDateTime(),
|
||||||
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () async {
|
||||||
|
if (state.keyType.value == 2 || state.keyType.value == 1) {
|
||||||
|
// 限时
|
||||||
|
var data = await Get.toNamed(
|
||||||
|
Routers.otherTypeKeyChangeDatePage,
|
||||||
|
arguments: {
|
||||||
|
"pushType": 0,
|
||||||
|
"fingerprintItemData":
|
||||||
|
state.fingerprintItemData.value,
|
||||||
|
});
|
||||||
|
if (data != null) {
|
||||||
|
setState(() {
|
||||||
|
state.starDate.value = data["beginTimeTimestamp"];
|
||||||
|
state.endDate.value = data["endTimeTimestamp"];
|
||||||
|
state.keyType.value = 2;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else if (state.keyType.value == 4) {
|
||||||
|
// 循环
|
||||||
|
var data = await Get.toNamed(
|
||||||
|
Routers.otherTypeKeyChangeValidityDatePage,
|
||||||
|
arguments: {
|
||||||
|
"pushType": 0,
|
||||||
|
"fingerprintItemData":
|
||||||
|
state.fingerprintItemData.value,
|
||||||
|
});
|
||||||
|
if (data != null) {
|
||||||
|
setState(() {
|
||||||
|
print("state.starDate.value:${data["starDate"]} "
|
||||||
|
"state.endDate.value:${data["endDate"]} "
|
||||||
|
"state.starTime.value:${data["starTime"]} "
|
||||||
|
"state.endTime.value:${data["endTime"]} "
|
||||||
|
"state.weekDay.value:${data["weekDay"]}");
|
||||||
|
|
||||||
|
state.starDate.value = data["starDate"];
|
||||||
|
state.endDate.value = data["endDate"];
|
||||||
|
state.starTime.value = data["starTime"];
|
||||||
|
state.endTime.value = data["endTime"];
|
||||||
|
state.weekDay.value = data["weekDay"];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}))),
|
||||||
|
Obx(() => Visibility(
|
||||||
|
visible: state.keyType.value == 4 ? true : false,
|
||||||
|
child: Obx(() => CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.effectiveDay!.tr,
|
||||||
|
rightTitle: state.weekDay.value.join(','),
|
||||||
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () async {
|
||||||
|
var data = await Get.toNamed(
|
||||||
|
Routers.otherTypeKeyChangeValidityDatePage,
|
||||||
|
arguments: {
|
||||||
|
"pushType": 0,
|
||||||
|
"fingerprintItemData":
|
||||||
|
state.fingerprintItemData.value,
|
||||||
|
});
|
||||||
|
if (data != null) {
|
||||||
|
setState(() {
|
||||||
|
state.starDate.value = data["starDate"];
|
||||||
|
state.endDate.value = data["endDate"];
|
||||||
|
state.starTime.value = data["starTime"];
|
||||||
|
state.endTime.value = data["endTime"];
|
||||||
|
state.weekDay.value = data["weekDay"];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})))),
|
||||||
|
Obx(() => Visibility(
|
||||||
|
visible: state.keyType.value == 4 ? true : false,
|
||||||
|
child: Obx(() => CommonItem(
|
||||||
|
leftTitel: "有效时间",
|
||||||
|
rightTitle:
|
||||||
|
"${DateTool().dateToHNString(state.starTime.value)}-${DateTool().dateToHNString(state.endTime.value)}",
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () async {
|
||||||
|
var data = await Get.toNamed(
|
||||||
|
Routers.otherTypeKeyChangeValidityDatePage,
|
||||||
|
arguments: {
|
||||||
|
"pushType": 0,
|
||||||
|
"fingerprintItemData":
|
||||||
|
state.fingerprintItemData.value,
|
||||||
|
});
|
||||||
|
if (data != null) {
|
||||||
|
setState(() {
|
||||||
|
state.starDate.value = data["starDate"];
|
||||||
|
state.endDate.value = data["endDate"];
|
||||||
|
state.starTime.value = data["starTime"];
|
||||||
|
state.endTime.value = data["endTime"];
|
||||||
|
state.weekDay.value = data["validityValue"];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})))),
|
||||||
|
Container(height: 10.h),
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.additive!.tr,
|
||||||
|
rightTitle: state.adder.value,
|
||||||
|
)),
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.addTime!.tr,
|
||||||
|
rightTitle: DateTool()
|
||||||
|
.dateToYMDHNString(state.addTime.value.toString()),
|
||||||
|
)),
|
||||||
|
SizedBox(height: 10.h),
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.operatingRecord!.tr,
|
||||||
|
rightTitle: "",
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
Get.toNamed(Routers.keyOperationRecordPage, arguments: {
|
||||||
|
'lockId': state.fingerprintItemData.value.lockId.toString(),
|
||||||
|
'cardId': state.fingerprintItemData.value.cardId.toString()
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
// SizedBox(height: 40.h),
|
||||||
|
// addControlsBtn(type),
|
||||||
|
SizedBox(height: 30.h),
|
||||||
|
SubmitBtn(
|
||||||
|
btnName: TranslationLoader.lanKeys!.delete!.tr,
|
||||||
|
isDelete: true,
|
||||||
|
borderRadius: 20.w,
|
||||||
|
margin: EdgeInsets.only(
|
||||||
|
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
|
||||||
|
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||||
|
onClick: () {
|
||||||
|
showIosTipViewDialog(context);
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void showCupertinoAlertDialog(BuildContext context) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return ShowTFView(
|
||||||
|
title:
|
||||||
|
"${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}",
|
||||||
|
tipTitle: "",
|
||||||
|
controller: state.changeNameController,
|
||||||
|
sureClick: () {
|
||||||
|
if (state.changeNameController.text.isEmpty) {
|
||||||
|
logic.showToast("请输入姓名");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Get.back();
|
||||||
|
state.typeName.value = state.changeNameController.text;
|
||||||
|
// logic.editICCardData();
|
||||||
|
},
|
||||||
|
cancelClick: () {
|
||||||
|
Get.back();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void showIosTipViewDialog(BuildContext context) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return ShowIosTipView(
|
||||||
|
title: "提示",
|
||||||
|
tipTitle: "确定要删除吗?",
|
||||||
|
sureClick: () async {
|
||||||
|
Get.back();
|
||||||
|
String? idStr = await Storage.getUid();
|
||||||
|
logic.senderAddICCard();
|
||||||
|
},
|
||||||
|
cancelClick: () {
|
||||||
|
Get.back();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() {
|
||||||
|
// TODO: implement didChangeDependencies
|
||||||
|
super.didChangeDependencies();
|
||||||
|
|
||||||
|
/// 路由订阅
|
||||||
|
AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
// TODO: implement dispose
|
||||||
|
/// 取消路由订阅
|
||||||
|
AppRouteObserver().routeObserver.unsubscribe(this);
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 从上级界面进入 当前界面即将出现
|
||||||
|
@override
|
||||||
|
void didPush() {
|
||||||
|
super.didPush();
|
||||||
|
print("lockSet===didPush");
|
||||||
|
state.ifCurrentScreen.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 返回上一个界面 当前界面即将消失
|
||||||
|
@override
|
||||||
|
void didPop() {
|
||||||
|
super.didPop();
|
||||||
|
print("lockSet===didPop");
|
||||||
|
logic.cancelBlueConnetctToastTimer();
|
||||||
|
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
|
||||||
|
BlueManage().stopScan();
|
||||||
|
state.ifCurrentScreen.value = false;
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 从下级返回 当前界面即将出现
|
||||||
|
@override
|
||||||
|
void didPopNext() {
|
||||||
|
super.didPopNext();
|
||||||
|
print("lockSet===didPopNext");
|
||||||
|
state.ifCurrentScreen.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 进入下级界面 当前界面即将消失
|
||||||
|
@override
|
||||||
|
void didPushNext() {
|
||||||
|
super.didPushNext();
|
||||||
|
print("lockSet===didPushNext");
|
||||||
|
logic.cancelBlueConnetctToastTimer();
|
||||||
|
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
|
||||||
|
BlueManage().stopScan();
|
||||||
|
state.ifCurrentScreen.value = false;
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
import '../../fingerprint/fingerprintList/fingerprintListData_entity.dart';
|
||||||
|
|
||||||
|
class PalmDetailState {
|
||||||
|
final fingerprintItemData = FingerprintItemData().obs;
|
||||||
|
|
||||||
|
final TextEditingController changeNameController = TextEditingController();
|
||||||
|
|
||||||
|
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||||
|
var sureBtnState = 0.obs; // 0普通状态(可用) 1连接中(不可用)
|
||||||
|
|
||||||
|
final typeNumber = "".obs; // 指纹号
|
||||||
|
final typeName = "".obs; // 指纹名字
|
||||||
|
var starDate = "".obs; // 开始时间
|
||||||
|
var endDate = "".obs; // 结束时间
|
||||||
|
var starTime = "".obs; // 生效时间
|
||||||
|
var endTime = "".obs; // 失效时间
|
||||||
|
final keyType = 0.obs; // 永久:1;限时2,单次3,循环:4
|
||||||
|
var weekDay = [].obs; // 有效日
|
||||||
|
var adder = "".obs; // 添加者
|
||||||
|
var addTime = 0.obs; // 添加时间
|
||||||
|
var keyId = 0.obs; // 卡id
|
||||||
|
|
||||||
|
final isStressFingerprint = false.obs;
|
||||||
|
PalmDetailState() {
|
||||||
|
Map map = Get.arguments;
|
||||||
|
if ((map["fingerprintItemData"] != null)) {
|
||||||
|
fingerprintItemData.value = map["fingerprintItemData"];
|
||||||
|
keyId.value = fingerprintItemData.value.cardId!;
|
||||||
|
typeNumber.value = fingerprintItemData.value.cardNumber!;
|
||||||
|
typeName.value = fingerprintItemData.value.cardName!;
|
||||||
|
changeNameController.text = typeName.value;
|
||||||
|
starDate.value = fingerprintItemData.value.startDate!.toString();
|
||||||
|
endDate.value = fingerprintItemData.value.endDate!.toString();
|
||||||
|
starTime.value = fingerprintItemData.value.startDate!.toString();
|
||||||
|
endTime.value = fingerprintItemData.value.endDate!.toString();
|
||||||
|
keyType.value = fingerprintItemData.value.cardType!;
|
||||||
|
adder.value = fingerprintItemData.value.senderUsername!;
|
||||||
|
addTime.value = fingerprintItemData.value.createDate!;
|
||||||
|
isStressFingerprint.value =
|
||||||
|
fingerprintItemData.value.isCoerced! == 2 ? true : false;
|
||||||
|
weekDay.value = fingerprintItemData.value.weekDay!;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user