From 08de8f1fdf757db191a1742165d89487ebe80440 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AD=8F=E5=B0=91=E9=98=B3?= <786612630@qq.com> Date: Fri, 3 May 2024 18:31:15 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E4=BF=AE=E5=A4=8D=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E6=B3=A8=E5=86=8C=E9=97=AE=E9=A2=98=EF=BC=8C=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=9A=90=E8=97=8F=E6=98=BE=E7=A4=BA=E5=AF=86?= =?UTF-8?q?=E7=A0=81=E6=8C=89=E9=92=AE=202=E3=80=81=E9=83=A8=E5=88=86?= =?UTF-8?q?=E5=8D=8F=E8=AE=AENember=201=E4=B8=AA=E5=AD=97=E8=8A=82?= =?UTF-8?q?=E4=BF=AE=E6=94=B92=E5=AD=97=E8=8A=82=203=E3=80=81=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E6=97=A0=E7=BD=91=E7=BB=9C=E5=BC=80=E9=94=81=E8=8E=B7?= =?UTF-8?q?=E5=8F=96token=E5=BC=82=E5=B8=B8=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- star_lock/images/lan/lan_en.json | 3 +- star_lock/images/lan/lan_keys.json | 1 + star_lock/images/lan/lan_zh.json | 1 + .../lib/blue/io_protocol/io_addFace.dart | 20 ++++---- ...o_addFingerprintWithTimeCycleCoercion.dart | 18 ++++---- .../io_addICCardWithTimeCycleCoercion.dart | 20 ++++---- .../io_changeAdministratorPassword.dart | 18 ++++---- .../io_protocol/io_senderCustomPasswords.dart | 17 +++---- star_lock/lib/blue/io_tool/io_tool.dart | 15 ++++++ .../starLock_forgetPassword_page.dart | 2 + .../starLock_forgetPassword_xhj_page.dart | 2 + .../lib/login/login/starLock_login_page.dart | 1 + .../login/login/starLock_login_xhj_page.dart | 1 + .../register/starLock_register_logic.dart | 6 +++ .../register/starLock_register_page.dart | 2 + .../register/starLock_register_state.dart | 2 +- .../register/starLock_register_xhj_page.dart | 15 +++--- .../card/addICCard/addICCard_logic.dart | 3 +- .../doorLockLog/doorLockLog_page.dart | 26 +++++------ .../face/addFace/addFace_logic.dart | 6 ++- .../addFingerprint/addFingerprint_logic.dart | 10 ++-- .../lockDetail/lockDetail_logic.dart | 5 +- .../lockDetail/lockDetail_state.dart | 2 +- .../editLockName/editLockName_page.dart | 2 +- .../passwordKey_perpetual_logic.dart | 16 ++++--- star_lock/lib/tools/tf_loginInput.dart | 46 +++++++++++++------ 26 files changed, 165 insertions(+), 95 deletions(-) diff --git a/star_lock/images/lan/lan_en.json b/star_lock/images/lan/lan_en.json index ee395c42..dcf070d6 100644 --- a/star_lock/images/lan/lan_en.json +++ b/star_lock/images/lan/lan_en.json @@ -789,5 +789,6 @@ "文件校验失败 0x03": "File verification failed 0x03", "固件升级完成": "Firmware upgrade completed", "记录":"Record", - "开通高级功能后才可以对锁进行管理":"You can manage locks only after the advanced function is enabled" + "开通高级功能后才可以对锁进行管理":"You can manage locks only after the advanced function is enabled", + "密码不一致哦":"The passwords are inconsistent", } diff --git a/star_lock/images/lan/lan_keys.json b/star_lock/images/lan/lan_keys.json index e3bed9cc..09e63f14 100644 --- a/star_lock/images/lan/lan_keys.json +++ b/star_lock/images/lan/lan_keys.json @@ -707,6 +707,7 @@ "型号": "型号", "密码生成后,请在当日23:59前使用一次进行激活,否则过0点后未激活则失效。密码激活后,有效期内不限次数使用。": "密码生成后,请在当日23:59前使用一次进行激活,否则过0点后未激活则失效。密码激活后,有效期内不限次数使用。", "密码生成后,请在当日23:59前使用,否则过0点后失效。清空码用于清空今天0点之前生成的所有密码。":"密码生成后,请在当日23:59前使用,否则过0点后失效。清空码用于清空今天0点之前生成的所有密码。", + "密码不一致哦":"密码不一致哦", "相机": "相机", "相册": "相册", diff --git a/star_lock/images/lan/lan_zh.json b/star_lock/images/lan/lan_zh.json index 474e9039..b505da4a 100644 --- a/star_lock/images/lan/lan_zh.json +++ b/star_lock/images/lan/lan_zh.json @@ -709,6 +709,7 @@ "型号": "型号", "密码生成后,请在当日23:59前使用一次进行激活,否则过0点后未激活则失效。密码激活后,有效期内不限次数使用。": "密码生成后,请在当日23:59前使用一次进行激活,否则过0点后未激活则失效。密码激活后,有效期内不限次数使用。", "密码生成后,请在当日23:59前使用,否则过0点后失效。清空码用于清空今天0点之前生成的所有密码。":"密码生成后,请在当日23:59前使用,否则过0点后失效。清空码用于清空今天0点之前生成的所有密码。", + "密码不一致哦":"密码不一致哦", "相机": "相机", "相册": "相册", diff --git a/star_lock/lib/blue/io_protocol/io_addFace.dart b/star_lock/lib/blue/io_protocol/io_addFace.dart index 24baf88f..b510633f 100644 --- a/star_lock/lib/blue/io_protocol/io_addFace.dart +++ b/star_lock/lib/blue/io_protocol/io_addFace.dart @@ -57,12 +57,13 @@ class SenderAddFaceCommand extends SenderProtocol { List ebcData = []; // 指令类型 - int type = commandType!.typeValue; - double typeDouble = type / 256; - int type1 = typeDouble.toInt(); - int type2 = type % 256; - data.add(type1); - data.add(type2); + // int type = commandType!.typeValue; + // double typeDouble = type / 256; + // int type1 = typeDouble.toInt(); + // int type2 = type % 256; + // data.add(type1); + // data.add(type2); + data.addAll(intChangList(commandType!.typeValue)); // 子命令类型 data.add(81); @@ -77,11 +78,12 @@ class SenderAddFaceCommand extends SenderProtocol { subData.addAll(utf8.encode(userID!)); subData = getFixedLengthList(subData, 20 - userIDLength); - // fingerNo - subData.add(faceNo!); + // faceNo + subData.addAll(intChangList(faceNo!)); + AppLog.log("faceNo:$faceNo intChangList(faceNo!):${intChangList(faceNo!)}"); // UseCountLimit - subData.add(useCountLimit!); + subData.addAll(intChangList(useCountLimit!)); // isForce subData.add(isForce!); diff --git a/star_lock/lib/blue/io_protocol/io_addFingerprintWithTimeCycleCoercion.dart b/star_lock/lib/blue/io_protocol/io_addFingerprintWithTimeCycleCoercion.dart index 8fd20c5e..fefe7734 100644 --- a/star_lock/lib/blue/io_protocol/io_addFingerprintWithTimeCycleCoercion.dart +++ b/star_lock/lib/blue/io_protocol/io_addFingerprintWithTimeCycleCoercion.dart @@ -57,12 +57,13 @@ class SenderAddFingerprintWithTimeCycleCoercionCommand extends SenderProtocol { List ebcData = []; // 指令类型 - int type = commandType!.typeValue; - double typeDouble = type / 256; - int type1 = typeDouble.toInt(); - int type2 = type % 256; - data.add(type1); - data.add(type2); + // int type = commandType!.typeValue; + // double typeDouble = type / 256; + // int type1 = typeDouble.toInt(); + // int type2 = type % 256; + // data.add(type1); + // data.add(type2); + data.addAll(intChangList(commandType!.typeValue)); // 子命令类型 data.add(36); @@ -78,10 +79,11 @@ class SenderAddFingerprintWithTimeCycleCoercionCommand extends SenderProtocol { subData = getFixedLengthList(subData, 20 - userIDLength); // fingerNo - subData.add(fingerNo!); + subData.addAll(intChangList(fingerNo!)); + AppLog.log("fingerNo:$fingerNo intChangList(fingerNo!):${intChangList(fingerNo!)}"); // UseCountLimit - subData.add(useCountLimit!); + subData.addAll(intChangList(useCountLimit!)); // isForce subData.add(isForce!); diff --git a/star_lock/lib/blue/io_protocol/io_addICCardWithTimeCycleCoercion.dart b/star_lock/lib/blue/io_protocol/io_addICCardWithTimeCycleCoercion.dart index d688093b..49def20e 100644 --- a/star_lock/lib/blue/io_protocol/io_addICCardWithTimeCycleCoercion.dart +++ b/star_lock/lib/blue/io_protocol/io_addICCardWithTimeCycleCoercion.dart @@ -57,12 +57,13 @@ class SenderAddICCardWithTimeCycleCoercionCommand extends SenderProtocol { List ebcData = []; // 指令类型 - int type = commandType!.typeValue; - double typeDouble = type / 256; - int type1 = typeDouble.toInt(); - int type2 = type % 256; - data.add(type1); - data.add(type2); + // int type = commandType!.typeValue; + // double typeDouble = type / 256; + // int type1 = typeDouble.toInt(); + // int type2 = type % 256; + // data.add(type1); + // data.add(type2); + data.addAll(intChangList(commandType!.typeValue)); // 子命令类型 data.add(24); @@ -77,11 +78,12 @@ class SenderAddICCardWithTimeCycleCoercionCommand extends SenderProtocol { subData.addAll(utf8.encode(userID!)); subData = getFixedLengthList(subData, 20 - userIDLength); - // fingerNo - subData.add(cardNo!); + // cardNo + subData.addAll(intChangList(cardNo!)); + AppLog.log("cardNo:$cardNo intChangList(cardNo!):${intChangList(cardNo!)}"); // UseCountLimit - subData.add(useCountLimit!); + subData.addAll(intChangList(useCountLimit!)); // isForce subData.add(isForce!); diff --git a/star_lock/lib/blue/io_protocol/io_changeAdministratorPassword.dart b/star_lock/lib/blue/io_protocol/io_changeAdministratorPassword.dart index d9a5c9c1..530ba7f9 100644 --- a/star_lock/lib/blue/io_protocol/io_changeAdministratorPassword.dart +++ b/star_lock/lib/blue/io_protocol/io_changeAdministratorPassword.dart @@ -45,12 +45,13 @@ class ChangeAdministratorPasswordCommand extends SenderProtocol { List ebcData = []; // 指令类型 - int type = commandType!.typeValue; - double typeDouble = type / 256; - int type1 = typeDouble.toInt(); - int type2 = type % 256; - data.add(type1); - data.add(type2); + // int type = commandType!.typeValue; + // double typeDouble = type / 256; + // int type1 = typeDouble.toInt(); + // int type2 = type % 256; + // data.add(type1); + // data.add(type2); + data.addAll(intChangList(commandType!.typeValue)); // 子命令类型 data.add(2); @@ -66,7 +67,8 @@ class ChangeAdministratorPasswordCommand extends SenderProtocol { subData = getFixedLengthList(subData, 20 - userIDLength); // PwdNo - subData.add(1); + subData.addAll(intChangList(pwdNo!)); + AppLog.log("pwdNo:$pwdNo"); // pwd 20 int pwdLength = utf8.encode(pwd!).length; @@ -74,7 +76,7 @@ class ChangeAdministratorPasswordCommand extends SenderProtocol { subData = getFixedLengthList(subData, 20 - pwdLength); // UseCountLimit - subData.add(0xff); + subData.addAll(intChangList(useCountLimit!)); // token subData.addAll(token!); diff --git a/star_lock/lib/blue/io_protocol/io_senderCustomPasswords.dart b/star_lock/lib/blue/io_protocol/io_senderCustomPasswords.dart index 29d23145..3d0c7770 100644 --- a/star_lock/lib/blue/io_protocol/io_senderCustomPasswords.dart +++ b/star_lock/lib/blue/io_protocol/io_senderCustomPasswords.dart @@ -50,12 +50,13 @@ class SenderCustomPasswordsCommand extends SenderProtocol { List ebcData = []; // 指令类型 - int type = commandType!.typeValue; - double typeDouble = type / 256; - int type1 = typeDouble.toInt(); - int type2 = type % 256; - data.add(type1); - data.add(type2); + // int type = commandType!.typeValue; + // double typeDouble = type / 256; + // int type1 = typeDouble.toInt(); + // int type2 = type % 256; + // data.add(type1); + // data.add(type2); + data.addAll(intChangList(commandType!.typeValue)); // 子命令类型 data.add(3); @@ -71,7 +72,7 @@ class SenderCustomPasswordsCommand extends SenderProtocol { subData = getFixedLengthList(subData, 20 - userIDLength); // PwdNo - subData.add(pwdNo!); + subData.addAll(intChangList(pwdNo!)); AppLog.log("pwdNo:$pwdNo"); // pwd 20 @@ -81,7 +82,7 @@ class SenderCustomPasswordsCommand extends SenderProtocol { AppLog.log("pwd:$pwd"); // UseCountLimit - subData.add(useCountLimit!); + subData.addAll(intChangList(useCountLimit!)); // token subData.addAll(token!); diff --git a/star_lock/lib/blue/io_tool/io_tool.dart b/star_lock/lib/blue/io_tool/io_tool.dart index 4db02eb7..ad6f1e37 100644 --- a/star_lock/lib/blue/io_tool/io_tool.dart +++ b/star_lock/lib/blue/io_tool/io_tool.dart @@ -4,6 +4,21 @@ import 'dart:typed_data'; import 'package:crypto/crypto.dart'; import 'package:flutter/services.dart'; +int listChangInt(List list){ + int dataLen = (list[0] << 8) + list[61]; + return dataLen; +} + +List intChangList(int count){ + List intList = []; + double typeDouble = count / 256; + int type1 = typeDouble.toInt(); + int type2 = count % 256; + intList.add(type1); + intList.add(type2); + return intList; +} + List changeIntListToStringList(List list){ List strList = []; for(int i = 0; i { logic.checkNext(state.pwdController); }, isPwd: true, + isSuffixIcon: 2, leftWidget: Padding( padding: EdgeInsets.only( top: 30.w, bottom: 20.w, right: 20.w, left: 5.w), diff --git a/star_lock/lib/login/login/starLock_login_xhj_page.dart b/star_lock/lib/login/login/starLock_login_xhj_page.dart index 14f7b99a..80ed4e90 100644 --- a/star_lock/lib/login/login/starLock_login_xhj_page.dart +++ b/star_lock/lib/login/login/starLock_login_xhj_page.dart @@ -106,6 +106,7 @@ class _StarLockLoginPageState extends State { logic.checkNext(state.pwdController); }, isPwd: true, + isSuffixIcon: 2, leftWidget: Padding( padding: EdgeInsets.only( top: 30.w, diff --git a/star_lock/lib/login/register/starLock_register_logic.dart b/star_lock/lib/login/register/starLock_register_logic.dart index 9b63c0b6..39fd7561 100644 --- a/star_lock/lib/login/register/starLock_register_logic.dart +++ b/star_lock/lib/login/register/starLock_register_logic.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; +import 'package:star_lock/app_settings/app_settings.dart'; import '../../network/api_repository.dart'; import '../../tools/baseGetXController.dart'; @@ -29,6 +30,11 @@ class StarLockRegisterLogic extends BaseGetXController { } void register() async { + AppLog.log("state.pwd.value:${state.pwd.value} state.surePwd.value:${state.surePwd.value}"); + if(state.pwd.value != state.surePwd.value){ + showToast("密码不一致哦".tr); + return; + } var entity = await ApiRepository.to.register( receiverType: state.isIphoneType.value == true ? 1 : 2, countryCode: int.parse(state.countryCode.value), diff --git a/star_lock/lib/login/register/starLock_register_page.dart b/star_lock/lib/login/register/starLock_register_page.dart index dd2d5bbe..e6f59e8c 100644 --- a/star_lock/lib/login/register/starLock_register_page.dart +++ b/star_lock/lib/login/register/starLock_register_page.dart @@ -226,6 +226,7 @@ class _StarLockRegisterPageState extends State { logic.checkNext(state.pwdController); }, isPwd: true, + isSuffixIcon: 2, leftWidget: Padding( padding: EdgeInsets.only(right: 10.w, left: 5.w), child: Image.asset( @@ -252,6 +253,7 @@ class _StarLockRegisterPageState extends State { logic.checkNext(state.sureController); }, isPwd: true, + isSuffixIcon: 2, leftWidget: Padding( padding: EdgeInsets.only(right: 10.w, left: 5.w), child: Image.asset( diff --git a/star_lock/lib/login/register/starLock_register_state.dart b/star_lock/lib/login/register/starLock_register_state.dart index 99f3003c..41625bac 100644 --- a/star_lock/lib/login/register/starLock_register_state.dart +++ b/star_lock/lib/login/register/starLock_register_state.dart @@ -25,7 +25,7 @@ class StarLockRegisterState { bool get isEmail => RegexUtil.isEmail(phoneOrEmailStr.value); bool get isIphone => RegexUtil.isMobileSimple(phoneOrEmailStr.value); - bool get pwdIsOK => pwd.value.isNotEmpty && (pwd.value == surePwd.value); + bool get pwdIsOK => pwd.value.isNotEmpty && surePwd.value.isNotEmpty; bool get codeIsOK => verificationCode.value.isNotEmpty; var canResend = false.obs; diff --git a/star_lock/lib/login/register/starLock_register_xhj_page.dart b/star_lock/lib/login/register/starLock_register_xhj_page.dart index c636f2c5..ad3691ad 100644 --- a/star_lock/lib/login/register/starLock_register_xhj_page.dart +++ b/star_lock/lib/login/register/starLock_register_xhj_page.dart @@ -155,6 +155,7 @@ class _StarLockRegisterPageState extends State { logic.checkNext(state.pwdController); }, isPwd: true, + isSuffixIcon: 2, leftWidget: Padding( padding: EdgeInsets.only(right: 10.w, left: 5.w), ), @@ -174,6 +175,7 @@ class _StarLockRegisterPageState extends State { logic.checkNext(state.sureController); }, isPwd: true, + isSuffixIcon: 2, leftWidget: Padding( padding: EdgeInsets.only(right: 10.w, left: 5.w), ), @@ -201,17 +203,18 @@ class _StarLockRegisterPageState extends State { ), Obx(() => GestureDetector( onTap: - state.phoneOrEmailStrIsOK.value && state.canResend.value - ? () async { + state.phoneOrEmailStrIsOK.value && state.canResend.value ? () async { // Navigator.pushNamed(context, Routers.safetyVerificationPage, arguments: {"countryCode":"+86", "account":state.phoneOrEmailStr.value}); - var result = await Navigator.pushNamed( - context, Routers.safetyVerificationPage, + if(state.pwd.value != state.surePwd.value){ + logic.showToast("密码不一致哦".tr); + return; + } + var result = await Get.toNamed(Routers.safetyVerificationPage, arguments: { "countryCode": state.countryCode, "account": state.phoneOrEmailStr.value }); - state.xWidth.value = - (result as Map)['xWidth']; + state.xWidth.value = (result as Map)['xWidth']; logic.sendValidationCode(); } : null, diff --git a/star_lock/lib/main/lockDetail/card/addICCard/addICCard_logic.dart b/star_lock/lib/main/lockDetail/card/addICCard/addICCard_logic.dart index 14793897..2e405f9a 100644 --- a/star_lock/lib/main/lockDetail/card/addICCard/addICCard_logic.dart +++ b/star_lock/lib/main/lockDetail/card/addICCard/addICCard_logic.dart @@ -50,7 +50,8 @@ class AddICCardLogic extends BaseGetXController{ switch(status){ case 0x00: //成功 - state.cardNumber.value = reply.data.last.toString(); + var cardNumber = listChangInt(reply.data.sublist(9, 11)).toString(); + state.cardNumber.value = cardNumber.toString(); cancelBlueConnetctToastTimer(); state.ifConnectScuess.value = true; break; diff --git a/star_lock/lib/main/lockDetail/doorLockLog/doorLockLog_page.dart b/star_lock/lib/main/lockDetail/doorLockLog/doorLockLog_page.dart index 1a8c4a1e..0957a13d 100644 --- a/star_lock/lib/main/lockDetail/doorLockLog/doorLockLog_page.dart +++ b/star_lock/lib/main/lockDetail/doorLockLog/doorLockLog_page.dart @@ -161,20 +161,20 @@ class _DoorLockLogPageState extends State with RouteAware { }, child: Stack( children: [ - timelineData.imagesUrl != null + timelineData.imagesUrl!.isNotEmpty ? - // Image.network( - // timelineData.imagesUrl!, - // width: 260.w, - // height: 260.h, - // ) - Image( - image: const AssetImage( - 'images/main/icon_lockDetail_monitoringvoiceFrist.png'), - width: 240.w, - height: 180.h, - fit: BoxFit.contain, - ) + Image.network( + timelineData.imagesUrl!, + width: 260.w, + height: 260.h, + ) + // Image( + // image: const AssetImage( + // 'images/main/icon_lockDetail_monitoringvoiceFrist.png'), + // width: 240.w, + // height: 180.h, + // fit: BoxFit.contain, + // ) : Container(), Positioned( top: 150.h, diff --git a/star_lock/lib/main/lockDetail/face/addFace/addFace_logic.dart b/star_lock/lib/main/lockDetail/face/addFace/addFace_logic.dart index 6c60559f..73d7883e 100644 --- a/star_lock/lib/main/lockDetail/face/addFace/addFace_logic.dart +++ b/star_lock/lib/main/lockDetail/face/addFace/addFace_logic.dart @@ -132,10 +132,12 @@ class AddFaceLogic extends BaseGetXController { switch (status) { case 0x00: //成功 - if (state.faceNumber.value == (reply.data[6]).toString()) { + var faceNumber = listChangInt(reply.data.sublist(6, 7)).toString(); + // if (state.faceNumber.value == (reply.data[6]).toString()) { + if (state.faceNumber.value == faceNumber) { return; } else { - state.faceNumber.value = (reply.data[6]).toString(); + state.faceNumber.value = faceNumber; } addFaceData(); break; diff --git a/star_lock/lib/main/lockDetail/fingerprint/addFingerprint/addFingerprint_logic.dart b/star_lock/lib/main/lockDetail/fingerprint/addFingerprint/addFingerprint_logic.dart index ae5ba930..76fe577d 100644 --- a/star_lock/lib/main/lockDetail/fingerprint/addFingerprint/addFingerprint_logic.dart +++ b/star_lock/lib/main/lockDetail/fingerprint/addFingerprint/addFingerprint_logic.dart @@ -27,7 +27,7 @@ class AddFingerprintLogic extends BaseGetXController { void _initReplySubscription() { _replySubscription = EventBusManager().eventBus!.on().listen((reply) async { // 添加指纹开始 - if(reply is SenderAddFingerprintWithTimeCycleCoercionReply) { + if((reply is SenderAddFingerprintWithTimeCycleCoercionReply) && (state.ifCurrentScreen.value == true)) { _replyAddFingerprintBegin(reply); } @@ -153,17 +153,17 @@ class AddFingerprintLogic extends BaseGetXController { Future _replyAddFingerprintConfirmation(Reply reply) async { int status = reply.data[2]; - switch(status){ case 0x00: //成功 - if(state.fingerprintNumber.value == (reply.data[6]).toString()){ + var fingerprintNum = listChangInt(reply.data.sublist(9, 11)).toString(); + if(state.fingerprintNumber.value == fingerprintNum){ return; }else{ - state.fingerprintNumber.value = (reply.data[6]).toString(); + state.fingerprintNumber.value = fingerprintNum; } // if(state.isCoerced.value == "1"){ - // 非胁迫指纹 + // 调用添加指纹接口 addFingerprintsData(); // }else{ // // 如果是胁迫指纹在 添加完之后以后再调用添加胁迫指纹的 diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart index ec218510..b1fc67d6 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart @@ -432,9 +432,12 @@ class LockDetailLogic extends BaseGetXController { AppLog.log("从服务器获取联网token:${state.lockNetToken}"); openDoorAction(); }else{ - showToast("", something: (){ + showToast("网络访问失败,请检查网络是否正常".tr, something: (){ state.openLockBtnState.value = 0; + state.animationController!.forward(); cancelBlueConnetctToastTimer(); + state.lockNetToken = "0"; + openDoorAction(); }); } } diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_state.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_state.dart index ef1f22ec..28fa4dd6 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_state.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_state.dart @@ -13,7 +13,7 @@ class LockDetailState { late StreamSubscription replySubscription; StreamSubscription? lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent; - String lockNetToken = ""; + String lockNetToken = "0"; int differentialTime = 0; int lockUserNo = 0; var senderUserId = 0; diff --git a/star_lock/lib/main/lockDetail/lockSet/basicInformation/editLockName/editLockName_page.dart b/star_lock/lib/main/lockDetail/lockSet/basicInformation/editLockName/editLockName_page.dart index 47dce353..5847dce1 100644 --- a/star_lock/lib/main/lockDetail/lockSet/basicInformation/editLockName/editLockName_page.dart +++ b/star_lock/lib/main/lockDetail/lockSet/basicInformation/editLockName/editLockName_page.dart @@ -48,7 +48,7 @@ class _EditLockNamePageState extends State { leftWidget: const SizedBox(), hintText: "请输入名称".tr, isHaveLeftWidget: true, - isSuffixIcon: true, + isSuffixIcon: 1, inputFormatters: [ LengthLimitingTextInputFormatter(50), ]), diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart index 4e82c36a..868eae47 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart @@ -4,6 +4,7 @@ import 'dart:async'; import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:get/get.dart'; +import 'package:star_lock/app_settings/app_settings.dart'; import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_state.dart'; import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/tools/eventBusEventManage.dart'; @@ -205,23 +206,26 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { void _initReplySubscription() { _replySubscription = EventBusManager().eventBus!.on().listen((reply) async { // 设置自定义密码 - if (reply is SenderCustomPasswordsReply) { - var token = reply.data.sublist(5, 9); - var saveStrList = changeIntListToStringList(token); - Storage.setStringList(saveBlueToken, saveStrList); - + if ((reply is SenderCustomPasswordsReply) && (state.ifCurrentScreen.value == true)) { int status = reply.data[2]; switch (status) { case 0x00: //成功 state.sureBtnState.value = 0; - state.pwdNumber.value = (reply.data[9]); + state.pwdNumber.value = listChangInt(reply.data.sublist(9, 11)); + // AppLog.log("密码编号:${state.pwdNumber.value}"); + dismissEasyLoading(); cancelBlueConnetctToastTimer(); addKeyboardPwdRequest(); break; case 0x06: //无权限 + var token = reply.data.sublist(5, 9); + // AppLog.log("token:$token"); + var saveStrList = changeIntListToStringList(token); + Storage.setStringList(saveBlueToken, saveStrList); + var privateKey = await Storage.getStringList(saveBluePrivateKey); List getPrivateKeyList = changeStringListToIntList(privateKey!); diff --git a/star_lock/lib/tools/tf_loginInput.dart b/star_lock/lib/tools/tf_loginInput.dart index 5cb0056d..d6dd6025 100644 --- a/star_lock/lib/tools/tf_loginInput.dart +++ b/star_lock/lib/tools/tf_loginInput.dart @@ -11,7 +11,7 @@ import 'package:star_lock/app_settings/app_colors.dart'; typedef BlockStrCallback = void Function(dynamic textStr); typedef BlockClickCallback = void Function(); -class LoginInput extends StatelessWidget { +class LoginInput extends StatefulWidget { TextEditingController? controller; FocusNode? focusNode; List? inputFormatters; @@ -22,7 +22,7 @@ class LoginInput extends StatelessWidget { Widget? leftWidget; String? label; bool? isPwd; - bool? isSuffixIcon; + int? isSuffixIcon; Widget? rightSlot; BlockStrCallback? onchangeAction; BlockClickCallback? onTapAction; @@ -46,6 +46,11 @@ class LoginInput extends StatelessWidget { }) : super(key: key); + @override + State createState() => _LoginInputState(); +} + +class _LoginInputState extends State { @override Widget build(BuildContext context) { return Container( @@ -54,37 +59,48 @@ class LoginInput extends StatelessWidget { TextField( //输入框一行 maxLines: 1, - controller: controller, - focusNode: focusNode, - onChanged: onchangeAction, - onTap: onTapAction, + controller: widget.controller, + focusNode: widget.focusNode, + onChanged: widget.onchangeAction, + onTap: widget.onTapAction, autofocus: false, - inputFormatters: inputFormatters, + inputFormatters: widget.inputFormatters, decoration: InputDecoration( //输入里面输入文字内边距设置 contentPadding: const EdgeInsets.only( top: 8.0, left: -19.0, right: -15.0, bottom: 8.0), - labelText: label, + labelText: widget.label, labelStyle: TextStyle(fontSize: 22.sp,color: AppColors.darkGrayTextColor), hintStyle: TextStyle(fontSize: 22.sp), - hintText: hintText, + hintText: widget.hintText, //不需要输入框下划线 border: InputBorder.none, - suffixIcon: (isSuffixIcon ?? false) + suffixIcon: (widget.isSuffixIcon == 1) ? IconButton( icon: const Icon(Icons.clear), - onPressed: controller!.clear, + onPressed: widget.controller!.clear, ) - : null, + : (widget.isSuffixIcon == 2 ? IconButton( + icon: Icon( + // 根据 _obscureText 的值切换图标 + widget.isPwd! ? Icons.visibility_off : Icons.visibility, + ), + onPressed: () { + // 当按钮被点击时,切换 _obscureText 的值 + setState(() { + widget.isPwd = !widget.isPwd!; + }); + }, + ):null), //左边图标设置 - icon: isHaveLeftWidget == true - ? leftWidget + icon: widget.isHaveLeftWidget == true + ? widget.leftWidget : SizedBox( width: 20.w, height: 40.w, ), ), - obscureText: isPwd ?? false, + obscureText: widget.isPwd ?? false, ), Container( height: 0.5.h,