From cacf3528e3a63a2b5f8e42465f03d5154202b9b7 Mon Sep 17 00:00:00 2001 From: Daisy <> Date: Thu, 14 Dec 2023 14:33:12 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=BE=AA=E7=8E=AF=E5=AF=86?= =?UTF-8?q?=E7=A0=81=E5=8F=82=E6=95=B0=E4=B8=8D=E5=90=88=E6=B3=95=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=88=E7=94=B1=E4=BA=8E=E5=90=8E=E5=8F=B0=E9=9C=80?= =?UTF-8?q?=E7=BB=93=E6=9D=9F=E6=97=A5=E6=9C=9F=E5=AD=97=E6=AE=B5=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sendElectronicKey_page.dart | 5 +- .../passwordKey_perpetual_page.dart | 47 ++++++++++++++++--- 2 files changed, 42 insertions(+), 10 deletions(-) diff --git a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_page.dart b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_page.dart index 715764e9..840c39c1 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_page.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_page.dart @@ -276,9 +276,8 @@ class _SendElectronicKeyPageState extends State { state.keyNameController.text.isNotEmpty) { if (int.parse(widget.type) == 0) { //失效时间大于生效时间 - if (state.failureDateTime.value - .compareTo(state.effectiveDateTime.value) == - 1) { + if (state.effectiveDateTime.value + .isBefore(state.failureDateTime.value)) { logic.sendElectronicKeyRequest(context); } else { Toast.show(msg: '失效时间需大于生效时间'); diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart index be6b10fb..2a51f040 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart @@ -288,6 +288,28 @@ class _PasswordKeyPerpetualPageState extends State { ]; 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( leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr, rightTitle: state.loopEffectiveDate.value, @@ -387,11 +409,10 @@ class _PasswordKeyPerpetualPageState extends State { return; } - //限时||循环 + //限时 if (getWidgetNumber == 1) { - if (state.failureDateTime.value - .compareTo(state.effectiveDateTime.value) != - 1) { + if (!state.effectiveDateTime.value + .isBefore(state.failureDateTime.value)) { Toast.show(msg: '失效时间需大于生效时间'); return; } @@ -406,9 +427,8 @@ class _PasswordKeyPerpetualPageState extends State { } //非永久 须有时限 if (state.isPermanent.value == false) { - if (state.failureDateTime.value - .compareTo(state.effectiveDateTime.value) != - 1) { + if (!state.effectiveDateTime.value + .isBefore(state.failureDateTime.value)) { Toast.show(msg: '失效时间需大于生效时间'); return; } @@ -417,6 +437,19 @@ class _PasswordKeyPerpetualPageState extends State { logic.addKeyboardPwdRequest(); } + //循环密码 + if (getWidgetNumber == 4) { + if (!state.effectiveDateTime.value + .isBefore(state.failureDateTime.value)) { + Toast.show(msg: '结束时间需大于当前时间'); + return; + } + if (state.loopEndHours.value <= state.loopStartHours.value) { + Toast.show(msg: '失效时间需大于生效时间'); + return; + } + } + logic.getKeyboardPwdRequest(); } else { Toast.show(msg: '演示模式');