1,锁用户管理—即将到期列表—密码模块新增循环显示

2,锁用户管理—即将到期列表—修改已过期显示逻辑
3,锁用户管理—即将到期列表--删除指纹的文字提示要对应为确定删除指纹吗
This commit is contained in:
Daisy 2024-05-14 14:29:56 +08:00
parent 76347a27ee
commit 78581d580f
3 changed files with 163 additions and 164 deletions

View File

@ -1,4 +1,3 @@
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';
@ -23,8 +22,8 @@ class _ExpireFingerprintPageState extends State<ExpireFingerprintPage> {
final state = Get.find<ExpireFingerprintLogic>().state; final state = Get.find<ExpireFingerprintLogic>().state;
Future<void> getHttpData() async { Future<void> getHttpData() async {
logic.expirFingerprintListRequest().then((ExpireFingerprintEntity value){ logic.expirFingerprintListRequest().then((ExpireFingerprintEntity value) {
if(mounted) setState(() {}); if (mounted) setState(() {});
}); });
} }
@ -38,56 +37,62 @@ class _ExpireFingerprintPageState extends State<ExpireFingerprintPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return EasyRefreshTool( return EasyRefreshTool(
onRefresh: (){ onRefresh: () {
logic.pageNo = 1; logic.pageNo = 1;
getHttpData(); getHttpData();
}, },
onLoad: (){ onLoad: () {
getHttpData(); getHttpData();
}, },
child: Obx(() => _buildMainUI()) child: Obx(() => _buildMainUI()));
);
} }
Widget _buildMainUI() { Widget _buildMainUI() {
return state.dataList.isEmpty return state.dataList.isEmpty
? NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 190.h - 64.h) ? NoData(
noDataHeight: 1.sh -
ScreenUtil().statusBarHeight -
ScreenUtil().bottomBarHeight -
190.h -
64.h)
: SlidableAutoCloseBehavior( : SlidableAutoCloseBehavior(
child: ListView.separated( child: ListView.separated(
itemCount: state.dataList.length, itemCount: state.dataList.length,
itemBuilder: (c, index) { itemBuilder: (c, index) {
ExpireFingerprintItemEntity indexEntity = state.dataList[index]; ExpireFingerprintItemEntity indexEntity = state.dataList[index];
return Slidable( return Slidable(
key:ValueKey(indexEntity.uid), key: ValueKey(indexEntity.uid),
endActionPane: ActionPane( endActionPane: ActionPane(
extentRatio: 0.2, extentRatio: 0.2,
motion: const ScrollMotion(), motion: const ScrollMotion(),
children: [ children: [
SlidableAction( SlidableAction(
onPressed: (BuildContext context){ onPressed: (BuildContext context) {
ShowTipView().showIosTipWithContentDialog("确定删除卡吗?", (){ ShowTipView().showIosTipWithContentDialog("确定删除指纹吗?",
state.deletExpireFingerprintItemEntity = indexEntity; () {
logic.senderAddFingerprint(); state.deletExpireFingerprintItemEntity =
}); indexEntity;
}, logic.senderAddFingerprint();
backgroundColor: Colors.red, });
foregroundColor: Colors.white, },
label: '删除', backgroundColor: Colors.red,
padding: EdgeInsets.only(left: 5.w, right: 5.w), foregroundColor: Colors.white,
), label: '删除',
], padding: EdgeInsets.only(left: 5.w, right: 5.w),
),
],
),
child: _electronicKeyItem(indexEntity),
);
},
separatorBuilder: (BuildContext context, int index) {
return const Divider(
height: 1,
color: AppColors.greyLineColor,
);
},
), ),
child: _electronicKeyItem(indexEntity),
); );
},
separatorBuilder: (BuildContext context, int index) {
return const Divider(
height: 1,
color: AppColors.greyLineColor,
);
},
),
);
} }
Widget _electronicKeyItem(ExpireFingerprintItemEntity itemData) { Widget _electronicKeyItem(ExpireFingerprintItemEntity itemData) {
@ -156,8 +161,8 @@ class _ExpireFingerprintPageState extends State<ExpireFingerprintPage> {
), ),
Expanded( Expanded(
child: SizedBox( child: SizedBox(
width: 10.w, width: 10.w,
)), )),
Text( Text(
itemData.lockAlias ?? '', itemData.lockAlias ?? '',
style: TextStyle( style: TextStyle(
@ -216,8 +221,7 @@ class _ExpireFingerprintPageState extends State<ExpireFingerprintPage> {
), ),
child: Text( child: Text(
'${itemData.expireDate.toString()}', '${itemData.expireDate.toString()}',
style: TextStyle( style: TextStyle(color: Colors.white, fontSize: 13.sp),
color: Colors.white, fontSize: 13.sp),
), ),
); );
} else { } else {
@ -229,12 +233,10 @@ class _ExpireFingerprintPageState extends State<ExpireFingerprintPage> {
), ),
child: Text( child: Text(
'已过期', '已过期',
style: TextStyle( style: TextStyle(color: Colors.white, fontSize: 13.sp),
color: Colors.white, fontSize: 13.sp),
), ),
); );
} }
// } // }
} }
} }

