Merge branch 'master' of https://gitee.com/starlock-cn/app-starlock
# Conflicts: # star_lock/lib/network/api_provider_base.dart
This commit is contained in:
commit
7c84d86160
@ -663,21 +663,20 @@
|
||||
"用户无权限": "User has no permission",
|
||||
"创建公司后,考勤功能才能使用": "After creating the company, the attendance function can be used",
|
||||
|
||||
"permission_dialog_camera": "camera",
|
||||
"permission_dialog_photos": "photos",
|
||||
"permission_dialog_storage": "storage",
|
||||
"permission_dialog_location": "location",
|
||||
"permission_dialog_camera_text": "Access to the camera is required to take photos and upload files, such as uploading a profile picture",
|
||||
"permission_dialog_photos_text": "Access to camera is required to upload files and avatars using album images",
|
||||
"permission_dialog_storage_text": "Access to read and write permissions is required to upload avatars using local images",
|
||||
"permission_dialog_location_text": "Access to location information is required to use the add key function",
|
||||
"permission_dialog_application": "application",
|
||||
"permission_dialog_authority": "permission",
|
||||
"permission_dialog_not_allowed": "Not Allowed",
|
||||
"permission_dialog_allowed": "Allowed",
|
||||
"permission_dialog_permission_denied": "Permission denied",
|
||||
"permission_dialog_open_permissions": "Please manually enable it in the system settings",
|
||||
"permission_dialog_permission_continue_text": "Permission to continue using the application.",
|
||||
"permission_dialog_go_set_up": "Go set it up"
|
||||
|
||||
"相机": "camera",
|
||||
"相册": "photos",
|
||||
"读写": "storage",
|
||||
"定位": "location",
|
||||
"需要访问相机权限才能拍照上传文件例如头像上传": "Access to the camera is required to take photos and upload files, such as uploading a profile picture",
|
||||
"需要访问相机权限才能使用相册图片上传文件上传头像": "Access to camera is required to upload files and avatars using album images",
|
||||
"需要访问读写权限才能使用本地图片上传头像": "Access to read and write permissions is required to upload avatars using local images",
|
||||
"需要访问定位权限才能使用添加钥匙功能的位置信息": "Access to location information is required to use the add key function",
|
||||
"申请": "application",
|
||||
"权限": "permission",
|
||||
"不允许": "Not Allowed",
|
||||
"允许": "Allowed",
|
||||
"权限被拒绝": "Permission denied",
|
||||
"请手动在系统设置中开启": "Please manually enable it in the system settings",
|
||||
"权限以继续使用应用": "Permission to continue using the application.",
|
||||
"去设置": "Go set it up"
|
||||
}
|
||||
|
||||
@ -663,20 +663,20 @@
|
||||
"用户无权限": "用户无权限",
|
||||
"创建公司后,考勤功能才能使用": "创建公司后,考勤功能才能使用",
|
||||
|
||||
"permission_dialog_camera": "相机",
|
||||
"permission_dialog_photos": "相册",
|
||||
"permission_dialog_storage": "读写",
|
||||
"permission_dialog_location": "定位",
|
||||
"permission_dialog_camera_text": "需要访问相机权限才能拍照上传文件例如头像上传",
|
||||
"permission_dialog_photos_text": "需要访问相机权限才能使用相册图片上传文件上传头像",
|
||||
"permission_dialog_storage_text": "需要访问读写权限才能使用本地图片上传头像",
|
||||
"permission_dialog_location_text": "需要访问定位权限才能使用添加钥匙功能的位置信息",
|
||||
"permission_dialog_application": "申请",
|
||||
"permission_dialog_authority": "权限",
|
||||
"permission_dialog_not_allowed": "不允许",
|
||||
"permission_dialog_allowed": "允许",
|
||||
"permission_dialog_permission_denied": "权限被拒绝",
|
||||
"permission_dialog_open_permissions": "请手动在系统设置中开启",
|
||||
"permission_dialog_permission_continue_text": "权限以继续使用应用。",
|
||||
"permission_dialog_go_set_up": "去设置"
|
||||
"相机": "相机",
|
||||
"相册": "相册",
|
||||
"读写": "读写",
|
||||
"定位": "定位",
|
||||
"需要访问相机权限才能拍照上传文件例如头像上传": "需要访问相机权限才能拍照上传文件例如头像上传",
|
||||
"需要访问相机权限才能使用相册图片上传文件上传头像": "需要访问相机权限才能使用相册图片上传文件上传头像",
|
||||
"需要访问读写权限才能使用本地图片上传头像": "需要访问读写权限才能使用本地图片上传头像",
|
||||
"需要访问定位权限才能使用添加钥匙功能的位置信息": "需要访问定位权限才能使用添加钥匙功能的位置信息",
|
||||
"申请": "申请",
|
||||
"权限": "权限",
|
||||
"不允许": "不允许",
|
||||
"允许": "允许",
|
||||
"权限被拒绝": "权限被拒绝",
|
||||
"请手动在系统设置中开启": "请手动在系统设置中开启",
|
||||
"权限以继续使用应用": "权限以继续使用应用。",
|
||||
"去设置": "去设置"
|
||||
}
|
||||
|
||||
@ -664,21 +664,20 @@
|
||||
"用户无权限": "用户无权限",
|
||||
"创建公司后,考勤功能才能使用": "创建公司后,考勤功能才能使用",
|
||||
|
||||
"permission_dialog_camera": "相机",
|
||||
"permission_dialog_photos": "相册",
|
||||
"permission_dialog_storage": "读写",
|
||||
"permission_dialog_location": "定位",
|
||||
"permission_dialog_camera_text": "需要访问相机权限才能拍照上传文件例如头像上传",
|
||||
"permission_dialog_photos_text": "需要访问相机权限才能使用相册图片上传文件上传头像",
|
||||
"permission_dialog_storage_text": "需要访问读写权限才能使用本地图片上传头像",
|
||||
"permission_dialog_location_text": "需要访问定位权限才能使用添加钥匙功能的位置信息",
|
||||
"permission_dialog_application": "申请",
|
||||
"permission_dialog_authority": "权限",
|
||||
"permission_dialog_not_allowed": "不允许",
|
||||
"permission_dialog_allowed": "允许",
|
||||
"permission_dialog_permission_denied": "权限被拒绝",
|
||||
"permission_dialog_open_permissions": "请手动在系统设置中开启",
|
||||
"permission_dialog_permission_continue_text": "权限以继续使用应用。",
|
||||
"permission_dialog_go_set_up": "去设置"
|
||||
|
||||
"相机": "相机",
|
||||
"相册": "相册",
|
||||
"读写": "读写",
|
||||
"定位": "定位",
|
||||
"需要访问相机权限才能拍照上传文件例如头像上传": "需要访问相机权限才能拍照上传文件例如头像上传",
|
||||
"需要访问相机权限才能使用相册图片上传文件上传头像": "需要访问相机权限才能使用相册图片上传文件上传头像",
|
||||
"需要访问读写权限才能使用本地图片上传头像": "需要访问读写权限才能使用本地图片上传头像",
|
||||
"需要访问定位权限才能使用添加钥匙功能的位置信息": "需要访问定位权限才能使用添加钥匙功能的位置信息",
|
||||
"申请": "申请",
|
||||
"权限": "权限",
|
||||
"不允许": "不允许",
|
||||
"允许": "允许",
|
||||
"权限被拒绝": "权限被拒绝",
|
||||
"请手动在系统设置中开启": "请手动在系统设置中开启",
|
||||
"权限以继续使用应用": "权限以继续使用应用。",
|
||||
"去设置": "去设置"
|
||||
}
|
||||
|
||||
@ -35,26 +35,9 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.doorLockLog!.tr,
|
||||
barTitle: TranslationLoader.lanKeys!.operatingRecord!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
actionsList: [
|
||||
IconButton(
|
||||
icon: Image.asset(
|
||||
'images/icon_bar_more.png',
|
||||
height: 30.h,
|
||||
width: 10.w,
|
||||
),
|
||||
onPressed: () async {
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if (isDemoMode == false) {
|
||||
} else {
|
||||
// Get.toNamed(Routers.selectLockTypePage);
|
||||
logic.showToast("演示模式");
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
body: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
@ -68,7 +51,7 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> {
|
||||
endIndent: 30.w,
|
||||
),
|
||||
eventDropDownWidget(),
|
||||
Expanded(child: Obx(() => timeLineView(state.lockLogItemList.value)))
|
||||
Expanded(child: Obx(() => timeLineView(state.lockLogItemList)))
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@ -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/main/lockDetail/face/faceDetail/faceDetail_state.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/dateTool.dart';
|
||||
import '../../../../blue/blue_manage.dart';
|
||||
import '../../../../blue/io_reply.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 {
|
||||
int status = reply.data[2];
|
||||
@ -62,8 +77,8 @@ class FaceDetailLogic extends BaseGetXController {
|
||||
userID: userID,
|
||||
faceNo: int.parse(state.typeNumber.value),
|
||||
useCountLimit: 0,
|
||||
startTime: state.effectiveDateTime.value,
|
||||
endTime: state.failureDateTime.value,
|
||||
startTime: int.parse(state.startDate.value),
|
||||
endTime: int.parse(state.endDate.value),
|
||||
needAuthor: 1,
|
||||
publicKey: publicKeyDataList,
|
||||
privateKey: getPrivateKeyList,
|
||||
@ -119,14 +134,15 @@ class FaceDetailLogic extends BaseGetXController {
|
||||
userID: userID,
|
||||
faceNo: int.parse(state.typeNumber.value),
|
||||
useCountLimit: 0,
|
||||
startTime: state.effectiveDateTime.value,
|
||||
endTime: state.failureDateTime.value,
|
||||
startTime: int.parse(state.startDate.value),
|
||||
endTime: int.parse(state.endDate.value),
|
||||
needAuthor: 1,
|
||||
publicKey: publicKeyDataList,
|
||||
privateKey: getPrivateKeyList,
|
||||
token: getTokenList,
|
||||
);
|
||||
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
||||
} else if (deviceConnectionState ==
|
||||
BluetoothConnectionState.disconnected) {
|
||||
dismissEasyLoading();
|
||||
cancelBlueConnetctToastTimer();
|
||||
state.sureBtnState.value = 0;
|
||||
@ -170,8 +186,8 @@ class FaceDetailLogic extends BaseGetXController {
|
||||
var entity = await ApiRepository.to.updateFaceValidity(
|
||||
lockId: state.faceItemData.value.lockId!,
|
||||
faceId: state.faceItemData.value.faceId!,
|
||||
startDate: state.effectiveDateTime.value,
|
||||
endDate: state.failureDateTime.value,
|
||||
startDate: int.parse(state.startTime.value),
|
||||
endDate: int.parse(state.endTime.value),
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("修改成功", something: () {
|
||||
|
||||
@ -12,6 +12,7 @@ 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';
|
||||
@ -35,16 +36,8 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
|
||||
barTitle: "人脸详情",
|
||||
haveBack: true,
|
||||
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: [
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: "人脸号",
|
||||
@ -60,40 +53,32 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
|
||||
showCupertinoAlertDialog(context);
|
||||
})),
|
||||
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
|
||||
: false,
|
||||
child: CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||
allHeight: 70.h,
|
||||
// rightTitle:"2023.09.19 11:27\n2023.09.25 11:27",
|
||||
rightTitle: state.keyType.value == 1
|
||||
? "永久"
|
||||
: "${DateTool().dateToYMDHNString(state.effectiveDateTime.value.toString())}\n${DateTool().dateToYMDHNString(state.failureDateTime.value.toString())}",
|
||||
rightTitle: logic.getKeyTypeShowDateTime(),
|
||||
isHaveDirection: true,
|
||||
isHaveLine: true,
|
||||
action: () async {
|
||||
// switch(state.type.value){
|
||||
// case 0:
|
||||
// // 卡
|
||||
//
|
||||
// break;
|
||||
// case 1:
|
||||
// 当是指纹的时候
|
||||
if (state.keyType.value == 2) {
|
||||
if (state.keyType.value == 2 || state.keyType.value == 1) {
|
||||
// 限时
|
||||
var data = await Get.toNamed(
|
||||
Routers.otherTypeKeyChangeDatePage,
|
||||
arguments: {
|
||||
"faceItemData": state.faceItemData.value,
|
||||
"pushType": 1,
|
||||
"pushType": 0,
|
||||
"fingerprintItemData": state.faceItemData.value,
|
||||
});
|
||||
if (data != null) {
|
||||
setState(() {
|
||||
state.effectiveDateTime.value =
|
||||
data["beginTimeTimestamp"];
|
||||
state.failureDateTime.value =
|
||||
data["endTimeTimestamp"];
|
||||
state.startDate.value = data["beginTimeTimestamp"];
|
||||
state.endDate.value = data["endTimeTimestamp"];
|
||||
state.keyType.value = 2;
|
||||
});
|
||||
}
|
||||
} else if (state.keyType.value == 4) {
|
||||
@ -101,14 +86,21 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
|
||||
var data = await Get.toNamed(
|
||||
Routers.otherTypeKeyChangeValidityDatePage,
|
||||
arguments: {
|
||||
"faceItemData": state.faceItemData.value,
|
||||
"pushType": 0,
|
||||
"fingerprintItemData": state.faceItemData.value,
|
||||
});
|
||||
if (data != null) {
|
||||
setState(() {
|
||||
state.effectiveDateTime.value =
|
||||
data["beginTimeTimestamp"];
|
||||
state.failureDateTime.value =
|
||||
data["endTimeTimestamp"];
|
||||
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.startDate.value = data["starDate"];
|
||||
state.endDate.value = data["endDate"];
|
||||
state.startTime.value = data["starTime"];
|
||||
state.endTime.value = data["endTime"];
|
||||
state.weekDay.value = data["weekDay"];
|
||||
});
|
||||
}
|
||||
@ -120,42 +112,64 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
|
||||
leftTitel: TranslationLoader.lanKeys!.effectiveDay!.tr,
|
||||
rightTitle: state.weekDay.value.join(','),
|
||||
isHaveDirection: true,
|
||||
isHaveLine: true,
|
||||
action: () async {
|
||||
// 当是人脸的时候
|
||||
var data = await Get.toNamed(
|
||||
Routers.otherTypeKeyChangeValidityDatePage,
|
||||
arguments: {
|
||||
"faceItemData": state.faceItemData.value,
|
||||
"pushType": 0,
|
||||
"fingerprintItemData": state.faceItemData.value,
|
||||
});
|
||||
if (data != null) {
|
||||
setState(() {
|
||||
state.effectiveDateTime.value =
|
||||
data["beginTimeTimestamp"];
|
||||
state.failureDateTime.value = data["endTimeTimestamp"];
|
||||
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"];
|
||||
});
|
||||
}
|
||||
})))),
|
||||
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),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.additive!.tr,
|
||||
rightTitle: state.adder.value,
|
||||
isHaveLine: true,
|
||||
action: () {})),
|
||||
leftTitel: TranslationLoader.lanKeys!.additive!.tr,
|
||||
rightTitle: state.adder.value,
|
||||
)),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.addTime!.tr,
|
||||
rightTitle:
|
||||
DateTool().dateToYMDHNString(state.addTime.value.toString()),
|
||||
action: () {})),
|
||||
leftTitel: TranslationLoader.lanKeys!.addTime!.tr,
|
||||
rightTitle: DateTool()
|
||||
.dateToYMDHNString(state.addTime.value.toString()),
|
||||
)),
|
||||
SizedBox(height: 10.h),
|
||||
|
||||
Container(height: 10.h),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.operatingRecord!.tr,
|
||||
rightTitle: "",
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
// 人脸
|
||||
Get.toNamed(Routers.keyOperationRecordPage, arguments: {
|
||||
'lockId': state.faceItemData.value.lockId.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) {
|
||||
showDialog(
|
||||
context: context,
|
||||
@ -284,8 +208,8 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
|
||||
return;
|
||||
}
|
||||
Get.back();
|
||||
// 面容
|
||||
logic.updateFaceNameData();
|
||||
state.typeName.value = state.changeNameController.text;
|
||||
// logic.editFaceData();
|
||||
},
|
||||
cancelClick: () {
|
||||
Get.back();
|
||||
@ -301,9 +225,9 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
|
||||
return ShowIosTipView(
|
||||
title: "提示",
|
||||
tipTitle: "确定要删除吗?",
|
||||
sureClick: () {
|
||||
sureClick: () async {
|
||||
Get.back();
|
||||
// 人脸
|
||||
String? idStr = await Storage.getUid();
|
||||
logic.senderAddFace();
|
||||
},
|
||||
cancelClick: () {
|
||||
|
||||
@ -9,8 +9,10 @@ class FaceDetailState {
|
||||
|
||||
final typeNumber = "".obs; // 人脸号
|
||||
final typeName = "".obs; // 人脸名字
|
||||
var effectiveDateTime = 0.obs; // 生效时间
|
||||
var failureDateTime = 0.obs; // 失效时间
|
||||
var startDate = "".obs; // 开始时间
|
||||
var endDate = "".obs; // 结束时间
|
||||
var startTime = "".obs; // 生效时间
|
||||
var endTime = "".obs; // 失效时间
|
||||
final keyType = 0.obs; // 永久:1;限时2,单次3,循环:4
|
||||
var weekDay = [].obs; // 有效日
|
||||
var adder = "".obs; // 添加者
|
||||
@ -27,8 +29,10 @@ class FaceDetailState {
|
||||
typeNumber.value = faceItemData.value.faceNumber!;
|
||||
typeName.value = faceItemData.value.faceName!;
|
||||
changeNameController.text = typeName.value;
|
||||
effectiveDateTime.value = faceItemData.value.startDate!;
|
||||
failureDateTime.value = faceItemData.value.endDate!;
|
||||
startDate.value = faceItemData.value.startDate!.toString();
|
||||
endDate.value = faceItemData.value.endDate!.toString();
|
||||
startTime.value = faceItemData.value.startDate!.toString();
|
||||
endTime.value = faceItemData.value.endDate!.toString();
|
||||
keyType.value = faceItemData.value.faceType!;
|
||||
adder.value = faceItemData.value.senderUsername!;
|
||||
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);
|
||||
if (isDemoMode == false) {
|
||||
_replySubscription.cancel();
|
||||
_teamEvent.cancel();
|
||||
// _replySubscription.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!;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:star_lock/flavors.dart';
|
||||
import 'package:star_lock/tools/appFirstEnterHandle.dart';
|
||||
import 'package:star_lock/tools/storage.dart';
|
||||
|
||||
@ -47,10 +48,12 @@ class _SelectLockTypePageState extends State<SelectLockTypePage>
|
||||
Navigator.pushNamed(context, Routers.addLockPage,
|
||||
arguments: {'getLockType': 1});
|
||||
}),
|
||||
lockTypeItem('images/lockType/lockType_NFCLock.png',
|
||||
if (!F.isLite)
|
||||
lockTypeItem('images/lockType/lockType_NFCLock.png',
|
||||
TranslationLoader.lanKeys!.NFCPassiveLock!.tr, () {
|
||||
// Navigator.pushNamed(context, Routers.addLockPage);
|
||||
}),
|
||||
if (!F.isLite)
|
||||
lockTypeItem('images/lockType/lockType_padlock.png',
|
||||
TranslationLoader.lanKeys!.padlock!.tr, () {
|
||||
// Navigator.pushNamed(context, Routers.addLockPage);
|
||||
@ -76,10 +79,12 @@ class _SelectLockTypePageState extends State<SelectLockTypePage>
|
||||
// TranslationLoader.lanKeys!.bicycleLock!.tr, () {
|
||||
// Navigator.pushNamed(context, Routers.addLockPage);
|
||||
// }),
|
||||
if (!F.isLite)
|
||||
lockTypeItem('images/lockType/lockType_gatewayLock.png',
|
||||
TranslationLoader.lanKeys!.gateway!.tr, () {
|
||||
// Navigator.pushNamed(context, Routers.gatewayListPage);
|
||||
}),
|
||||
if (!F.isLite)
|
||||
lockTypeItem('images/lockType/lockType_camera.png', '网络摄像头',
|
||||
() {
|
||||
// Navigator.pushNamed(context, Routers.gatewayListPage);
|
||||
|
||||
@ -22,22 +22,24 @@ class BaseProvider extends GetConnect with Api {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Response<T>> post<T>(String? url, body,
|
||||
{String? contentType = "application/json",
|
||||
Map<String, String>? headers,
|
||||
Map<String, dynamic>? query,
|
||||
Decoder<T>? decoder,
|
||||
bool? isUnUploadFile = true,
|
||||
Progress? uploadProgress,
|
||||
bool? isUnShowLoading = false,// 是否显示loading
|
||||
bool? isUserBaseUrl = true,// 文件上传不使用baseUrl
|
||||
}) async {
|
||||
Future<Response<T>> post<T>(
|
||||
String? url,
|
||||
body, {
|
||||
String? contentType = "application/json",
|
||||
Map<String, String>? headers,
|
||||
Map<String, dynamic>? query,
|
||||
Decoder<T>? decoder,
|
||||
bool? isUnUploadFile = true,
|
||||
Progress? uploadProgress,
|
||||
bool? isUnShowLoading = false, // 是否显示loading
|
||||
bool? isUserBaseUrl = true, // 文件上传不使用baseUrl
|
||||
}) async {
|
||||
// print("post: url:${url} body:${body} contentType:${contentType} headers:${headers} query:${query}");
|
||||
if (isUnShowLoading == false) EasyLoading.show();
|
||||
if (isUserBaseUrl == false){
|
||||
// 上传文件不需要baseUrl
|
||||
// print('请求url======>$url');
|
||||
if (isUserBaseUrl == false) {
|
||||
httpClient.baseUrl = '';
|
||||
}else{
|
||||
} else {
|
||||
httpClient.baseUrl = '${F.apiPrefix}/api';
|
||||
}
|
||||
// print('请求body体======>$body');
|
||||
@ -49,9 +51,12 @@ class BaseProvider extends GetConnect with Api {
|
||||
uploadProgress: uploadProgress);
|
||||
// print('res.body======>${res.body}');
|
||||
if (res.body == null) {
|
||||
if (EasyLoading.isShow) await EasyLoading.dismiss(animation: true);
|
||||
if (EasyLoading.isShow) await EasyLoading.dismiss(animation: true);
|
||||
EasyLoading.showToast("数据请求失败", duration: 2000.milliseconds);
|
||||
// EasyLoading.showToast("Network Error!", duration: 2000.milliseconds);
|
||||
if (res.statusCode == null) {
|
||||
EasyLoading.showToast("Network Error!", duration: 2000.milliseconds);
|
||||
}
|
||||
var rs = {
|
||||
"errorMsg": "Network Error!",
|
||||
"errorCode": -1,
|
||||
|
||||
@ -8,21 +8,17 @@ import 'package:star_lock/translations/trans_lib.dart';
|
||||
|
||||
class PermissionDialog {
|
||||
static Map<Permission, String> titles = {
|
||||
Permission.camera: TranslationLoader.lanKeys!.permissionDialogCamera!.tr,
|
||||
Permission.photos: TranslationLoader.lanKeys!.permissionDialogPhotos!.tr,
|
||||
Permission.storage: TranslationLoader.lanKeys!.permissionDialogStorage!.tr,
|
||||
Permission.location:
|
||||
TranslationLoader.lanKeys!.permissionDialogLocation!.tr,
|
||||
Permission.camera: '相机'.tr,
|
||||
Permission.photos: '相册'.tr,
|
||||
Permission.storage: '读写'.tr,
|
||||
Permission.location: '定位'.tr,
|
||||
};
|
||||
|
||||
static Map<Permission, String> contents = {
|
||||
Permission.camera:
|
||||
TranslationLoader.lanKeys!.permissionDialogCameraText!.tr,
|
||||
Permission.photos: TranslationLoader.lanKeys!.permissionDialogPhotos!.tr,
|
||||
Permission.storage:
|
||||
TranslationLoader.lanKeys!.permissionDialogStorageText!.tr,
|
||||
Permission.location:
|
||||
TranslationLoader.lanKeys!.permissionDialogLocationText!.tr,
|
||||
Permission.camera: '需要访问相机权限才能拍照上传文件例如头像上传'.tr,
|
||||
Permission.photos: '需要访问相机权限才能使用相册图片上传文件上传头像'.tr,
|
||||
Permission.storage: '需要访问读写权限才能使用本地图片上传头像'.tr,
|
||||
Permission.location: '需要访问定位权限才能使用添加钥匙功能的位置信息'.tr,
|
||||
};
|
||||
|
||||
//显示权限判断申请框
|
||||
@ -40,20 +36,17 @@ class PermissionDialog {
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
child: CupertinoAlertDialog(
|
||||
title: Text(
|
||||
'${TranslationLoader.lanKeys!.permissionDialogApplication!.tr}${titles[permission] ?? ''}${TranslationLoader.lanKeys!.permissionDialogAuthority!.tr}'),
|
||||
title: Text('${'申请'.tr}${titles[permission] ?? ''}${'权限'.tr}'),
|
||||
content: Text(contents[permission] ?? ''),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: Text(TranslationLoader
|
||||
.lanKeys!.permissionDialogNotAllowed!.tr),
|
||||
child: Text('不允许'.tr),
|
||||
onPressed: () {
|
||||
Get.back(result: false);
|
||||
},
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
child: Text(
|
||||
TranslationLoader.lanKeys!.permissionDialogAllowed!.tr),
|
||||
child: Text('允许'.tr),
|
||||
onPressed: () {
|
||||
Get.back(result: true);
|
||||
},
|
||||
@ -62,7 +55,7 @@ class PermissionDialog {
|
||||
));
|
||||
},
|
||||
);
|
||||
if(application){
|
||||
if (application) {
|
||||
await Storage.setString(titles[permission], titles[permission]);
|
||||
}
|
||||
} else if (cache is String) {
|
||||
@ -89,14 +82,12 @@ class PermissionDialog {
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
child: CupertinoAlertDialog(
|
||||
title: Text(
|
||||
'${titles[permission] ?? ''}${TranslationLoader.lanKeys!.permissionDialogPermissionDenied!.tr}'),
|
||||
title: Text('${titles[permission] ?? ''}${'权限被拒绝'.tr}'),
|
||||
content: Text(
|
||||
'${contents[permission] ?? ''},${TranslationLoader.lanKeys!.permissionDialogOpenPermissions!.tr}${titles[permission]}${TranslationLoader.lanKeys!.permissionDialogCameraText!.tr}'),
|
||||
'${contents[permission] ?? ''},${'请手动在系统设置中开启'.tr}${titles[permission]}${'权限以继续使用应用'.tr}'),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: Text(
|
||||
TranslationLoader.lanKeys!.permissionDialogGoSetUp!.tr),
|
||||
child: Text('去设置'.tr),
|
||||
onPressed: () {
|
||||
Get.back(); // 关闭对话框
|
||||
openAppSettings(); // 打开系统设置页面
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user