Merge branch 'master' of gitee.com:starlock-cn/app-starlock
This commit is contained in:
commit
fe4b3ebaef
@ -0,0 +1,34 @@
|
|||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_state.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||||
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import 'package:star_lock/tools/toast.dart';
|
||||||
|
|
||||||
|
class ElectronicKeyDetailLogic extends BaseGetXController {
|
||||||
|
final ElectronicKeyDetailState state = ElectronicKeyDetailState();
|
||||||
|
|
||||||
|
//修改钥匙名称请求
|
||||||
|
Future<void> modifyKeyNameRequest() async {
|
||||||
|
KeyOperationRecordEntity entity = await ApiRepository.to
|
||||||
|
.modifyKeyNameForAdmin(state.itemData.value.keyId.toString(),
|
||||||
|
state.changeNameController.text, '');
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
print("修改要是名称成功啦啦啦啦啦");
|
||||||
|
Toast.show(msg: "修改成功");
|
||||||
|
Get.back();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除电子钥匙名称请求
|
||||||
|
Future<void> deleteKeyRequest() async {
|
||||||
|
ElectronicKeyListEntity entity = await ApiRepository.to
|
||||||
|
.deleteElectronicKey(state.itemData.value.keyId.toString());
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
print("删除电子钥匙成功");
|
||||||
|
Toast.show(msg: "删除成功");
|
||||||
|
Get.back();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -3,12 +3,9 @@ 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/common/XSConstantMacro/XSConstantMacro.dart';
|
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
|
||||||
import 'package:star_lock/tools/jh_pop_menus.dart';
|
import 'package:star_lock/tools/jh_pop_menus.dart';
|
||||||
import 'package:star_lock/tools/toast.dart';
|
|
||||||
|
|
||||||
import '../../../../../appRouters.dart';
|
import '../../../../../appRouters.dart';
|
||||||
import '../../../../../app_settings/app_colors.dart';
|
import '../../../../../app_settings/app_colors.dart';
|
||||||
@ -28,16 +25,11 @@ class ElectronicKeyDetailPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||||
final TextEditingController _changeNameController = TextEditingController();
|
final logic = Get.put(ElectronicKeyDetailLogic());
|
||||||
ElectronicKeyListItem itemData = ElectronicKeyListItem();
|
final state = Get.find<ElectronicKeyDetailLogic>().state;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
dynamic obj = ModalRoute.of(context)?.settings.arguments;
|
|
||||||
if (obj != null && (obj["itemData"] != null)) {
|
|
||||||
itemData = obj["itemData"];
|
|
||||||
}
|
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
resizeToAvoidBottomInset: false,
|
resizeToAvoidBottomInset: false,
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
@ -68,38 +60,29 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
|||||||
children: [
|
children: [
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
||||||
rightTitle: _changeNameController.text.isNotEmpty
|
rightTitle: state.changeNameController.text.isNotEmpty
|
||||||
? _changeNameController.text
|
? state.changeNameController.text
|
||||||
: itemData.keyName,
|
: state.itemData.value.keyName,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
action: () {
|
action: () {
|
||||||
showCupertinoAlertDialog(context);
|
showCupertinoAlertDialog(context);
|
||||||
}),
|
}),
|
||||||
CommonItem(
|
getPeriodValidityWidget(),
|
||||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
|
||||||
allHeight: 90.h,
|
|
||||||
rightTitle: getUseDateStr(itemData),
|
|
||||||
isHaveDirection: true,
|
|
||||||
action: () {
|
|
||||||
Navigator.pushNamed(
|
|
||||||
context, Routers.electronicKeyDetailChangeDate,
|
|
||||||
arguments: {"itemData": itemData});
|
|
||||||
}),
|
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.receiver!.tr,
|
leftTitel: TranslationLoader.lanKeys!.receiver!.tr,
|
||||||
rightTitle: itemData.username,
|
rightTitle: state.itemData.value.username,
|
||||||
action: () {}),
|
action: () {}),
|
||||||
const SizedBox(height: 1),
|
const SizedBox(height: 1),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.sender!.tr,
|
leftTitel: TranslationLoader.lanKeys!.sender!.tr,
|
||||||
rightTitle: itemData.senderUsername,
|
rightTitle: state.itemData.value.senderUsername,
|
||||||
action: () {}),
|
action: () {}),
|
||||||
const SizedBox(height: 1),
|
const SizedBox(height: 1),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.senderTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.senderTime!.tr,
|
||||||
rightTitle: getSenderDate(itemData),
|
rightTitle: getSenderDate(state.itemData.value),
|
||||||
action: () {}),
|
action: () {}),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
@ -108,8 +91,9 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
|||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
rightWidget: SizedBox(
|
rightWidget: SizedBox(
|
||||||
width: 60.w,
|
width: 60.w,
|
||||||
child:
|
child: _switch(state.itemData.value.faceAuthentication == 1
|
||||||
_switch(itemData.faceAuthentication == 1 ? true : false)),
|
? true
|
||||||
|
: false)),
|
||||||
action: () {}),
|
action: () {}),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
@ -119,8 +103,8 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
|||||||
action: () {
|
action: () {
|
||||||
Navigator.pushNamed(context, Routers.keyOperationRecordPage,
|
Navigator.pushNamed(context, Routers.keyOperationRecordPage,
|
||||||
arguments: {
|
arguments: {
|
||||||
'lockId': itemData.lockId.toString(),
|
'lockId': state.itemData.value.lockId.toString(),
|
||||||
'keyId': itemData.keyId.toString()
|
'keyId': state.itemData.value.keyId.toString()
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
Container(height: 40.h),
|
Container(height: 40.h),
|
||||||
@ -139,106 +123,136 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//使用期限
|
//根据类型获取限时有效期样式
|
||||||
String getUseDateStr(ElectronicKeyListItem indexEntity) {
|
Widget getPeriodValidityWidget() {
|
||||||
String useDateStr = '';
|
int? dateType = state.itemData.value.keyType;
|
||||||
if (indexEntity.keyType == XSConstantMacro.keyTypeTime) {
|
if (dateType == XSConstantMacro.keyTypeLong) {
|
||||||
//限期
|
return getLongTypeDateWidget();
|
||||||
DateTime startDateStr =
|
} else if (dateType == XSConstantMacro.keyTypeTime) {
|
||||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
|
return getTimeLimitTypeDateWidget();
|
||||||
DateTime endDateStr =
|
} else if (dateType == XSConstantMacro.keyTypeOnce) {
|
||||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
|
return getOnceTypeDateWidget();
|
||||||
useDateStr =
|
} else if (dateType == XSConstantMacro.keyTypeLoop) {
|
||||||
'${startDateStr.toLocal().toString().substring(0, 16)}\n${endDateStr.toLocal().toString().substring(0, 16)}';
|
return getLoopTypeDateWidget();
|
||||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) {
|
|
||||||
//永久
|
|
||||||
// DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
|
|
||||||
// useDateStr = '${dateStr.toLocal().toString().substring(0, 16)}\n 永久';
|
|
||||||
useDateStr = '永久';
|
|
||||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) {
|
|
||||||
//单次
|
|
||||||
// DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
|
|
||||||
// useDateStr = '${dateStr.toLocal().toString().substring(0, 16)}\n 单次';
|
|
||||||
useDateStr = '单次';
|
|
||||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) {
|
|
||||||
//循环
|
|
||||||
useDateStr = '循环';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return useDateStr;
|
return Container();
|
||||||
|
}
|
||||||
|
|
||||||
|
//永久钥匙
|
||||||
|
Widget getLongTypeDateWidget() {
|
||||||
|
return CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||||
|
rightTitle: '永久',
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
Navigator.pushNamed(context, Routers.electronicKeyDetailChangeDate,
|
||||||
|
arguments: {"itemData": state.itemData.value});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//限时钥匙
|
||||||
|
Widget getTimeLimitTypeDateWidget() {
|
||||||
|
DateTime startDateStr =
|
||||||
|
DateTime.fromMillisecondsSinceEpoch(state.itemData.value.startDate!);
|
||||||
|
DateTime endDateStr =
|
||||||
|
DateTime.fromMillisecondsSinceEpoch(state.itemData.value.endDate!);
|
||||||
|
String useDateStr =
|
||||||
|
'${startDateStr.toLocal().toString().substring(0, 16)}\n${endDateStr.toLocal().toString().substring(0, 16)}';
|
||||||
|
|
||||||
|
return CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||||
|
allHeight: 90.h,
|
||||||
|
rightTitle: useDateStr,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
Navigator.pushNamed(context, Routers.electronicKeyDetailChangeDate,
|
||||||
|
arguments: {"itemData": state.itemData.value});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//单次钥匙
|
||||||
|
Widget getOnceTypeDateWidget() {
|
||||||
|
return CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||||
|
rightTitle: '单次',
|
||||||
|
isHaveDirection: false,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//循环钥匙
|
||||||
|
Widget getLoopTypeDateWidget() {
|
||||||
|
DateTime startDateStr =
|
||||||
|
DateTime.fromMillisecondsSinceEpoch(state.itemData.value.startDate!);
|
||||||
|
DateTime endDateStr =
|
||||||
|
DateTime.fromMillisecondsSinceEpoch(state.itemData.value.endDate!);
|
||||||
|
String useDateStr =
|
||||||
|
'${startDateStr.toLocal().toString().substring(0, 16)} \n ${endDateStr.toLocal().toString().substring(0, 16)}';
|
||||||
|
|
||||||
|
List getEffectiveDateList = [];
|
||||||
|
List weekDaysList = state.itemData.value.weekDays!;
|
||||||
|
if (weekDaysList.isNotEmpty) {
|
||||||
|
String effectiveDateStr = '';
|
||||||
|
for (int i = 0; i < weekDaysList.length; i++) {
|
||||||
|
if (weekDaysList[i] == 1) {
|
||||||
|
effectiveDateStr = '一';
|
||||||
|
getEffectiveDateList.add(effectiveDateStr);
|
||||||
|
} else if (weekDaysList[i] == 2) {
|
||||||
|
effectiveDateStr = '二';
|
||||||
|
getEffectiveDateList.add(effectiveDateStr);
|
||||||
|
} else if (weekDaysList[i] == 3) {
|
||||||
|
effectiveDateStr = '三';
|
||||||
|
getEffectiveDateList.add(effectiveDateStr);
|
||||||
|
} else if (weekDaysList[i] == 4) {
|
||||||
|
effectiveDateStr = '四';
|
||||||
|
getEffectiveDateList.add(effectiveDateStr);
|
||||||
|
} else if (weekDaysList[i] == 5) {
|
||||||
|
effectiveDateStr = '五';
|
||||||
|
getEffectiveDateList.add(effectiveDateStr);
|
||||||
|
} else if (weekDaysList[i] == 6) {
|
||||||
|
effectiveDateStr = '六';
|
||||||
|
getEffectiveDateList.add(effectiveDateStr);
|
||||||
|
} else if (weekDaysList[i] == 7) {
|
||||||
|
effectiveDateStr = '日';
|
||||||
|
getEffectiveDateList.add(effectiveDateStr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||||
|
allHeight: 90.h,
|
||||||
|
rightTitle: useDateStr,
|
||||||
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () {
|
||||||
|
Navigator.pushNamed(
|
||||||
|
context, Routers.electronicKeyPeriodValidityPage);
|
||||||
|
}),
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: '有效日',
|
||||||
|
rightTitle: getEffectiveDateList.map((e) => e.toString()).join(','),
|
||||||
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () {
|
||||||
|
Navigator.pushNamed(
|
||||||
|
context, Routers.electronicKeyPeriodValidityPage);
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//发送时间
|
//发送时间
|
||||||
String getSenderDate(ElectronicKeyListItem indexEntity) {
|
String getSenderDate(ElectronicKeyListItem indexEntity) {
|
||||||
String senderDate = '';
|
String senderDate = '';
|
||||||
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!);
|
DateTime dateStr =
|
||||||
|
DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!);
|
||||||
senderDate = dateStr.toLocal().toString().substring(0, 16);
|
senderDate = dateStr.toLocal().toString().substring(0, 16);
|
||||||
return senderDate;
|
return senderDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Widget commonItem(String leftTitle, String rightTitle,
|
|
||||||
// {bool isHaveDirection = false,
|
|
||||||
// bool isHaveLine = false,
|
|
||||||
// bool isHaveRightWidget = false,
|
|
||||||
// Widget? rightWidget,
|
|
||||||
// Function()? action}) {
|
|
||||||
// return GestureDetector(
|
|
||||||
// onTap: action,
|
|
||||||
// child: Column(
|
|
||||||
// // mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
// children: [
|
|
||||||
// Container(
|
|
||||||
// // height: 80.h,
|
|
||||||
// color: Colors.white,
|
|
||||||
// padding: EdgeInsets.only(
|
|
||||||
// left: 20.w, right: 10.w, top: 20.w, bottom: 20.w),
|
|
||||||
// child: Row(
|
|
||||||
// children: [
|
|
||||||
// SizedBox(width: 20.w),
|
|
||||||
// Text(
|
|
||||||
// leftTitle,
|
|
||||||
// style:
|
|
||||||
// TextStyle(fontSize: 28.sp, fontWeight: FontWeight.w500),
|
|
||||||
// ),
|
|
||||||
// SizedBox(width: 20.w),
|
|
||||||
// Expanded(
|
|
||||||
// child: Row(
|
|
||||||
// mainAxisAlignment: MainAxisAlignment.end,
|
|
||||||
// children: [
|
|
||||||
// isHaveRightWidget
|
|
||||||
// ? rightWidget!
|
|
||||||
// : Text(
|
|
||||||
// rightTitle,
|
|
||||||
// textAlign: TextAlign.end,
|
|
||||||
// style: TextStyle(
|
|
||||||
// fontSize: 28.sp, fontWeight: FontWeight.w500),
|
|
||||||
// )
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// SizedBox(width: 5.w),
|
|
||||||
// isHaveDirection
|
|
||||||
// ? Image.asset(
|
|
||||||
// 'images/icon_right.png',
|
|
||||||
// width: 50.w,
|
|
||||||
// height: 50.w,
|
|
||||||
// )
|
|
||||||
// : SizedBox(width: 10.w),
|
|
||||||
// // SizedBox(width:10.w),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// isHaveLine
|
|
||||||
// ? Container(
|
|
||||||
// height: 0.5.h,
|
|
||||||
// color: Colors.grey,
|
|
||||||
// )
|
|
||||||
// : Container()
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
CupertinoSwitch _switch(isOn) {
|
CupertinoSwitch _switch(isOn) {
|
||||||
return CupertinoSwitch(
|
return CupertinoSwitch(
|
||||||
activeColor: CupertinoColors.activeBlue,
|
activeColor: CupertinoColors.activeBlue,
|
||||||
@ -253,33 +267,6 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//修改钥匙名称请求
|
|
||||||
Future<void> modifyKeyNameRequest() async {
|
|
||||||
KeyOperationRecordEntity entity = await ApiRepository.to
|
|
||||||
.modifyKeyNameForAdmin(
|
|
||||||
itemData.keyId.toString(), _changeNameController.text, '');
|
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
|
||||||
print("修改要是名称成功啦啦啦啦啦");
|
|
||||||
Toast.show(msg: "修改成功");
|
|
||||||
setState(() {
|
|
||||||
Navigator.pop(context);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//删除电子钥匙名称请求
|
|
||||||
Future<void> deleteKeyRequest() async {
|
|
||||||
ElectronicKeyListEntity entity =
|
|
||||||
await ApiRepository.to.deleteElectronicKey(itemData.keyId.toString());
|
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
|
||||||
print("删除电子钥匙成功");
|
|
||||||
Toast.show(msg: "删除成功");
|
|
||||||
setState(() {
|
|
||||||
Navigator.pop(context, true);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void showCupertinoAlertDialog(BuildContext context) {
|
void showCupertinoAlertDialog(BuildContext context) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
@ -288,11 +275,11 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
|||||||
title:
|
title:
|
||||||
"${TranslationLoader.lanKeys!.amend!.tr} ${TranslationLoader.lanKeys!.name!.tr}",
|
"${TranslationLoader.lanKeys!.amend!.tr} ${TranslationLoader.lanKeys!.name!.tr}",
|
||||||
tipTitle: "请输入",
|
tipTitle: "请输入",
|
||||||
controller: _changeNameController,
|
controller: state.changeNameController,
|
||||||
sureClick: () {
|
sureClick: () {
|
||||||
//发送编辑钥匙名称请求
|
//发送编辑钥匙名称请求
|
||||||
if (_changeNameController.text.isNotEmpty) {
|
if (state.changeNameController.text.isNotEmpty) {
|
||||||
modifyKeyNameRequest();
|
logic.modifyKeyNameRequest();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
cancelClick: () {
|
cancelClick: () {
|
||||||
@ -304,7 +291,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void showIosTipViewDialog(BuildContext context) {
|
void showIosTipViewDialog(BuildContext context) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return ShowIosTipView(
|
return ShowIosTipView(
|
||||||
@ -312,14 +299,12 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
|||||||
tipTitle: "确定要删除吗?",
|
tipTitle: "确定要删除吗?",
|
||||||
sureClick: () {
|
sureClick: () {
|
||||||
Get.back();
|
Get.back();
|
||||||
deleteKeyRequest();
|
logic.deleteKeyRequest();
|
||||||
},
|
},
|
||||||
cancelClick: () {
|
cancelClick: () {
|
||||||
Get.back();
|
Get.back();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,13 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||||
|
|
||||||
|
class ElectronicKeyDetailState {
|
||||||
|
final itemData = ElectronicKeyListItem().obs;
|
||||||
|
final TextEditingController changeNameController = TextEditingController();
|
||||||
|
|
||||||
|
ElectronicKeyDetailState() {
|
||||||
|
Map map = Get.arguments;
|
||||||
|
itemData.value = map["itemData"];
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -270,6 +270,8 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
|||||||
//使用期限
|
//使用期限
|
||||||
String getUseDateStr(ElectronicKeyListItem indexEntity) {
|
String getUseDateStr(ElectronicKeyListItem indexEntity) {
|
||||||
String useDateStr = '';
|
String useDateStr = '';
|
||||||
|
DateTime sendDateStr =
|
||||||
|
DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!);
|
||||||
if (indexEntity.keyType == XSConstantMacro.keyTypeTime) {
|
if (indexEntity.keyType == XSConstantMacro.keyTypeTime) {
|
||||||
//限期
|
//限期
|
||||||
DateTime startDateStr =
|
DateTime startDateStr =
|
||||||
@ -280,14 +282,11 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
|||||||
'${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}';
|
'${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}';
|
||||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) {
|
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) {
|
||||||
//永久
|
//永久
|
||||||
// DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
|
useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} 永久';
|
||||||
// useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 永久';
|
|
||||||
useDateStr = "永久";
|
|
||||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) {
|
} else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) {
|
||||||
//单次
|
//单次
|
||||||
// DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
|
|
||||||
// useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 单次';
|
|
||||||
useDateStr = "单次";
|
useDateStr = "单次";
|
||||||
|
useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} 单次';
|
||||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) {
|
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) {
|
||||||
//循环
|
//循环
|
||||||
useDateStr = '循环';
|
useDateStr = '循环';
|
||||||
|
|||||||
@ -229,11 +229,29 @@ class _ElectronicKeyPeriodValidityPageState
|
|||||||
if ((state.selectIndexList.value.isNotEmpty &&
|
if ((state.selectIndexList.value.isNotEmpty &&
|
||||||
state.isHaveEffectiveDate.value == true &&
|
state.isHaveEffectiveDate.value == true &&
|
||||||
state.isHaveFailureDate.value == true)) {
|
state.isHaveFailureDate.value == true)) {
|
||||||
Map<String, dynamic> resultMap = {};
|
DateTime startDateTime = DateTime(
|
||||||
resultMap['validityValue'] = state.selectIndexList.value;
|
state.effectiveDateTime.value.year,
|
||||||
resultMap['starDate'] = state.effectiveDateTime.value;
|
state.effectiveDateTime.value.month,
|
||||||
resultMap['endDate'] = state.failureDateTime.value;
|
state.effectiveDateTime.value.day,
|
||||||
Navigator.pop(context, resultMap);
|
state.effectiveDateTime.value.hour,
|
||||||
|
state.effectiveDateTime.value.minute);
|
||||||
|
DateTime endDateTime = DateTime(
|
||||||
|
state.failureDateTime.value.year,
|
||||||
|
state.failureDateTime.value.month,
|
||||||
|
state.failureDateTime.value.day,
|
||||||
|
state.failureDateTime.value.hour,
|
||||||
|
state.failureDateTime.value.minute);
|
||||||
|
//时间判断
|
||||||
|
if (!startDateTime.isBefore(endDateTime) ||
|
||||||
|
startDateTime.isAtSameMomentAs(endDateTime)) {
|
||||||
|
Toast.show(msg: '失效时间需大于生效时间');
|
||||||
|
} else {
|
||||||
|
Map<String, dynamic> resultMap = {};
|
||||||
|
resultMap['validityValue'] = state.selectIndexList.value;
|
||||||
|
resultMap['starDate'] = state.effectiveDateTime.value;
|
||||||
|
resultMap['endDate'] = state.failureDateTime.value;
|
||||||
|
Navigator.pop(context, resultMap);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})),
|
})),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -271,17 +271,27 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
btnName: TranslationLoader.lanKeys!.send!.tr,
|
btnName: TranslationLoader.lanKeys!.send!.tr,
|
||||||
onClick: () {
|
onClick: () {
|
||||||
if (isDemoMode == false) {
|
if (isDemoMode == false) {
|
||||||
|
DateTime startDateTime = DateTime(
|
||||||
|
state.effectiveDateTime.value.year,
|
||||||
|
state.effectiveDateTime.value.month,
|
||||||
|
state.effectiveDateTime.value.day,
|
||||||
|
state.effectiveDateTime.value.hour,
|
||||||
|
state.effectiveDateTime.value.minute);
|
||||||
|
DateTime endDateTime = DateTime(
|
||||||
|
state.failureDateTime.value.year,
|
||||||
|
state.failureDateTime.value.month,
|
||||||
|
state.failureDateTime.value.day,
|
||||||
|
state.failureDateTime.value.hour,
|
||||||
|
state.failureDateTime.value.minute);
|
||||||
//发送钥匙请求
|
//发送钥匙请求
|
||||||
if (state.emailOrPhoneController.text.isNotEmpty &&
|
if (state.emailOrPhoneController.text.isNotEmpty &&
|
||||||
state.keyNameController.text.isNotEmpty) {
|
state.keyNameController.text.isNotEmpty) {
|
||||||
if (int.parse(widget.type) == 0) {
|
if (int.parse(widget.type) == 0) {
|
||||||
//失效时间大于生效时间
|
if (!startDateTime.isBefore(endDateTime) ||
|
||||||
if (state.failureDateTime.value
|
startDateTime.isAtSameMomentAs(endDateTime)) {
|
||||||
.compareTo(state.effectiveDateTime.value) ==
|
|
||||||
1) {
|
|
||||||
logic.sendElectronicKeyRequest(context);
|
|
||||||
} else {
|
|
||||||
Toast.show(msg: '失效时间需大于生效时间');
|
Toast.show(msg: '失效时间需大于生效时间');
|
||||||
|
} else {
|
||||||
|
logic.sendElectronicKeyRequest(context);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logic.sendElectronicKeyRequest(context);
|
logic.sendElectronicKeyRequest(context);
|
||||||
|
|||||||
@ -0,0 +1,38 @@
|
|||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_state.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart';
|
||||||
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import 'package:star_lock/tools/toast.dart';
|
||||||
|
|
||||||
|
class PasswordKeyDetailLogic extends BaseGetXController {
|
||||||
|
final PasswordKeyDetailState state = PasswordKeyDetailState();
|
||||||
|
|
||||||
|
//删除密码请求 deleteType:1-蓝牙 2-网关
|
||||||
|
Future<void> deletePwdRequest() async {
|
||||||
|
PasswordKeyEntity entity = await ApiRepository.to.deleteKeyboardPwd(
|
||||||
|
state.itemData.value.lockId.toString(),
|
||||||
|
state.itemData.value.keyboardPwdId.toString(),
|
||||||
|
1);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
Toast.show(msg: "删除成功");
|
||||||
|
Get.back();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//更新密码请求
|
||||||
|
Future<void> updatePwdRequest() async {
|
||||||
|
PasswordKeyEntity entity = await ApiRepository.to.updatePasswordKey(
|
||||||
|
state.itemData.value.lockId.toString(),
|
||||||
|
state.itemData.value.keyboardPwdId.toString(),
|
||||||
|
state.inputNameController.text,
|
||||||
|
state.inputPwdController.text,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'');
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
Toast.show(msg: "修改成功");
|
||||||
|
Get.back();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,12 +2,9 @@ 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/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.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/passwordKey_perpetual/passwordKeyEntity.dart';
|
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
|
||||||
import 'package:star_lock/tools/showTFView.dart';
|
import 'package:star_lock/tools/showTFView.dart';
|
||||||
import 'package:star_lock/tools/toast.dart';
|
|
||||||
|
|
||||||
import '../../../../appRouters.dart';
|
import '../../../../appRouters.dart';
|
||||||
import '../../../../app_settings/app_colors.dart';
|
import '../../../../app_settings/app_colors.dart';
|
||||||
@ -25,25 +22,12 @@ class PasswordKeyDetailPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
||||||
PasswordKeyListItem itemData = PasswordKeyListItem();
|
|
||||||
late TextEditingController _inputPwdController;
|
|
||||||
late TextEditingController _inputNameController;
|
|
||||||
static const methodChannel = MethodChannel('talkPlugin');
|
static const methodChannel = MethodChannel('talkPlugin');
|
||||||
|
final logic = Get.put(PasswordKeyDetailLogic());
|
||||||
@override
|
final state = Get.find<PasswordKeyDetailLogic>().state;
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
|
|
||||||
_inputPwdController = TextEditingController();
|
|
||||||
_inputNameController = TextEditingController();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
dynamic obj = ModalRoute.of(context)?.settings.arguments;
|
|
||||||
if (obj != null && (obj["itemData"] != null)) {
|
|
||||||
itemData = obj["itemData"];
|
|
||||||
}
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
@ -68,45 +52,52 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
|||||||
children: [
|
children: [
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.password!.tr,
|
leftTitel: TranslationLoader.lanKeys!.password!.tr,
|
||||||
rightTitle: _inputPwdController.text.isNotEmpty
|
rightTitle: state.inputPwdController.text.isNotEmpty
|
||||||
? _inputPwdController.text
|
? state.inputPwdController.text
|
||||||
: itemData.keyboardPwd,
|
: state.itemData.value.keyboardPwd,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
action: () {
|
action: () {
|
||||||
showCupertinoAlertDialog(context, _inputPwdController);
|
showCupertinoAlertDialog(context, state.inputPwdController);
|
||||||
}),
|
}),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
||||||
rightTitle: _inputNameController.text.isNotEmpty
|
rightTitle: state.inputNameController.text.isNotEmpty
|
||||||
? _inputNameController.text
|
? state.inputNameController.text
|
||||||
: itemData.keyboardPwdName,
|
: state.itemData.value.keyboardPwdName,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
action: () {
|
action: () {
|
||||||
showCupertinoAlertDialog(context, _inputNameController);
|
showCupertinoAlertDialog(
|
||||||
|
context, state.inputNameController);
|
||||||
}),
|
}),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||||
rightTitle: "永久",
|
rightTitle: getUseDateStr(),
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
|
allHeight:
|
||||||
|
state.itemData.value.keyboardPwdType == 3 ? 90.h : 65.h,
|
||||||
action: () {
|
action: () {
|
||||||
|
if (state.itemData.value.keyboardPwdType! > 4 &&
|
||||||
|
state.itemData.value.keyboardPwdType! < 15) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
Navigator.pushNamed(
|
Navigator.pushNamed(
|
||||||
context, Routers.electronicKeyDetailChangeDate,
|
context, Routers.electronicKeyDetailChangeDate,
|
||||||
arguments: {
|
arguments: {
|
||||||
'lockId': itemData.lockId.toString(),
|
'lockId': state.itemData.value.lockId.toString(),
|
||||||
'pwdId': itemData.keyboardPwdId.toString()
|
'pwdId': state.itemData.value.keyboardPwdId.toString()
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.sender!.tr,
|
leftTitel: TranslationLoader.lanKeys!.sender!.tr,
|
||||||
rightTitle: itemData.senderUsername,
|
rightTitle: state.itemData.value.senderUsername,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
action: () {}),
|
action: () {}),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.senderTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.senderTime!.tr,
|
||||||
rightTitle: getSenderDate(itemData),
|
rightTitle: getSenderDate(state.itemData.value),
|
||||||
action: () {}),
|
action: () {}),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
@ -116,8 +107,8 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
|||||||
action: () {
|
action: () {
|
||||||
Navigator.pushNamed(context, Routers.keyOperationRecordPage,
|
Navigator.pushNamed(context, Routers.keyOperationRecordPage,
|
||||||
arguments: {
|
arguments: {
|
||||||
'lockId': itemData.lockId.toString(),
|
'lockId': state.itemData.value.lockId.toString(),
|
||||||
'keyId': itemData.keyboardPwdId.toString()
|
'keyId': state.itemData.value.keyboardPwdId.toString()
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
Container(height: 40.h),
|
Container(height: 40.h),
|
||||||
@ -129,9 +120,10 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
|||||||
// backgroundColor: Colors.white,
|
// backgroundColor: Colors.white,
|
||||||
side: BorderSide(width: 1, color: AppColors.mainColor)),
|
side: BorderSide(width: 1, color: AppColors.mainColor)),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pushNamed(context, Routers.cardListPage, arguments: {
|
Navigator.pushNamed(context, Routers.cardListPage,
|
||||||
"lockId": itemData.lockId,
|
arguments: {
|
||||||
});
|
"lockId": state.itemData.value.lockId,
|
||||||
|
});
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
'设置卡',
|
'设置卡',
|
||||||
@ -150,12 +142,15 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
|||||||
// backgroundColor: Colors.white,
|
// backgroundColor: Colors.white,
|
||||||
side: BorderSide(width: 1, color: AppColors.mainColor)),
|
side: BorderSide(width: 1, color: AppColors.mainColor)),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pushNamed(
|
Navigator.pushNamed(context, Routers.fingerprintListPage,
|
||||||
context, Routers.fingerprintListPage,arguments: {
|
arguments: {
|
||||||
"lockId": itemData.lockId,
|
"lockId": state.itemData.value.lockId,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
child: Text('设置指纹', style: TextStyle(color: AppColors.mainColor, fontSize: 24.sp),
|
child: Text(
|
||||||
|
'设置指纹',
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppColors.mainColor, fontSize: 24.sp),
|
||||||
)),
|
)),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
@ -169,9 +164,11 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
|||||||
// backgroundColor: Colors.white,
|
// backgroundColor: Colors.white,
|
||||||
side: BorderSide(width: 1, color: AppColors.mainColor)),
|
side: BorderSide(width: 1, color: AppColors.mainColor)),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pushNamed(context, Routers.remoteControlListPage, arguments: {
|
Navigator.pushNamed(
|
||||||
"lockId": itemData.lockId,
|
context, Routers.remoteControlListPage,
|
||||||
});
|
arguments: {
|
||||||
|
"lockId": state.itemData.value.lockId,
|
||||||
|
});
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
'设置遥控',
|
'设置遥控',
|
||||||
@ -197,6 +194,83 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//使用期限
|
||||||
|
String getUseDateStr() {
|
||||||
|
int? getPwdType = state.itemData.value.keyboardPwdType;
|
||||||
|
String useDateStr = '';
|
||||||
|
DateTime startDateStr =
|
||||||
|
DateTime.fromMillisecondsSinceEpoch(state.itemData.value.startDate!);
|
||||||
|
DateTime endDateStr =
|
||||||
|
DateTime.fromMillisecondsSinceEpoch(state.itemData.value.endDate!);
|
||||||
|
int starHour = startDateStr.hour;
|
||||||
|
int endHour = endDateStr.hour;
|
||||||
|
|
||||||
|
switch (getPwdType) {
|
||||||
|
case 1:
|
||||||
|
//单次 1 只能在开始时间后6小时内使用一次
|
||||||
|
useDateStr =
|
||||||
|
'${startDateStr.toLocal().toString().substring(0, 16)}\n${endDateStr.toLocal().toString().substring(0, 16)}';
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
//永久 2 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效
|
||||||
|
useDateStr = '永久';
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
//限期 3 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效
|
||||||
|
useDateStr =
|
||||||
|
'${startDateStr.toLocal().toString().substring(0, 16)}\n${endDateStr.toLocal().toString().substring(0, 16)}';
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
//删除 4 在锁上使用后会删除之前在锁上使用过的密码
|
||||||
|
useDateStr =
|
||||||
|
'${startDateStr.toLocal().toString().substring(0, 16)}\n${endDateStr.toLocal().toString().substring(0, 16)}';
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
//周未循环 5 在周未开始和结束时间指定时间段内有效
|
||||||
|
useDateStr = '周末 $starHour:00-$endHour:00';
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
//每日循环 6 每天开始和结束时间指定时间段内有效
|
||||||
|
useDateStr = '周日 $starHour:00-$endHour:00';
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
//工作日循环 7 工作日开始和结束时间指定的时间段内有效
|
||||||
|
useDateStr = '工作日 $starHour:00-$endHour:00';
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
//周一循环 8 每周一开始和结束时间指定时间段内有效
|
||||||
|
useDateStr = '周一 $starHour:00-$endHour:00';
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
//周二循环 9 每周二开始和结束时间指定时间段内有效
|
||||||
|
useDateStr = '周二 $starHour:00-$endHour:00';
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
//周三循环 10 每周三开始和结束时间指定时间段内有效
|
||||||
|
useDateStr = '周三 $starHour:00-$endHour:00';
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
|
//周四循环 11 每周四开始和结束时间指定时间段内有效
|
||||||
|
useDateStr = '周四 $starHour:00-$endHour:00';
|
||||||
|
break;
|
||||||
|
case 12:
|
||||||
|
//周五循环 12 每周五开始和结束时间指定时间段内有效
|
||||||
|
useDateStr = '周五 $starHour:00-$endHour:00';
|
||||||
|
break;
|
||||||
|
case 13:
|
||||||
|
//周六循环 13 每周六开始和结束时间指定时间段内有效
|
||||||
|
useDateStr = '周六 $starHour:00-$endHour:00';
|
||||||
|
break;
|
||||||
|
case 14:
|
||||||
|
//周天循环 14 每周日开始和结束时间指定时间段内有效
|
||||||
|
useDateStr = '周天 $starHour:00-$endHour:00';
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
return useDateStr;
|
||||||
|
}
|
||||||
|
|
||||||
//发送时间
|
//发送时间
|
||||||
String getSenderDate(PasswordKeyListItem indexEntity) {
|
String getSenderDate(PasswordKeyListItem indexEntity) {
|
||||||
String senderDate = '';
|
String senderDate = '';
|
||||||
@ -206,106 +280,13 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
|||||||
return senderDate;
|
return senderDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget commonItem(String leftTitle, String rightTitle,
|
|
||||||
{bool isHaveDirection = false,
|
|
||||||
bool isHaveLine = false,
|
|
||||||
bool isHaveRightWidget = false,
|
|
||||||
Widget? rightWidget,
|
|
||||||
Function()? action}) {
|
|
||||||
return GestureDetector(
|
|
||||||
onTap: action,
|
|
||||||
child: Column(
|
|
||||||
// mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
// height: 80.h,
|
|
||||||
color: Colors.white,
|
|
||||||
padding: EdgeInsets.only(
|
|
||||||
left: 20.w, right: 10.w, top: 20.w, bottom: 20.w),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
SizedBox(width: 20.w),
|
|
||||||
Text(
|
|
||||||
leftTitle,
|
|
||||||
style:
|
|
||||||
TextStyle(fontSize: 28.sp, fontWeight: FontWeight.w500),
|
|
||||||
),
|
|
||||||
SizedBox(width: 20.w),
|
|
||||||
Expanded(
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
|
||||||
children: [
|
|
||||||
isHaveRightWidget
|
|
||||||
? rightWidget!
|
|
||||||
: Text(
|
|
||||||
rightTitle,
|
|
||||||
textAlign: TextAlign.end,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 28.sp, fontWeight: FontWeight.w500),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(width: 5.w),
|
|
||||||
isHaveDirection
|
|
||||||
? Image.asset(
|
|
||||||
'images/icon_right.png',
|
|
||||||
width: 50.w,
|
|
||||||
height: 50.w,
|
|
||||||
)
|
|
||||||
: SizedBox(width: 10.w),
|
|
||||||
// SizedBox(width:10.w),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
isHaveLine
|
|
||||||
? Container(
|
|
||||||
height: 0.5.h,
|
|
||||||
color: Colors.grey,
|
|
||||||
)
|
|
||||||
: Container()
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//删除密码请求 deleteType:1-蓝牙 2-网关
|
|
||||||
Future<void> deletePwdRequest() async {
|
|
||||||
PasswordKeyEntity entity = await ApiRepository.to.deleteKeyboardPwd(
|
|
||||||
itemData.lockId.toString(), itemData.keyboardPwdId.toString(), 1);
|
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
|
||||||
Toast.show(msg: "删除成功");
|
|
||||||
setState(() {
|
|
||||||
Navigator.pop(context, true);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//更新密码请求
|
|
||||||
Future<void> updatePwdRequest() async {
|
|
||||||
PasswordKeyEntity entity = await ApiRepository.to.updatePasswordKey(
|
|
||||||
itemData.lockId.toString(),
|
|
||||||
itemData.keyboardPwdId.toString(),
|
|
||||||
_inputNameController.text,
|
|
||||||
_inputPwdController.text,
|
|
||||||
'',
|
|
||||||
'',
|
|
||||||
'');
|
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
|
||||||
Toast.show(msg: "修改成功");
|
|
||||||
setState(() {
|
|
||||||
Navigator.pop(context);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void showCupertinoAlertDialog(
|
void showCupertinoAlertDialog(
|
||||||
BuildContext context, TextEditingController inputController) {
|
BuildContext context, TextEditingController inputController) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return ShowTFView(
|
return ShowTFView(
|
||||||
title: inputController == _inputNameController
|
title: inputController == state.inputNameController
|
||||||
? "${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}"
|
? "${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}"
|
||||||
: "${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.password!.tr}",
|
: "${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.password!.tr}",
|
||||||
tipTitle: "请输入",
|
tipTitle: "请输入",
|
||||||
@ -313,7 +294,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
|||||||
sureClick: () {
|
sureClick: () {
|
||||||
//发送编辑钥匙名称请求
|
//发送编辑钥匙名称请求
|
||||||
if (inputController.text.isNotEmpty) {
|
if (inputController.text.isNotEmpty) {
|
||||||
updatePwdRequest();
|
logic.updatePwdRequest();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
cancelClick: () {
|
cancelClick: () {
|
||||||
@ -411,7 +392,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
|||||||
{
|
{
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
String pwdShareStr =
|
String pwdShareStr =
|
||||||
'您好,您的密码是:${itemData.keyboardPwd}\n生效时间:${itemData.startDate}\n类型:永久\n锁名:${itemData.keyboardPwdName}';
|
'您好,您的密码是:${state.itemData.value.keyboardPwd}\n生效时间:${state.itemData.value.startDate}\n类型:永久\n锁名:${state.itemData.value.keyboardPwdName}';
|
||||||
tokNative('flutter_sharePassword_to_ios',
|
tokNative('flutter_sharePassword_to_ios',
|
||||||
arguments: {'pwdShareStr': pwdShareStr}).then((result) {
|
arguments: {'pwdShareStr': pwdShareStr}).then((result) {
|
||||||
print('$result');
|
print('$result');
|
||||||
@ -456,13 +437,12 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
|||||||
tipTitle: "确定要删除吗?",
|
tipTitle: "确定要删除吗?",
|
||||||
sureClick: () {
|
sureClick: () {
|
||||||
Get.back();
|
Get.back();
|
||||||
deletePwdRequest();
|
logic.deletePwdRequest();
|
||||||
},
|
},
|
||||||
cancelClick: () {
|
cancelClick: () {
|
||||||
Get.back();
|
Get.back();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,20 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
|
||||||
|
|
||||||
|
class PasswordKeyDetailState {
|
||||||
|
final itemData = PasswordKeyListItem().obs;
|
||||||
|
final TextEditingController inputPwdController = TextEditingController();
|
||||||
|
final TextEditingController inputNameController = TextEditingController();
|
||||||
|
|
||||||
|
// final keyInfo = LockListInfoItemEntity().obs;
|
||||||
|
// var pageNum = 1.obs; //请求页码
|
||||||
|
// final pageSize = 20.obs; //请求每页数据条数
|
||||||
|
// final itemDataList = <PasswordKeyListItem>[].obs;
|
||||||
|
// final TextEditingController searchController = TextEditingController();
|
||||||
|
|
||||||
|
PasswordKeyDetailState() {
|
||||||
|
Map map = Get.arguments;
|
||||||
|
itemData.value = map["itemData"];
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -248,54 +248,89 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//使用期限
|
//使用期限
|
||||||
/**
|
|
||||||
单次 1 只能在开始时间后6小时内使用一次
|
|
||||||
永久 2 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效
|
|
||||||
限期 3 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效
|
|
||||||
删除 4 在锁上使用后会删除之前在锁上使用过的密码
|
|
||||||
周未循环 5 在周未开始和结束时间指定时间段内有效
|
|
||||||
每日循环 6 每天开始和结束时间指定时间段内有效
|
|
||||||
工作日循环 7 工作日开始和结束时间指定的时间段内有效
|
|
||||||
周一循环 8 每周一开始和结束时间指定时间段内有效
|
|
||||||
周二循环 9 每周二开始和结束时间指定时间段内有效
|
|
||||||
周三循环 10 每周三开始和结束时间指定时间段内有效
|
|
||||||
周四循环 11 每周四开始和结束时间指定时间段内有效
|
|
||||||
周五循环 12 每周五开始和结束时间指定时间段内有效
|
|
||||||
周六循环 13 每周六开始和结束时间指定时间段内有效
|
|
||||||
周天循环 14 每周日开始和结束时间指定时间段内有效
|
|
||||||
*/
|
|
||||||
String getUseDateStr(PasswordKeyListItem indexEntity) {
|
String getUseDateStr(PasswordKeyListItem indexEntity) {
|
||||||
|
int? getPwdType = indexEntity.keyboardPwdType;
|
||||||
String useDateStr = '';
|
String useDateStr = '';
|
||||||
if (indexEntity.keyboardPwdType == 3) {
|
DateTime sendDateStr =
|
||||||
//限期
|
DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!);
|
||||||
DateTime startDateStr =
|
DateTime startDateStr =
|
||||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
|
DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
|
||||||
DateTime endDateStr =
|
DateTime endDateStr =
|
||||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
|
DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
|
||||||
useDateStr =
|
int starHour = startDateStr.hour;
|
||||||
'${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}';
|
int endHour = endDateStr.hour;
|
||||||
} else if (indexEntity.keyboardPwdType == 2) {
|
|
||||||
//永久
|
|
||||||
DateTime dateStr =
|
|
||||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!);
|
|
||||||
useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 永久';
|
|
||||||
} else if (indexEntity.keyboardPwdType == 1) {
|
|
||||||
//单次
|
|
||||||
DateTime dateStr =
|
|
||||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!);
|
|
||||||
useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 单次';
|
|
||||||
} else if (indexEntity.keyboardPwdType == 4) {
|
|
||||||
//删除
|
|
||||||
DateTime dateStr =
|
|
||||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!);
|
|
||||||
useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 清空码';
|
|
||||||
} else {
|
|
||||||
//循环
|
|
||||||
DateTime dateStr =
|
|
||||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!);
|
|
||||||
useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 循环';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
switch (getPwdType) {
|
||||||
|
case 1:
|
||||||
|
//单次 1 只能在开始时间后6小时内使用一次
|
||||||
|
useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} 单次';
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
//永久 2 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效
|
||||||
|
useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} 永久';
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
//限期 3 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效
|
||||||
|
useDateStr =
|
||||||
|
'${startDateStr.toLocal().toString().substring(0, 16)} - ${endDateStr.toLocal().toString().substring(0, 16)} 限时';
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
//删除 4 在锁上使用后会删除之前在锁上使用过的密码
|
||||||
|
useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} 清空码';
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
//周未循环 5 在周未开始和结束时间指定时间段内有效
|
||||||
|
useDateStr =
|
||||||
|
'${sendDateStr.toLocal().toString().substring(0, 16)} 周末$starHour:00-$endHour:00 循环';
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
//每日循环 6 每天开始和结束时间指定时间段内有效
|
||||||
|
useDateStr =
|
||||||
|
'${sendDateStr.toLocal().toString().substring(0, 16)} 周日$starHour:00-$endHour:00 循环';
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
//工作日循环 7 工作日开始和结束时间指定的时间段内有效
|
||||||
|
useDateStr =
|
||||||
|
'${sendDateStr.toLocal().toString().substring(0, 16)} 工作日$starHour:00-$endHour:00 循环';
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
//周一循环 8 每周一开始和结束时间指定时间段内有效
|
||||||
|
useDateStr =
|
||||||
|
'${sendDateStr.toLocal().toString().substring(0, 16)} 周一$starHour:00-$endHour:00 循环';
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
//周二循环 9 每周二开始和结束时间指定时间段内有效
|
||||||
|
useDateStr =
|
||||||
|
'${sendDateStr.toLocal().toString().substring(0, 16)} 周二$starHour:00-$endHour:00 循环';
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
//周三循环 10 每周三开始和结束时间指定时间段内有效
|
||||||
|
useDateStr =
|
||||||
|
'${sendDateStr.toLocal().toString().substring(0, 16)} 周三$starHour:00-$endHour:00 循环';
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
|
//周四循环 11 每周四开始和结束时间指定时间段内有效
|
||||||
|
useDateStr =
|
||||||
|
'${sendDateStr.toLocal().toString().substring(0, 16)} 周四$starHour:00-$endHour:00 循环';
|
||||||
|
break;
|
||||||
|
case 12:
|
||||||
|
//周五循环 12 每周五开始和结束时间指定时间段内有效
|
||||||
|
useDateStr =
|
||||||
|
'${sendDateStr.toLocal().toString().substring(0, 16)} 周五$starHour:00-$endHour:00 循环';
|
||||||
|
break;
|
||||||
|
case 13:
|
||||||
|
//周六循环 13 每周六开始和结束时间指定时间段内有效
|
||||||
|
useDateStr =
|
||||||
|
'${sendDateStr.toLocal().toString().substring(0, 16)} 周六$starHour:00-$endHour:00 循环';
|
||||||
|
break;
|
||||||
|
case 14:
|
||||||
|
//周天循环 14 每周日开始和结束时间指定时间段内有效
|
||||||
|
useDateStr =
|
||||||
|
'${sendDateStr.toLocal().toString().substring(0, 16)} 周天$starHour:00-$endHour:00 循环';
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
}
|
||||||
return useDateStr;
|
return useDateStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -288,6 +288,28 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
|||||||
];
|
];
|
||||||
showPickerView(context, pickerDataList);
|
showPickerView(context, pickerDataList);
|
||||||
}),
|
}),
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: '结束日期',
|
||||||
|
rightTitle: state.selectFailureDate.value,
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
Pickers.showDatePicker(context, mode: DateMode.YMDH,
|
||||||
|
onConfirm: (p) {
|
||||||
|
state.failureDateTime.value = DateTime.parse(
|
||||||
|
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}');
|
||||||
|
state.selectFailureDate.value =
|
||||||
|
"${formatDate(state.failureDateTime.value, [
|
||||||
|
yyyy,
|
||||||
|
'-',
|
||||||
|
mm,
|
||||||
|
'-',
|
||||||
|
dd,
|
||||||
|
' ',
|
||||||
|
HH
|
||||||
|
])}:00";
|
||||||
|
});
|
||||||
|
}),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||||
rightTitle: state.loopEffectiveDate.value,
|
rightTitle: state.loopEffectiveDate.value,
|
||||||
@ -382,42 +404,68 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
|||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
if (isDemoMode == false) {
|
if (isDemoMode == false) {
|
||||||
int getWidgetNumber = int.parse(widget.type);
|
int getWidgetNumber = int.parse(widget.type);
|
||||||
if (state.nameController.text.isEmpty) {
|
DateTime startDateTime = DateTime(
|
||||||
Toast.show(msg: '请输入姓名');
|
state.effectiveDateTime.value.year,
|
||||||
return;
|
state.effectiveDateTime.value.month,
|
||||||
}
|
state.effectiveDateTime.value.day,
|
||||||
|
state.effectiveDateTime.value.hour);
|
||||||
//限时||循环
|
DateTime endDateTime = DateTime(
|
||||||
if (getWidgetNumber == 1) {
|
state.failureDateTime.value.year,
|
||||||
if (state.failureDateTime.value
|
state.failureDateTime.value.month,
|
||||||
.compareTo(state.effectiveDateTime.value) !=
|
state.failureDateTime.value.day,
|
||||||
1) {
|
state.failureDateTime.value.hour);
|
||||||
Toast.show(msg: '失效时间需大于生效时间');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//自定义密码
|
//自定义密码
|
||||||
if (getWidgetNumber == 3) {
|
if (getWidgetNumber == 3) {
|
||||||
logic.getStartDate(state.effectiveDateTime.value);
|
logic.getStartDate(state.effectiveDateTime.value);
|
||||||
|
if (state.nameController.text.isEmpty) {
|
||||||
|
Toast.show(msg: '请输入姓名');
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (state.pwdController.text.isEmpty) {
|
if (state.pwdController.text.isEmpty) {
|
||||||
Toast.show(msg: '请输入密码');
|
Toast.show(msg: '请输入密码');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//非永久 须有时限
|
//非永久 须有时限
|
||||||
if (state.isPermanent.value == false) {
|
if (state.isPermanent.value == false) {
|
||||||
if (state.failureDateTime.value
|
if (!startDateTime.isBefore(endDateTime) ||
|
||||||
.compareTo(state.effectiveDateTime.value) !=
|
startDateTime.isAtSameMomentAs(endDateTime)) {
|
||||||
1) {
|
|
||||||
Toast.show(msg: '失效时间需大于生效时间');
|
Toast.show(msg: '失效时间需大于生效时间');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logic.addKeyboardPwdRequest();
|
logic.addKeyboardPwdRequest();
|
||||||
}
|
} else {
|
||||||
|
if (state.nameController.text.isEmpty) {
|
||||||
|
Toast.show(msg: '请输入姓名');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
logic.getKeyboardPwdRequest();
|
//限时
|
||||||
|
if (getWidgetNumber == 1) {
|
||||||
|
if (!startDateTime.isBefore(endDateTime) ||
|
||||||
|
startDateTime.isAtSameMomentAs(endDateTime)) {
|
||||||
|
Toast.show(msg: '失效时间需大于生效时间');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//循环密码
|
||||||
|
if (getWidgetNumber == 4) {
|
||||||
|
if (!startDateTime.isBefore(endDateTime) ||
|
||||||
|
startDateTime.isAtSameMomentAs(endDateTime)) {
|
||||||
|
Toast.show(msg: '结束时间需大于当前时间');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (state.loopEndHours.value <=
|
||||||
|
state.loopStartHours.value) {
|
||||||
|
Toast.show(msg: '失效时间需大于生效时间');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
logic.getKeyboardPwdRequest();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Toast.show(msg: '演示模式');
|
Toast.show(msg: '演示模式');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,7 @@ class PasswordKeyPerpetualState {
|
|||||||
|
|
||||||
final isInitialized = false.obs;
|
final isInitialized = false.obs;
|
||||||
final isSendSuccess = false.obs; //是否发送成功
|
final isSendSuccess = false.obs; //是否发送成功
|
||||||
final isPermanent = false.obs; //是否永久
|
final isPermanent = true.obs; //是否永久
|
||||||
var getPwdStr = ''.obs;
|
var getPwdStr = ''.obs;
|
||||||
|
|
||||||
final effectiveDateTime = DateTime.now().obs;
|
final effectiveDateTime = DateTime.now().obs;
|
||||||
|
|||||||
@ -59,18 +59,24 @@ class CommonItem extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
isHaveRightWidget!
|
isHaveRightWidget!
|
||||||
? rightWidget!
|
? rightWidget!
|
||||||
: Text(rightTitle ?? "", textAlign: TextAlign.end,
|
: Text(
|
||||||
|
rightTitle ?? "",
|
||||||
|
textAlign: TextAlign.right,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
maxLines: 1,
|
maxLines: 2,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 22.sp,
|
fontSize: 22.sp,
|
||||||
color: AppColors.darkGrayTextColor),
|
color: AppColors.darkGrayTextColor),
|
||||||
)
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
isHaveDirection! ? SizedBox(width: 3.w) : Container(),
|
isHaveDirection! ? SizedBox(width: 3.w) : Container(),
|
||||||
isHaveDirection!
|
isHaveDirection!
|
||||||
? Image.asset('images/icon_right_grey.png', width: 12.w, height: 21.w,)
|
? Image.asset(
|
||||||
|
'images/icon_right_grey.png',
|
||||||
|
width: 12.w,
|
||||||
|
height: 21.w,
|
||||||
|
)
|
||||||
: SizedBox(width: 10.w),
|
: SizedBox(width: 10.w),
|
||||||
isHaveDirection! ? SizedBox(width: 5.w) : Container(),
|
isHaveDirection! ? SizedBox(width: 5.w) : Container(),
|
||||||
],
|
],
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user