View File

@ -1,4 +1,3 @@
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';
@ -13,8 +12,9 @@ class ExpirePasswordLogic extends BaseGetXController {
// //
Future<ExpirePasswordEntity> expirePasswordListRequest() async { Future<ExpirePasswordEntity> expirePasswordListRequest() async {
ExpirePasswordEntity entity = await ApiRepository.to.expirePasswordList(pageNo.toString(), pageSize.toString()); ExpirePasswordEntity entity = await ApiRepository.to
if(entity.errorCode!.codeIsSuccessful){ .expirePasswordList(pageNo.toString(), pageSize.toString());
if (entity.errorCode!.codeIsSuccessful) {
if (pageNo == 1) { if (pageNo == 1) {
state.dataList.value = entity.data!.list!; state.dataList.value = entity.data!.list!;
pageNo++; pageNo++;
@ -29,11 +29,12 @@ class ExpirePasswordLogic extends BaseGetXController {
} }
// deleteType:1- 2- // deleteType:1- 2-
Future<void> deletePwdRequest(ExpirePasswordItemData expirePasswordItemData) async { Future<void> deletePwdRequest(
ExpirePasswordItemData expirePasswordItemData) async {
PasswordKeyEntity entity = await ApiRepository.to.deleteKeyboardPwd( PasswordKeyEntity entity = await ApiRepository.to.deleteKeyboardPwd(
lockId:expirePasswordItemData.lockId.toString(), lockId: expirePasswordItemData.lockId.toString(),
keyboardPwdId:expirePasswordItemData.pwdId.toString(), keyboardPwdId: expirePasswordItemData.pwdId.toString(),
deleteType:1); deleteType: 1);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
showToast("删除成功", something: () { showToast("删除成功", something: () {
pageNo = 1; pageNo = 1;
@ -46,12 +47,13 @@ class ExpirePasswordLogic extends BaseGetXController {
//使 //使
String getExpireDateStr(ExpirePasswordItemData itemData) { String getExpireDateStr(ExpirePasswordItemData itemData) {
String useDateStr = ''; String useDateStr = '';
if(itemData.keyboardPwdType == 4){ //* getKeyType 1 2 3 4 5 6 7 8 9 10 11 12 13 14
if (itemData.keyboardPwdType! > 4) {
useDateStr = '循环'; useDateStr = '循环';
}else{ } else {
useDateStr = '${DateTool().dateToYMDString(itemData.startDate.toString())}-${DateTool().dateToYMDString(itemData.endDate.toString())}'; useDateStr =
'${DateTool().dateToYMDString(itemData.startDate.toString())}-${DateTool().dateToYMDString(itemData.endDate.toString())}';
} }
return useDateStr; return useDateStr;
} }
} }

View File

@ -1,10 +1,10 @@
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/appRouters.dart'; import 'package:star_lock/appRouters.dart';
import 'package:star_lock/app_settings/app_colors.dart'; import 'package:star_lock/app_settings/app_colors.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
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';
@ -24,8 +24,8 @@ class _ExpirePasswordPageState extends State<ExpirePasswordPage> {
final state = Get.find<ExpirePasswordLogic>().state; final state = Get.find<ExpirePasswordLogic>().state;
Future<void> getHttpData() async { Future<void> getHttpData() async {
logic.expirePasswordListRequest().then((ExpirePasswordEntity value){ logic.expirePasswordListRequest().then((ExpirePasswordEntity value) {
if(mounted) setState(() {}); if (mounted) setState(() {});
}); });
} }
@ -39,67 +39,73 @@ class _ExpirePasswordPageState extends State<ExpirePasswordPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return EasyRefreshTool( return EasyRefreshTool(
onRefresh: (){ onRefresh: () {
logic.pageNo = 1; logic.pageNo = 1;
getHttpData(); getHttpData();
}, },
onLoad: (){ onLoad: () {
getHttpData(); getHttpData();
}, },
child: Obx(() => _buildMainUI()) child: Obx(() => _buildMainUI()));
);
} }
Widget _buildMainUI() { Widget _buildMainUI() {
return state.dataList.isEmpty return state.dataList.isEmpty
? NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 190.h - 64.h) ? NoData(
noDataHeight: 1.sh -
ScreenUtil().statusBarHeight -
ScreenUtil().bottomBarHeight -
190.h -
64.h)
: SlidableAutoCloseBehavior( : SlidableAutoCloseBehavior(
child: ListView.separated( child: ListView.separated(
itemCount: state.dataList.length, itemCount: state.dataList.length,
itemBuilder: (c, index) { itemBuilder: (c, index) {
ExpirePasswordItemData indexEntity = state.dataList[index]; ExpirePasswordItemData indexEntity = state.dataList[index];
return Slidable( return Slidable(
key:ValueKey(indexEntity.uid), key: ValueKey(indexEntity.uid),
endActionPane: ActionPane( endActionPane: ActionPane(
extentRatio: 0.2, extentRatio: 0.2,
motion: const ScrollMotion(), motion: const ScrollMotion(),
children: [ children: [
SlidableAction( SlidableAction(
onPressed: (BuildContext context){ onPressed: (BuildContext context) {
ShowTipView().showIosTipWithContentDialog("确定删除该密码吗?", (){ ShowTipView().showIosTipWithContentDialog("确定删除该密码吗?",
logic.deletePwdRequest(indexEntity); () {
}); logic.deletePwdRequest(indexEntity);
}, });
backgroundColor: Colors.red, },
foregroundColor: Colors.white, backgroundColor: Colors.red,
label: '删除', foregroundColor: Colors.white,
padding: EdgeInsets.only(left: 5.w, right: 5.w), label: '删除',
), padding: EdgeInsets.only(left: 5.w, right: 5.w),
], ),
],
),
child: _electronicKeyItem(indexEntity),
);
},
separatorBuilder: (BuildContext context, int index) {
return const Divider(
height: 1,
color: AppColors.greyLineColor,
);
},
), ),
child: _electronicKeyItem(indexEntity),
); );
},
separatorBuilder: (BuildContext context, int index) {
return const Divider(
height: 1,
color: AppColors.greyLineColor,
);
},
),
);
} }
Widget _electronicKeyItem(ExpirePasswordItemData itemData) { Widget _electronicKeyItem(ExpirePasswordItemData itemData) {
return GestureDetector( return GestureDetector(
onTap: () async { onTap: () async {
// if(itemData.keyboardPwdType! == 4){ // if (itemData.keyboardPwdType! > 4) {
// // // //
// var data = await Get.toNamed(Routers.electronicKeyPeriodValidityPage, arguments: { // var data = await Get.toNamed(Routers.electronicKeyPeriodValidityPage,
// "pushType": 0, // arguments: {
// "expireLockItem": itemData, // "pushType": 0,
// }); // "expirePasswordItem": itemData,
// if(data != null) { // });
// if (data != null) {
// // setState(() { // // setState(() {
// // state.starDate.value = data["starDate"]; // // state.starDate.value = data["starDate"];
// // state.endDate.value = data["endDate"]; // // state.endDate.value = data["endDate"];
@ -110,19 +116,20 @@ class _ExpirePasswordPageState extends State<ExpirePasswordPage> {
// logic.pageNo = 1; // logic.pageNo = 1;
// getHttpData(); // getHttpData();
// } // }
// }else{ // } else {
// var data = await Get.toNamed(Routers.electronicKeyDetailChangeDate, arguments: { // var backData = await Get.toNamed(
// "pushType": 0, // Routers.passwordKeyDetailChangeDatePage,
// "expireLockItem": itemData, // arguments: {
// }); // 'itemData': itemData,
// if(data != null) {
// setState(() { // });
// // state.starDate.value = data["beginTimeTimestamp"].toString(); // if (backData != null) {
// // state.endDate.value = data["endTimeTimestamp"].toString(); // itemData.startDate =
// // state.keyType.value = 2; // int.parse(backData["beginTimeTimestamp"]) * 1000;
// logic.pageNo = 1; // itemData.endDate = int.parse(backData["endTimeTimestamp"]) * 1000;
// getHttpData(); // //
// }); // itemData.keyboardPwdType = 3;
// setState(() {});
// } // }
// } // }
}, },
@ -156,8 +163,8 @@ class _ExpirePasswordPageState extends State<ExpirePasswordPage> {
), ),
Expanded( Expanded(
child: SizedBox( child: SizedBox(
width: 10.w, width: 10.w,
)), )),
Text( Text(
itemData.lockAlias ?? '', itemData.lockAlias ?? '',
style: TextStyle( style: TextStyle(
@ -193,48 +200,36 @@ class _ExpirePasswordPageState extends State<ExpirePasswordPage> {
} }
Widget getStatus(ExpirePasswordItemData itemData) { Widget getStatus(ExpirePasswordItemData itemData) {
// if (itemData.keyboardPwdStatus! == 1) { //keyboardPwdStatus 1 2
// return Container( return Row(
// padding: EdgeInsets.only(left: 5.w, right: 5.w), children: [
// decoration: BoxDecoration( Visibility(
// color: Colors.red, visible: itemData.expireDate! > 0 ? true : false,
// borderRadius: BorderRadius.circular(2.0), child: Container(
// ), padding: EdgeInsets.only(left: 5.w, right: 5.w),
// child: Text( decoration: BoxDecoration(
// '未生效', color: AppColors.expireTextBgColor,
// style: TextStyle( borderRadius: BorderRadius.circular(2.0),
// color: Colors.white, fontSize: 13.sp), ),
// ), child: Text(
// ); '${itemData.expireDate.toString()}',
// } else { style: TextStyle(color: Colors.white, fontSize: 13.sp),
if (itemData.expireDate! > 0) { ),
return Container( )),
padding: EdgeInsets.only(left: 5.w, right: 5.w), Visibility(
decoration: BoxDecoration( visible: itemData.keyboardPwdStatus! == 2 ? true : false,
color: AppColors.expireTextBgColor, child: Container(
borderRadius: BorderRadius.circular(2.0), padding: EdgeInsets.only(left: 5.w, right: 5.w),
), decoration: BoxDecoration(
child: Text( color: Colors.red,
'${itemData.expireDate.toString()}', borderRadius: BorderRadius.circular(2.0),
style: TextStyle( ),
color: Colors.white, fontSize: 13.sp), child: Text(
), '已过期'.tr,
); style: TextStyle(color: Colors.white, fontSize: 13.sp),
} else { ),
return Container( ))
padding: EdgeInsets.only(left: 5.w, right: 5.w), ],
decoration: BoxDecoration( );
color: Colors.red,
borderRadius: BorderRadius.circular(2.0),
),
child: Text(
'已过期',
style: TextStyle(
color: Colors.white, fontSize: 13.sp),
),
);
}
// }
} }
} }