fix提测问题: 卡/密码/指纹 列表超过 20 条删除单条后下拉卡顿问题
This commit is contained in:
parent
1d5c745454
commit
778fcffe1d
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||||
@ -27,10 +26,11 @@ class CardListLogic extends BaseGetXController {
|
|||||||
// 获取解析后的数据
|
// 获取解析后的数据
|
||||||
late StreamSubscription<Reply> _replySubscription;
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
void _initReplySubscription() {
|
void _initReplySubscription() {
|
||||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply 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);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -40,7 +40,7 @@ class CardListLogic extends BaseGetXController {
|
|||||||
Future<void> _replyAddICCardBegin(Reply reply) async {
|
Future<void> _replyAddICCardBegin(Reply reply) async {
|
||||||
final int status = reply.data[2];
|
final int status = reply.data[2];
|
||||||
|
|
||||||
switch(status){
|
switch (status) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
//成功
|
//成功
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
@ -48,10 +48,13 @@ class CardListLogic extends BaseGetXController {
|
|||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
//无权限
|
//无权限
|
||||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey =
|
||||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList =
|
||||||
|
changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
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!);
|
||||||
|
|
||||||
final List<int> token = reply.data.sublist(5, 9);
|
final List<int> token = reply.data.sublist(5, 9);
|
||||||
@ -59,25 +62,24 @@ class CardListLogic extends BaseGetXController {
|
|||||||
Storage.setStringList(saveBlueToken, saveStrList);
|
Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
|
|
||||||
IoSenderManage.senderAddCardWithTimeCycleCoercionCommand(
|
IoSenderManage.senderAddCardWithTimeCycleCoercionCommand(
|
||||||
keyID:state.deletKeyID,
|
keyID: state.deletKeyID,
|
||||||
userID:(await Storage.getUid())!,
|
userID: (await Storage.getUid())!,
|
||||||
cardNo:state.deletCardNo,
|
cardNo: state.deletCardNo,
|
||||||
useCountLimit:0xffff,
|
useCountLimit: 0xffff,
|
||||||
operate: state.isDeletAll == true ? 3 : 2, // 0:注册 1:修改 2:删除 3:删除全部
|
operate: state.isDeletAll == true ? 3 : 2, // 0:注册 1:修改 2:删除 3:删除全部
|
||||||
isAdmin:0,
|
isAdmin: 0,
|
||||||
isForce:0, // 是否是胁迫
|
isForce: 0, // 是否是胁迫
|
||||||
isRound:0, // 是否是循环
|
isRound: 0, // 是否是循环
|
||||||
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,
|
||||||
token: token,
|
token: token,
|
||||||
isBeforeAddUser: false
|
isBeforeAddUser: false);
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//失败
|
//失败
|
||||||
@ -88,44 +90,48 @@ class CardListLogic extends BaseGetXController {
|
|||||||
// 删除卡片
|
// 删除卡片
|
||||||
Future<void> senderAddICCard() async {
|
Future<void> senderAddICCard() async {
|
||||||
showEasyLoading();
|
showEasyLoading();
|
||||||
showBlueConnetctToastTimer(action: (){
|
showBlueConnetctToastTimer(action: () {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
});
|
});
|
||||||
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected){
|
(BluetoothConnectionState deviceConnectionState) async {
|
||||||
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
|
final List<String>? signKey =
|
||||||
|
await Storage.getStringList(saveBlueSignKey);
|
||||||
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey =
|
||||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList =
|
||||||
|
changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||||
final List<int> getTokenList = changeStringListToIntList(token!);
|
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
IoSenderManage.senderAddCardWithTimeCycleCoercionCommand(
|
IoSenderManage.senderAddCardWithTimeCycleCoercionCommand(
|
||||||
keyID:state.deletKeyID,
|
keyID: state.deletKeyID,
|
||||||
userID:(await Storage.getUid())!,
|
userID: (await Storage.getUid())!,
|
||||||
cardNo:state.deletCardNo,
|
cardNo: state.deletCardNo,
|
||||||
useCountLimit:0xffff,
|
useCountLimit: 0xffff,
|
||||||
operate: state.isDeletAll == true ? 3 : 2, // 0:注册 1:修改 2:删除 3:删除全部
|
operate: state.isDeletAll == true ? 3 : 2, // 0:注册 1:修改 2:删除 3:删除全部
|
||||||
isAdmin:0,
|
isAdmin: 0,
|
||||||
isForce:0, // 是否是胁迫
|
isForce: 0, // 是否是胁迫
|
||||||
isRound:0, // 是否是循环
|
isRound: 0, // 是否是循环
|
||||||
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,
|
||||||
token: getTokenList,
|
token: getTokenList,
|
||||||
isBeforeAddUser: false
|
isBeforeAddUser: false);
|
||||||
);
|
} else if (deviceConnectionState ==
|
||||||
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
BluetoothConnectionState.disconnected) {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
if(state.ifCurrentScreen.value == true){
|
if (state.ifCurrentScreen.value == true) {
|
||||||
showBlueConnetctToast();
|
showBlueConnetctToast();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -133,32 +139,34 @@ class CardListLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取IC卡列表
|
// 获取IC卡列表
|
||||||
Future<FingerprintListDataEntity> getICCardListData() async{
|
Future<FingerprintListDataEntity> getICCardListData(
|
||||||
final FingerprintListDataEntity entity = await ApiRepository.to.getICCardListData(
|
{required bool isRefresh}) async {
|
||||||
|
// 如果是下拉刷新,清空已有数据
|
||||||
|
if (isRefresh) {
|
||||||
|
state.fingerprintItemListData.clear();
|
||||||
|
pageNo = 1;
|
||||||
|
}
|
||||||
|
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,
|
||||||
searchStr: state.searchController.text,
|
searchStr: state.searchController.text,
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
if (pageNo == 1) {
|
// 更新数据列表
|
||||||
state.fingerprintItemListData.value = entity.data!.list!;
|
state.fingerprintItemListData.addAll(entity.data!.list!);
|
||||||
pageNo++;
|
// 更新页码
|
||||||
} else {
|
pageNo++;
|
||||||
if (entity.data!.list!.isNotEmpty) {
|
|
||||||
state.fingerprintItemListData.value.addAll(entity.data!.list!);
|
|
||||||
pageNo++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除所有IC卡
|
// 删除所有IC卡
|
||||||
Future<void> deletICCardData() async{
|
Future<void> deletICCardData() async {
|
||||||
String cardId = '';
|
String cardId = '';
|
||||||
String type = '1';
|
String type = '1';
|
||||||
if(state.isDeletAll == false){
|
if (state.isDeletAll == false) {
|
||||||
cardId = state.deletKeyID;
|
cardId = state.deletKeyID;
|
||||||
type = '0';
|
type = '0';
|
||||||
}
|
}
|
||||||
@ -166,18 +174,15 @@ class CardListLogic extends BaseGetXController {
|
|||||||
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: (){
|
getICCardListData(isRefresh: true);
|
||||||
pageNo = 1;
|
|
||||||
getICCardListData();
|
|
||||||
});
|
});
|
||||||
}else{
|
} else {
|
||||||
showToast('重置成功'.tr, something: (){
|
showToast('重置成功'.tr, something: () {
|
||||||
pageNo = 1;
|
getICCardListData(isRefresh: true);
|
||||||
getICCardListData();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -186,44 +191,48 @@ class CardListLogic extends BaseGetXController {
|
|||||||
// 监听修改完详情之后刷新列表
|
// 监听修改完详情之后刷新列表
|
||||||
late StreamSubscription _teamEvent;
|
late StreamSubscription _teamEvent;
|
||||||
void _initRefreshAction() {
|
void _initRefreshAction() {
|
||||||
_teamEvent = eventBus.on<OtherTypeRefreshListEvent>().listen((OtherTypeRefreshListEvent event) {
|
_teamEvent = eventBus
|
||||||
pageNo = 1;
|
.on<OtherTypeRefreshListEvent>()
|
||||||
getICCardListData();
|
.listen((OtherTypeRefreshListEvent event) {
|
||||||
|
getICCardListData(isRefresh: true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
String getKeyType(FingerprintItemData fingerprintItemData){
|
String getKeyType(FingerprintItemData fingerprintItemData) {
|
||||||
String 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) {
|
||||||
String 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 =
|
||||||
}else if(fingerprintItemData.cardType! == 2){
|
'${DateTool().dateToYMDHNString(fingerprintItemData.createDate.toString())} 永久';
|
||||||
keyDateTypeStr = '${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())} 限时';
|
} else if (fingerprintItemData.cardType! == 2) {
|
||||||
}else if(fingerprintItemData.cardType! == 4){
|
keyDateTypeStr =
|
||||||
keyDateTypeStr = '${DateTool().dateToYMDString(fingerprintItemData.startDate.toString())}-${DateTool().dateToYMDString(fingerprintItemData.endDate.toString())} 循环';
|
'${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())} 限时';
|
||||||
|
} else if (fingerprintItemData.cardType! == 4) {
|
||||||
|
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 {
|
||||||
super.onReady();
|
super.onReady();
|
||||||
|
|
||||||
// 获取是否是演示模式 演示模式不获取接口
|
// 获取是否是演示模式 演示模式不获取接口
|
||||||
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
if(isDemoMode == false){
|
if (isDemoMode == false) {
|
||||||
_initReplySubscription();
|
_initReplySubscription();
|
||||||
|
|
||||||
_initRefreshAction();
|
_initRefreshAction();
|
||||||
@ -239,10 +248,10 @@ class CardListLogic extends BaseGetXController {
|
|||||||
Future<void> onClose() async {
|
Future<void> onClose() async {
|
||||||
super.onClose();
|
super.onClose();
|
||||||
|
|
||||||
final bool? 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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
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';
|
||||||
@ -31,11 +30,13 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
|||||||
final CardListLogic logic = Get.put(CardListLogic());
|
final CardListLogic logic = Get.put(CardListLogic());
|
||||||
final CardListState state = Get.find<CardListLogic>().state;
|
final CardListState state = Get.find<CardListLogic>().state;
|
||||||
|
|
||||||
Future<void> getHttpData() async {
|
Future<void> getHttpData({required bool isRefresh}) async {
|
||||||
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
if (isDemoMode == false) {
|
if (isDemoMode == false) {
|
||||||
logic.getICCardListData().then((FingerprintListDataEntity value){
|
logic
|
||||||
if(mounted) {
|
.getICCardListData(isRefresh: isRefresh)
|
||||||
|
.then((FingerprintListDataEntity value) {
|
||||||
|
if (mounted) {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -46,12 +47,11 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
getHttpData();
|
getHttpData(isRefresh: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
@ -67,7 +67,8 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
|||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
final bool? 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;
|
||||||
@ -82,34 +83,33 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: EasyRefreshTool(
|
body: EasyRefreshTool(
|
||||||
onRefresh: (){
|
onRefresh: () {
|
||||||
logic.pageNo = 1;
|
getHttpData(isRefresh: true);
|
||||||
getHttpData();
|
|
||||||
},
|
},
|
||||||
onLoad: (){
|
onLoad: () {
|
||||||
getHttpData();
|
getHttpData(isRefresh: false);
|
||||||
},
|
},
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
KeySearchWidget(
|
KeySearchWidget(
|
||||||
editingController: state.searchController,
|
editingController: state.searchController,
|
||||||
onSubmittedAction: () {
|
onSubmittedAction: () {
|
||||||
logic.pageNo = 1;
|
getHttpData(isRefresh: true);
|
||||||
getHttpData();
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
SizedBox(height: 20.h),
|
SizedBox(height: 20.h),
|
||||||
Expanded(child: _buildMainUI()),
|
Expanded(child: _buildMainUI()),
|
||||||
AddBottomWhiteBtn(
|
AddBottomWhiteBtn(
|
||||||
btnName: '${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.card!.tr}',
|
btnName:
|
||||||
|
'${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.card!.tr}',
|
||||||
onClick: () async {
|
onClick: () async {
|
||||||
final data = await Get.toNamed(Routers.addCardPage, arguments: <String, int>{
|
final data = await Get.toNamed(Routers.addCardPage,
|
||||||
'lockId': state.lockId.value,
|
arguments: <String, int>{
|
||||||
'fromType': 1 // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
'lockId': state.lockId.value,
|
||||||
});
|
'fromType': 1 // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||||
|
});
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
logic.pageNo = 1;
|
getHttpData(isRefresh: true);
|
||||||
getHttpData();
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -125,59 +125,69 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
|||||||
Widget _buildMainUI() {
|
Widget _buildMainUI() {
|
||||||
return Obx(() => state.fingerprintItemListData.value.isNotEmpty
|
return Obx(() => state.fingerprintItemListData.value.isNotEmpty
|
||||||
? SlidableAutoCloseBehavior(
|
? SlidableAutoCloseBehavior(
|
||||||
child: ListView.separated(
|
child: ListView.separated(
|
||||||
itemCount: state.fingerprintItemListData.value.length,
|
itemCount: state.fingerprintItemListData.value.length,
|
||||||
itemBuilder: (BuildContext c, int index) {
|
itemBuilder: (BuildContext c, int index) {
|
||||||
final FingerprintItemData fingerprintItemData = state.fingerprintItemListData.value[index];
|
final FingerprintItemData fingerprintItemData =
|
||||||
return Slidable(
|
state.fingerprintItemListData.value[index];
|
||||||
key:ValueKey(fingerprintItemData.fingerprintId),
|
return Slidable(
|
||||||
endActionPane: ActionPane(
|
key: ValueKey(fingerprintItemData.fingerprintId),
|
||||||
extentRatio: 0.2,
|
endActionPane: ActionPane(
|
||||||
motion: const ScrollMotion(),
|
extentRatio: 0.2,
|
||||||
children: <Widget>[
|
motion: const ScrollMotion(),
|
||||||
SlidableAction(
|
children: <Widget>[
|
||||||
onPressed: (BuildContext context){
|
SlidableAction(
|
||||||
ShowTipView().showIosTipWithContentDialog('确定要删除吗?'.tr, () async {
|
onPressed: (BuildContext context) {
|
||||||
state.isDeletAll = false;
|
ShowTipView().showIosTipWithContentDialog(
|
||||||
state.deletKeyID = fingerprintItemData.cardId.toString();
|
'确定要删除吗?'.tr, () async {
|
||||||
state.deletCardNo = int.parse(fingerprintItemData.cardNumber!);
|
state.isDeletAll = false;
|
||||||
logic.senderAddICCard();
|
state.deletKeyID =
|
||||||
});
|
fingerprintItemData.cardId.toString();
|
||||||
},
|
state.deletCardNo =
|
||||||
backgroundColor: Colors.red,
|
int.parse(fingerprintItemData.cardNumber!);
|
||||||
foregroundColor: Colors.white,
|
logic.senderAddICCard();
|
||||||
label: '删除'.tr,
|
});
|
||||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
},
|
||||||
),
|
backgroundColor: Colors.red,
|
||||||
],
|
foregroundColor: Colors.white,
|
||||||
|
label: '删除'.tr,
|
||||||
|
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: _keyItem(
|
||||||
|
'images/icon_card.png',
|
||||||
|
fingerprintItemData.cardName!,
|
||||||
|
logic.getKeyType(fingerprintItemData),
|
||||||
|
logic.getKeyDateType(fingerprintItemData), () async {
|
||||||
|
final data = await Get.toNamed(Routers.cardDetailPage,
|
||||||
|
arguments: <String, FingerprintItemData>{
|
||||||
|
'fingerprintItemData': fingerprintItemData,
|
||||||
|
});
|
||||||
|
if (data != null) {
|
||||||
|
getHttpData(isRefresh: true);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
separatorBuilder: (BuildContext context, int index) {
|
||||||
|
return const Divider(
|
||||||
|
height: 1,
|
||||||
|
color: AppColors.greyLineColor,
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
child: _keyItem(
|
)
|
||||||
'images/icon_card.png',
|
: NoData(
|
||||||
fingerprintItemData.cardName!,
|
noDataHeight: 1.sh -
|
||||||
logic.getKeyType(fingerprintItemData),
|
ScreenUtil().statusBarHeight -
|
||||||
logic.getKeyDateType(fingerprintItemData), () async {
|
ScreenUtil().bottomBarHeight -
|
||||||
final data = await Get.toNamed(
|
190.h -
|
||||||
Routers.cardDetailPage, arguments: <String, FingerprintItemData>{
|
64.h));
|
||||||
'fingerprintItemData': fingerprintItemData,
|
|
||||||
});
|
|
||||||
if (data != null) {
|
|
||||||
logic.pageNo = 1;
|
|
||||||
getHttpData();
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
separatorBuilder: (BuildContext context, int index) {
|
|
||||||
return const Divider(
|
|
||||||
height: 1,
|
|
||||||
color: AppColors.greyLineColor,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
) : NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 190.h - 64.h));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _keyItem(String lockTypeIcon, String lockTypeTitle, String ifInvalidation, String showTime, Function() action) {
|
Widget _keyItem(String lockTypeIcon, String lockTypeTitle,
|
||||||
|
String ifInvalidation, String showTime, Function() action) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: action,
|
onTap: action,
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -201,14 +211,13 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Flexible(
|
Flexible(
|
||||||
child: Text(
|
child: Text(lockTypeTitle,
|
||||||
lockTypeTitle,
|
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor)
|
style: TextStyle(
|
||||||
),
|
fontSize: 24.sp,
|
||||||
|
color: AppColors.blackColor)),
|
||||||
),
|
),
|
||||||
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||||
@ -18,15 +17,17 @@ import '../../../../tools/storage.dart';
|
|||||||
import 'fingerprintListData_entity.dart';
|
import 'fingerprintListData_entity.dart';
|
||||||
import 'fingerprintList_state.dart';
|
import 'fingerprintList_state.dart';
|
||||||
|
|
||||||
class FingerprintListLogic extends BaseGetXController{
|
class FingerprintListLogic extends BaseGetXController {
|
||||||
FingerprintListState state = FingerprintListState();
|
FingerprintListState state = FingerprintListState();
|
||||||
|
|
||||||
// 获取解析后的数据
|
// 获取解析后的数据
|
||||||
late StreamSubscription<Reply> _replySubscription;
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
void _initReplySubscription() {
|
void _initReplySubscription() {
|
||||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
|
_replySubscription =
|
||||||
|
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
|
||||||
// 添加指纹开始(此处用作删除指纹)
|
// 添加指纹开始(此处用作删除指纹)
|
||||||
if((reply is SenderAddFingerprintWithTimeCycleCoercionReply) && (state.ifCurrentScreen.value == true)) {
|
if ((reply is SenderAddFingerprintWithTimeCycleCoercionReply) &&
|
||||||
|
(state.ifCurrentScreen.value == true)) {
|
||||||
_replyAddFingerprintBegin(reply);
|
_replyAddFingerprintBegin(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +46,7 @@ class FingerprintListLogic 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:
|
||||||
//成功
|
//成功
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
@ -54,10 +55,13 @@ class FingerprintListLogic extends BaseGetXController{
|
|||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
//无权限
|
//无权限
|
||||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey =
|
||||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList =
|
||||||
|
changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
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!);
|
||||||
|
|
||||||
final List<int> token = reply.data.sublist(5, 9);
|
final List<int> token = reply.data.sublist(5, 9);
|
||||||
@ -65,25 +69,24 @@ class FingerprintListLogic extends BaseGetXController{
|
|||||||
Storage.setStringList(saveBlueToken, saveStrList);
|
Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
|
|
||||||
IoSenderManage.senderAddFingerprintWithTimeCycleCoercionCommand(
|
IoSenderManage.senderAddFingerprintWithTimeCycleCoercionCommand(
|
||||||
keyID:state.deletKeyID,
|
keyID: state.deletKeyID,
|
||||||
userID:(await Storage.getUid())!,
|
userID: (await Storage.getUid())!,
|
||||||
fingerNo:state.deletFingerNo,
|
fingerNo: state.deletFingerNo,
|
||||||
useCountLimit:0xffff,
|
useCountLimit: 0xffff,
|
||||||
operate: state.isDeletAll == true ? 3 : 2, // 0:注册 1:修改 2:删除 3:删除全部
|
operate: state.isDeletAll == true ? 3 : 2, // 0:注册 1:修改 2:删除 3:删除全部
|
||||||
isAdmin:0,
|
isAdmin: 0,
|
||||||
isForce:0, // 是否是胁迫
|
isForce: 0, // 是否是胁迫
|
||||||
isRound:0, // 是否是循环
|
isRound: 0, // 是否是循环
|
||||||
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,
|
||||||
token: token,
|
token: token,
|
||||||
isBeforeAddUser: false
|
isBeforeAddUser: false);
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//失败
|
//失败
|
||||||
@ -245,81 +248,124 @@ class FingerprintListLogic extends BaseGetXController{
|
|||||||
// 删除指纹
|
// 删除指纹
|
||||||
Future<void> senderAddFingerprint() async {
|
Future<void> senderAddFingerprint() async {
|
||||||
showEasyLoading();
|
showEasyLoading();
|
||||||
showBlueConnetctToastTimer(action: (){
|
showBlueConnetctToastTimer(action: () {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
});
|
});
|
||||||
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected){
|
(BluetoothConnectionState deviceConnectionState) async {
|
||||||
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
// 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!);
|
||||||
|
|
||||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey =
|
||||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList =
|
||||||
|
changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||||
final List<int> getTokenList = changeStringListToIntList(token!);
|
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
IoSenderManage.senderAddFingerprintWithTimeCycleCoercionCommand(
|
IoSenderManage.senderAddFingerprintWithTimeCycleCoercionCommand(
|
||||||
keyID:state.deletKeyID,
|
keyID: state.deletKeyID,
|
||||||
userID:(await Storage.getUid())!,
|
userID: (await Storage.getUid())!,
|
||||||
fingerNo:state.deletFingerNo,
|
fingerNo: state.deletFingerNo,
|
||||||
useCountLimit:0xffff,
|
useCountLimit: 0xffff,
|
||||||
operate: state.isDeletAll == true ? 3 : 2, // 0:注册 1:修改 2:删除 3:删除全部
|
operate: state.isDeletAll == true ? 3 : 2, // 0:注册 1:修改 2:删除 3:删除全部
|
||||||
isAdmin:0,
|
isAdmin: 0,
|
||||||
isForce:0, // 是否是胁迫
|
isForce: 0, // 是否是胁迫
|
||||||
isRound:0, // 是否是循环
|
isRound: 0, // 是否是循环
|
||||||
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,
|
||||||
token: getTokenList,
|
token: getTokenList,
|
||||||
isBeforeAddUser: false
|
isBeforeAddUser: false);
|
||||||
);
|
} else if (deviceConnectionState ==
|
||||||
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
BluetoothConnectionState.disconnected) {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
if(state.ifCurrentScreen.value == true){
|
if (state.ifCurrentScreen.value == true) {
|
||||||
showBlueConnetctToast();
|
showBlueConnetctToast();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* //请求密码钥匙列表
|
||||||
|
Future<PasswordKeyListEntity> mockNetworkDataRequest(
|
||||||
|
{required bool isRefresh}) async {
|
||||||
|
// 如果是下拉刷新,清空已有数据
|
||||||
|
if (isRefresh) {
|
||||||
|
state.itemDataList.clear();
|
||||||
|
pageNo = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
final PasswordKeyListEntity entity = await ApiRepository.to.passwordKeyList(
|
||||||
|
state.keyInfo.value.keyStatus.toString(),
|
||||||
|
state.keyInfo.value.lockId.toString(),
|
||||||
|
pageNo.toString(),
|
||||||
|
pageSize.toString(),
|
||||||
|
state.searchController.text);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
// 更新数据列表
|
||||||
|
state.itemDataList.addAll(entity.data!.itemList!);
|
||||||
|
// 更新页码
|
||||||
|
pageNo++;
|
||||||
|
}
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
// 获取指纹列表
|
// 获取指纹列表
|
||||||
Future<FingerprintListDataEntity> getFingerprintsListData() async{
|
Future<FingerprintListDataEntity> getFingerprintsListData(
|
||||||
// state.fingerprintItemListData.value.clear();
|
{required bool isRefresh}) async {
|
||||||
final FingerprintListDataEntity entity = await ApiRepository.to.getFingerprintsListData(
|
// 如果是下拉刷新,清空已有数据
|
||||||
|
if (isRefresh) {
|
||||||
|
state.fingerprintItemListData.clear();
|
||||||
|
pageNo = 1;
|
||||||
|
}
|
||||||
|
final FingerprintListDataEntity entity =
|
||||||
|
await ApiRepository.to.getFingerprintsListData(
|
||||||
lockId: state.lockId.value.toString(),
|
lockId: state.lockId.value.toString(),
|
||||||
pageNo: pageNo.toString(),
|
pageNo: pageNo.toString(),
|
||||||
pageSize: pageSize.toString(),
|
pageSize: pageSize.toString(),
|
||||||
searchStr: state.searchController.text,
|
searchStr: state.searchController.text,
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
// if (entity.errorCode!.codeIsSuccessful) {
|
||||||
if (pageNo == 1) {
|
// if (pageNo == 1) {
|
||||||
state.fingerprintItemListData.value = entity.data!.list!;
|
// state.fingerprintItemListData.value = entity.data!.list!;
|
||||||
pageNo++;
|
// pageNo++;
|
||||||
} else {
|
// } else {
|
||||||
if (entity.data!.list!.isNotEmpty) {
|
// if (entity.data!.list!.isNotEmpty) {
|
||||||
state.fingerprintItemListData.value.addAll(entity.data!.list!);
|
// state.fingerprintItemListData.value.addAll(entity.data!.list!);
|
||||||
pageNo++;
|
// pageNo++;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
// 更新数据列表
|
||||||
|
state.fingerprintItemListData.addAll(entity.data!.list!);
|
||||||
|
// 更新页码
|
||||||
|
pageNo++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 重置所有的指纹
|
// 重置所有的指纹
|
||||||
Future<void> deletAllFingerprintsData() async{
|
Future<void> deletAllFingerprintsData() async {
|
||||||
String fingerprintId = '';
|
String fingerprintId = '';
|
||||||
String type = '1';
|
String type = '1';
|
||||||
if(state.isDeletAll == false){
|
if (state.isDeletAll == false) {
|
||||||
fingerprintId = state.deletKeyID;
|
fingerprintId = state.deletKeyID;
|
||||||
type = '0';
|
type = '0';
|
||||||
}
|
}
|
||||||
@ -327,18 +373,15 @@ class FingerprintListLogic extends BaseGetXController{
|
|||||||
fingerprintId: fingerprintId,
|
fingerprintId: fingerprintId,
|
||||||
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:(){
|
getFingerprintsListData(isRefresh: true);
|
||||||
pageNo = 1;
|
|
||||||
getFingerprintsListData();
|
|
||||||
});
|
});
|
||||||
}else{
|
} else {
|
||||||
showToast('重置成功'.tr, something:(){
|
showToast('重置成功'.tr, something: () {
|
||||||
pageNo = 1;
|
getFingerprintsListData(isRefresh: true);
|
||||||
getFingerprintsListData();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -347,35 +390,39 @@ class FingerprintListLogic extends BaseGetXController{
|
|||||||
// 监听修改完详情之后刷新列表
|
// 监听修改完详情之后刷新列表
|
||||||
late StreamSubscription _teamEvent;
|
late StreamSubscription _teamEvent;
|
||||||
void _initRefreshAction() {
|
void _initRefreshAction() {
|
||||||
_teamEvent = eventBus.on<OtherTypeRefreshListEvent>().listen((OtherTypeRefreshListEvent event) {
|
_teamEvent = eventBus
|
||||||
pageNo = 1;
|
.on<OtherTypeRefreshListEvent>()
|
||||||
getFingerprintsListData();
|
.listen((OtherTypeRefreshListEvent event) {
|
||||||
|
getFingerprintsListData(isRefresh: true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
String getKeyType(FingerprintItemData fingerprintItemData){
|
String getKeyType(FingerprintItemData fingerprintItemData) {
|
||||||
// fingerprintStatus 1:正常 2:失效
|
// fingerprintStatus 1:正常 2:失效
|
||||||
String keyTypeStr = '';//
|
String keyTypeStr = ''; //
|
||||||
// (fingerprintItemData.fingerprintType! != 1) ? (fingerprintItemData.endDate! < DateTime.now().millisecondsSinceEpoch ? "已失效" : "") : ""
|
// (fingerprintItemData.fingerprintType! != 1) ? (fingerprintItemData.endDate! < DateTime.now().millisecondsSinceEpoch ? "已失效" : "") : ""
|
||||||
if(fingerprintItemData.fingerprintStatus == 1){
|
if (fingerprintItemData.fingerprintStatus == 1) {
|
||||||
if(fingerprintItemData.startDate! > DateTime.now().millisecondsSinceEpoch){
|
if (fingerprintItemData.startDate! >
|
||||||
|
DateTime.now().millisecondsSinceEpoch) {
|
||||||
keyTypeStr = '未生效'.tr;
|
keyTypeStr = '未生效'.tr;
|
||||||
}
|
}
|
||||||
|
} else if (fingerprintItemData.fingerprintStatus == 2) {
|
||||||
}else if(fingerprintItemData.fingerprintStatus == 2){
|
|
||||||
keyTypeStr = '已失效'.tr;
|
keyTypeStr = '已失效'.tr;
|
||||||
}
|
}
|
||||||
return keyTypeStr;
|
return keyTypeStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
String getKeyDateType(FingerprintItemData fingerprintItemData){
|
String getKeyDateType(FingerprintItemData fingerprintItemData) {
|
||||||
String keyDateTypeStr = '';// 永久:1;限时2,单次3,循环:4
|
String keyDateTypeStr = ''; // 永久:1;限时2,单次3,循环:4
|
||||||
if(fingerprintItemData.fingerprintType! == 1){
|
if (fingerprintItemData.fingerprintType! == 1) {
|
||||||
keyDateTypeStr = "${DateTool().dateToYMDHNString(fingerprintItemData.createDate.toString())} ${"永久".tr}";
|
keyDateTypeStr =
|
||||||
}else if(fingerprintItemData.fingerprintType! == 2){
|
"${DateTool().dateToYMDHNString(fingerprintItemData.createDate.toString())} ${"永久".tr}";
|
||||||
keyDateTypeStr = '${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())} 限时';
|
} else if (fingerprintItemData.fingerprintType! == 2) {
|
||||||
}else if(fingerprintItemData.fingerprintType! == 4){
|
keyDateTypeStr =
|
||||||
keyDateTypeStr = '${DateTool().dateToYMDString(fingerprintItemData.startDate.toString())}-${DateTool().dateToYMDString(fingerprintItemData.endDate.toString())} 循环';
|
'${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())} 限时';
|
||||||
|
} else if (fingerprintItemData.fingerprintType! == 4) {
|
||||||
|
keyDateTypeStr =
|
||||||
|
'${DateTool().dateToYMDString(fingerprintItemData.startDate.toString())}-${DateTool().dateToYMDString(fingerprintItemData.endDate.toString())} 循环';
|
||||||
}
|
}
|
||||||
return keyDateTypeStr;
|
return keyDateTypeStr;
|
||||||
}
|
}
|
||||||
@ -385,8 +432,8 @@ class FingerprintListLogic extends BaseGetXController{
|
|||||||
super.onReady();
|
super.onReady();
|
||||||
|
|
||||||
// 获取是否是演示模式 演示模式不获取接口
|
// 获取是否是演示模式 演示模式不获取接口
|
||||||
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
if(isDemoMode == false){
|
if (isDemoMode == false) {
|
||||||
_initReplySubscription();
|
_initReplySubscription();
|
||||||
|
|
||||||
_initRefreshAction();
|
_initRefreshAction();
|
||||||
@ -402,10 +449,10 @@ class FingerprintListLogic extends BaseGetXController{
|
|||||||
Future<void> onClose() async {
|
Future<void> onClose() async {
|
||||||
super.onClose();
|
super.onClose();
|
||||||
|
|
||||||
final bool? 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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
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';
|
||||||
@ -29,14 +28,17 @@ class FingerprintListPage extends StatefulWidget {
|
|||||||
State<FingerprintListPage> createState() => _FingerprintListPageState();
|
State<FingerprintListPage> createState() => _FingerprintListPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _FingerprintListPageState extends State<FingerprintListPage> with RouteAware {
|
class _FingerprintListPageState extends State<FingerprintListPage>
|
||||||
|
with RouteAware {
|
||||||
final logic = Get.put(FingerprintListLogic());
|
final logic = Get.put(FingerprintListLogic());
|
||||||
final state = Get.find<FingerprintListLogic>().state;
|
final state = Get.find<FingerprintListLogic>().state;
|
||||||
|
|
||||||
Future<void> getHttpData() async {
|
Future<void> getHttpData({required bool isRefresh}) async {
|
||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
if (isDemoMode == false) {
|
if (isDemoMode == false) {
|
||||||
logic.getFingerprintsListData().then((FingerprintListDataEntity value){
|
logic
|
||||||
|
.getFingerprintsListData(isRefresh: isRefresh)
|
||||||
|
.then((FingerprintListDataEntity value) {
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
@ -48,7 +50,7 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
getHttpData();
|
getHttpData(isRefresh: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -68,7 +70,8 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
|
|||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
var 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 = "1";
|
state.deletKeyID = "1";
|
||||||
state.deletFingerNo = 0;
|
state.deletFingerNo = 0;
|
||||||
@ -82,20 +85,18 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: EasyRefreshTool(
|
body: EasyRefreshTool(
|
||||||
onRefresh: (){
|
onRefresh: () {
|
||||||
logic.pageNo = 1;
|
getHttpData(isRefresh: true);
|
||||||
getHttpData();
|
|
||||||
},
|
},
|
||||||
onLoad: (){
|
onLoad: () {
|
||||||
getHttpData();
|
getHttpData(isRefresh: false);
|
||||||
},
|
},
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
KeySearchWidget(
|
KeySearchWidget(
|
||||||
editingController: state.searchController,
|
editingController: state.searchController,
|
||||||
onSubmittedAction: () {
|
onSubmittedAction: () {
|
||||||
logic.pageNo = 1;
|
getHttpData(isRefresh: true);
|
||||||
getHttpData();
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
@ -103,16 +104,16 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
|
|||||||
),
|
),
|
||||||
Expanded(child: _buildMainUI()),
|
Expanded(child: _buildMainUI()),
|
||||||
AddBottomWhiteBtn(
|
AddBottomWhiteBtn(
|
||||||
btnName: '${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.fingerprint!.tr}',
|
btnName:
|
||||||
|
'${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.fingerprint!.tr}',
|
||||||
onClick: () async {
|
onClick: () async {
|
||||||
var data =
|
var data = await Get.toNamed(Routers.addFingerprintTypePage,
|
||||||
await Get.toNamed(Routers.addFingerprintTypePage, arguments: {
|
arguments: {
|
||||||
"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;
|
getHttpData(isRefresh: true);
|
||||||
getHttpData();
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -126,61 +127,70 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
|
|||||||
Widget _buildMainUI() {
|
Widget _buildMainUI() {
|
||||||
return Obx(() => state.fingerprintItemListData.value.isNotEmpty
|
return Obx(() => state.fingerprintItemListData.value.isNotEmpty
|
||||||
? SlidableAutoCloseBehavior(
|
? SlidableAutoCloseBehavior(
|
||||||
child: ListView.separated(
|
child: ListView.separated(
|
||||||
itemCount: state.fingerprintItemListData.value.length,
|
itemCount: state.fingerprintItemListData.value.length,
|
||||||
itemBuilder: (c, index) {
|
itemBuilder: (c, index) {
|
||||||
FingerprintItemData fingerprintItemData = state.fingerprintItemListData.value[index];
|
FingerprintItemData fingerprintItemData =
|
||||||
// 指纹
|
state.fingerprintItemListData.value[index];
|
||||||
return Slidable(
|
// 指纹
|
||||||
key:ValueKey(fingerprintItemData.fingerprintId),
|
return Slidable(
|
||||||
endActionPane: ActionPane(
|
key: ValueKey(fingerprintItemData.fingerprintId),
|
||||||
extentRatio: 0.2,
|
endActionPane: ActionPane(
|
||||||
motion: const ScrollMotion(),
|
extentRatio: 0.2,
|
||||||
children: [
|
motion: const ScrollMotion(),
|
||||||
SlidableAction(
|
children: [
|
||||||
onPressed: (BuildContext context){
|
SlidableAction(
|
||||||
ShowTipView().showIosTipWithContentDialog("确定要删除吗?".tr, () async {
|
onPressed: (BuildContext context) {
|
||||||
state.isDeletAll = false;
|
ShowTipView().showIosTipWithContentDialog(
|
||||||
state.deletKeyID = fingerprintItemData.fingerprintId.toString();
|
"确定要删除吗?".tr, () async {
|
||||||
state.deletFingerNo = int.parse(fingerprintItemData.fingerprintNumber!);
|
state.isDeletAll = false;
|
||||||
logic.senderAddFingerprint();
|
state.deletKeyID =
|
||||||
});
|
fingerprintItemData.fingerprintId.toString();
|
||||||
},
|
state.deletFingerNo = int.parse(
|
||||||
backgroundColor: Colors.red,
|
fingerprintItemData.fingerprintNumber!);
|
||||||
// foregroundColor: Colors.white,
|
logic.senderAddFingerprint();
|
||||||
label: '删除'.tr,
|
});
|
||||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
},
|
||||||
),
|
backgroundColor: Colors.red,
|
||||||
],
|
// foregroundColor: Colors.white,
|
||||||
|
label: '删除'.tr,
|
||||||
|
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: _keyItem(
|
||||||
|
'images/icon_fingerprint.png',
|
||||||
|
fingerprintItemData.fingerprintName!,
|
||||||
|
logic.getKeyType(fingerprintItemData),
|
||||||
|
logic.getKeyDateType(fingerprintItemData), () async {
|
||||||
|
var data = await Get.toNamed(Routers.fingerprintDetailPage,
|
||||||
|
arguments: {
|
||||||
|
"fingerprintItemData": fingerprintItemData,
|
||||||
|
});
|
||||||
|
if (data != null) {
|
||||||
|
getHttpData(isRefresh: true);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
separatorBuilder: (BuildContext context, int index) {
|
||||||
|
return const Divider(
|
||||||
|
height: 1,
|
||||||
|
color: AppColors.greyLineColor,
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
child: _keyItem(
|
)
|
||||||
'images/icon_fingerprint.png',
|
: NoData(
|
||||||
fingerprintItemData.fingerprintName!,
|
noDataHeight: 1.sh -
|
||||||
logic.getKeyType(fingerprintItemData),
|
ScreenUtil().statusBarHeight -
|
||||||
logic.getKeyDateType(fingerprintItemData), () async {
|
ScreenUtil().bottomBarHeight -
|
||||||
var data = await Get.toNamed(
|
190.h -
|
||||||
Routers.fingerprintDetailPage,
|
64.h));
|
||||||
arguments: {
|
|
||||||
"fingerprintItemData": fingerprintItemData,
|
|
||||||
});
|
|
||||||
if (data != null) {
|
|
||||||
logic.pageNo = 1;
|
|
||||||
getHttpData();
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
separatorBuilder: (BuildContext context, int index) {
|
|
||||||
return const Divider(
|
|
||||||
height: 1,
|
|
||||||
color: AppColors.greyLineColor,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
) : NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 190.h - 64.h));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _keyItem(String lockTypeIcon, String lockTypeTitle, String ifInvalidation, String showTime, Function() action) {
|
Widget _keyItem(String lockTypeIcon, String lockTypeTitle,
|
||||||
|
String ifInvalidation, String showTime, Function() action) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: action,
|
onTap: action,
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -204,24 +214,24 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
|
|||||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: ifInvalidation.isNotEmpty ? 1.sw - 110.w - 100.w : 1.sw - 110.w - 50.w,
|
width: ifInvalidation.isNotEmpty
|
||||||
|
? 1.sw - 110.w - 100.w
|
||||||
|
: 1.sw - 110.w - 50.w,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Flexible(
|
Flexible(
|
||||||
child: Text(
|
child: Text(lockTypeTitle,
|
||||||
lockTypeTitle,
|
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor)
|
style: TextStyle(
|
||||||
),
|
fontSize: 24.sp,
|
||||||
|
color: AppColors.blackColor)),
|
||||||
),
|
),
|
||||||
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(ifInvalidation,
|
Text(ifInvalidation,
|
||||||
style: TextStyle(
|
style: TextStyle(fontSize: 22.sp, color: Colors.red)),
|
||||||
fontSize: 22.sp, color: Colors.red)),
|
|
||||||
SizedBox(width: 10.w),
|
SizedBox(width: 10.w),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -298,5 +308,4 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
|
|||||||
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
|
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
|
||||||
state.ifCurrentScreen.value = false;
|
state.ifCurrentScreen.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,13 +25,16 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
// 获取解析后的数据
|
// 获取解析后的数据
|
||||||
late StreamSubscription<Reply> _replySubscription;
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
void _initReplySubscription() {
|
void _initReplySubscription() {
|
||||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
|
_replySubscription =
|
||||||
|
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
|
||||||
// 添加卡片开始(重置锁里面所有卡)
|
// 添加卡片开始(重置锁里面所有卡)
|
||||||
if ((reply is SenderCustomPasswordsReply) && (state.ifCurrentScreen.value == true)) {
|
if ((reply is SenderCustomPasswordsReply) &&
|
||||||
|
(state.ifCurrentScreen.value == true)) {
|
||||||
_replyAddPassword(reply);
|
_replyAddPassword(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((reply is SenderResetPasswordsReply) && (state.ifCurrentScreen.value == true)) {
|
if ((reply is SenderResetPasswordsReply) &&
|
||||||
|
(state.ifCurrentScreen.value == true)) {
|
||||||
_replyResetPassword(reply);
|
_replyResetPassword(reply);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -49,10 +52,13 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
//无权限
|
//无权限
|
||||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey =
|
||||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList =
|
||||||
|
changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
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!);
|
||||||
|
|
||||||
final List<int> token = reply.data.sublist(5, 9);
|
final List<int> token = reply.data.sublist(5, 9);
|
||||||
@ -95,10 +101,13 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
//无权限
|
//无权限
|
||||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey =
|
||||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList =
|
||||||
|
changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
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!);
|
||||||
|
|
||||||
final List<int> token = reply.data.sublist(5, 9);
|
final List<int> token = reply.data.sublist(5, 9);
|
||||||
@ -131,11 +140,14 @@ 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) {
|
||||||
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!);
|
||||||
|
|
||||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey =
|
||||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList =
|
||||||
|
changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||||
final List<int> getTokenList = changeStringListToIntList(token!);
|
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
@ -182,11 +194,14 @@ 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) {
|
||||||
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!);
|
||||||
|
|
||||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey =
|
||||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList =
|
||||||
|
changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||||
final List<int> getTokenList = changeStringListToIntList(token!);
|
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
@ -255,26 +270,16 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
state.itemDataList.addAll(entity.data!.itemList!);
|
state.itemDataList.addAll(entity.data!.itemList!);
|
||||||
// 更新页码
|
// 更新页码
|
||||||
pageNo++;
|
pageNo++;
|
||||||
|
|
||||||
// if (pageNo == 1) {
|
|
||||||
// state.itemDataList.value.clear();
|
|
||||||
// state.itemDataList.value = entity.data!.itemList!;
|
|
||||||
// pageNo++;
|
|
||||||
// } else {
|
|
||||||
// if (entity.data!.itemList!.isNotEmpty) {
|
|
||||||
// state.itemDataList.value.addAll(entity.data!.itemList!);
|
|
||||||
// pageNo++;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
//密码钥匙重置请求
|
//密码钥匙重置请求
|
||||||
Future<void> resetPasswordKeyListRequest() async {
|
Future<void> resetPasswordKeyListRequest() async {
|
||||||
final PasswordKeyListEntity entity = await ApiRepository.to.keyboardPwdReset(
|
final PasswordKeyListEntity entity = await ApiRepository.to
|
||||||
lockId: state.keyInfo.value.lockId.toString(),
|
.keyboardPwdReset(
|
||||||
passwordKey: state.encrpyKey);
|
lockId: state.keyInfo.value.lockId.toString(),
|
||||||
|
passwordKey: state.encrpyKey);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast('重置成功'.tr, something: () {
|
showToast('重置成功'.tr, something: () {
|
||||||
pageNo = 1;
|
pageNo = 1;
|
||||||
@ -390,8 +395,9 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
StreamSubscription? _getPasswordListRefreshUIEvent;
|
StreamSubscription? _getPasswordListRefreshUIEvent;
|
||||||
void _getPasswordListRefreshUIAction() {
|
void _getPasswordListRefreshUIAction() {
|
||||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||||
_getPasswordListRefreshUIEvent =
|
_getPasswordListRefreshUIEvent = eventBus
|
||||||
eventBus.on<GetPasswordListRefreshUI>().listen((GetPasswordListRefreshUI event) {
|
.on<GetPasswordListRefreshUI>()
|
||||||
|
.listen((GetPasswordListRefreshUI event) {
|
||||||
mockNetworkDataRequest(isRefresh: true);
|
mockNetworkDataRequest(isRefresh: true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user