1、添加重置密码前校验接口能否调用成功功能
2、修改卡胁迫问题
This commit is contained in:
parent
ad29462882
commit
c0ff6200fc
@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/app_settings/app_settings.dart';
|
import 'package:star_lock/app_settings/app_settings.dart';
|
||||||
|
import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
|
||||||
import '../../../../appRouters.dart';
|
import '../../../../appRouters.dart';
|
||||||
@ -12,31 +13,31 @@ class AddCardTypeLogic extends BaseGetXController{
|
|||||||
AddCardTypeState state = AddCardTypeState();
|
AddCardTypeState state = AddCardTypeState();
|
||||||
|
|
||||||
// 添加卡数据
|
// 添加卡数据
|
||||||
void addCardData() async {
|
Future<void> addCardData() async {
|
||||||
var carType = 0; // 永久:1;限时2,单次3,循环:4
|
int carType = 0; // 永久:1;限时2,单次3,循环:4
|
||||||
var startDate = "";
|
String startDate = '';
|
||||||
var endDate = "";
|
String endDate = '';
|
||||||
var startTime = "";
|
String startTime = '';
|
||||||
var endTime = "";
|
String endTime = '';
|
||||||
if (state.selectType.value == "0") {
|
if (state.selectType.value == '0') {
|
||||||
carType = 1;
|
carType = 1;
|
||||||
startDate = "0";
|
startDate = '0';
|
||||||
endDate = "0";
|
endDate = '0';
|
||||||
startTime = "0";
|
startTime = '0';
|
||||||
endTime = "0";
|
endTime = '0';
|
||||||
} else if (state.selectType.value == "1") {
|
} else if (state.selectType.value == '1') {
|
||||||
carType = 2;
|
carType = 2;
|
||||||
startDate = DateTool().dateToTimestamp(state.timeLimitBeginTime.value, 1).toString();
|
startDate = DateTool().dateToTimestamp(state.timeLimitBeginTime.value, 1).toString();
|
||||||
endDate = DateTool().dateToTimestamp(state.timeLimitEndTime.value, 1).toString();
|
endDate = DateTool().dateToTimestamp(state.timeLimitEndTime.value, 1).toString();
|
||||||
startTime = "0";
|
startTime = '0';
|
||||||
endTime = "0";
|
endTime = '0';
|
||||||
|
|
||||||
if (startDate.isEmpty) {
|
if (startDate.isEmpty) {
|
||||||
showToast("请选择开始时间".tr);
|
showToast('请选择开始时间'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (endDate.isEmpty) {
|
if (endDate.isEmpty) {
|
||||||
showToast("请选择结束时间".tr);
|
showToast('请选择结束时间'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,14 +47,14 @@ class AddCardTypeLogic extends BaseGetXController{
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
if (int.parse(startDate) >= int.parse(endDate)) {
|
if (int.parse(startDate) >= int.parse(endDate)) {
|
||||||
showToast("失效时间要大于生效时间".tr);
|
showToast('失效时间要大于生效时间'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// AppLog.log("state.timeLimitBeginTime.value:${state.timeLimitBeginTime.value} startDate:$startDate");
|
// AppLog.log("state.timeLimitBeginTime.value:${state.timeLimitBeginTime.value} startDate:$startDate");
|
||||||
// AppLog.log("state.timeLimitEndTime.value:${state.timeLimitEndTime.value} endDate:$endDate");
|
// AppLog.log("state.timeLimitEndTime.value:${state.timeLimitEndTime.value} endDate:$endDate");
|
||||||
} else if (state.selectType.value == "2") {
|
} else if (state.selectType.value == '2') {
|
||||||
if (state.cycleBeginTime.value.isEmpty) {
|
if (state.cycleBeginTime.value.isEmpty) {
|
||||||
showToast("请选择有效期".tr);
|
showToast('请选择有效期'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
startDate = DateTool().dateToTimestamp(state.cycleBeginTime.value, 1).toString();
|
startDate = DateTool().dateToTimestamp(state.cycleBeginTime.value, 1).toString();
|
||||||
@ -63,28 +64,27 @@ class AddCardTypeLogic extends BaseGetXController{
|
|||||||
carType = 4;
|
carType = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
// var isCoerced = state.isStressFingerprint.value == false ? "1" : "2"; // 1:非胁迫卡 2:胁迫卡
|
Get.toNamed(Routers.addICCardPage, arguments: <String, Object>{
|
||||||
Get.toNamed(Routers.addICCardPage, arguments: {
|
'lockId': state.lockId.value,
|
||||||
"lockId": state.lockId.value,
|
'endDate': endDate,
|
||||||
"endDate": endDate,
|
'addType': '1',
|
||||||
"addType": "1",
|
'cardName': state.nameController.text,
|
||||||
"cardName": state.nameController.text,
|
'cardNumber': '123456',
|
||||||
"cardNumber": "123456",
|
'cardType': carType.toString(),
|
||||||
"cardType": carType.toString(),
|
'isCoerced': state.isStressFingerprint.value == false ? '2' : '1',
|
||||||
"isCoerced": state.isStressFingerprint.value == false ? "1" : "2",
|
'startDate': startDate,
|
||||||
"startDate": startDate,
|
'weekDay': state.weekdaysList.value,
|
||||||
"weekDay": state.weekdaysList.value,
|
'fromType': state.fromType.value,
|
||||||
"fromType": state.fromType.value,
|
'isAdministrator': state.isAdministrator.value == false ? '1' : '2', // 1:不是管理员 2:是管理员
|
||||||
"isAdministrator": state.isAdministrator.value == false ? "1" : "2", // 1:不是管理员 2:是管理员
|
'effectiveTime': startTime,
|
||||||
"effectiveTime": startTime,
|
'failureTime': endTime,
|
||||||
"failureTime": endTime,
|
'selectType': state.selectType.value,
|
||||||
"selectType": state.selectType.value,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 校验卡名字是否重复
|
// 校验卡名字是否重复
|
||||||
void checkCardNameDuplicated(String cardName) async{
|
Future<void> checkCardNameDuplicated(String cardName) async{
|
||||||
var entity = await ApiRepository.to.checkCardNameDuplicatedData(
|
final LoginEntity entity = await ApiRepository.to.checkCardNameDuplicatedData(
|
||||||
lockId: state.lockId.value.toString(),
|
lockId: state.lockId.value.toString(),
|
||||||
cardName: cardName,
|
cardName: cardName,
|
||||||
);
|
);
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/card/addCardType/addCardType_state.dart';
|
||||||
import 'package:star_lock/tools/commonDataManage.dart';
|
import 'package:star_lock/tools/commonDataManage.dart';
|
||||||
import 'package:star_lock/tools/pickers/pickers.dart';
|
import 'package:star_lock/tools/pickers/pickers.dart';
|
||||||
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
||||||
@ -28,12 +29,11 @@ class AddCardPage extends StatefulWidget {
|
|||||||
|
|
||||||
class _AddCardPageState extends State<AddCardPage>
|
class _AddCardPageState extends State<AddCardPage>
|
||||||
with SingleTickerProviderStateMixin {
|
with SingleTickerProviderStateMixin {
|
||||||
final logic = Get.put(AddCardTypeLogic());
|
final AddCardTypeLogic logic = Get.put(AddCardTypeLogic());
|
||||||
final state = Get.find<AddCardTypeLogic>().state;
|
final AddCardTypeState state = Get.find<AddCardTypeLogic>().state;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
// TODO: implement initState
|
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
state.tabController = TabController(
|
state.tabController = TabController(
|
||||||
@ -63,7 +63,7 @@ class _AddCardPageState extends State<AddCardPage>
|
|||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor),
|
backgroundColor: AppColors.mainColor),
|
||||||
body: Column(
|
body: Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
_tabBar(),
|
_tabBar(),
|
||||||
_pageWidget(),
|
_pageWidget(),
|
||||||
],
|
],
|
||||||
@ -78,7 +78,7 @@ class _AddCardPageState extends State<AddCardPage>
|
|||||||
// 永久
|
// 永久
|
||||||
return SingleChildScrollView(
|
return SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
perpetualKeyWidget(
|
perpetualKeyWidget(
|
||||||
TranslationLoader.lanKeys!.name!.tr,
|
TranslationLoader.lanKeys!.name!.tr,
|
||||||
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||||
@ -93,7 +93,7 @@ class _AddCardPageState extends State<AddCardPage>
|
|||||||
// 限时
|
// 限时
|
||||||
return SingleChildScrollView(
|
return SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
perpetualKeyWidget(
|
perpetualKeyWidget(
|
||||||
TranslationLoader.lanKeys!.name!.tr,
|
TranslationLoader.lanKeys!.name!.tr,
|
||||||
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||||
@ -110,7 +110,7 @@ class _AddCardPageState extends State<AddCardPage>
|
|||||||
// 循环
|
// 循环
|
||||||
return SingleChildScrollView(
|
return SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
perpetualKeyWidget(
|
perpetualKeyWidget(
|
||||||
TranslationLoader.lanKeys!.name!.tr,
|
TranslationLoader.lanKeys!.name!.tr,
|
||||||
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||||
@ -131,10 +131,10 @@ class _AddCardPageState extends State<AddCardPage>
|
|||||||
Widget perpetualKeyWidget(
|
Widget perpetualKeyWidget(
|
||||||
String titleStr, String rightTitle, TextEditingController controller) {
|
String titleStr, String rightTitle, TextEditingController controller) {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: titleStr,
|
leftTitel: titleStr,
|
||||||
rightTitle: "",
|
rightTitle: '',
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
rightWidget: getTFWidget(rightTitle)),
|
rightWidget: getTFWidget(rightTitle)),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
@ -145,17 +145,17 @@ class _AddCardPageState extends State<AddCardPage>
|
|||||||
// 限时顶部选择日期
|
// 限时顶部选择日期
|
||||||
Widget keyTimeLimitWidget() {
|
Widget keyTimeLimitWidget() {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||||
rightTitle: state.timeLimitBeginTime.value,
|
rightTitle: state.timeLimitBeginTime.value,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () async {
|
action: () async {
|
||||||
PDuration selectDate = PDuration.parse(
|
final PDuration selectDate = PDuration.parse(
|
||||||
DateTime.parse(state.timeLimitBeginTime.value));
|
DateTime.parse(state.timeLimitBeginTime.value));
|
||||||
Pickers.showDatePicker(context,
|
Pickers.showDatePicker(context,
|
||||||
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
|
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (PDuration p) {
|
||||||
state.timeLimitBeginTime.value =
|
state.timeLimitBeginTime.value =
|
||||||
DateTool().getYMDHNDateString(p, 1);
|
DateTool().getYMDHNDateString(p, 1);
|
||||||
});
|
});
|
||||||
@ -165,10 +165,10 @@ class _AddCardPageState extends State<AddCardPage>
|
|||||||
rightTitle: state.timeLimitEndTime.value,
|
rightTitle: state.timeLimitEndTime.value,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
PDuration selectDate =
|
final PDuration selectDate =
|
||||||
PDuration.parse(DateTime.tryParse(state.timeLimitEndTime.value));
|
PDuration.parse(DateTime.tryParse(state.timeLimitEndTime.value));
|
||||||
Pickers.showDatePicker(context,
|
Pickers.showDatePicker(context,
|
||||||
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
|
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (PDuration p) {
|
||||||
state.timeLimitEndTime.value =
|
state.timeLimitEndTime.value =
|
||||||
DateTool().getYMDHNDateString(p, 1);
|
DateTool().getYMDHNDateString(p, 1);
|
||||||
});
|
});
|
||||||
@ -181,16 +181,16 @@ class _AddCardPageState extends State<AddCardPage>
|
|||||||
// 循环顶部选择日期
|
// 循环顶部选择日期
|
||||||
Widget keyCyclicDate() {
|
Widget keyCyclicDate() {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||||
rightTitle:
|
rightTitle:
|
||||||
"${state.cycleBeginTime.value}\n${state.cycleEndTime.value}",
|
'${state.cycleBeginTime.value}\n${state.cycleEndTime.value}',
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
action: () async {
|
action: () async {
|
||||||
var result =
|
final result =
|
||||||
await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
|
await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: <String, Object>{
|
||||||
'validityValue': state.weekdaysList.value,
|
'validityValue': state.weekdaysList.value,
|
||||||
'starDate': state.cycleBeginTime.value,
|
'starDate': state.cycleBeginTime.value,
|
||||||
'endDate': state.cycleEndTime.value,
|
'endDate': state.cycleEndTime.value,
|
||||||
@ -206,15 +206,15 @@ class _AddCardPageState extends State<AddCardPage>
|
|||||||
}
|
}
|
||||||
})),
|
})),
|
||||||
Obx(() => Visibility(
|
Obx(() => Visibility(
|
||||||
visible: state.weekdaysList.isNotEmpty ? true : false,
|
visible: state.weekdaysList.isNotEmpty,
|
||||||
child: CommonItem(
|
child: CommonItem(
|
||||||
leftTitel: "有效日".tr,
|
leftTitel: '有效日'.tr,
|
||||||
rightTitle: state.weekdaysList.value.join(",").toString(),
|
rightTitle: state.weekdaysList.value.join(',').toString(),
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
action: () async {
|
action: () async {
|
||||||
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
final result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
||||||
arguments: {
|
arguments: <String, Object>{
|
||||||
'validityValue': state.weekdaysList.value,
|
'validityValue': state.weekdaysList.value,
|
||||||
'starDate': state.cycleBeginTime.value,
|
'starDate': state.cycleBeginTime.value,
|
||||||
'endDate': state.cycleEndTime.value,
|
'endDate': state.cycleEndTime.value,
|
||||||
@ -232,13 +232,13 @@ class _AddCardPageState extends State<AddCardPage>
|
|||||||
Obx(() => Visibility(
|
Obx(() => Visibility(
|
||||||
visible: state.effectiveDateTime.value.isNotEmpty,
|
visible: state.effectiveDateTime.value.isNotEmpty,
|
||||||
child: CommonItem(
|
child: CommonItem(
|
||||||
leftTitel: "有效时间".tr,
|
leftTitel: '有效时间'.tr,
|
||||||
rightTitle:
|
rightTitle:
|
||||||
"${state.effectiveDateTime.value}-${state.failureDateTime.value}",
|
'${state.effectiveDateTime.value}-${state.failureDateTime.value}',
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () async {
|
action: () async {
|
||||||
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
final result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
||||||
arguments: {
|
arguments: <String, Object>{
|
||||||
'validityValue': state.weekdaysList.value,
|
'validityValue': state.weekdaysList.value,
|
||||||
'starDate': state.cycleBeginTime.value,
|
'starDate': state.cycleBeginTime.value,
|
||||||
'endDate': state.cycleEndTime.value,
|
'endDate': state.cycleEndTime.value,
|
||||||
@ -259,14 +259,12 @@ class _AddCardPageState extends State<AddCardPage>
|
|||||||
|
|
||||||
Widget keyBottomWidget() {
|
Widget keyBottomWidget() {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Obx(() => Visibility(
|
Obx(() => Visibility(
|
||||||
visible: CommonDataManage().currentKeyInfo.isLockOwner == 1
|
visible: CommonDataManage().currentKeyInfo.isLockOwner == 1,
|
||||||
? true
|
|
||||||
: false,
|
|
||||||
child: CommonItem(
|
child: CommonItem(
|
||||||
leftTitel: "是否为管理员".tr,
|
leftTitel: '是否为管理员'.tr,
|
||||||
rightTitle: "",
|
rightTitle: '',
|
||||||
isTipsImg: false,
|
isTipsImg: false,
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
rightWidget:
|
rightWidget:
|
||||||
@ -274,7 +272,7 @@ class _AddCardPageState extends State<AddCardPage>
|
|||||||
SizedBox(height: 10.h),
|
SizedBox(height: 10.h),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.stressCard!.tr,
|
leftTitel: TranslationLoader.lanKeys!.stressCard!.tr,
|
||||||
rightTitle: "",
|
rightTitle: '',
|
||||||
isTipsImg: false,
|
isTipsImg: false,
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
rightWidget: SizedBox(
|
rightWidget: SizedBox(
|
||||||
@ -291,17 +289,17 @@ class _AddCardPageState extends State<AddCardPage>
|
|||||||
SubmitBtn(
|
SubmitBtn(
|
||||||
btnName: TranslationLoader.lanKeys!.next!.tr,
|
btnName: TranslationLoader.lanKeys!.next!.tr,
|
||||||
onClick: () async {
|
onClick: () async {
|
||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
if (isDemoMode == false) {
|
if (isDemoMode == false) {
|
||||||
if (state.nameController.text.isEmpty) {
|
if (state.nameController.text.isEmpty) {
|
||||||
logic.showToast("请输入姓名".tr);
|
logic.showToast('请输入姓名'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
logic.checkCardNameDuplicated(state.nameController.text);
|
logic.checkCardNameDuplicated(state.nameController.text);
|
||||||
} else {
|
} else {
|
||||||
// Get.toNamed(Routers.selectLockTypePage);
|
// Get.toNamed(Routers.selectLockTypePage);
|
||||||
logic.showToast("演示模式".tr);
|
logic.showToast('演示模式'.tr);
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
@ -318,7 +316,7 @@ class _AddCardPageState extends State<AddCardPage>
|
|||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Expanded(
|
Expanded(
|
||||||
child: TextField(
|
child: TextField(
|
||||||
//输入框一行
|
//输入框一行
|
||||||
@ -368,7 +366,7 @@ class _AddCardPageState extends State<AddCardPage>
|
|||||||
trackColor: CupertinoColors.systemGrey5,
|
trackColor: CupertinoColors.systemGrey5,
|
||||||
thumbColor: CupertinoColors.white,
|
thumbColor: CupertinoColors.white,
|
||||||
value: state.isStressFingerprint.value,
|
value: state.isStressFingerprint.value,
|
||||||
onChanged: (value) {
|
onChanged: (bool value) {
|
||||||
state.isStressFingerprint.value = value;
|
state.isStressFingerprint.value = value;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -381,34 +379,34 @@ class _AddCardPageState extends State<AddCardPage>
|
|||||||
trackColor: CupertinoColors.systemGrey5,
|
trackColor: CupertinoColors.systemGrey5,
|
||||||
thumbColor: CupertinoColors.white,
|
thumbColor: CupertinoColors.white,
|
||||||
value: state.isAdministrator.value,
|
value: state.isAdministrator.value,
|
||||||
onChanged: (value) {
|
onChanged: (bool value) {
|
||||||
state.isAdministrator.value = value;
|
state.isAdministrator.value = value;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<ItemView> _itemTabs = <ItemView>[
|
final List<ItemView> _itemTabs = <ItemView>[
|
||||||
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
|
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: '0'),
|
||||||
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
|
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: '1'),
|
||||||
ItemView(
|
ItemView(
|
||||||
title: TranslationLoader.lanKeys!.circulation!.tr, selectType: "2"),
|
title: TranslationLoader.lanKeys!.circulation!.tr, selectType: '2'),
|
||||||
];
|
];
|
||||||
|
|
||||||
final List<ItemView> _fromCheckInTypeItemTabs = <ItemView>[
|
final List<ItemView> _fromCheckInTypeItemTabs = <ItemView>[
|
||||||
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
|
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: '0'),
|
||||||
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
|
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: '1'),
|
||||||
];
|
];
|
||||||
|
|
||||||
TabBar _tabBar() {
|
TabBar _tabBar() {
|
||||||
return TabBar(
|
return TabBar(
|
||||||
controller: state.tabController,
|
controller: state.tabController,
|
||||||
onTap: (index) {
|
onTap: (int index) {
|
||||||
FocusScope.of(context).requestFocus(FocusNode());
|
FocusScope.of(context).requestFocus(FocusNode());
|
||||||
},
|
},
|
||||||
tabs: state.fromType.value == 1
|
tabs: state.fromType.value == 1
|
||||||
? _itemTabs.map((ItemView item) => _tab(item)).toList()
|
? _itemTabs.map(_tab).toList()
|
||||||
: _fromCheckInTypeItemTabs
|
: _fromCheckInTypeItemTabs
|
||||||
.map((ItemView item) => _tab(item))
|
.map(_tab)
|
||||||
.toList(),
|
.toList(),
|
||||||
isScrollable: true,
|
isScrollable: true,
|
||||||
indicatorColor: Colors.red,
|
indicatorColor: Colors.red,
|
||||||
@ -443,10 +441,10 @@ class _AddCardPageState extends State<AddCardPage>
|
|||||||
controller: state.tabController,
|
controller: state.tabController,
|
||||||
children: state.fromType.value == 1
|
children: state.fromType.value == 1
|
||||||
? _itemTabs
|
? _itemTabs
|
||||||
.map((ItemView item) => Obx(() => indexChangeWidget()))
|
.map((ItemView item) => Obx(indexChangeWidget))
|
||||||
.toList()
|
.toList()
|
||||||
: _fromCheckInTypeItemTabs
|
: _fromCheckInTypeItemTabs
|
||||||
.map((ItemView item) => Obx(() => indexChangeWidget()))
|
.map((ItemView item) => Obx(indexChangeWidget))
|
||||||
.toList(),
|
.toList(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -5,31 +5,31 @@ import 'package:get/get.dart';
|
|||||||
import '../../../../tools/dateTool.dart';
|
import '../../../../tools/dateTool.dart';
|
||||||
|
|
||||||
class AddCardTypeState{
|
class AddCardTypeState{
|
||||||
|
AddCardTypeState() {
|
||||||
|
Map map = Get.arguments;
|
||||||
|
lockId.value = map['lockId'];
|
||||||
|
fromType.value = map['fromType'];
|
||||||
|
// 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||||
|
if(fromType.value == 2){
|
||||||
|
fromTypeTwoStaffName.value = map['fromTypeTwoStaffName']; // 从添加员工进入 传入员工名字
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final lockId = 0.obs;
|
final RxInt lockId = 0.obs;
|
||||||
final selectType = "0".obs;// 0永久 1限时 2循环
|
final RxString selectType = '0'.obs;// 0永久 1限时 2循环
|
||||||
final fromType = 1.obs; // // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
final RxInt fromType = 1.obs; // // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||||
final isStressFingerprint = false.obs;
|
final RxBool isStressFingerprint = false.obs;
|
||||||
final isAdministrator = false.obs;// 是否是管理员
|
final RxBool isAdministrator = false.obs;// 是否是管理员
|
||||||
|
|
||||||
var timeLimitBeginTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;// 限时开始时间
|
RxString timeLimitBeginTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;// 限时开始时间
|
||||||
var timeLimitEndTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;// 限时结束时间
|
RxString timeLimitEndTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;// 限时结束时间
|
||||||
var cycleBeginTime = "".obs;// 循环开始时间
|
RxString cycleBeginTime = ''.obs;// 循环开始时间
|
||||||
var cycleEndTime = "".obs;// 循环结束时间
|
RxString cycleEndTime = ''.obs;// 循环结束时间
|
||||||
var effectiveDateTime = "".obs;// 生效时间
|
RxString effectiveDateTime = ''.obs;// 生效时间
|
||||||
var failureDateTime = "".obs;// 失效时间
|
RxString failureDateTime = ''.obs;// 失效时间
|
||||||
var weekdaysList = [].obs;
|
RxList weekdaysList = [].obs;
|
||||||
var fromTypeTwoStaffName = "".obs; // 从添加员工进入 传入员工名字
|
RxString fromTypeTwoStaffName = ''.obs; // 从添加员工进入 传入员工名字
|
||||||
|
|
||||||
final TextEditingController nameController = TextEditingController();
|
final TextEditingController nameController = TextEditingController();
|
||||||
late TabController tabController;
|
late TabController tabController;
|
||||||
AddCardTypeState() {
|
|
||||||
Map map = Get.arguments;
|
|
||||||
lockId.value = map["lockId"];
|
|
||||||
fromType.value = map["fromType"];
|
|
||||||
// 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
|
||||||
if(fromType.value == 2){
|
|
||||||
fromTypeTwoStaffName.value = map["fromTypeTwoStaffName"]; // 从添加员工进入 传入员工名字
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -77,7 +77,7 @@ class AddICCardLogic extends BaseGetXController{
|
|||||||
useCountLimit:0xffff,
|
useCountLimit:0xffff,
|
||||||
operate:0, // 0:注册 1:修改 2:删除 3:删除全部
|
operate:0, // 0:注册 1:修改 2:删除 3:删除全部
|
||||||
isAdmin:state.isAdministrator.value == '2' ? 1 : 0,
|
isAdmin:state.isAdministrator.value == '2' ? 1 : 0,
|
||||||
isForce:state.isCoerced.value == '2' ? 1 : 0, // 是否是胁迫
|
isForce:state.isCoerced.value == '1' ? 1 : 0, // 是否是胁迫
|
||||||
isRound:state.selectType.value == '2' ? 1: 0, // 是否是循环
|
isRound:state.selectType.value == '2' ? 1: 0, // 是否是循环
|
||||||
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环
|
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环
|
||||||
startDate: int.parse(state.startDate.value)~/1000,
|
startDate: int.parse(state.startDate.value)~/1000,
|
||||||
@ -151,8 +151,6 @@ class AddICCardLogic extends BaseGetXController{
|
|||||||
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected){
|
if (deviceConnectionState == BluetoothConnectionState.connected){
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
|
||||||
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
|
||||||
|
|
||||||
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
@ -170,7 +168,7 @@ class AddICCardLogic extends BaseGetXController{
|
|||||||
useCountLimit:0xffff,
|
useCountLimit:0xffff,
|
||||||
operate:0, // 0:注册 1:修改 2:删除 3:删除全部
|
operate:0, // 0:注册 1:修改 2:删除 3:删除全部
|
||||||
isAdmin:state.isAdministrator.value == '2' ? 1 : 0,
|
isAdmin:state.isAdministrator.value == '2' ? 1 : 0,
|
||||||
isForce:state.isCoerced.value == '2' ? 1 : 0, // 是否是胁迫
|
isForce:state.isCoerced.value == '1' ? 1 : 0, // 是否是胁迫
|
||||||
isRound:state.selectType.value == '2' ? 1: 0, // 是否是循环
|
isRound:state.selectType.value == '2' ? 1: 0, // 是否是循环
|
||||||
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环
|
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环
|
||||||
startDate: int.parse(state.startDate.value)~/1000,
|
startDate: int.parse(state.startDate.value)~/1000,
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import 'package:flutter/cupertino.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/card/addICCard/addICCard_state.dart';
|
||||||
|
|
||||||
import '../../../../app_settings/app_colors.dart';
|
import '../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../tools/appRouteObserver.dart';
|
import '../../../../tools/appRouteObserver.dart';
|
||||||
@ -18,8 +19,8 @@ class AddICCardPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _AddICCardPageState extends State<AddICCardPage> with RouteAware {
|
class _AddICCardPageState extends State<AddICCardPage> with RouteAware {
|
||||||
final logic = Get.put(AddICCardLogic());
|
final AddICCardLogic logic = Get.put(AddICCardLogic());
|
||||||
final state = Get.find<AddICCardLogic>().state;
|
final AddICCardState state = Get.find<AddICCardLogic>().state;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -31,7 +32,7 @@ class _AddICCardPageState extends State<AddICCardPage> with RouteAware {
|
|||||||
backgroundColor: AppColors.mainColor,
|
backgroundColor: AppColors.mainColor,
|
||||||
),
|
),
|
||||||
body: ListView(
|
body: ListView(
|
||||||
children: [
|
children: <Widget>[
|
||||||
SizedBox(height: 200.h),
|
SizedBox(height: 200.h),
|
||||||
Center(
|
Center(
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
@ -60,8 +61,8 @@ class _AddICCardPageState extends State<AddICCardPage> with RouteAware {
|
|||||||
child: Center(
|
child: Center(
|
||||||
child: Obx(() => Text(
|
child: Obx(() => Text(
|
||||||
state.ifConnectScuess.value
|
state.ifConnectScuess.value
|
||||||
? "已连接到锁,请将卡靠近锁的读卡区".tr
|
? '已连接到锁,请将卡靠近锁的读卡区'.tr
|
||||||
: "尝试连接设备...".tr,
|
: '尝试连接设备...'.tr,
|
||||||
style: TextStyle(color: Colors.white, fontSize: 24.sp)))),
|
style: TextStyle(color: Colors.white, fontSize: 24.sp)))),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -71,7 +72,6 @@ class _AddICCardPageState extends State<AddICCardPage> with RouteAware {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
// TODO: implement didChangeDependencies
|
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
|
|
||||||
/// 路由订阅
|
/// 路由订阅
|
||||||
@ -80,7 +80,6 @@ class _AddICCardPageState extends State<AddICCardPage> with RouteAware {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
// TODO: implement dispose
|
|
||||||
/// 取消路由订阅
|
/// 取消路由订阅
|
||||||
AppRouteObserver().routeObserver.unsubscribe(this);
|
AppRouteObserver().routeObserver.unsubscribe(this);
|
||||||
super.dispose();
|
super.dispose();
|
||||||
|
|||||||
@ -3,48 +3,48 @@ import 'package:get/get.dart';
|
|||||||
|
|
||||||
import '../../../../tools/commonDataManage.dart';
|
import '../../../../tools/commonDataManage.dart';
|
||||||
|
|
||||||
class AddICCardState{
|
class AddICCardState{ // 0永久 1显示 2循环
|
||||||
var ifConnectScuess = false.obs;
|
|
||||||
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
|
||||||
var ifAddState = false.obs;// 是否是添加状态,如果是添加状态,返回上级界面发送取消添加指令
|
|
||||||
|
|
||||||
var addFingerprintProcessNumber = 0.obs;
|
|
||||||
final lockId = 0.obs;
|
|
||||||
final endDate = "".obs;
|
|
||||||
final addType = "".obs;
|
|
||||||
final cardName = "".obs;
|
|
||||||
final cardNumber = "".obs;
|
|
||||||
final cardType = "".obs;
|
|
||||||
final isCoerced = "".obs;
|
|
||||||
final isAdministrator = "".obs;
|
|
||||||
final startDate = "".obs;
|
|
||||||
final weekDay = [].obs;
|
|
||||||
final fromType = 0.obs;
|
|
||||||
final effectiveDateTime = "".obs; // 生效时间
|
|
||||||
final failureDateTime = "".obs; // 失效时间
|
|
||||||
final selectType = "0".obs; // 0永久 1显示 2循环
|
|
||||||
|
|
||||||
AddICCardState() {
|
AddICCardState() {
|
||||||
Map map = Get.arguments;
|
Map map = Get.arguments;
|
||||||
lockId.value = map["lockId"];
|
lockId.value = map['lockId'];
|
||||||
addType.value = map["addType"];
|
addType.value = map['addType'];
|
||||||
cardName.value = map["cardName"];
|
cardName.value = map['cardName'];
|
||||||
cardNumber.value = map["cardNumber"];
|
cardNumber.value = map['cardNumber'];
|
||||||
cardType.value = map["cardType"];
|
cardType.value = map['cardType'];
|
||||||
isCoerced.value = map["isCoerced"];
|
isCoerced.value = map['isCoerced'];
|
||||||
isAdministrator.value = map["isAdministrator"];
|
isAdministrator.value = map['isAdministrator'];
|
||||||
startDate.value = map["startDate"];
|
startDate.value = map['startDate'];
|
||||||
weekDay.value = map["weekDay"];
|
weekDay.value = map['weekDay'];
|
||||||
fromType.value = map["fromType"];
|
fromType.value = map['fromType'];
|
||||||
effectiveDateTime.value = map["effectiveTime"];
|
effectiveDateTime.value = map['effectiveTime'];
|
||||||
failureDateTime.value = map["failureTime"];
|
failureDateTime.value = map['failureTime'];
|
||||||
selectType.value = map["selectType"];
|
selectType.value = map['selectType'];
|
||||||
//循环类型下,结束时间加一天
|
//循环类型下,结束时间加一天
|
||||||
if (selectType.value == '2') {
|
if (selectType.value == '2') {
|
||||||
endDate.value =
|
endDate.value =
|
||||||
"${int.parse(map["endDate"]) + CommonDataManage().dayLatestTime}";
|
"${int.parse(map["endDate"]) + CommonDataManage().dayLatestTime}";
|
||||||
} else {
|
} else {
|
||||||
endDate.value = map["endDate"];
|
endDate.value = map['endDate'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
RxBool ifConnectScuess = false.obs;
|
||||||
|
RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||||
|
RxBool ifAddState = false.obs;// 是否是添加状态,如果是添加状态,返回上级界面发送取消添加指令
|
||||||
|
|
||||||
|
RxInt addFingerprintProcessNumber = 0.obs;
|
||||||
|
final RxInt lockId = 0.obs;
|
||||||
|
final RxString endDate = ''.obs;
|
||||||
|
final RxString addType = ''.obs;
|
||||||
|
final RxString cardName = ''.obs;
|
||||||
|
final RxString cardNumber = ''.obs;
|
||||||
|
final RxString cardType = ''.obs;
|
||||||
|
final RxString isCoerced = ''.obs;
|
||||||
|
final RxString isAdministrator = ''.obs;
|
||||||
|
final RxString startDate = ''.obs;
|
||||||
|
final RxList weekDay = [].obs;
|
||||||
|
final RxInt fromType = 0.obs;
|
||||||
|
final RxString effectiveDateTime = ''.obs; // 生效时间
|
||||||
|
final RxString failureDateTime = ''.obs; // 失效时间
|
||||||
|
final RxString selectType = '0'.obs;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import 'dart:async';
|
|||||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/blue/io_type.dart';
|
import 'package:star_lock/blue/io_type.dart';
|
||||||
|
import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
import 'package:star_lock/tools/eventBusEventManage.dart';
|
import 'package:star_lock/tools/eventBusEventManage.dart';
|
||||||
|
|
||||||
@ -24,7 +25,7 @@ class CardDetailLogic extends BaseGetXController{
|
|||||||
// 监听设备返回的数据
|
// 监听设备返回的数据
|
||||||
late StreamSubscription<Reply> _replySubscription;
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
void _initReplySubscription() {
|
void _initReplySubscription() {
|
||||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) async {
|
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
|
||||||
// 添加卡片开始(重置锁里面所有卡)
|
// 添加卡片开始(重置锁里面所有卡)
|
||||||
if((reply is SenderAddICCardWithTimeCycleCoercionReply) && (state.ifCurrentScreen.value == true)) {
|
if((reply is SenderAddICCardWithTimeCycleCoercionReply) && (state.ifCurrentScreen.value == true)) {
|
||||||
_replyAddICCardBegin(reply);
|
_replyAddICCardBegin(reply);
|
||||||
@ -34,7 +35,7 @@ class CardDetailLogic extends BaseGetXController{
|
|||||||
|
|
||||||
// 添加卡片开始(此处用作删除卡片)
|
// 添加卡片开始(此处用作删除卡片)
|
||||||
Future<void> _replyAddICCardBegin(Reply reply) async {
|
Future<void> _replyAddICCardBegin(Reply reply) async {
|
||||||
int status = reply.data[2];
|
final int status = reply.data[2];
|
||||||
|
|
||||||
switch(status){
|
switch(status){
|
||||||
case 0x00:
|
case 0x00:
|
||||||
@ -49,17 +50,14 @@ class CardDetailLogic extends BaseGetXController{
|
|||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
//无权限
|
//无权限
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
final List<int> token = reply.data.sublist(5, 9);
|
||||||
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
final List<String> saveStrList = changeIntListToStringList(token);
|
||||||
|
|
||||||
var token = reply.data.sublist(5, 9);
|
|
||||||
var saveStrList = changeIntListToStringList(token);
|
|
||||||
Storage.setStringList(saveBlueToken, saveStrList);
|
Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
|
|
||||||
IoSenderManage.senderAddCardWithTimeCycleCoercionCommand(
|
IoSenderManage.senderAddCardWithTimeCycleCoercionCommand(
|
||||||
@ -103,14 +101,14 @@ class CardDetailLogic extends BaseGetXController{
|
|||||||
});
|
});
|
||||||
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected){
|
if (deviceConnectionState == BluetoothConnectionState.connected){
|
||||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
var token = await Storage.getStringList(saveBlueToken);
|
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||||
List<int> getTokenList = changeStringListToIntList(token!);
|
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
IoSenderManage.senderAddCardWithTimeCycleCoercionCommand(
|
IoSenderManage.senderAddCardWithTimeCycleCoercionCommand(
|
||||||
keyID:state.keyId.value.toString(),
|
keyID:state.keyId.value.toString(),
|
||||||
@ -144,39 +142,39 @@ class CardDetailLogic extends BaseGetXController{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 编辑iC卡
|
// 编辑iC卡
|
||||||
void editICCardData() async{
|
Future<void> editICCardData() async{
|
||||||
var entity = await ApiRepository.to.editICCardData(
|
final LoginEntity entity = await ApiRepository.to.editICCardData(
|
||||||
cardId: state.keyId.value.toString(),
|
cardId: state.keyId.value.toString(),
|
||||||
lockId: state.fingerprintItemData.value.lockId.toString(),
|
lockId: state.fingerprintItemData.value.lockId.toString(),
|
||||||
weekDay: state.weekDay.value,
|
weekDay: state.weekDay.value,
|
||||||
startDate: state.startDate.value,
|
startDate: state.startDate.value,
|
||||||
endDate: state.endDate.value,
|
endDate: state.endDate.value,
|
||||||
isCoerced: state.isStressCard.value ? "2" : "1",
|
isCoerced: state.isStressCard.value ? '1' : '2',
|
||||||
cardName: state.changeNameController.text,
|
cardName: state.changeNameController.text,
|
||||||
changeType: "1",
|
changeType: '1',
|
||||||
startTime: int.parse(state.starTime.value),
|
startTime: int.parse(state.starTime.value),
|
||||||
endTime: int.parse(state.endTime.value),
|
endTime: int.parse(state.endTime.value),
|
||||||
cardType:state.keyType.value,
|
cardType:state.keyType.value,
|
||||||
cardRight: state.isAdministrator.value ? 1 : 0,
|
cardRight: state.isAdministrator.value ? 1 : 0,
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
showToast("修改成功".tr, something: (){
|
showToast('修改成功'.tr, something: (){
|
||||||
eventBus.fire(OtherTypeRefreshListEvent());
|
eventBus.fire(OtherTypeRefreshListEvent());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除IC卡
|
// 删除IC卡
|
||||||
void deletICCardData() async{
|
Future<void> deletICCardData() async{
|
||||||
var entity = await ApiRepository.to.deletIcCardData(
|
final LoginEntity entity = await ApiRepository.to.deletIcCardData(
|
||||||
cardId: state.fingerprintItemData.value.cardId.toString(),
|
cardId: state.fingerprintItemData.value.cardId.toString(),
|
||||||
lockId: state.fingerprintItemData.value.lockId.toString(),
|
lockId: state.fingerprintItemData.value.lockId.toString(),
|
||||||
type: "0",
|
type: '0',
|
||||||
deleteType:"1"
|
deleteType:'1'
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
showToast("删除成功".tr, something: (){
|
showToast('删除成功'.tr, something: (){
|
||||||
Get.back(result: "addScuess");
|
Get.back(result: 'addScuess');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -184,33 +182,24 @@ class CardDetailLogic extends BaseGetXController{
|
|||||||
String getKeyTypeShowDateTime(){
|
String getKeyTypeShowDateTime(){
|
||||||
String useDateStr = '';
|
String useDateStr = '';
|
||||||
if(state.keyType.value == 1){
|
if(state.keyType.value == 1){
|
||||||
useDateStr = "永久".tr;
|
useDateStr = '永久'.tr;
|
||||||
}else if(state.keyType.value == 2){
|
}else if(state.keyType.value == 2){
|
||||||
useDateStr = "${DateTool().dateToYMDHNString(state.startDate.value)}\n${DateTool().dateToYMDHNString(state.endDate.value)}";
|
useDateStr = '${DateTool().dateToYMDHNString(state.startDate.value)}\n${DateTool().dateToYMDHNString(state.endDate.value)}';
|
||||||
} else if(state.keyType.value == 4){
|
} else if(state.keyType.value == 4){
|
||||||
useDateStr = "${DateTool().dateToYMDString(state.startDate.value)}\n${DateTool().dateToYMDString(state.endDate.value)}";
|
useDateStr = '${DateTool().dateToYMDString(state.startDate.value)}\n${DateTool().dateToYMDString(state.endDate.value)}';
|
||||||
}
|
}
|
||||||
return useDateStr;
|
return useDateStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() {
|
void onReady() {
|
||||||
// TODO: implement onReady
|
|
||||||
super.onReady();
|
super.onReady();
|
||||||
|
|
||||||
_initReplySubscription();
|
_initReplySubscription();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
void onInit() {
|
|
||||||
// TODO: implement onInit
|
|
||||||
super.onInit();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
// TODO: implement onClose
|
|
||||||
super.onClose();
|
super.onClose();
|
||||||
|
|
||||||
_replySubscription.cancel();
|
_replySubscription.cancel();
|
||||||
|
|||||||
@ -1,16 +1,16 @@
|
|||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/card/cardDetail/cardDetail_state.dart';
|
||||||
|
|
||||||
import '../../../../appRouters.dart';
|
import '../../../../appRouters.dart';
|
||||||
import '../../../../app_settings/app_colors.dart';
|
import '../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../blue/blue_manage.dart';
|
|
||||||
import '../../../../tools/appRouteObserver.dart';
|
import '../../../../tools/appRouteObserver.dart';
|
||||||
import '../../../../tools/commonItem.dart';
|
import '../../../../tools/commonItem.dart';
|
||||||
import '../../../../tools/dateTool.dart';
|
import '../../../../tools/dateTool.dart';
|
||||||
import '../../../../tools/showTFView.dart';
|
|
||||||
import '../../../../tools/showTipView.dart';
|
import '../../../../tools/showTipView.dart';
|
||||||
import '../../../../tools/submitBtn.dart';
|
import '../../../../tools/submitBtn.dart';
|
||||||
import '../../../../tools/titleAppBar.dart';
|
import '../../../../tools/titleAppBar.dart';
|
||||||
@ -25,20 +25,20 @@ class CardDetailPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
||||||
final logic = Get.put(CardDetailLogic());
|
final CardDetailLogic logic = Get.put(CardDetailLogic());
|
||||||
final state = Get.find<CardDetailLogic>().state;
|
final CardDetailState state = Get.find<CardDetailLogic>().state;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
barTitle: "卡详情".tr,
|
barTitle: '卡详情'.tr,
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor,
|
backgroundColor: AppColors.mainColor,
|
||||||
),
|
),
|
||||||
body: ListView(
|
body: ListView(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel:
|
leftTitel:
|
||||||
"${TranslationLoader.lanKeys!.card!.tr}${TranslationLoader.lanKeys!.number!.tr}",
|
"${TranslationLoader.lanKeys!.card!.tr}${TranslationLoader.lanKeys!.number!.tr}",
|
||||||
@ -54,9 +54,9 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
|||||||
ShowTipView().showTFViewAlertDialog(
|
ShowTipView().showTFViewAlertDialog(
|
||||||
state.changeNameController,
|
state.changeNameController,
|
||||||
"${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}",
|
"${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}",
|
||||||
"", () {
|
'', () {
|
||||||
if (state.changeNameController.text.isEmpty) {
|
if (state.changeNameController.text.isEmpty) {
|
||||||
logic.showToast("请输入姓名".tr);
|
logic.showToast('请输入姓名'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Get.back();
|
Get.back();
|
||||||
@ -79,30 +79,30 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
|||||||
action: () async {
|
action: () async {
|
||||||
if(state.keyType.value == 2 || state.keyType.value == 1){
|
if(state.keyType.value == 2 || state.keyType.value == 1){
|
||||||
// 限时
|
// 限时
|
||||||
var data = await Get.toNamed(Routers.otherTypeKeyChangeDatePage, arguments: {
|
var data = await Get.toNamed(Routers.otherTypeKeyChangeDatePage, arguments: <String, Object>{
|
||||||
"pushType": 0,
|
'pushType': 0,
|
||||||
"fingerprintItemData": state.fingerprintItemData.value,
|
'fingerprintItemData': state.fingerprintItemData.value,
|
||||||
});
|
});
|
||||||
if(data != null) {
|
if(data != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.startDate.value = data["beginTimeTimestamp"];
|
state.startDate.value = data['beginTimeTimestamp'];
|
||||||
state.endDate.value = data["endTimeTimestamp"];
|
state.endDate.value = data['endTimeTimestamp'];
|
||||||
state.keyType.value = 2;
|
state.keyType.value = 2;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}else if(state.keyType.value == 4){
|
}else if(state.keyType.value == 4){
|
||||||
// 循环
|
// 循环
|
||||||
var data = await Get.toNamed(Routers.otherTypeKeyChangeValidityDatePage, arguments: {
|
var data = await Get.toNamed(Routers.otherTypeKeyChangeValidityDatePage, arguments: <String, Object>{
|
||||||
"pushType": 0,
|
'pushType': 0,
|
||||||
"fingerprintItemData": state.fingerprintItemData.value,
|
'fingerprintItemData': state.fingerprintItemData.value,
|
||||||
});
|
});
|
||||||
if(data != null) {
|
if(data != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.startDate.value = data["starDate"];
|
state.startDate.value = data['starDate'];
|
||||||
state.endDate.value = data["endDate"];
|
state.endDate.value = data['endDate'];
|
||||||
state.starTime.value = data["starTime"];
|
state.starTime.value = data['starTime'];
|
||||||
state.endTime.value = data["endTime"];
|
state.endTime.value = data['endTime'];
|
||||||
state.weekDay.value = data["weekDay"];
|
state.weekDay.value = data['weekDay'];
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -116,38 +116,38 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
|||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
action: () async {
|
action: () async {
|
||||||
var data = await Get.toNamed(Routers.otherTypeKeyChangeValidityDatePage, arguments: {
|
var data = await Get.toNamed(Routers.otherTypeKeyChangeValidityDatePage, arguments: <String, Object>{
|
||||||
"pushType": 0,
|
'pushType': 0,
|
||||||
"fingerprintItemData": state.fingerprintItemData.value,
|
'fingerprintItemData': state.fingerprintItemData.value,
|
||||||
});
|
});
|
||||||
if(data != null) {
|
if(data != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.startDate.value = data["starDate"];
|
state.startDate.value = data['starDate'];
|
||||||
state.endDate.value = data["endDate"];
|
state.endDate.value = data['endDate'];
|
||||||
state.starTime.value = data["starTime"];
|
state.starTime.value = data['starTime'];
|
||||||
state.endTime.value = data["endTime"];
|
state.endTime.value = data['endTime'];
|
||||||
state.weekDay.value = data["weekDay"];
|
state.weekDay.value = data['weekDay'];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})))),
|
})))),
|
||||||
Obx(() => Visibility(
|
Obx(() => Visibility(
|
||||||
visible: state.keyType.value == 4 ? true : false,
|
visible: state.keyType.value == 4 ? true : false,
|
||||||
child: Obx(() => CommonItem(
|
child: Obx(() => CommonItem(
|
||||||
leftTitel: "有效时间".tr,
|
leftTitel: '有效时间'.tr,
|
||||||
rightTitle: "${DateTool().dateToHNString(state.starTime.value)}-${DateTool().dateToHNString(state.endTime.value)}",
|
rightTitle: '${DateTool().dateToHNString(state.starTime.value)}-${DateTool().dateToHNString(state.endTime.value)}',
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () async {
|
action: () async {
|
||||||
var data = await Get.toNamed(Routers.otherTypeKeyChangeValidityDatePage, arguments: {
|
var data = await Get.toNamed(Routers.otherTypeKeyChangeValidityDatePage, arguments: <String, Object>{
|
||||||
"pushType": 0,
|
'pushType': 0,
|
||||||
"fingerprintItemData": state.fingerprintItemData.value,
|
'fingerprintItemData': state.fingerprintItemData.value,
|
||||||
});
|
});
|
||||||
if(data != null) {
|
if(data != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.startDate.value = data["starDate"];
|
state.startDate.value = data['starDate'];
|
||||||
state.endDate.value = data["endDate"];
|
state.endDate.value = data['endDate'];
|
||||||
state.starTime.value = data["starTime"];
|
state.starTime.value = data['starTime'];
|
||||||
state.endTime.value = data["endTime"];
|
state.endTime.value = data['endTime'];
|
||||||
state.weekDay.value = data["validityValue"];
|
state.weekDay.value = data['validityValue'];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})))),
|
})))),
|
||||||
@ -165,15 +165,15 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
|||||||
SizedBox(height: 10.h),
|
SizedBox(height: 10.h),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.stressCard!.tr,
|
leftTitel: TranslationLoader.lanKeys!.stressCard!.tr,
|
||||||
rightTitle: "",
|
rightTitle: '',
|
||||||
isTipsImg: false,
|
isTipsImg: false,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
rightWidget: SizedBox(
|
rightWidget: SizedBox(
|
||||||
width: 60.w, height: 50.h, child: _isStressFingerprint()))),
|
width: 60.w, height: 50.h, child: _isStressFingerprint()))),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: "是否为管理员".tr,
|
leftTitel: '是否为管理员'.tr,
|
||||||
rightTitle: "",
|
rightTitle: '',
|
||||||
isTipsImg: false,
|
isTipsImg: false,
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
rightWidget:
|
rightWidget:
|
||||||
@ -181,10 +181,10 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
|||||||
Container(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.lockOperatingRecordPage, arguments: {
|
Get.toNamed(Routers.lockOperatingRecordPage, arguments: <String, Object?>{
|
||||||
'type': 2,
|
'type': 2,
|
||||||
'id': state.fingerprintItemData.value.cardId.toString(),
|
'id': state.fingerprintItemData.value.cardId.toString(),
|
||||||
'recordName': state.fingerprintItemData.value.cardName
|
'recordName': state.fingerprintItemData.value.cardName
|
||||||
@ -200,7 +200,7 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
|||||||
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w, bottom: 30.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),
|
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||||
onClick: () {
|
onClick: () {
|
||||||
ShowTipView().showIosTipWithContentDialog("确定要删除吗?".tr, () async {
|
ShowTipView().showIosTipWithContentDialog('确定要删除吗?'.tr, () async {
|
||||||
state.isDeletCard.value = true;
|
state.isDeletCard.value = true;
|
||||||
logic.senderAddICCard();
|
logic.senderAddICCard();
|
||||||
});
|
});
|
||||||
@ -217,7 +217,7 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
|||||||
trackColor: CupertinoColors.systemGrey5,
|
trackColor: CupertinoColors.systemGrey5,
|
||||||
thumbColor: CupertinoColors.white,
|
thumbColor: CupertinoColors.white,
|
||||||
value: state.isStressCard.value,
|
value: state.isStressCard.value,
|
||||||
onChanged: (value) {
|
onChanged: (bool value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.isStressCard.value = value;
|
state.isStressCard.value = value;
|
||||||
state.isDeletCard.value = false;
|
state.isDeletCard.value = false;
|
||||||
@ -234,7 +234,7 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
|||||||
trackColor: CupertinoColors.systemGrey5,
|
trackColor: CupertinoColors.systemGrey5,
|
||||||
thumbColor: CupertinoColors.white,
|
thumbColor: CupertinoColors.white,
|
||||||
value: state.isAdministrator.value,
|
value: state.isAdministrator.value,
|
||||||
onChanged: (value) {
|
onChanged: (bool value) {
|
||||||
// state.isAdministrator.value = value;
|
// state.isAdministrator.value = value;
|
||||||
// state.isDeletCard.value = false;
|
// state.isDeletCard.value = false;
|
||||||
// logic.senderAddICCard();
|
// logic.senderAddICCard();
|
||||||
@ -244,16 +244,13 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
// TODO: implement didChangeDependencies
|
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
|
|
||||||
/// 路由订阅
|
/// 路由订阅
|
||||||
AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!);
|
AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
// TODO: implement dispose
|
|
||||||
/// 取消路由订阅
|
/// 取消路由订阅
|
||||||
AppRouteObserver().routeObserver.unsubscribe(this);
|
AppRouteObserver().routeObserver.unsubscribe(this);
|
||||||
super.dispose();
|
super.dispose();
|
||||||
@ -271,7 +268,9 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
|||||||
void didPop() {
|
void didPop() {
|
||||||
super.didPop();
|
super.didPop();
|
||||||
logic.cancelBlueConnetctToastTimer();
|
logic.cancelBlueConnetctToastTimer();
|
||||||
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
|
if (EasyLoading.isShow) {
|
||||||
|
EasyLoading.dismiss(animation: true);
|
||||||
|
}
|
||||||
state.ifCurrentScreen.value = false;
|
state.ifCurrentScreen.value = false;
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
}
|
}
|
||||||
@ -288,7 +287,9 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
|||||||
void didPushNext() {
|
void didPushNext() {
|
||||||
super.didPushNext();
|
super.didPushNext();
|
||||||
logic.cancelBlueConnetctToastTimer();
|
logic.cancelBlueConnetctToastTimer();
|
||||||
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
|
if (EasyLoading.isShow) {
|
||||||
|
EasyLoading.dismiss(animation: true);
|
||||||
|
}
|
||||||
state.ifCurrentScreen.value = false;
|
state.ifCurrentScreen.value = false;
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,32 +4,10 @@ import 'package:get/get.dart';
|
|||||||
import '../../fingerprint/fingerprintList/fingerprintListData_entity.dart';
|
import '../../fingerprint/fingerprintList/fingerprintListData_entity.dart';
|
||||||
|
|
||||||
class CardDetailState {
|
class CardDetailState {
|
||||||
final fingerprintItemData = FingerprintItemData().obs;
|
|
||||||
|
|
||||||
final TextEditingController changeNameController = TextEditingController();
|
|
||||||
|
|
||||||
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
|
||||||
var sureBtnState = 0.obs; // 0普通状态(可用) 1连接中(不可用)
|
|
||||||
var isDeletCard = true.obs; // 是否删除卡
|
|
||||||
var isStressCard = false.obs; // 是否胁迫
|
|
||||||
var isAdministrator = false.obs; // 是否为管理员
|
|
||||||
|
|
||||||
final typeNumber = "".obs; // 指纹号
|
|
||||||
final typeName = "".obs; // 指纹名字
|
|
||||||
var startDate = "".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
|
|
||||||
|
|
||||||
CardDetailState() {
|
CardDetailState() {
|
||||||
Map map = Get.arguments;
|
Map map = Get.arguments;
|
||||||
if ((map["fingerprintItemData"] != null)) {
|
if (map['fingerprintItemData'] != null) {
|
||||||
fingerprintItemData.value = map["fingerprintItemData"];
|
fingerprintItemData.value = map['fingerprintItemData'];
|
||||||
keyId.value = fingerprintItemData.value.cardId!;
|
keyId.value = fingerprintItemData.value.cardId!;
|
||||||
typeNumber.value = fingerprintItemData.value.cardNumber!;
|
typeNumber.value = fingerprintItemData.value.cardNumber!;
|
||||||
typeName.value = fingerprintItemData.value.cardName!;
|
typeName.value = fingerprintItemData.value.cardName!;
|
||||||
@ -41,11 +19,30 @@ class CardDetailState {
|
|||||||
keyType.value = fingerprintItemData.value.cardType!;
|
keyType.value = fingerprintItemData.value.cardType!;
|
||||||
adder.value = fingerprintItemData.value.senderUsername!;
|
adder.value = fingerprintItemData.value.senderUsername!;
|
||||||
addTime.value = fingerprintItemData.value.createDate!;
|
addTime.value = fingerprintItemData.value.createDate!;
|
||||||
isStressCard.value =
|
isStressCard.value = fingerprintItemData.value.isCoerced! == 1;
|
||||||
fingerprintItemData.value.isCoerced! == 2 ? true : false;
|
|
||||||
weekDay.value = fingerprintItemData.value.weekDay!;
|
weekDay.value = fingerprintItemData.value.weekDay!;
|
||||||
isAdministrator.value =
|
isAdministrator.value = fingerprintItemData.value.cardRight! == 1;
|
||||||
fingerprintItemData.value.cardRight! == 1 ? true : false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
final Rx<FingerprintItemData> fingerprintItemData = FingerprintItemData().obs;
|
||||||
|
|
||||||
|
final TextEditingController changeNameController = TextEditingController();
|
||||||
|
|
||||||
|
RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||||
|
RxInt sureBtnState = 0.obs; // 0普通状态(可用) 1连接中(不可用)
|
||||||
|
RxBool isDeletCard = true.obs; // 是否删除卡
|
||||||
|
RxBool isStressCard = false.obs; // 是否胁迫
|
||||||
|
RxBool isAdministrator = false.obs; // 是否为管理员
|
||||||
|
|
||||||
|
final RxString typeNumber = ''.obs; // 指纹号
|
||||||
|
final RxString typeName = ''.obs; // 指纹名字
|
||||||
|
RxString startDate = ''.obs; // 开始时间
|
||||||
|
RxString endDate = ''.obs; // 结束时间
|
||||||
|
RxString starTime = ''.obs; // 生效时间
|
||||||
|
RxString endTime = ''.obs; // 失效时间
|
||||||
|
final RxInt keyType = 0.obs; // 永久:1;限时2,单次3,循环:4
|
||||||
|
RxList weekDay = [].obs; // 有效日
|
||||||
|
RxString adder = ''.obs; // 添加者
|
||||||
|
RxInt addTime = 0.obs; // 添加时间
|
||||||
|
RxInt keyId = 0.obs; // 卡id
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import 'dart:async';
|
|||||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/blue/io_type.dart';
|
import 'package:star_lock/blue/io_type.dart';
|
||||||
|
import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
import 'package:star_lock/tools/dateTool.dart';
|
import 'package:star_lock/tools/dateTool.dart';
|
||||||
import '../../../../blue/blue_manage.dart';
|
import '../../../../blue/blue_manage.dart';
|
||||||
@ -26,26 +27,18 @@ class CardListLogic extends BaseGetXController {
|
|||||||
// 获取解析后的数据
|
// 获取解析后的数据
|
||||||
late StreamSubscription<Reply> _replySubscription;
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
void _initReplySubscription() {
|
void _initReplySubscription() {
|
||||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) {
|
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
|
||||||
|
|
||||||
// 添加卡片开始(重置锁里面所有卡)
|
// 添加卡片开始(重置锁里面所有卡)
|
||||||
if((reply is SenderAddICCardWithTimeCycleCoercionReply) && (state.ifCurrentScreen.value == true)) {
|
if((reply is SenderAddICCardWithTimeCycleCoercionReply) && (state.ifCurrentScreen.value == true)) {
|
||||||
_replyAddICCardBegin(reply);
|
_replyAddICCardBegin(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if(reply is SenderCheckingCardStatusReply) {
|
|
||||||
// _replyReferEventRecordNumber(reply);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if(reply is SenderCheckingUserInfoCountReply){
|
|
||||||
// _replyCheckingUserInfoCount(reply);
|
|
||||||
// }
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加卡片开始(此处用作删除卡片)
|
// 添加卡片开始(此处用作删除卡片)
|
||||||
Future<void> _replyAddICCardBegin(Reply reply) async {
|
Future<void> _replyAddICCardBegin(Reply reply) async {
|
||||||
int status = reply.data[2];
|
final int status = reply.data[2];
|
||||||
|
|
||||||
switch(status){
|
switch(status){
|
||||||
case 0x00:
|
case 0x00:
|
||||||
@ -55,17 +48,14 @@ class CardListLogic extends BaseGetXController {
|
|||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
//无权限
|
//无权限
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
final List<int> token = reply.data.sublist(5, 9);
|
||||||
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
final List<String> saveStrList = changeIntListToStringList(token);
|
||||||
|
|
||||||
var token = reply.data.sublist(5, 9);
|
|
||||||
var saveStrList = changeIntListToStringList(token);
|
|
||||||
Storage.setStringList(saveBlueToken, saveStrList);
|
Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
|
|
||||||
IoSenderManage.senderAddCardWithTimeCycleCoercionCommand(
|
IoSenderManage.senderAddCardWithTimeCycleCoercionCommand(
|
||||||
@ -80,8 +70,8 @@ class CardListLogic extends BaseGetXController {
|
|||||||
weekRound:0, // 周循环
|
weekRound:0, // 周循环
|
||||||
startDate: 0x11223344,
|
startDate: 0x11223344,
|
||||||
endDate: 0x11223344,
|
endDate: 0x11223344,
|
||||||
startTime:"0",
|
startTime:'0',
|
||||||
endTime:"0",
|
endTime:'0',
|
||||||
needAuthor:1,
|
needAuthor:1,
|
||||||
signKey:signKeyDataList,
|
signKey:signKeyDataList,
|
||||||
privateKey:getPrivateKeyList,
|
privateKey:getPrivateKeyList,
|
||||||
@ -95,135 +85,6 @@ class CardListLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// // 获取卡片状态
|
|
||||||
// Future<void> _replyReferEventRecordNumber(Reply reply) async {
|
|
||||||
// int status = reply.data[2];
|
|
||||||
// switch(status){
|
|
||||||
// case 0x00:
|
|
||||||
// //成功
|
|
||||||
// // _getLockStatus();
|
|
||||||
// break;
|
|
||||||
// case 0x06:
|
|
||||||
// //无权限
|
|
||||||
// break;
|
|
||||||
// default:
|
|
||||||
// //失败
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // 查询用户、指纹、密码、卡片数量(用于判断是否同步)
|
|
||||||
// Future<void> _replyCheckingUserInfoCount(Reply reply) async {
|
|
||||||
// int status = reply.data[2];
|
|
||||||
//
|
|
||||||
// // 用户数量
|
|
||||||
// int userNum = reply.data[5];
|
|
||||||
//
|
|
||||||
// // 指纹数量
|
|
||||||
// int fingerNum = reply.data[6];
|
|
||||||
//
|
|
||||||
// // 密码数量
|
|
||||||
// int pwdNum = reply.data[7];
|
|
||||||
//
|
|
||||||
// // 卡片数量
|
|
||||||
// int cardNum = reply.data[8];
|
|
||||||
//
|
|
||||||
// // 记录数量
|
|
||||||
// int logsNum = reply.data[9];
|
|
||||||
//
|
|
||||||
// // 版本
|
|
||||||
// int verNo = reply.data[10];
|
|
||||||
//
|
|
||||||
// // 最大管理员指纹数量
|
|
||||||
// int maxAdminFingerNum = reply.data[11];
|
|
||||||
//
|
|
||||||
// // 最大用户指纹数量
|
|
||||||
// int maxUserFingerNum = reply.data[12];
|
|
||||||
//
|
|
||||||
// // 最大管理员密码数量
|
|
||||||
// int maxAdminPassNum = reply.data[13];
|
|
||||||
//
|
|
||||||
// // 最大用户密码数量
|
|
||||||
// int maxUserPassNum = reply.data[14];
|
|
||||||
//
|
|
||||||
// // 最大管理员卡片数量
|
|
||||||
// int maxAdminCardNum = reply.data[15];
|
|
||||||
//
|
|
||||||
// // 最大用户卡片数量
|
|
||||||
// int maxUserCardNum = reply.data[16];
|
|
||||||
//
|
|
||||||
// // 序列号
|
|
||||||
// var serialNo = reply.data.sublist(17, 21);
|
|
||||||
//
|
|
||||||
// switch(status){
|
|
||||||
// case 0x00:
|
|
||||||
// //成功
|
|
||||||
// // _getLockStatus();
|
|
||||||
// break;
|
|
||||||
// case 0x06:
|
|
||||||
// //需要鉴权
|
|
||||||
// break;
|
|
||||||
// default:
|
|
||||||
// //失败
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // 查询卡片状态
|
|
||||||
// Future<void> senderCheckingCardStatus() async {
|
|
||||||
// BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState state) async {
|
|
||||||
// if (state == BluetoothConnectionState.connected) {
|
|
||||||
// var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
|
||||||
// List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
|
||||||
//
|
|
||||||
// var token = await Storage.getStringList(saveBlueToken);
|
|
||||||
// List<int> getTokenList = changeStringListToIntList(token!);
|
|
||||||
//
|
|
||||||
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
|
||||||
// List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
|
|
||||||
//
|
|
||||||
// IoSenderManage.senderCheckingCardStatusCommand(
|
|
||||||
// keyID:BlueManage().connectDeviceName,
|
|
||||||
// userID:await Storage.getUid(),
|
|
||||||
// role:0xff,
|
|
||||||
// cardCount:20,
|
|
||||||
// cardNo:1,
|
|
||||||
// token:getTokenList,
|
|
||||||
// needAuthor:1,
|
|
||||||
// publicKey:getPublicKeyList,
|
|
||||||
// privateKey:getPrivateKeyList,
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // 查询用户、指纹、密码、卡片数量(用于判断是否同步)
|
|
||||||
// Future<void> senderCheckingUserInfoCount() async {
|
|
||||||
// BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState state) async {
|
|
||||||
// if (state == BluetoothConnectionState.connected) {
|
|
||||||
// var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
|
||||||
// List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
|
||||||
//
|
|
||||||
// var token = await Storage.getStringList(saveBlueToken);
|
|
||||||
// List<int> getTokenList = changeStringListToIntList(token!);
|
|
||||||
//
|
|
||||||
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
|
||||||
// List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
|
|
||||||
//
|
|
||||||
// IoSenderManage.senderCheckingUserInfoCountCommand(
|
|
||||||
// keyID:BlueManage().connectDeviceName,
|
|
||||||
// userID:await Storage.getUid(),
|
|
||||||
// role:0xff,
|
|
||||||
// nowTime:DateTime.now().millisecondsSinceEpoch~/1000,
|
|
||||||
// token:getTokenList,
|
|
||||||
// needAuthor:1,
|
|
||||||
// publicKey:getPublicKeyList,
|
|
||||||
// privateKey:getPrivateKeyList,
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 删除卡片
|
// 删除卡片
|
||||||
Future<void> senderAddICCard() async {
|
Future<void> senderAddICCard() async {
|
||||||
showEasyLoading();
|
showEasyLoading();
|
||||||
@ -232,17 +93,14 @@ class CardListLogic extends BaseGetXController {
|
|||||||
});
|
});
|
||||||
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected){
|
if (deviceConnectionState == BluetoothConnectionState.connected){
|
||||||
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
var token = await Storage.getStringList(saveBlueToken);
|
|
||||||
List<int> getTokenList = changeStringListToIntList(token!);
|
|
||||||
|
|
||||||
IoSenderManage.senderAddCardWithTimeCycleCoercionCommand(
|
IoSenderManage.senderAddCardWithTimeCycleCoercionCommand(
|
||||||
keyID:state.deletKeyID,
|
keyID:state.deletKeyID,
|
||||||
@ -256,8 +114,8 @@ class CardListLogic extends BaseGetXController {
|
|||||||
weekRound:0, // 周循环
|
weekRound:0, // 周循环
|
||||||
startDate: 0x11223344,
|
startDate: 0x11223344,
|
||||||
endDate: 0x11223344,
|
endDate: 0x11223344,
|
||||||
startTime:"0",
|
startTime:'0',
|
||||||
endTime:"0",
|
endTime:'0',
|
||||||
needAuthor:1,
|
needAuthor:1,
|
||||||
signKey:signKeyDataList,
|
signKey:signKeyDataList,
|
||||||
privateKey:getPrivateKeyList,
|
privateKey:getPrivateKeyList,
|
||||||
@ -276,7 +134,7 @@ class CardListLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 获取IC卡列表
|
// 获取IC卡列表
|
||||||
Future<FingerprintListDataEntity> getICCardListData() async{
|
Future<FingerprintListDataEntity> getICCardListData() async{
|
||||||
FingerprintListDataEntity entity = await ApiRepository.to.getICCardListData(
|
final FingerprintListDataEntity entity = await ApiRepository.to.getICCardListData(
|
||||||
lockId: state.lockId.value.toString(),
|
lockId: state.lockId.value.toString(),
|
||||||
pageNo: pageNo.toString(),
|
pageNo: pageNo.toString(),
|
||||||
pageSize: pageSize,
|
pageSize: pageSize,
|
||||||
@ -297,27 +155,27 @@ class CardListLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 删除所有IC卡
|
// 删除所有IC卡
|
||||||
void deletICCardData() async{
|
Future<void> deletICCardData() async{
|
||||||
var cardId = "";
|
String cardId = '';
|
||||||
var type = "1";
|
String type = '1';
|
||||||
if(state.isDeletAll == false){
|
if(state.isDeletAll == false){
|
||||||
cardId = state.deletKeyID;
|
cardId = state.deletKeyID;
|
||||||
type = "0";
|
type = '0';
|
||||||
}
|
}
|
||||||
var entity = await ApiRepository.to.deletIcCardData(
|
final LoginEntity entity = await ApiRepository.to.deletIcCardData(
|
||||||
cardId: cardId,
|
cardId: cardId,
|
||||||
lockId: state.lockId.value.toString(),
|
lockId: state.lockId.value.toString(),
|
||||||
type: type,
|
type: type,
|
||||||
deleteType:"1"
|
deleteType:'1'
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
if(state.isDeletAll == false){
|
if(state.isDeletAll == false){
|
||||||
showToast("删除成功".tr, something: (){
|
showToast('删除成功'.tr, something: (){
|
||||||
pageNo = 1;
|
pageNo = 1;
|
||||||
getICCardListData();
|
getICCardListData();
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
showToast("重置成功".tr, something: (){
|
showToast('重置成功'.tr, something: (){
|
||||||
pageNo = 1;
|
pageNo = 1;
|
||||||
getICCardListData();
|
getICCardListData();
|
||||||
});
|
});
|
||||||
@ -328,44 +186,43 @@ class CardListLogic extends BaseGetXController {
|
|||||||
// 监听修改完详情之后刷新列表
|
// 监听修改完详情之后刷新列表
|
||||||
late StreamSubscription _teamEvent;
|
late StreamSubscription _teamEvent;
|
||||||
void _initRefreshAction() {
|
void _initRefreshAction() {
|
||||||
_teamEvent = eventBus.on<OtherTypeRefreshListEvent>().listen((event) {
|
_teamEvent = eventBus.on<OtherTypeRefreshListEvent>().listen((OtherTypeRefreshListEvent event) {
|
||||||
pageNo = 1;
|
pageNo = 1;
|
||||||
getICCardListData();
|
getICCardListData();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
String getKeyType(FingerprintItemData fingerprintItemData){
|
String getKeyType(FingerprintItemData fingerprintItemData){
|
||||||
var keyTypeStr = "";//
|
String keyTypeStr = '';//
|
||||||
if(fingerprintItemData.cardStatus == 1){
|
if(fingerprintItemData.cardStatus == 1){
|
||||||
if(fingerprintItemData.startDate! > DateTime.now().millisecondsSinceEpoch){
|
if(fingerprintItemData.startDate! > DateTime.now().millisecondsSinceEpoch){
|
||||||
keyTypeStr = "未生效".tr;
|
keyTypeStr = '未生效'.tr;
|
||||||
}
|
}
|
||||||
|
|
||||||
}else if(fingerprintItemData.cardStatus == 2){
|
}else if(fingerprintItemData.cardStatus == 2){
|
||||||
keyTypeStr = "已失效".tr;
|
keyTypeStr = '已失效'.tr;
|
||||||
}
|
}
|
||||||
return keyTypeStr;
|
return keyTypeStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
String getKeyDateType(FingerprintItemData fingerprintItemData){
|
String getKeyDateType(FingerprintItemData fingerprintItemData){
|
||||||
var keyDateTypeStr = "";// 永久:1;限时2,单次3,循环:4
|
String keyDateTypeStr = '';// 永久:1;限时2,单次3,循环:4
|
||||||
if(fingerprintItemData.cardType! == 1){
|
if(fingerprintItemData.cardType! == 1){
|
||||||
keyDateTypeStr = "${DateTool().dateToYMDHNString(fingerprintItemData.createDate.toString())} 永久";
|
keyDateTypeStr = '${DateTool().dateToYMDHNString(fingerprintItemData.createDate.toString())} 永久';
|
||||||
}else if(fingerprintItemData.cardType! == 2){
|
}else if(fingerprintItemData.cardType! == 2){
|
||||||
keyDateTypeStr = "${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())} 限时";
|
keyDateTypeStr = '${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())} 限时';
|
||||||
}else if(fingerprintItemData.cardType! == 4){
|
}else if(fingerprintItemData.cardType! == 4){
|
||||||
keyDateTypeStr = "${DateTool().dateToYMDString(fingerprintItemData.startDate.toString())}-${DateTool().dateToYMDString(fingerprintItemData.endDate.toString())} 循环";
|
keyDateTypeStr = '${DateTool().dateToYMDString(fingerprintItemData.startDate.toString())}-${DateTool().dateToYMDString(fingerprintItemData.endDate.toString())} 循环';
|
||||||
}
|
}
|
||||||
return keyDateTypeStr;
|
return keyDateTypeStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> onReady() async {
|
Future<void> onReady() async {
|
||||||
// TODO: implement onReady
|
|
||||||
super.onReady();
|
super.onReady();
|
||||||
|
|
||||||
// 获取是否是演示模式 演示模式不获取接口
|
// 获取是否是演示模式 演示模式不获取接口
|
||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
if(isDemoMode == false){
|
if(isDemoMode == false){
|
||||||
_initReplySubscription();
|
_initReplySubscription();
|
||||||
|
|
||||||
@ -375,16 +232,14 @@ class CardListLogic extends BaseGetXController {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> onInit() async {
|
Future<void> onInit() async {
|
||||||
// TODO: implement onInit
|
|
||||||
super.onInit();
|
super.onInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> onClose() async {
|
Future<void> onClose() async {
|
||||||
// TODO: implement onClose
|
|
||||||
super.onClose();
|
super.onClose();
|
||||||
|
|
||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
if(isDemoMode == false) {
|
if(isDemoMode == false) {
|
||||||
_replySubscription.cancel();
|
_replySubscription.cancel();
|
||||||
_teamEvent.cancel();
|
_teamEvent.cancel();
|
||||||
|
|||||||
@ -4,10 +4,10 @@ import 'package:flutter_easyloading/flutter_easyloading.dart';
|
|||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/card/cardList/cardList_state.dart';
|
||||||
|
|
||||||
import '../../../../appRouters.dart';
|
import '../../../../appRouters.dart';
|
||||||
import '../../../../app_settings/app_colors.dart';
|
import '../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../blue/blue_manage.dart';
|
|
||||||
import '../../../../tools/EasyRefreshTool.dart';
|
import '../../../../tools/EasyRefreshTool.dart';
|
||||||
import '../../../../tools/appRouteObserver.dart';
|
import '../../../../tools/appRouteObserver.dart';
|
||||||
import '../../../../tools/keySearchWidget.dart';
|
import '../../../../tools/keySearchWidget.dart';
|
||||||
@ -28,14 +28,16 @@ class CardListPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _CardListPageState extends State<CardListPage> with RouteAware {
|
class _CardListPageState extends State<CardListPage> with RouteAware {
|
||||||
final logic = Get.put(CardListLogic());
|
final CardListLogic logic = Get.put(CardListLogic());
|
||||||
final state = Get.find<CardListLogic>().state;
|
final CardListState state = Get.find<CardListLogic>().state;
|
||||||
|
|
||||||
Future<void> getHttpData() async {
|
Future<void> getHttpData() async {
|
||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
if (isDemoMode == false) {
|
if (isDemoMode == false) {
|
||||||
logic.getICCardListData().then((FingerprintListDataEntity value){
|
logic.getICCardListData().then((FingerprintListDataEntity value){
|
||||||
if(mounted) setState(() {});
|
if(mounted) {
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -56,24 +58,24 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
|||||||
barTitle: TranslationLoader.lanKeys!.card!.tr,
|
barTitle: TranslationLoader.lanKeys!.card!.tr,
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor,
|
backgroundColor: AppColors.mainColor,
|
||||||
actionsList: [
|
actionsList: <Widget>[
|
||||||
TextButton(
|
TextButton(
|
||||||
child: Text(
|
child: Text(
|
||||||
TranslationLoader.lanKeys!.reset!.tr,
|
TranslationLoader.lanKeys!.reset!.tr,
|
||||||
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
if (isDemoMode == false) {
|
if (isDemoMode == false) {
|
||||||
ShowTipView().showIosTipWithContentDialog("重置后,该锁的卡都将被删除哦,确认要重置吗?".tr, () async {
|
ShowTipView().showIosTipWithContentDialog('重置后,该锁的卡都将被删除哦,确认要重置吗?'.tr, () async {
|
||||||
state.isDeletAll = true;
|
state.isDeletAll = true;
|
||||||
state.deletKeyID = "0";
|
state.deletKeyID = '0';
|
||||||
state.deletCardNo = 0;
|
state.deletCardNo = 0;
|
||||||
logic.senderAddICCard();
|
logic.senderAddICCard();
|
||||||
});
|
});
|
||||||
// showDeletAlertDialog(context);
|
// showDeletAlertDialog(context);
|
||||||
} else {
|
} else {
|
||||||
logic.showToast("演示模式".tr);
|
logic.showToast('演示模式'.tr);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -88,7 +90,7 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
|||||||
getHttpData();
|
getHttpData();
|
||||||
},
|
},
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
KeySearchWidget(
|
KeySearchWidget(
|
||||||
editingController: state.searchController,
|
editingController: state.searchController,
|
||||||
onSubmittedAction: () {
|
onSubmittedAction: () {
|
||||||
@ -101,9 +103,9 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
|||||||
AddBottomWhiteBtn(
|
AddBottomWhiteBtn(
|
||||||
btnName: '${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.card!.tr}',
|
btnName: '${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.card!.tr}',
|
||||||
onClick: () async {
|
onClick: () async {
|
||||||
var data = await Get.toNamed(Routers.addCardPage, arguments: {
|
final data = await Get.toNamed(Routers.addCardPage, arguments: <String, int>{
|
||||||
"lockId": state.lockId.value,
|
'lockId': state.lockId.value,
|
||||||
"fromType": 1 // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
'fromType': 1 // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||||
});
|
});
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
logic.pageNo = 1;
|
logic.pageNo = 1;
|
||||||
@ -125,17 +127,17 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
|||||||
? SlidableAutoCloseBehavior(
|
? SlidableAutoCloseBehavior(
|
||||||
child: ListView.separated(
|
child: ListView.separated(
|
||||||
itemCount: state.fingerprintItemListData.value.length,
|
itemCount: state.fingerprintItemListData.value.length,
|
||||||
itemBuilder: (c, index) {
|
itemBuilder: (BuildContext c, int index) {
|
||||||
FingerprintItemData fingerprintItemData = state.fingerprintItemListData.value[index];
|
final FingerprintItemData fingerprintItemData = state.fingerprintItemListData.value[index];
|
||||||
return Slidable(
|
return Slidable(
|
||||||
key:ValueKey(fingerprintItemData.fingerprintId),
|
key:ValueKey(fingerprintItemData.fingerprintId),
|
||||||
endActionPane: ActionPane(
|
endActionPane: ActionPane(
|
||||||
extentRatio: 0.2,
|
extentRatio: 0.2,
|
||||||
motion: const ScrollMotion(),
|
motion: const ScrollMotion(),
|
||||||
children: [
|
children: <Widget>[
|
||||||
SlidableAction(
|
SlidableAction(
|
||||||
onPressed: (BuildContext context){
|
onPressed: (BuildContext context){
|
||||||
ShowTipView().showIosTipWithContentDialog("确定要删除吗?".tr, () async {
|
ShowTipView().showIosTipWithContentDialog('确定要删除吗?'.tr, () async {
|
||||||
state.isDeletAll = false;
|
state.isDeletAll = false;
|
||||||
state.deletKeyID = fingerprintItemData.cardId.toString();
|
state.deletKeyID = fingerprintItemData.cardId.toString();
|
||||||
state.deletCardNo = int.parse(fingerprintItemData.cardNumber!);
|
state.deletCardNo = int.parse(fingerprintItemData.cardNumber!);
|
||||||
@ -154,9 +156,9 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
|||||||
fingerprintItemData.cardName!,
|
fingerprintItemData.cardName!,
|
||||||
logic.getKeyType(fingerprintItemData),
|
logic.getKeyType(fingerprintItemData),
|
||||||
logic.getKeyDateType(fingerprintItemData), () async {
|
logic.getKeyDateType(fingerprintItemData), () async {
|
||||||
var data = await Get.toNamed(
|
final data = await Get.toNamed(
|
||||||
Routers.cardDetailPage, arguments: {
|
Routers.cardDetailPage, arguments: <String, FingerprintItemData>{
|
||||||
"fingerprintItemData": fingerprintItemData,
|
'fingerprintItemData': fingerprintItemData,
|
||||||
});
|
});
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
logic.pageNo = 1;
|
logic.pageNo = 1;
|
||||||
@ -183,21 +185,21 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
|||||||
// margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
|
// margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: <Widget>[
|
||||||
SizedBox(width: 30.w),
|
SizedBox(width: 30.w),
|
||||||
Image.asset(lockTypeIcon, width: 60.w, height: 60.w),
|
Image.asset(lockTypeIcon, width: 60.w, height: 60.w),
|
||||||
SizedBox(width: 20.w),
|
SizedBox(width: 20.w),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Row(
|
Row(
|
||||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: <Widget>[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 1.sw - 110.w - 100.w,
|
width: 1.sw - 110.w - 100.w,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Flexible(
|
Flexible(
|
||||||
child: Text(
|
child: Text(
|
||||||
lockTypeTitle,
|
lockTypeTitle,
|
||||||
@ -218,7 +220,7 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
|||||||
SizedBox(height: 5.h),
|
SizedBox(height: 5.h),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Flexible(
|
Flexible(
|
||||||
child: Text(showTime,
|
child: Text(showTime,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
@ -240,65 +242,8 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// void showIosTipViewDialog(FingerprintItemData fingerprintItemData) {
|
|
||||||
// showDialog(
|
|
||||||
// context: Get.context!,
|
|
||||||
// builder: (BuildContext context) {
|
|
||||||
// return ShowIosTipView(
|
|
||||||
// title: "提示",
|
|
||||||
// tipTitle: "确定要删除吗?",
|
|
||||||
// sureClick: () async {
|
|
||||||
// Get.back();
|
|
||||||
// state.isDeletCardData = true;
|
|
||||||
// state.isDeletAll = false;
|
|
||||||
// state.deletUserID = (await Storage.getUid())!;
|
|
||||||
// state.deletKeyID = fingerprintItemData.cardId.toString();
|
|
||||||
// state.deletCardNo = int.parse(fingerprintItemData.cardNumber!);
|
|
||||||
// logic.senderAddICCard();
|
|
||||||
// },
|
|
||||||
// cancelClick: () {
|
|
||||||
// Get.back();
|
|
||||||
// },
|
|
||||||
// );
|
|
||||||
// },
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
// void showDeletAlertDialog(BuildContext context) {
|
|
||||||
// showCupertinoDialog(
|
|
||||||
// context: context,
|
|
||||||
// builder: (context) {
|
|
||||||
// return CupertinoAlertDialog(
|
|
||||||
// title: const Text("提示"),
|
|
||||||
// content: const Text('重置后,该锁的卡都将被删除哦,确认要重置吗?'),
|
|
||||||
// actions: [
|
|
||||||
// CupertinoDialogAction(
|
|
||||||
// child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
|
||||||
// onPressed: () {
|
|
||||||
// Navigator.pop(context);
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// CupertinoDialogAction(
|
|
||||||
// child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
|
||||||
// onPressed: () {
|
|
||||||
// Navigator.pop(context);
|
|
||||||
// state.isDeletCardData = true;
|
|
||||||
// state.isDeletAll = true;
|
|
||||||
// state.deletKeyID = "1";
|
|
||||||
// state.deletUserID = "DeleteAll!@#";
|
|
||||||
// state.deletCardNo = 255;
|
|
||||||
// logic.senderAddICCard();
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// );
|
|
||||||
// },
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
// TODO: implement didChangeDependencies
|
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
|
|
||||||
/// 路由订阅
|
/// 路由订阅
|
||||||
@ -307,7 +252,6 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
// TODO: implement dispose
|
|
||||||
/// 取消路由订阅
|
/// 取消路由订阅
|
||||||
AppRouteObserver().routeObserver.unsubscribe(this);
|
AppRouteObserver().routeObserver.unsubscribe(this);
|
||||||
super.dispose();
|
super.dispose();
|
||||||
@ -325,7 +269,9 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
|||||||
void didPop() {
|
void didPop() {
|
||||||
super.didPop();
|
super.didPop();
|
||||||
logic.cancelBlueConnetctToastTimer();
|
logic.cancelBlueConnetctToastTimer();
|
||||||
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
|
if (EasyLoading.isShow) {
|
||||||
|
EasyLoading.dismiss(animation: true);
|
||||||
|
}
|
||||||
state.ifCurrentScreen.value = false;
|
state.ifCurrentScreen.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -341,7 +287,9 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
|||||||
void didPushNext() {
|
void didPushNext() {
|
||||||
super.didPushNext();
|
super.didPushNext();
|
||||||
logic.cancelBlueConnetctToastTimer();
|
logic.cancelBlueConnetctToastTimer();
|
||||||
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
|
if (EasyLoading.isShow) {
|
||||||
|
EasyLoading.dismiss(animation: true);
|
||||||
|
}
|
||||||
state.ifCurrentScreen.value = false;
|
state.ifCurrentScreen.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,21 +4,20 @@ import 'package:get/get.dart';
|
|||||||
import '../../fingerprint/fingerprintList/fingerprintListData_entity.dart';
|
import '../../fingerprint/fingerprintList/fingerprintListData_entity.dart';
|
||||||
|
|
||||||
class CardListState {
|
class CardListState {
|
||||||
final lockId = 0.obs;
|
|
||||||
|
|
||||||
// 因为删除跟添加指纹用的同一个协议 所以这里用做判断
|
|
||||||
var isDeletAll = false;
|
|
||||||
var deletKeyID = "0";
|
|
||||||
var deletCardNo = 0;
|
|
||||||
|
|
||||||
final fingerprintItemListData = <FingerprintItemData>[].obs;
|
|
||||||
// var fingerprintDeletItem = FingerprintItemData();
|
|
||||||
final TextEditingController searchController = TextEditingController();
|
|
||||||
|
|
||||||
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
|
||||||
|
|
||||||
CardListState() {
|
CardListState() {
|
||||||
Map map = Get.arguments;
|
Map map = Get.arguments;
|
||||||
lockId.value = map["lockId"];
|
lockId.value = map['lockId'];
|
||||||
}
|
}
|
||||||
|
final RxInt lockId = 0.obs;
|
||||||
|
|
||||||
|
// 因为删除跟添加指纹用的同一个协议 所以这里用做判断
|
||||||
|
bool isDeletAll = false;
|
||||||
|
String deletKeyID = '0';
|
||||||
|
int deletCardNo = 0;
|
||||||
|
|
||||||
|
final RxList<FingerprintItemData> fingerprintItemListData = <FingerprintItemData>[].obs;
|
||||||
|
final TextEditingController searchController = TextEditingController();
|
||||||
|
|
||||||
|
RxBool ifCurrentScreen = true.obs;// 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||||
}
|
}
|
||||||
@ -14,6 +14,7 @@ import '../../../../blue/io_reply.dart';
|
|||||||
import '../../../../blue/io_tool/io_tool.dart';
|
import '../../../../blue/io_tool/io_tool.dart';
|
||||||
import '../../../../blue/io_tool/manager_event_bus.dart';
|
import '../../../../blue/io_tool/manager_event_bus.dart';
|
||||||
import '../../../../blue/sender_manage.dart';
|
import '../../../../blue/sender_manage.dart';
|
||||||
|
import '../../../../mine/minePersonInfo/minePersonInfoPage/minePersonInfo_entity.dart';
|
||||||
import '../../../../tools/eventBusEventManage.dart';
|
import '../../../../tools/eventBusEventManage.dart';
|
||||||
import '../../../../tools/storage.dart';
|
import '../../../../tools/storage.dart';
|
||||||
import '../passwordKey_perpetual/passwordKeyEntity.dart';
|
import '../passwordKey_perpetual/passwordKeyEntity.dart';
|
||||||
@ -24,16 +25,13 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
// 获取解析后的数据
|
// 获取解析后的数据
|
||||||
late StreamSubscription<Reply> _replySubscription;
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
void _initReplySubscription() {
|
void _initReplySubscription() {
|
||||||
_replySubscription =
|
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
|
||||||
EventBusManager().eventBus!.on<Reply>().listen((reply) {
|
|
||||||
// 添加卡片开始(重置锁里面所有卡)
|
// 添加卡片开始(重置锁里面所有卡)
|
||||||
if ((reply is SenderCustomPasswordsReply) &&
|
if ((reply is SenderCustomPasswordsReply) && (state.ifCurrentScreen.value == true)) {
|
||||||
(state.ifCurrentScreen.value == true)) {
|
|
||||||
_replyAddPassword(reply);
|
_replyAddPassword(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((reply is SenderResetPasswordsReply) &&
|
if ((reply is SenderResetPasswordsReply) && (state.ifCurrentScreen.value == true)) {
|
||||||
(state.ifCurrentScreen.value == true)) {
|
|
||||||
_replyResetPassword(reply);
|
_replyResetPassword(reply);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -41,7 +39,7 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 添加密码开始(此处用作删除卡片)
|
// 添加密码开始(此处用作删除卡片)
|
||||||
Future<void> _replyAddPassword(Reply reply) async {
|
Future<void> _replyAddPassword(Reply reply) async {
|
||||||
int status = reply.data[2];
|
final int status = reply.data[2];
|
||||||
|
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
@ -51,18 +49,18 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
//无权限
|
//无权限
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
var token = reply.data.sublist(5, 9);
|
final List<int> token = reply.data.sublist(5, 9);
|
||||||
var saveStrList = changeIntListToStringList(token);
|
final List<String> saveStrList = changeIntListToStringList(token);
|
||||||
Storage.setStringList(saveBlueToken, saveStrList);
|
Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
|
|
||||||
IoSenderManage.senderCustomPasswordsCommand(
|
IoSenderManage.senderCustomPasswordsCommand(
|
||||||
keyID: "0",
|
keyID: '0',
|
||||||
userID: (await Storage.getUid())!,
|
userID: (await Storage.getUid())!,
|
||||||
pwdNo: state.itemData.isCustom == 1 ? state.pwdNo : 0,
|
pwdNo: state.itemData.isCustom == 1 ? state.pwdNo : 0,
|
||||||
pwd: state.pwd, //state.deletPWD,
|
pwd: state.pwd, //state.deletPWD,
|
||||||
@ -86,7 +84,7 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 重置密码
|
// 重置密码
|
||||||
Future<void> _replyResetPassword(Reply reply) async {
|
Future<void> _replyResetPassword(Reply reply) async {
|
||||||
int status = reply.data[2];
|
final int status = reply.data[2];
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
//成功
|
//成功
|
||||||
@ -97,18 +95,18 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
//无权限
|
//无权限
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
var token = reply.data.sublist(5, 9);
|
final List<int> token = reply.data.sublist(5, 9);
|
||||||
var saveStrList = changeIntListToStringList(token);
|
final List<String> saveStrList = changeIntListToStringList(token);
|
||||||
Storage.setStringList(saveBlueToken, saveStrList);
|
Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
|
|
||||||
IoSenderManage.senderResetPasswordsCommand(
|
IoSenderManage.senderResetPasswordsCommand(
|
||||||
keyID: "0",
|
keyID: '0',
|
||||||
userID: (await Storage.getUid())!,
|
userID: (await Storage.getUid())!,
|
||||||
needAuthor: 1,
|
needAuthor: 1,
|
||||||
isBeforeAddUser: false,
|
isBeforeAddUser: false,
|
||||||
@ -133,17 +131,17 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||||
(BluetoothConnectionState deviceConnectionState) async {
|
(BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
var token = await Storage.getStringList(saveBlueToken);
|
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||||
List<int> getTokenList = changeStringListToIntList(token!);
|
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
IoSenderManage.senderCustomPasswordsCommand(
|
IoSenderManage.senderCustomPasswordsCommand(
|
||||||
keyID: "0",
|
keyID: '0',
|
||||||
userID: (await Storage.getUid())!,
|
userID: (await Storage.getUid())!,
|
||||||
pwdNo: state.itemData.isCustom == 1 ? state.pwdNo : 0,
|
pwdNo: state.itemData.isCustom == 1 ? state.pwdNo : 0,
|
||||||
pwd: state.pwd, //state.deletPWD,
|
pwd: state.pwd, //state.deletPWD,
|
||||||
@ -184,17 +182,17 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||||
(BluetoothConnectionState deviceConnectionState) async {
|
(BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
var token = await Storage.getStringList(saveBlueToken);
|
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||||
List<int> getTokenList = changeStringListToIntList(token!);
|
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
IoSenderManage.senderResetPasswordsCommand(
|
IoSenderManage.senderResetPasswordsCommand(
|
||||||
keyID: "0",
|
keyID: '0',
|
||||||
userID: (await Storage.getUid())!,
|
userID: (await Storage.getUid())!,
|
||||||
needAuthor: 1,
|
needAuthor: 1,
|
||||||
isBeforeAddUser: false,
|
isBeforeAddUser: false,
|
||||||
@ -274,11 +272,11 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
|
|
||||||
//密码钥匙重置请求
|
//密码钥匙重置请求
|
||||||
Future<void> resetPasswordKeyListRequest() async {
|
Future<void> resetPasswordKeyListRequest() async {
|
||||||
PasswordKeyListEntity entity = await ApiRepository.to.keyboardPwdReset(
|
final PasswordKeyListEntity entity = await ApiRepository.to.keyboardPwdReset(
|
||||||
lockId: state.keyInfo.value.lockId.toString(),
|
lockId: state.keyInfo.value.lockId.toString(),
|
||||||
passwordKey: state.encrpyKey);
|
passwordKey: state.encrpyKey);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast("重置成功".tr, something: () {
|
showToast('重置成功'.tr, something: () {
|
||||||
pageNo = 1;
|
pageNo = 1;
|
||||||
mockNetworkDataRequest(isRefresh: true);
|
mockNetworkDataRequest(isRefresh: true);
|
||||||
});
|
});
|
||||||
@ -287,30 +285,38 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
|
|
||||||
//删除密码请求 deleteType:1-蓝牙 2-网关
|
//删除密码请求 deleteType:1-蓝牙 2-网关
|
||||||
Future<void> deletePwdRequest() async {
|
Future<void> deletePwdRequest() async {
|
||||||
PasswordKeyEntity entity = await ApiRepository.to.deleteKeyboardPwd(
|
final PasswordKeyEntity entity = await ApiRepository.to.deleteKeyboardPwd(
|
||||||
lockId: state.itemData.lockId!.toString(),
|
lockId: state.itemData.lockId!.toString(),
|
||||||
keyboardPwdId: state.itemData.keyboardPwdId!.toString(),
|
keyboardPwdId: state.itemData.keyboardPwdId!.toString(),
|
||||||
deleteType: 1);
|
deleteType: 1);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast("删除成功".tr, something: () {
|
showToast('删除成功'.tr, something: () {
|
||||||
pageNo = 1;
|
pageNo = 1;
|
||||||
mockNetworkDataRequest(isRefresh: true);
|
mockNetworkDataRequest(isRefresh: true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取用户信息此处用作判断网络是否能获取成功
|
||||||
|
Future<void> getUserInfoRequest() async {
|
||||||
|
final MinePersonInfoEntity entity = await ApiRepository.to.getUserInfo();
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
senderResetPasswords();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//使用期限
|
//使用期限
|
||||||
String getUseDateStr(PasswordKeyListItem indexEntity) {
|
String getUseDateStr(PasswordKeyListItem indexEntity) {
|
||||||
int? getPwdType = indexEntity.keyboardPwdType;
|
final int? getPwdType = indexEntity.keyboardPwdType;
|
||||||
String useDateStr = '';
|
String useDateStr = '';
|
||||||
DateTime sendDateStr =
|
final DateTime sendDateStr =
|
||||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!);
|
DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!);
|
||||||
DateTime startDateStr =
|
final DateTime startDateStr =
|
||||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
|
DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
|
||||||
DateTime endDateStr =
|
final DateTime endDateStr =
|
||||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
|
DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
|
||||||
int starHour = indexEntity.hoursStart!;
|
final int starHour = indexEntity.hoursStart!;
|
||||||
int endHour = indexEntity.hoursEnd!;
|
final int endHour = indexEntity.hoursEnd!;
|
||||||
// AppLog.log('indexEntity.keyboardPwdName:${indexEntity.keyboardPwdName} indexEntity.keyboardPwdStatus:${indexEntity.keyboardPwdStatus} indexEntity.startDate!${indexEntity.startDate!} indexEntity.endDate!${indexEntity.endDate!} starHour:$starHour endHour:$endHour');
|
// AppLog.log('indexEntity.keyboardPwdName:${indexEntity.keyboardPwdName} indexEntity.keyboardPwdStatus:${indexEntity.keyboardPwdStatus} indexEntity.startDate!${indexEntity.startDate!} indexEntity.endDate!${indexEntity.endDate!} starHour:$starHour endHour:$endHour');
|
||||||
|
|
||||||
switch (getPwdType) {
|
switch (getPwdType) {
|
||||||
@ -385,7 +391,7 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
void _getPasswordListRefreshUIAction() {
|
void _getPasswordListRefreshUIAction() {
|
||||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||||
_getPasswordListRefreshUIEvent =
|
_getPasswordListRefreshUIEvent =
|
||||||
eventBus.on<GetPasswordListRefreshUI>().listen((event) {
|
eventBus.on<GetPasswordListRefreshUI>().listen((GetPasswordListRefreshUI event) {
|
||||||
mockNetworkDataRequest(isRefresh: true);
|
mockNetworkDataRequest(isRefresh: true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,12 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
|
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart';
|
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_state.dart';
|
||||||
|
import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart';
|
||||||
import 'package:star_lock/tools/noData.dart';
|
import 'package:star_lock/tools/noData.dart';
|
||||||
import 'package:star_lock/tools/storage.dart';
|
import 'package:star_lock/tools/storage.dart';
|
||||||
import '../../../../appRouters.dart';
|
import '../../../../appRouters.dart';
|
||||||
@ -25,11 +28,11 @@ class PasswordKeyListPage extends StatefulWidget {
|
|||||||
|
|
||||||
class _PasswordKeyListPageState extends State<PasswordKeyListPage>
|
class _PasswordKeyListPageState extends State<PasswordKeyListPage>
|
||||||
with RouteAware {
|
with RouteAware {
|
||||||
final logic = Get.put(PasswordKeyListLogic());
|
final PasswordKeyListLogic logic = Get.put(PasswordKeyListLogic());
|
||||||
final state = Get.find<PasswordKeyListLogic>().state;
|
final PasswordKeyListState state = Get.find<PasswordKeyListLogic>().state;
|
||||||
|
|
||||||
Future<void> getHttpData({required bool isRefresh}) async {
|
Future<void> getHttpData({required bool isRefresh}) async {
|
||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
if (isDemoMode == false) {
|
if (isDemoMode == false) {
|
||||||
logic
|
logic
|
||||||
.mockNetworkDataRequest(isRefresh: isRefresh)
|
.mockNetworkDataRequest(isRefresh: isRefresh)
|
||||||
@ -54,25 +57,22 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
|
|||||||
barTitle: TranslationLoader.lanKeys!.password!.tr,
|
barTitle: TranslationLoader.lanKeys!.password!.tr,
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor,
|
backgroundColor: AppColors.mainColor,
|
||||||
actionsList: [
|
actionsList: <Widget>[
|
||||||
TextButton(
|
TextButton(
|
||||||
child: Text(
|
child: Text(
|
||||||
TranslationLoader.lanKeys!.reset!.tr,
|
TranslationLoader.lanKeys!.reset!.tr,
|
||||||
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
if (isDemoMode == false) {
|
if (isDemoMode == false) {
|
||||||
if (state.itemDataList.isEmpty) {
|
if (state.itemDataList.isEmpty) {
|
||||||
logic.showToast("暂无密码,无需重置".tr);
|
logic.showToast('暂无密码,无需重置'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ShowTipView().showIosTipWithContentDialog('该锁的密码都将被删除'.tr,
|
ShowTipView().showIosTipWithContentDialog('该锁的密码都将被删除'.tr, logic.getUserInfoRequest);
|
||||||
() {
|
|
||||||
logic.senderResetPasswords();
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
logic.showToast("演示模式".tr);
|
logic.showToast('演示模式'.tr);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -86,7 +86,7 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
|
|||||||
getHttpData(isRefresh: false);
|
getHttpData(isRefresh: false);
|
||||||
},
|
},
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
// _searchWidget(),
|
// _searchWidget(),
|
||||||
KeySearchWidget(
|
KeySearchWidget(
|
||||||
editingController: state.searchController,
|
editingController: state.searchController,
|
||||||
@ -106,8 +106,8 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
|
|||||||
onClick: () {
|
onClick: () {
|
||||||
Navigator.pushNamed(
|
Navigator.pushNamed(
|
||||||
context, Routers.passwordKeyPerpetualPage,
|
context, Routers.passwordKeyPerpetualPage,
|
||||||
arguments: {"keyInfo": state.keyInfo.value})
|
arguments: <String, LockListInfoItemEntity>{'keyInfo': state.keyInfo.value})
|
||||||
.then((val) {
|
.then((Object? val) {
|
||||||
if (val != null) {
|
if (val != null) {
|
||||||
getHttpData(isRefresh: true);
|
getHttpData(isRefresh: true);
|
||||||
}
|
}
|
||||||
@ -132,10 +132,10 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
|
|||||||
: SlidableAutoCloseBehavior(
|
: SlidableAutoCloseBehavior(
|
||||||
child: ListView.separated(
|
child: ListView.separated(
|
||||||
itemCount: state.itemDataList.value.length,
|
itemCount: state.itemDataList.value.length,
|
||||||
itemBuilder: (c, index) {
|
itemBuilder: (BuildContext c, int index) {
|
||||||
PasswordKeyListItem passwordKeyListItem =
|
final PasswordKeyListItem passwordKeyListItem =
|
||||||
state.itemDataList.value[index];
|
state.itemDataList.value[index];
|
||||||
String useDateStr =
|
final String useDateStr =
|
||||||
logic.getUseDateStr(passwordKeyListItem); // 使用期限
|
logic.getUseDateStr(passwordKeyListItem); // 使用期限
|
||||||
|
|
||||||
return Slidable(
|
return Slidable(
|
||||||
@ -143,11 +143,10 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
|
|||||||
endActionPane: ActionPane(
|
endActionPane: ActionPane(
|
||||||
extentRatio: 0.2,
|
extentRatio: 0.2,
|
||||||
motion: const ScrollMotion(),
|
motion: const ScrollMotion(),
|
||||||
children: [
|
children: <Widget>[
|
||||||
SlidableAction(
|
SlidableAction(
|
||||||
onPressed: (BuildContext context) {
|
onPressed: (BuildContext context) {
|
||||||
ShowTipView().showIosTipWithContentDialog(
|
ShowTipView().showIosTipWithContentDialog('确定要删除吗?'.tr, () async {
|
||||||
"确定要删除吗?".tr, () async {
|
|
||||||
state.itemData = passwordKeyListItem;
|
state.itemData = passwordKeyListItem;
|
||||||
state.pwdNo = passwordKeyListItem.pwdUserNo!;
|
state.pwdNo = passwordKeyListItem.pwdUserNo!;
|
||||||
state.pwd = passwordKeyListItem.keyboardPwd!;
|
state.pwd = passwordKeyListItem.keyboardPwd!;
|
||||||
@ -163,9 +162,8 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
|
|||||||
),
|
),
|
||||||
child: _electronicKeyItem(index, 'images/icon_password.png',
|
child: _electronicKeyItem(index, 'images/icon_password.png',
|
||||||
passwordKeyListItem.keyboardPwdName!, useDateStr, () {
|
passwordKeyListItem.keyboardPwdName!, useDateStr, () {
|
||||||
Navigator.pushNamed(context, Routers.passwordKeyDetailPage,
|
Navigator.pushNamed(context, Routers.passwordKeyDetailPage, arguments: <String, PasswordKeyListItem>{'itemData': passwordKeyListItem})
|
||||||
arguments: {"itemData": passwordKeyListItem})
|
.then((Object? val) {
|
||||||
.then((val) {
|
|
||||||
if (val != null) {
|
if (val != null) {
|
||||||
getHttpData(isRefresh: true);
|
getHttpData(isRefresh: true);
|
||||||
}
|
}
|
||||||
@ -183,9 +181,8 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _electronicKeyItem(int itemIndex, String lockTypeIcon,
|
Widget _electronicKeyItem(int itemIndex, String lockTypeIcon, String lockTypeTitle, String useDateStr, Function()? action) {
|
||||||
String lockTypeTitle, String useDateStr, Function()? action) {
|
final PasswordKeyListItem passwordKeyListItem = state.itemDataList[itemIndex];
|
||||||
PasswordKeyListItem passwordKeyListItem = state.itemDataList[itemIndex];
|
|
||||||
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: action,
|
onTap: action,
|
||||||
@ -194,7 +191,7 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
|
|||||||
// margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
|
// margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: <Widget>[
|
||||||
SizedBox(width: 30.w),
|
SizedBox(width: 30.w),
|
||||||
Image.asset(
|
Image.asset(
|
||||||
lockTypeIcon,
|
lockTypeIcon,
|
||||||
@ -207,14 +204,14 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: <Widget>[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: passwordKeyListItem.keyboardPwdStatus == 2
|
width: passwordKeyListItem.keyboardPwdStatus == 2
|
||||||
? 1.sw - 110.w - 100.w
|
? 1.sw - 110.w - 100.w
|
||||||
: 1.sw - 110.w - 50.w,
|
: 1.sw - 110.w - 50.w,
|
||||||
child: Row(children: [
|
child: Row(children: <Widget>[
|
||||||
Flexible(
|
Flexible(
|
||||||
child: Text(lockTypeTitle,
|
child: Text(lockTypeTitle,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
@ -226,20 +223,18 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
|
|||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
SizedBox(width: 10.w),
|
SizedBox(width: 10.w),
|
||||||
passwordKeyListItem.keyboardPwdStatus == 2
|
if (passwordKeyListItem.keyboardPwdStatus == 2) Text(
|
||||||
? Text(
|
|
||||||
'已过期'.tr,
|
'已过期'.tr,
|
||||||
style:
|
style:
|
||||||
TextStyle(color: Colors.red, fontSize: 20.sp),
|
TextStyle(color: Colors.red, fontSize: 20.sp),
|
||||||
)
|
) else Container(),
|
||||||
: Container(),
|
|
||||||
// SizedBox(width: 15.w)
|
// SizedBox(width: 15.w)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(height: 5.h),
|
SizedBox(height: 5.h),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Flexible(
|
Flexible(
|
||||||
child: Text(
|
child: Text(
|
||||||
useDateStr,
|
useDateStr,
|
||||||
@ -265,7 +260,6 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
// TODO: implement didChangeDependencies
|
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
|
|
||||||
/// 路由订阅
|
/// 路由订阅
|
||||||
@ -274,7 +268,6 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
// TODO: implement dispose
|
|
||||||
/// 取消路由订阅
|
/// 取消路由订阅
|
||||||
AppRouteObserver().routeObserver.unsubscribe(this);
|
AppRouteObserver().routeObserver.unsubscribe(this);
|
||||||
super.dispose();
|
super.dispose();
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
@ -9,6 +10,7 @@ import 'package:star_lock/tools/EasyRefreshTool.dart';
|
|||||||
import 'package:star_lock/tools/noData.dart';
|
import 'package:star_lock/tools/noData.dart';
|
||||||
|
|
||||||
import '../../../../../appRouters.dart';
|
import '../../../../../appRouters.dart';
|
||||||
|
import '../../../../../tools/appRouteObserver.dart';
|
||||||
import '../../../../../tools/showTipView.dart';
|
import '../../../../../tools/showTipView.dart';
|
||||||
import 'expireCard_entity.dart';
|
import 'expireCard_entity.dart';
|
||||||
import 'expireCard_logic.dart';
|
import 'expireCard_logic.dart';
|
||||||
@ -20,7 +22,7 @@ class ExpireCardPage extends StatefulWidget {
|
|||||||
State<ExpireCardPage> createState() => _ExpireCardPageState();
|
State<ExpireCardPage> createState() => _ExpireCardPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ExpireCardPageState extends State<ExpireCardPage> {
|
class _ExpireCardPageState extends State<ExpireCardPage> with RouteAware {
|
||||||
final ExpireCardLogic logic = Get.put(ExpireCardLogic());
|
final ExpireCardLogic logic = Get.put(ExpireCardLogic());
|
||||||
final ExpireCardState state = Get.find<ExpireCardLogic>().state;
|
final ExpireCardState state = Get.find<ExpireCardLogic>().state;
|
||||||
|
|
||||||
@ -227,4 +229,57 @@ class _ExpireCardPageState extends State<ExpireCardPage> {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() {
|
||||||
|
super.didChangeDependencies();
|
||||||
|
|
||||||
|
/// 路由订阅
|
||||||
|
AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
/// 取消路由订阅
|
||||||
|
AppRouteObserver().routeObserver.unsubscribe(this);
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 从上级界面进入 当前界面即将出现
|
||||||
|
@override
|
||||||
|
void didPush() {
|
||||||
|
super.didPush();
|
||||||
|
state.ifCurrentScreen.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 返回上一个界面 当前界面即将消失
|
||||||
|
@override
|
||||||
|
void didPop() {
|
||||||
|
super.didPop();
|
||||||
|
logic.cancelBlueConnetctToastTimer();
|
||||||
|
if (EasyLoading.isShow) {
|
||||||
|
EasyLoading.dismiss(animation: true);
|
||||||
|
}
|
||||||
|
state.ifCurrentScreen.value = false;
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 从下级返回 当前界面即将出现
|
||||||
|
@override
|
||||||
|
void didPopNext() {
|
||||||
|
super.didPopNext();
|
||||||
|
state.ifCurrentScreen.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 进入下级界面 当前界面即将消失
|
||||||
|
@override
|
||||||
|
void didPushNext() {
|
||||||
|
super.didPushNext();
|
||||||
|
logic.cancelBlueConnetctToastTimer();
|
||||||
|
if (EasyLoading.isShow) {
|
||||||
|
EasyLoading.dismiss(animation: true);
|
||||||
|
}
|
||||||
|
state.ifCurrentScreen.value = false;
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,7 +35,6 @@ class ExpireFingerprintLogic extends BaseGetXController {
|
|||||||
// 添加指纹开始
|
// 添加指纹开始
|
||||||
Future<void> _replyAddFingerprintBegin(Reply reply) async {
|
Future<void> _replyAddFingerprintBegin(Reply reply) async {
|
||||||
final int status = reply.data[2];
|
final int status = reply.data[2];
|
||||||
|
|
||||||
switch(status){
|
switch(status){
|
||||||
case 0x00:
|
case 0x00:
|
||||||
//成功
|
//成功
|
||||||
@ -72,7 +71,7 @@ class ExpireFingerprintLogic extends BaseGetXController {
|
|||||||
privateKey:getPrivateKeyList,
|
privateKey:getPrivateKeyList,
|
||||||
token: getTokenList,
|
token: getTokenList,
|
||||||
isAdmin: 0,
|
isAdmin: 0,
|
||||||
operate: 0,
|
operate: 2,
|
||||||
isBeforeAddUser: true
|
isBeforeAddUser: true
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
@ -108,7 +107,7 @@ class ExpireFingerprintLogic extends BaseGetXController {
|
|||||||
keyID:state.deletExpireFingerprintItemEntity.fingerprintId.toString(),
|
keyID:state.deletExpireFingerprintItemEntity.fingerprintId.toString(),
|
||||||
userID:await Storage.getUid(),
|
userID:await Storage.getUid(),
|
||||||
fingerNo:int.parse(state.deletExpireFingerprintItemEntity.fingerprintNumber!),
|
fingerNo:int.parse(state.deletExpireFingerprintItemEntity.fingerprintNumber!),
|
||||||
useCountLimit:0xff,
|
useCountLimit:0xffff,
|
||||||
isForce:0, // 是否是胁迫
|
isForce:0, // 是否是胁迫
|
||||||
isRound:0, // 是否是循环
|
isRound:0, // 是否是循环
|
||||||
weekRound:0, // 周循环
|
weekRound:0, // 周循环
|
||||||
@ -121,7 +120,7 @@ class ExpireFingerprintLogic extends BaseGetXController {
|
|||||||
privateKey:getPrivateKeyList,
|
privateKey:getPrivateKeyList,
|
||||||
token: getTokenList,
|
token: getTokenList,
|
||||||
isAdmin: 0,
|
isAdmin: 0,
|
||||||
operate: 0,
|
operate: 2,
|
||||||
isBeforeAddUser: true
|
isBeforeAddUser: true
|
||||||
);
|
);
|
||||||
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
@ -9,6 +10,7 @@ import 'package:star_lock/tools/showTipView.dart';
|
|||||||
import '../../../../../appRouters.dart';
|
import '../../../../../appRouters.dart';
|
||||||
import '../../../../../app_settings/app_colors.dart';
|
import '../../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../../tools/EasyRefreshTool.dart';
|
import '../../../../../tools/EasyRefreshTool.dart';
|
||||||
|
import '../../../../../tools/appRouteObserver.dart';
|
||||||
import 'expireFingerprint_entity.dart';
|
import 'expireFingerprint_entity.dart';
|
||||||
import 'expireFingerprint_logic.dart';
|
import 'expireFingerprint_logic.dart';
|
||||||
|
|
||||||
@ -19,7 +21,7 @@ class ExpireFingerprintPage extends StatefulWidget {
|
|||||||
State<ExpireFingerprintPage> createState() => _ExpireFingerprintPageState();
|
State<ExpireFingerprintPage> createState() => _ExpireFingerprintPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ExpireFingerprintPageState extends State<ExpireFingerprintPage> {
|
class _ExpireFingerprintPageState extends State<ExpireFingerprintPage> with RouteAware {
|
||||||
final ExpireFingerprintLogic logic = Get.put(ExpireFingerprintLogic());
|
final ExpireFingerprintLogic logic = Get.put(ExpireFingerprintLogic());
|
||||||
final ExpireFingerprintState state = Get.find<ExpireFingerprintLogic>().state;
|
final ExpireFingerprintState state = Get.find<ExpireFingerprintLogic>().state;
|
||||||
|
|
||||||
@ -214,4 +216,57 @@ class _ExpireFingerprintPageState extends State<ExpireFingerprintPage> {
|
|||||||
}
|
}
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() {
|
||||||
|
super.didChangeDependencies();
|
||||||
|
|
||||||
|
/// 路由订阅
|
||||||
|
AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
/// 取消路由订阅
|
||||||
|
AppRouteObserver().routeObserver.unsubscribe(this);
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 从上级界面进入 当前界面即将出现
|
||||||
|
@override
|
||||||
|
void didPush() {
|
||||||
|
super.didPush();
|
||||||
|
state.ifCurrentScreen.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 返回上一个界面 当前界面即将消失
|
||||||
|
@override
|
||||||
|
void didPop() {
|
||||||
|
super.didPop();
|
||||||
|
logic.cancelBlueConnetctToastTimer();
|
||||||
|
if (EasyLoading.isShow) {
|
||||||
|
EasyLoading.dismiss(animation: true);
|
||||||
|
}
|
||||||
|
state.ifCurrentScreen.value = false;
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 从下级返回 当前界面即将出现
|
||||||
|
@override
|
||||||
|
void didPopNext() {
|
||||||
|
super.didPopNext();
|
||||||
|
state.ifCurrentScreen.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 进入下级界面 当前界面即将消失
|
||||||
|
@override
|
||||||
|
void didPushNext() {
|
||||||
|
super.didPushNext();
|
||||||
|
logic.cancelBlueConnetctToastTimer();
|
||||||
|
if (EasyLoading.isShow) {
|
||||||
|
EasyLoading.dismiss(animation: true);
|
||||||
|
}
|
||||||
|
state.ifCurrentScreen.value = false;
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
@ -9,6 +10,7 @@ import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expirePassw
|
|||||||
import 'package:star_lock/tools/EasyRefreshTool.dart';
|
import 'package:star_lock/tools/EasyRefreshTool.dart';
|
||||||
import 'package:star_lock/tools/noData.dart';
|
import 'package:star_lock/tools/noData.dart';
|
||||||
|
|
||||||
|
import '../../../../../tools/appRouteObserver.dart';
|
||||||
import '../../../../../tools/showTipView.dart';
|
import '../../../../../tools/showTipView.dart';
|
||||||
import 'expirePassword_entity.dart';
|
import 'expirePassword_entity.dart';
|
||||||
import 'expirePassword_logic.dart';
|
import 'expirePassword_logic.dart';
|
||||||
@ -20,7 +22,7 @@ class ExpirePasswordPage extends StatefulWidget {
|
|||||||
State<ExpirePasswordPage> createState() => _ExpirePasswordPageState();
|
State<ExpirePasswordPage> createState() => _ExpirePasswordPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ExpirePasswordPageState extends State<ExpirePasswordPage> {
|
class _ExpirePasswordPageState extends State<ExpirePasswordPage> with RouteAware {
|
||||||
final ExpirePasswordLogic logic = Get.put(ExpirePasswordLogic());
|
final ExpirePasswordLogic logic = Get.put(ExpirePasswordLogic());
|
||||||
final ExpirePasswordState state = Get.find<ExpirePasswordLogic>().state;
|
final ExpirePasswordState state = Get.find<ExpirePasswordLogic>().state;
|
||||||
|
|
||||||
@ -237,4 +239,57 @@ class _ExpirePasswordPageState extends State<ExpirePasswordPage> {
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() {
|
||||||
|
super.didChangeDependencies();
|
||||||
|
|
||||||
|
/// 路由订阅
|
||||||
|
AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
/// 取消路由订阅
|
||||||
|
AppRouteObserver().routeObserver.unsubscribe(this);
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 从上级界面进入 当前界面即将出现
|
||||||
|
@override
|
||||||
|
void didPush() {
|
||||||
|
super.didPush();
|
||||||
|
state.ifCurrentScreen.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 返回上一个界面 当前界面即将消失
|
||||||
|
@override
|
||||||
|
void didPop() {
|
||||||
|
super.didPop();
|
||||||
|
logic.cancelBlueConnetctToastTimer();
|
||||||
|
if (EasyLoading.isShow) {
|
||||||
|
EasyLoading.dismiss(animation: true);
|
||||||
|
}
|
||||||
|
state.ifCurrentScreen.value = false;
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 从下级返回 当前界面即将出现
|
||||||
|
@override
|
||||||
|
void didPopNext() {
|
||||||
|
super.didPopNext();
|
||||||
|
state.ifCurrentScreen.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 进入下级界面 当前界面即将消失
|
||||||
|
@override
|
||||||
|
void didPushNext() {
|
||||||
|
super.didPushNext();
|
||||||
|
logic.cancelBlueConnetctToastTimer();
|
||||||
|
if (EasyLoading.isShow) {
|
||||||
|
EasyLoading.dismiss(animation: true);
|
||||||
|
}
|
||||||
|
state.ifCurrentScreen.value = false;
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,10 +15,10 @@ class ShowTipView {
|
|||||||
void showSureAlertDialog(String contentStr) {
|
void showSureAlertDialog(String contentStr) {
|
||||||
showCupertinoDialog(
|
showCupertinoDialog(
|
||||||
context: Get.context!,
|
context: Get.context!,
|
||||||
builder: (context) {
|
builder: (BuildContext context) {
|
||||||
return CupertinoAlertDialog(
|
return CupertinoAlertDialog(
|
||||||
content: Text(contentStr),
|
content: Text(contentStr),
|
||||||
actions: [
|
actions: <Widget>[
|
||||||
CupertinoDialogAction(
|
CupertinoDialogAction(
|
||||||
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
@ -44,12 +44,12 @@ class ShowTipView {
|
|||||||
// height: 100.h,
|
// height: 100.h,
|
||||||
child: ShowDeleteAdministratorIsHaveAllDataWidget(
|
child: ShowDeleteAdministratorIsHaveAllDataWidget(
|
||||||
contentStr: contentStr,
|
contentStr: contentStr,
|
||||||
blockIsHaveAllDataCallback: (a) {
|
blockIsHaveAllDataCallback: (bool a) {
|
||||||
selet = a;
|
selet = a;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
actions: [
|
actions: <Widget>[
|
||||||
CupertinoDialogAction(
|
CupertinoDialogAction(
|
||||||
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
@ -73,15 +73,13 @@ class ShowTipView {
|
|||||||
void showIosTipWithContentDialog(String contentStr, Function sureClick) {
|
void showIosTipWithContentDialog(String contentStr, Function sureClick) {
|
||||||
showCupertinoDialog(
|
showCupertinoDialog(
|
||||||
context: Get.context!,
|
context: Get.context!,
|
||||||
builder: (context) {
|
builder: (BuildContext context) {
|
||||||
return CupertinoAlertDialog(
|
return CupertinoAlertDialog(
|
||||||
content: Text(contentStr),
|
content: Text(contentStr),
|
||||||
actions: [
|
actions: <Widget>[
|
||||||
CupertinoDialogAction(
|
CupertinoDialogAction(
|
||||||
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
||||||
onPressed: () {
|
onPressed: Get.back,
|
||||||
Get.back();
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
CupertinoDialogAction(
|
CupertinoDialogAction(
|
||||||
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user