From b70327fda63733add4c9949cdc71c04ab656facd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AD=8F=E5=B0=91=E9=98=B3?= <786612630@qq.com> Date: Sun, 7 Apr 2024 14:03:59 +0800 Subject: [PATCH] =?UTF-8?q?=10=10=10=101=E3=80=81=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E8=B4=A6=E5=8F=B7=E6=97=B6=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E9=82=AE=E7=AE=B1=E6=89=8B=E6=9C=BA=E5=8A=9F=E8=83=BD=E3=80=82?= =?UTF-8?q?2=E3=80=81=E6=B7=BB=E5=8A=A0=E9=83=A8=E5=88=86=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E5=9B=BD=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- star_lock/images/lan/lan_en.json | 76 +++++++- star_lock/images/lan/lan_keys.json | 77 ++++++++- star_lock/images/lan/lan_zh.json | 75 +++++++- .../blue/io_protocol/io_addFingerprint.dart | 2 + .../io_protocol/io_senderCustomPasswords.dart | 2 + star_lock/lib/flavors.dart | 8 +- .../starLock_forgetPassword_logic.dart | 7 +- .../starLock_forgetPassword_page.dart | 7 +- .../starLock_forgetPassword_state.dart | 2 +- .../lib/login/login/starLock_login_page.dart | 11 +- .../register/starLock_register_logic.dart | 4 +- .../register/starLock_register_page.dart | 14 +- .../register/starLock_register_state.dart | 2 +- .../selectCountryRegion_page.dart | 145 ++++++++-------- .../checkingInDetail_page.dart | 10 +- .../checkingInDetail_state.dart | 13 +- .../checkingInList/checkingInList_page.dart | 15 +- .../checkingInSet/checkingInSet_page.dart | 40 +---- .../checkingInAddStaff_logic.dart | 4 +- .../checkingInAddStaff_page.dart | 24 +-- .../checkingInAddStaff_state.dart | 8 +- .../checkingInStaffList_page.dart | 47 ++--- .../checkingInStaffDetail_page.dart | 10 +- .../checkingInStaffDetail_state.dart | 6 +- .../electronicKeyDetail_logic.dart | 7 +- .../electronicKeyDetail_page.dart | 7 +- .../electronicKeyDetail_state.dart | 2 +- .../electronicKeyList_page.dart | 9 +- .../addFingerprint/addFingerprint_logic.dart | 14 +- .../lockDetail/lockDetail_logic.dart | 20 +-- .../lockDetail/lockDetail_page.dart | 12 +- .../lockOperatingRecord_page.dart | 23 ++- .../lockOperatingRecord_state.dart | 3 + .../adminOpenLockPassword_logic.dart | 7 +- .../basicInformation_page.dart | 8 +- .../passwordKeyDetail_logic.dart | 4 +- .../passwordKeyList_logic.dart | 34 ++-- .../passwordKeyList/passwordKeyList_page.dart | 65 ++----- .../passwordKey_perpetual_logic.dart | 119 +++++++++---- .../passwordKey_perpetual_page.dart | 163 +++--------------- .../passwordKey_perpetual_state.dart | 12 +- star_lock/lib/mine/mall/lockMall_page.dart | 2 +- .../mine/safeVerify/safeVerify_logic.dart | 4 +- .../mine/mine/safeVerify/safeVerify_page.dart | 75 +++++++- .../lib/mine/mine/starLockMine_logic.dart | 4 +- .../mineBindPhoneOrEmail_logic.dart | 21 ++- .../mine/mineSet/mineSet/mineSet_logic.dart | 4 +- .../mine/mineSet/mineSet/mineSet_page.dart | 73 ++++---- star_lock/lib/tools/baseGetXController.dart | 4 +- star_lock/lib/tools/commonItem.dart | 4 +- star_lock/lib/tools/dateTool.dart | 84 ++++++--- star_lock/lib/tools/showTipView.dart | 6 +- star_lock/lib/tools/storage.dart | 2 +- star_lock/lib/translations/lanKeyEntity.dart | 4 - 54 files changed, 815 insertions(+), 590 deletions(-) diff --git a/star_lock/images/lan/lan_en.json b/star_lock/images/lan/lan_en.json index 87ae5eca..f6f54d6d 100644 --- a/star_lock/images/lan/lan_en.json +++ b/star_lock/images/lan/lan_en.json @@ -1,5 +1,6 @@ { "starLock":"Star Lock", + "lockThrough":"Lock Through", "clickUnlockAndHoldDownClose":"Click To Unlock And Hold Down to Close", "checkingIn":"Checking In", "electronicKey":"Electronic Key", @@ -202,7 +203,6 @@ "videoIntercomDoorLock":"Video intercom door lock", "NFCPassiveLock":"NFC Passive Lock", "addDevice":"Add device", - "shoppingCart":"Lock Mall", "gateway":"Gateway", "message":"Message", "supportStaff":"Support Staff", @@ -476,5 +476,77 @@ "judgmentMethodContent": "The man stood outside the house, facing the entrance door. \nIf the hinge or shaft of the door is on the left, the door is left open; \nA door is right-open if its hinge or shaft is on the right. \nIf the setting is wrong, it will not open and close the door properly. \nRecommended to be operated by installation or maintenance personnel.", "customMode": "Custom mode", - "videoSlot": "Video slot" + "videoSlot": "Video slot", + + "密码":"Password", + "卡":"Card", + "指纹":"Fingerprint", + "人脸":"Face", + "配件商城":"Lock Mall", + "公司名称":"Company Name", + "修改公司名字":"Change company name", + "请输入公司名字":"Please nter the company name", + "提示":"Hint", + "是否删除?":"Whether to delete?", + "员工信息":"Staff's Information", + "员工":"Staff", + "打卡方式无效":"The clocking method is invalid", + "中国":"China", + "选择钥匙":"Select the key", + "编辑":"Edit", + "无":"Unhave", + "有":"have", + "请输入姓名": "Please enter name", + "获取人脸":"Getting faces", + "选择密码":"Choosing a password", + "选择卡":"Select card", + "选择指纹":"Select fingerprint", + "选择人脸":"Select face", + "员工是否有人脸":"Whether the employee has a face", + "同时删除员工钥匙":"Also delete the employee key", + "删除":"Delet", + "确定要删除员工吗?":"Are you sure you want to delete the employee?", + "月统计":"Monthly statistics", + "迟到":"Be late", + "早退":"Leave early", + "未打卡":"No card punched", + "钥匙将在":"The key will be in", + "天后失效":"Days later invalid", + "锁更新时间:":"Lock update time:", + "新增配件":"Add accessories", + "请在锁旁边完成第一次开锁":"Please complete the first unlock next to the lock", + "正在开锁中...":"Unlocking...", + "你的钥匙": "Your key", + "常开模式启动!长按闭锁": "Open mode started! Long press to lock", + "演示模式": "Demo mode", + "请先同意用户协议及隐私政策": "Please agree to the user agreement and privacy policy first", + "用户协议": "User agreement", + "隐私政策": "Privacy policy", + "注册成功": "Registration success", + "你所在的": "You are in", + "手机号": "Mobile phone number", + "忘记密码": "Forget password", + "重置成功": "Reset success", + "确定要退出吗?": "Are you sure you want to exit?", + "功能暂未开放": "Function is not yet open", + "设置成功": "Set up successfully", + "删除成功": "Delete successfully", + "单次": "Once", + "永久": "Permanent", + "限时": "Time limit", + "自定义": "Custom", + "清空码": "Clear code", + "循环": "Cycle", + "工作日": "Workday", + "周末": "Weekend", + "周一": "Monday", + "周二": "Tuesday", + "周三": "Wednesday", + "周四": "Thursday", + "周五": "Friday", + "周六": "Saturday", + "周日": "Sunday", + "确定要删除吗?": "Are you sure you want to delete?", + "该锁的密码都将被删除": "The password of the lock will be deleted", + "已过期": "Expired" } diff --git a/star_lock/images/lan/lan_keys.json b/star_lock/images/lan/lan_keys.json index 0201e002..833d9983 100644 --- a/star_lock/images/lan/lan_keys.json +++ b/star_lock/images/lan/lan_keys.json @@ -1,5 +1,6 @@ { "starLock":"starLock", + "lockThrough":"lockThrough", "clickUnlockAndHoldDownClose":"clickUnlockAndHoldDownClose", "checkingIn":"checkingIn", "electronicKey":"electronicKey", @@ -202,7 +203,6 @@ "videoIntercomDoorLock":"videoIntercomDoorLock", "NFCPassiveLock":"NFCPassiveLock", "addDevice":"addDevice", - "shoppingCart":"shoppingCart", "gateway":"gateway", "message":"message", "supportStaff":"supportStaff", @@ -476,5 +476,78 @@ "judgmentMethodContent": "judgmentMethodContent", "customMode": "customMode", - "videoSlot": "videoSlot" + "videoSlot": "videoSlot", + + "密码":"密码", + "卡":"卡", + "指纹":"指纹", + "人脸":"人脸", + "配件商城":"配件商城", + "公司名称":"公司名称", + "修改公司名字":"修改公司名字", + "请输入公司名字":"请输入公司名字", + "提示":"提示", + "是否删除?":"是否删除?", + "员工信息":"员工信息", + "员工":"员工", + "打卡方式无效":"打卡方式无效", + "中国":"中国", + "选择钥匙":"选择钥匙", + "编辑":"编辑", + "无":"无", + "有":"有", + "请输入姓名":"请输入姓名", + "获取人脸":"获取人脸", + "选择密码":"选择密码", + "选择卡":"选择卡", + "选择指纹":"选择指纹", + "选择人脸":"选择人脸", + "员工是否有人脸":"员工是否有人脸", + "同时删除员工钥匙":"同时删除员工钥匙", + "删除":"删除", + "打卡方式无效":"打卡方式无效", + "确定要删除员工吗?":"确定要删除员工吗?", + "月统计":"月统计", + "迟到":"迟到", + "早退":"早退", + "未打卡":"未打卡", + "钥匙将在":"钥匙将在", + "天后失效":"天后失效", + "锁更新时间:":"锁更新时间:", + "新增配件":"新增配件", + "请在锁旁边完成第一次开锁":"请在锁旁边完成第一次开锁", + "正在开锁中...":"正在开锁中...", + "你的钥匙": "你的钥匙", + "常开模式启动!长按闭锁": "常开模式启动!长按闭锁", + "演示模式": "演示模式", + "请先同意用户协议及隐私政策": "请先同意用户协议及隐私政策", + "用户协议": "用户协议", + "隐私政策": "隐私政策", + "注册成功": "注册成功", + "你所在的": "你所在的", + "手机号": "公司已经开通了", + "忘记密码": "忘记密码", + "重置成功": "重置成功", + "确定要退出吗?": "确定要退出吗?", + "功能暂未开放": "功能暂未开放", + "设置成功": "设置成功", + "删除成功": "删除成功", + "单次": "单次", + "永久": "永久", + "限时": "限时", + "自定义": "自定义", + "清空码": "清空码", + "循环": "循环", + "工作日": "工作日", + "周末": "周末", + "周一": "周一", + "周二": "周二", + "周三": "周三", + "周四": "周四", + "周五": "周五", + "周六": "周六", + "周日": "周日", + "确定要删除吗?": "确定要删除吗?", + "该锁的密码都将被删除": "该锁的密码都将被删除", + "已过期": "已过期" } diff --git a/star_lock/images/lan/lan_zh.json b/star_lock/images/lan/lan_zh.json index 5d8a5aef..3343e66a 100644 --- a/star_lock/images/lan/lan_zh.json +++ b/star_lock/images/lan/lan_zh.json @@ -1,5 +1,6 @@ { "starLock":"星锁", + "lockThrough":"锁通通", "clickUnlockAndHoldDownClose":"点击开锁,长按闭锁", "checkingIn":"考勤", "electronicKey":"电子钥匙", @@ -202,7 +203,6 @@ "videoIntercomDoorLock":"可视对讲门锁", "NFCPassiveLock":"NFC无源锁", "addDevice":"添加设备", - "shoppingCart":"配件商城", "gateway":"网关", "message":"消息", "supportStaff":"客服", @@ -479,5 +479,76 @@ "judgmentMethodContent": "人站在屋外,面向入户门。\n如果门的合页或门轴在左边,则门是左开;\n如果门的合页或门轴在右边,则门是右开。\n如果设置错误,将无法正常开关门。\n建议由安装或维修人员操作。", "customMode": "自定义模式", - "videoSlot": "录像时段" + "videoSlot": "录像时段", + + "密码":"密码", + "卡":"卡", + "指纹":"指纹", + "人脸":"人脸", + "配件商城":"配件商城", + "公司名称":"公司名称", + "修改公司名字":"修改公司名字", + "请输入公司名字":"请输入公司名字", + "提示":"提示", + "是否删除?":"是否删除?", + "员工信息":"员工信息", + "员工":"员工", + "打卡方式无效":"打卡方式无效", + "中国":"中国", + "选择钥匙":"选择钥匙", + "编辑":"编辑", + "无":"无", + "有":"有", + "请输入姓名":"请输入姓名", + "获取人脸":"获取人脸", + "选择密码":"选择密码", + "选择卡":"选择卡", + "选择指纹":"选择指纹", + "选择人脸":"选择人脸", + "员工是否有人脸":"员工是否有人脸", + "同时删除员工钥匙":"同时删除员工钥匙", + "删除":"删除", + "确定要删除员工吗?":"确定要删除员工吗?", + "月统计":"月统计", + "迟到":"迟到", + "早退":"早退", + "钥匙将在":"钥匙将在", + "天后失效":"天后失效", + "锁更新时间:":"锁更新时间:", + "新增配件":"新增配件", + "请在锁旁边完成第一次开锁":"请在锁旁边完成第一次开锁", + "正在开锁中...":"正在开锁中...", + "你的钥匙": "你的钥匙", + "常开模式启动!长按闭锁": "常开模式启动!长按闭锁", + "演示模式": "演示模式", + "请先同意用户协议及隐私政策": "请先同意用户协议及隐私政策", + "用户协议": "用户协议", + "隐私政策": "隐私政策", + "注册成功": "注册成功", + "你所在的": "你所在的", + "手机号": "公司已经开通了", + "忘记密码": "忘记密码", + "重置成功": "重置成功", + "确定要退出吗?": "确定要退出吗?", + "功能暂未开放": "功能暂未开放", + "设置成功": "设置成功", + "删除成功": "删除成功", + "单次": "单次", + "永久": "永久", + "限时": "限时", + "自定义": "自定义", + "清空码": "清空码", + "循环": "循环", + "工作日": "工作日", + "周末": "周末", + "周一": "周一", + "周二": "周二", + "周三": "周三", + "周四": "周四", + "周五": "周五", + "周六": "周六", + "周日": "周日", + "确定要删除吗?": "确定要删除吗?", + "该锁的密码都将被删除": "该锁的密码都将被删除", + "已过期": "已过期" } diff --git a/star_lock/lib/blue/io_protocol/io_addFingerprint.dart b/star_lock/lib/blue/io_protocol/io_addFingerprint.dart index 0e4c73bc..23258492 100644 --- a/star_lock/lib/blue/io_protocol/io_addFingerprint.dart +++ b/star_lock/lib/blue/io_protocol/io_addFingerprint.dart @@ -45,6 +45,8 @@ class SenderAddFingerprintCommand extends SenderProtocol { List subData = []; List ebcData = []; + print("pwdNopwdNopwdNopwdNo:$fingerNo"); + // 指令类型 int type = commandType!.typeValue; double typeDouble = type / 256; diff --git a/star_lock/lib/blue/io_protocol/io_senderCustomPasswords.dart b/star_lock/lib/blue/io_protocol/io_senderCustomPasswords.dart index e041fdce..a2e4ae25 100644 --- a/star_lock/lib/blue/io_protocol/io_senderCustomPasswords.dart +++ b/star_lock/lib/blue/io_protocol/io_senderCustomPasswords.dart @@ -46,6 +46,8 @@ class SenderCustomPasswordsCommand extends SenderProtocol { List subData = []; List ebcData = []; + // print("pwdNopwdNopwdNopwdNo:$pwdNo"); + // 指令类型 int type = commandType!.typeValue; double typeDouble = type / 256; diff --git a/star_lock/lib/flavors.dart b/star_lock/lib/flavors.dart index 7eda6066..fc681b1a 100644 --- a/star_lock/lib/flavors.dart +++ b/star_lock/lib/flavors.dart @@ -1,3 +1,5 @@ +import 'package:get/get.dart'; + enum Flavor { xie, dev, @@ -41,11 +43,11 @@ class F { static String get navTitle { switch (appFlavor) { case Flavor.xie: - return '星锁-xie'; + return '${"starLock".tr}-xie'; case Flavor.dev: - return '星锁-dev'; + return '${"starLock".tr}-dev'; case Flavor.pre: - return '星锁'; + return "starLock".tr; case Flavor.sky: return '锁通通'; case Flavor.xhj: diff --git a/star_lock/lib/login/forgetPassword/starLock_forgetPassword_logic.dart b/star_lock/lib/login/forgetPassword/starLock_forgetPassword_logic.dart index 22264246..18bd4673 100644 --- a/star_lock/lib/login/forgetPassword/starLock_forgetPassword_logic.dart +++ b/star_lock/lib/login/forgetPassword/starLock_forgetPassword_logic.dart @@ -37,10 +37,8 @@ class StarLockForgetPasswordLogic extends BaseGetXController { "B748F838-94EE-4BDB-A0E6-7B2D16849792", state.verificationCode.value); if (entity.errorCode!.codeIsSuccessful) { - showToast("重置成功"); + showToast("重置成功".tr); Get.back(); - } else { - print('Error'); } } @@ -54,7 +52,7 @@ class StarLockForgetPasswordLogic extends BaseGetXController { xWidth:state.xWidth.value.toString()); if (entity.errorCode!.codeIsSuccessful) { _startTimer(); - } else {} + } } void checkNext(TextEditingController controller) { @@ -85,6 +83,5 @@ class StarLockForgetPasswordLogic extends BaseGetXController { void _resetCanSub() { state.canSub.value = state.pwdIsOK && state.codeIsOK; - print("22222:${state.canSub.value}"); } } diff --git a/star_lock/lib/login/forgetPassword/starLock_forgetPassword_page.dart b/star_lock/lib/login/forgetPassword/starLock_forgetPassword_page.dart index cf80fdd2..d50f70ce 100644 --- a/star_lock/lib/login/forgetPassword/starLock_forgetPassword_page.dart +++ b/star_lock/lib/login/forgetPassword/starLock_forgetPassword_page.dart @@ -32,8 +32,7 @@ class _StarLockForgetPasswordPageState resizeToAvoidBottomInset: false, backgroundColor: const Color(0xFFFFFFFF), appBar: TitleAppBar( - barTitle: - "忘记密码", + barTitle: "忘记密码".tr, haveBack: true, backgroundColor: AppColors.mainColor), body: ListView( @@ -196,8 +195,8 @@ class _StarLockForgetPasswordPageState : null, child: Container( width: 180.w, - height: 60.h, - padding: EdgeInsets.all(5.h), + // height: 60.h, + padding: EdgeInsets.all(10.h), decoration: BoxDecoration( color: state.phoneStrIsOK.value ? AppColors.mainColor diff --git a/star_lock/lib/login/forgetPassword/starLock_forgetPassword_state.dart b/star_lock/lib/login/forgetPassword/starLock_forgetPassword_state.dart index 97668b6c..8772c014 100644 --- a/star_lock/lib/login/forgetPassword/starLock_forgetPassword_state.dart +++ b/star_lock/lib/login/forgetPassword/starLock_forgetPassword_state.dart @@ -15,7 +15,7 @@ class StarLockForgetPasswordState { } var countryCode = "86".obs; - var countryName = '中国'.obs; + var countryName = '中国'.tr.obs; var codeType = '2'.obs; // 1:邮箱 2:手机 var pwd = ''.obs; var surePwd = ''.obs; diff --git a/star_lock/lib/login/login/starLock_login_page.dart b/star_lock/lib/login/login/starLock_login_page.dart index 76708589..1cde3c08 100644 --- a/star_lock/lib/login/login/starLock_login_page.dart +++ b/star_lock/lib/login/login/starLock_login_page.dart @@ -1,4 +1,4 @@ -import 'package:flutter/cupertino.dart'; + import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -8,7 +8,6 @@ import 'package:star_lock/flavors.dart'; import '../../appRouters.dart'; import '../../app_settings/app_colors.dart'; import '../../common/XSConstantMacro/XSConstantMacro.dart'; -import '../../tools/commonItem.dart'; import '../../tools/tf_loginInput.dart'; import '../../tools/submitBtn.dart'; import '../../tools/titleAppBar.dart'; @@ -141,7 +140,7 @@ class _StarLockLoginPageState extends State { onTap: () { Get.toNamed(Routers.webviewShowPage, arguments: { "url": XSConstantMacro.userAgreementURL, - "title": '用户协议' + "title": '用户协议'.tr }); }, )), @@ -156,7 +155,7 @@ class _StarLockLoginPageState extends State { onTap: () { Get.toNamed(Routers.webviewShowPage, arguments: { "url": XSConstantMacro.privacyPolicyURL, - "title": '隐私政策' + "title": '隐私政策'.tr }); }, )), @@ -175,7 +174,7 @@ class _StarLockLoginPageState extends State { onClick: state.canNext.value ? () { if (state.agree.value == false) { - logic.showToast('请先同意用户协议及隐私政策'); + logic.showToast('请先同意用户协议及隐私政策'.tr); return; } else { logic.login(); @@ -215,7 +214,7 @@ class _StarLockLoginPageState extends State { height: 50.h, // color: Colors.red, child: Center( - child: Text('演示模式', + child: Text('演示模式'.tr, style: TextStyle( fontSize: 22.sp, color: AppColors.mainColor)), diff --git a/star_lock/lib/login/register/starLock_register_logic.dart b/star_lock/lib/login/register/starLock_register_logic.dart index 668bfb15..fcb0dd01 100644 --- a/star_lock/lib/login/register/starLock_register_logic.dart +++ b/star_lock/lib/login/register/starLock_register_logic.dart @@ -36,9 +36,7 @@ class StarLockRegisterLogic extends BaseGetXController { password: state.pwd.value, verificationCode: state.verificationCode.value); if (entity.errorCode!.codeIsSuccessful) { - // await loginSuccess(loginEntity: entity); - // Toast.show(msg: "注册成功"); - showToast("注册成功"); + showToast("注册成功".tr); Get.back(result:{ "phoneOrEmailStr":state.phoneOrEmailStr.value, "pwd":state.pwd.value diff --git a/star_lock/lib/login/register/starLock_register_page.dart b/star_lock/lib/login/register/starLock_register_page.dart index 1e321d30..c4da5200 100644 --- a/star_lock/lib/login/register/starLock_register_page.dart +++ b/star_lock/lib/login/register/starLock_register_page.dart @@ -51,7 +51,7 @@ class _StarLockRegisterPageState extends State { onClick: state.canSub.value ? () { if (state.agree.value == false) { - logic.showToast('请先同意用户协议及隐私政策'); + logic.showToast('请先同意用户协议及隐私政策'.tr); return; } else { logic.register(); @@ -158,7 +158,7 @@ class _StarLockRegisterPageState extends State { children: [ SizedBox(width: 5.w), Expanded( - child: Text("你所在的${TranslationLoader.lanKeys!.countryAndRegion!.tr}", + child: Text("${"你所在的".tr}${TranslationLoader.lanKeys!.countryAndRegion!.tr}", style: TextStyle( fontSize: 26.sp, color: AppColors.blackColor))), SizedBox(width: 20.w), @@ -211,7 +211,7 @@ class _StarLockRegisterPageState extends State { height: 30.w, ), ), - hintText: "${TranslationLoader.lanKeys!.pleaseEnter!.tr}${state.isIphoneType.value ? "手机号" : TranslationLoader.lanKeys!.email!.tr}", + hintText: "${TranslationLoader.lanKeys!.pleaseEnter!.tr}${state.isIphoneType.value ? "手机号".tr : TranslationLoader.lanKeys!.email!.tr}", keyboardType: TextInputType.number, inputFormatters: [ // FilteringTextInputFormatter.allow(RegExp('[0-9]')), @@ -305,8 +305,8 @@ class _StarLockRegisterPageState extends State { : null, child: Container( width: 180.w, - height: 60.h, - padding: EdgeInsets.all(5.h), + // height: 60.h, + padding: EdgeInsets.all(10.h), decoration: BoxDecoration( color: state.phoneOrEmailStrIsOK.value ? AppColors.mainColor @@ -364,7 +364,7 @@ class _StarLockRegisterPageState extends State { onTap: () { Get.toNamed(Routers.webviewShowPage, arguments: { "url": XSConstantMacro.userAgreementURL, - "title": '用户协议' + "title": '用户协议'.tr }); }, )), @@ -378,7 +378,7 @@ class _StarLockRegisterPageState extends State { onTap: () { Get.toNamed(Routers.webviewShowPage, arguments: { "url": XSConstantMacro.privacyPolicyURL, - "title": '隐私政策' + "title": '隐私政策'.tr }); }, )), diff --git a/star_lock/lib/login/register/starLock_register_state.dart b/star_lock/lib/login/register/starLock_register_state.dart index 8ba411a5..525a7659 100644 --- a/star_lock/lib/login/register/starLock_register_state.dart +++ b/star_lock/lib/login/register/starLock_register_state.dart @@ -11,7 +11,7 @@ class StarLockRegisterState { final TextEditingController codeController = TextEditingController(); var countryCode = 86.obs; - var countryName = '中国'.obs; + var countryName = '中国'.tr.obs; var phoneOrEmailStr = ''.obs; var phoneOrEmailStrIsOK = false.obs; diff --git a/star_lock/lib/login/selectCountryRegion/selectCountryRegion_page.dart b/star_lock/lib/login/selectCountryRegion/selectCountryRegion_page.dart index 2c7e8995..0bbf4d63 100644 --- a/star_lock/lib/login/selectCountryRegion/selectCountryRegion_page.dart +++ b/star_lock/lib/login/selectCountryRegion/selectCountryRegion_page.dart @@ -78,80 +78,85 @@ class _SelectCountryRegionPageState extends State { @override Widget build(BuildContext context) { - return Scaffold( - resizeToAvoidBottomInset: false, - backgroundColor: const Color(0xFFFFFFFF), - appBar: TitleAppBar( - barTitle: - "${TranslationLoader.lanKeys!.select!.tr} ${TranslationLoader.lanKeys!.countryAndRegion!.tr}", - haveBack: true, - backgroundColor: AppColors.mainColor, - ), - body: Column( - children: [ - KeySearchWidget( - editingController: searchController, - backgroundColor: AppColors.mainBackgroundColor, - onSubmittedAction: () { - if(searchController.text.isEmpty){ - getCountriesListRequest(); - }else{ - var searchList = []; - for (int i = 0, length = countriesList.length; i < length; i++) { - CountryRegionModel countryModel = countriesList[i]; - if(countryModel.name!.contains(searchController.text) || countryModel.code!.contains(searchController.text)){ - searchList.add(countryModel); - Get.log('countryModel.name:${countryModel.name} countryModel.code:${countryModel.code}'); + return GestureDetector( + onTap: (){ + FocusScope.of(context).unfocus(); + }, + child: Scaffold( + resizeToAvoidBottomInset: false, + backgroundColor: const Color(0xFFFFFFFF), + appBar: TitleAppBar( + barTitle: + "${TranslationLoader.lanKeys!.select!.tr} ${TranslationLoader.lanKeys!.countryAndRegion!.tr}", + haveBack: true, + backgroundColor: AppColors.mainColor, + ), + body: Column( + children: [ + KeySearchWidget( + editingController: searchController, + backgroundColor: AppColors.mainBackgroundColor, + onSubmittedAction: () { + if(searchController.text.isEmpty){ + getCountriesListRequest(); + }else{ + var searchList = []; + for (int i = 0, length = countriesList.length; i < length; i++) { + CountryRegionModel countryModel = countriesList[i]; + if(countryModel.name!.contains(searchController.text) || countryModel.code!.contains(searchController.text)){ + searchList.add(countryModel); + Get.log('countryModel.name:${countryModel.name} countryModel.code:${countryModel.code}'); + } } + countriesList= searchList; + Get.log('searchList.length:${searchList.length}'); + _handleList(searchList); } - countriesList= searchList; - Get.log('searchList.length:${searchList.length}'); - _handleList(searchList); - } - setState(() {}); - }, - ), - SizedBox(height:20.h), - Visibility( - visible: searchController.text.isEmpty, - child: Utils.getSusItem(context, '★') - ), - countriesList.isNotEmpty ? Visibility( - visible: searchController.text.isEmpty, - child: Utils.getListItem(context, topCountriesList[0], () { - CountryRegionModel model = topCountriesList[0]; - Map resultMap = {}; - resultMap['code'] = model.code ?? ''; - resultMap['countryId'] = model.countryId.toString() ?? ''; - resultMap['countryName'] = model.name ?? '' ; - Navigator.pop(context, resultMap); - }) - ): Container(), - Expanded( - child: AzListView( - data: countriesList, - itemCount: countriesList.length, - itemBuilder: (BuildContext context, int index) { - CountryRegionModel model = countriesList[index]; - return Utils.getListItem(context, model, () { - Map resultMap = {}; - resultMap['code'] = model.code; - resultMap['countryId'] = model.countryId.toString(); - resultMap['countryName'] = model.name; - print("model.name:${model.name} model.code:${model.code} model.countryId:${model.countryId} model.flag:${model.flag} model.group:${model.group} model.tagIndex:${model.tagIndex}"); - Navigator.pop(context, resultMap); - }); + setState(() {}); }, - padding: EdgeInsets.zero, - susItemBuilder: (BuildContext context, int index) { - CountryRegionModel model = countriesList[index]; - String tag = model.getSuspensionTag(); - return Utils.getSusItem(context, tag); - }, - indexBarData: const ['★', ...kIndexBarData], ), - ), - ], + SizedBox(height:20.h), + Visibility( + visible: searchController.text.isEmpty, + child: Utils.getSusItem(context, '★') + ), + countriesList.isNotEmpty ? Visibility( + visible: searchController.text.isEmpty, + child: Utils.getListItem(context, topCountriesList[0], () { + CountryRegionModel model = topCountriesList[0]; + Map resultMap = {}; + resultMap['code'] = model.code ?? ''; + resultMap['countryId'] = model.countryId.toString() ?? ''; + resultMap['countryName'] = model.name ?? '' ; + Navigator.pop(context, resultMap); + }) + ): Container(), + Expanded( + child: AzListView( + data: countriesList, + itemCount: countriesList.length, + itemBuilder: (BuildContext context, int index) { + CountryRegionModel model = countriesList[index]; + return Utils.getListItem(context, model, () { + Map resultMap = {}; + resultMap['code'] = model.code; + resultMap['countryId'] = model.countryId.toString(); + resultMap['countryName'] = model.name; + print("model.name:${model.name} model.code:${model.code} model.countryId:${model.countryId} model.flag:${model.flag} model.group:${model.group} model.tagIndex:${model.tagIndex}"); + Navigator.pop(context, resultMap); + }); + }, + padding: EdgeInsets.zero, + susItemBuilder: (BuildContext context, int index) { + CountryRegionModel model = countriesList[index]; + String tag = model.getSuspensionTag(); + return Utils.getSusItem(context, tag); + }, + indexBarData: const ['★', ...kIndexBarData], + ), + ), + ], + ), ), ); } diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInDetail/checkingInDetail_page.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInDetail/checkingInDetail_page.dart index d4e9f3b6..94557742 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInDetail/checkingInDetail_page.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInDetail/checkingInDetail_page.dart @@ -83,7 +83,7 @@ class _CheckingInDetailPageState extends State { Widget build(BuildContext context) { return Scaffold( appBar: TitleAppBar( - barTitle: "张三", + barTitle: state.staffName.value, haveBack: true, backgroundColor: AppColors.mainColor), body: SingleChildScrollView( @@ -309,7 +309,7 @@ class _CheckingInDetailPageState extends State { padding: EdgeInsets.only(left: 50.w, top: 5.h, bottom: 5.h), color: Colors.grey, child: Text( - "月统计", + "月统计".tr, style: TextStyle( color: Colors.white, fontSize: 26.sp, @@ -318,9 +318,9 @@ class _CheckingInDetailPageState extends State { ), ], ), - _bottomStatisticsItemWidget(const Color(0xFFE83523), "迟到", state.lateTimes.value), - _bottomStatisticsItemWidget(const Color(0xFFEDB459), "早退", state.earlyTimes.value), - _bottomStatisticsItemWidget(const Color(0xFF666666), "未打卡", state.noPunchTimes.value), + _bottomStatisticsItemWidget(const Color(0xFFE83523), "迟到".tr, state.lateTimes.value), + _bottomStatisticsItemWidget(const Color(0xFFEDB459), "早退".tr, state.earlyTimes.value), + _bottomStatisticsItemWidget(const Color(0xFF666666), "未打卡".tr, state.noPunchTimes.value), ], ); } diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInDetail/checkingInDetail_state.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInDetail/checkingInDetail_state.dart index 43e692fb..7577b523 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInDetail/checkingInDetail_state.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInDetail/checkingInDetail_state.dart @@ -8,6 +8,7 @@ class CheckingInDetailState{ // final getKeyInfosData = LockListInfoItemEntity().obs; final companyId = "".obs; final staffId = 0.obs; + final staffName = "".obs; final checkDate = DateTime.now().millisecondsSinceEpoch.obs; @@ -17,9 +18,15 @@ class CheckingInDetailState{ final monthListData = [].obs; CheckingInDetailState() { Map map = Get.arguments; - // getKeyInfosData.value = map["getKeyInfosData"]; - companyId.value = map["companyId"]; - staffId.value = map["staffId"]; + if(companyId.value.isEmpty && map["companyId"] != null){ + companyId.value = map["companyId"]; + } + if(map["staffId"] != null){ + staffId.value = map["staffId"]; + } + if(staffName.value.isEmpty && map["staffName"] != null){ + staffName.value = map["staffName"]; + } } } \ No newline at end of file diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInList/checkingInList_page.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInList/checkingInList_page.dart index bff6e77c..20344f94 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInList/checkingInList_page.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInList/checkingInList_page.dart @@ -110,12 +110,13 @@ class _CheckingInListPageState extends State { }, child: Container( width: 90.w, - height: 70.h, + // height: 100.h, color: Colors.white, child: Obx(() => Column( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Text(TranslationLoader.lanKeys!.dailyCharts!.tr, style: TextStyle(color: state.isDay.value ? AppColors.mainColor : Colors.black, fontSize: 22.sp)), + SizedBox(height: 10.h), Visibility( visible: state.isDay.value, child: Container( @@ -147,12 +148,13 @@ class _CheckingInListPageState extends State { }, child: Container( width: 90.w, - height: 70.h, + // height: 100.h, color: Colors.white, child: Obx(() => Column( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Text(TranslationLoader.lanKeys!.monthlyLeaderboard!.tr, style: TextStyle(color: !state.isDay.value ? AppColors.mainColor : Colors.black, fontSize: 22.sp)), + SizedBox(height: 10.h), Visibility( visible: !state.isDay.value, child: Container(width: 20.w, height: 2.h, color: !state.isDay.value ? AppColors.mainColor : Colors.black)) @@ -259,11 +261,12 @@ class _CheckingInListPageState extends State { itemCount: state.checkingInDayListData.value.length, itemBuilder: (c, index) { AttendanceRecordDayList attendanceRecordList= state.checkingInDayListData.value[index]; - return _checkingInListItem(index, attendanceRecordList.headurl, attendanceRecordList.staffName,() { + return _checkingInListItem(index, attendanceRecordList.headurl, attendanceRecordList.staffName, () { Get.toNamed(Routers.checkingInDetailPage, arguments: { // "getKeyInfosData": state.getKeyInfosData.value, "companyId": state.companyId.value, "staffId": attendanceRecordList.staffId, + "staffName": attendanceRecordList.staffName, }); }); }, @@ -280,9 +283,9 @@ class _CheckingInListPageState extends State { AttendanceRecordMonthList attendanceRecordList= state.checkingInMonthListData.value[index]; return _checkingInListItem(index, attendanceRecordList.headurl, attendanceRecordList.staffName, () { Get.toNamed(Routers.checkingInDetailPage, arguments: { - "getKeyInfosData": state.getKeyInfosData.value, "companyId": state.companyId.value, "staffId": attendanceRecordList.staffId, + "staffName": attendanceRecordList.staffName, }); }); }, @@ -348,8 +351,8 @@ class _CheckingInListPageState extends State { } }, child: Obx(() => Container( - width: 200.w, - height: 60.h, + // width: 200.w, + // height: 60.h, color: AppColors.mainColor, child: Row( mainAxisAlignment: MainAxisAlignment.center, diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInSet/checkingInSet_page.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInSet/checkingInSet_page.dart index 28acc995..3ac3ba71 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInSet/checkingInSet_page.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInSet/checkingInSet_page.dart @@ -8,6 +8,7 @@ import 'package:star_lock/app_settings/app_colors.dart'; import '../../../../appRouters.dart'; import '../../../../tools/commonItem.dart'; import '../../../../tools/showTFView.dart'; +import '../../../../tools/showTipView.dart'; import '../../../../tools/submitBtn.dart'; import '../../../../tools/titleAppBar.dart'; import '../../../../translations/trans_lib.dart'; @@ -37,7 +38,7 @@ class _CheckingInSetPageState extends State { children: [ Obx(() => CommonItem( leftTitel: - "公司名称", + "公司名称".tr, // rightTitle: state.companyName.value ?? "", isHaveRightWidget: true, rightWidget: getTFWidget(), @@ -119,14 +120,17 @@ class _CheckingInSetPageState extends State { visible: state.getKeyInfosData.value.isLockOwner == 1, child: SubmitBtn( btnName: - "${TranslationLoader.lanKeys!.delete!.tr}${TranslationLoader.lanKeys!.company!.tr}", + "${TranslationLoader.lanKeys!.delete!.tr} ${TranslationLoader.lanKeys!.company!.tr}", borderRadius: 20.w, fontSize: 32.sp, isDelete: true, margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 20.w), padding: EdgeInsets.only(top: 20.w, bottom: 20.w), onClick: () { - showDeletCompanyAlertDialog(context); + ShowTipView().showIosTipWithContentDialog("是否删除?".tr, () { + logic.deletCompanyData(); + }); + // showDeletCompanyAlertDialog(context); }), ), ], @@ -139,12 +143,12 @@ class _CheckingInSetPageState extends State { context: context, builder: (BuildContext context) { return ShowTFView( - title: "修改公司名字", + title: "修改公司名字".tr, tipTitle: "", controller: state.changeNameController, sureClick: () { if(state.changeNameController.text.isEmpty){ - logic.showToast("请输入公司名字"); + logic.showToast("请输入公司名字".tr); return; } Get.back(); @@ -202,30 +206,4 @@ class _CheckingInSetPageState extends State { ); } - void showDeletCompanyAlertDialog(context) { - showCupertinoDialog( - context: context, - builder: (context) { - return CupertinoAlertDialog( - title: const Text("提示"), - content: const Text('是否删除?'), - actions: [ - CupertinoDialogAction( - child: Text(TranslationLoader.lanKeys!.cancel!.tr), - onPressed: () { - Get.back(); - }, - ), - CupertinoDialogAction( - child: Text(TranslationLoader.lanKeys!.sure!.tr), - onPressed: () { - Get.back(); - logic.deletCompanyData(); - }, - ), - ], - ); - }, - ); - } } diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_logic.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_logic.dart index db6e7c65..7427ebe1 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_logic.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_logic.dart @@ -106,7 +106,7 @@ class CheckingInAddStaffLogic extends BaseGetXController{ isCoerced: 1); if (entity.errorCode!.codeIsSuccessful) { - print('获取密码成功'); + // print('获取密码成功'); if (entity.data != null) { state.attendanceWayNumber.value = entity.data!.keyboardPwd!; isCanClickAction(); @@ -134,7 +134,7 @@ class CheckingInAddStaffLogic extends BaseGetXController{ }else{ state.isCanClick.value = state.staffNameIsNotEmpty && state.attendanceWayNumberIsNotEmpty; } - print("state.isCanClick.value = ${state.isCanClick.value}"); + // print("state.isCanClick.value = ${state.isCanClick.value}"); } @override diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_page.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_page.dart index c3800a74..ba974948 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_page.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_page.dart @@ -29,7 +29,7 @@ class _CheckingInAddStaffPageState extends State { backgroundColor: AppColors.mainBackgroundColor, appBar: TitleAppBar( barTitle: - "${state.isAdd.value == "1" ? TranslationLoader.lanKeys!.add!.tr : "编辑"}${TranslationLoader.lanKeys!.staff!.tr}", + "${state.isAdd.value == "1" ? TranslationLoader.lanKeys!.add!.tr : "编辑".tr}${TranslationLoader.lanKeys!.staff!.tr}", haveBack: true, backgroundColor: AppColors.mainColor), body: Column( @@ -50,11 +50,11 @@ class _CheckingInAddStaffPageState extends State { isHaveLine: false, isHaveDirection: true, action: () { - var list = ["APP", "密码", "卡", "指纹"]; + var list = ["APP", "密码".tr, "卡".tr, "指纹".tr]; if(state.getKeyInfosData.value.lockName!.contains("T9A")){ - list.add("人脸"); + list.add("人脸".tr); } - _showSelectClockInType(list, list, "1", "选择钥匙"); + _showSelectClockInType(list, list, "1", "选择钥匙".tr); })), SizedBox(height: 10.h), //员工是否有App、卡、钥匙、指纹必须显示 @@ -65,7 +65,7 @@ class _CheckingInAddStaffPageState extends State { isHaveRightWidget: true, rightWidget: Row( children: [ - whetherTheEmployeeHasAKeyWidget("无", state.appUnHaveAccount.value, () { + whetherTheEmployeeHasAKeyWidget("无".tr, state.appUnHaveAccount.value, () { setState(() { state.appUnHaveAccount.value = true; state.attendanceWayNumber.value = ""; @@ -75,7 +75,7 @@ class _CheckingInAddStaffPageState extends State { SizedBox( width: 30.w, ), - whetherTheEmployeeHasAKeyWidget("有", !state.appUnHaveAccount.value, () { + whetherTheEmployeeHasAKeyWidget("有".tr, !state.appUnHaveAccount.value, () { setState(() { state.appUnHaveAccount.value = false; state.attendanceWayNumber.value = ""; @@ -95,7 +95,7 @@ class _CheckingInAddStaffPageState extends State { isHaveLine: true, isHaveRightWidget: true, rightWidget: getTFWidget( - "${TranslationLoader.lanKeys!.pleaseEnter!.tr}员工${TranslationLoader.lanKeys!.accountNumber!.tr}", + "${TranslationLoader.lanKeys!.pleaseEnter!.tr}${"员工".tr}${TranslationLoader.lanKeys!.accountNumber!.tr}", state.staffAccountController)), CommonItem( leftTitel: @@ -146,7 +146,7 @@ class _CheckingInAddStaffPageState extends State { case 3: // 卡 if (state.staffNameController.text.isEmpty) { - logic.showToast("请输入姓名"); + logic.showToast("请输入姓名".tr); return; } @@ -164,7 +164,7 @@ class _CheckingInAddStaffPageState extends State { case 4: // 指纹 if (state.staffNameController.text.isEmpty) { - logic.showToast("请输入姓名"); + logic.showToast("请输入姓名".tr); return; } @@ -308,7 +308,7 @@ class _CheckingInAddStaffPageState extends State { state.attendanceWayNumber.value = numberList[index].toString(); } logic.isCanClickAction(); - print("object:$index str:$str type:$showBottomSheetToolType state.selectPrintingMethodType.value:${state.selectPrintingMethodType.value}"); + // print("object:$index str:$str type:$showBottomSheetToolType state.selectPrintingMethodType.value:${state.selectPrintingMethodType.value}"); }); }); } @@ -361,7 +361,7 @@ class _CheckingInAddStaffPageState extends State { title = TranslationLoader.lanKeys!.whetherTheEmployeeHasFingerprint!.tr; break; case 4: - title = "员工是否有人脸"; + title = "员工是否有人脸".tr; break; } return title; @@ -405,7 +405,7 @@ class _CheckingInAddStaffPageState extends State { title = TranslationLoader.lanKeys!.getFingerprint!.tr; break; case 5: - title = "获取人脸"; + title = "获取人脸".tr; break; } return title; diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_state.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_state.dart index 7972c825..dd4b2bda 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_state.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_state.dart @@ -17,7 +17,7 @@ class CheckingInAddStaffState{ final selectPrintingMethodType = "1".obs;// 选择打卡类型 1APP 2密码 3卡 4指纹 5人脸 final selectPrintingMethodStr = "APP".obs;// 选择打卡类型字符串 - final countryName = "中国".obs; + final countryName = "中国".tr.obs; final countryCode = "86".obs; final appUnHaveAccount = true.obs;// 默认没有账号 @@ -48,13 +48,13 @@ class CheckingInAddStaffState{ selectPrintingMethodStr.value = "APP"; break; case 2: - selectPrintingMethodStr.value = "密码"; + selectPrintingMethodStr.value = "密码".tr; break; case 3: - selectPrintingMethodStr.value = "卡"; + selectPrintingMethodStr.value = "卡".tr; break; case 4: - selectPrintingMethodStr.value = "指纹"; + selectPrintingMethodStr.value = "指纹".tr; break; } diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_page.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_page.dart index 0ab9411d..c3d189b7 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_page.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_page.dart @@ -74,16 +74,19 @@ class _CheckingInStaffListPageState extends State { onPressed: (BuildContext context){ // 1APP 2密码 3卡 4指纹 5人脸 if(staffListItem.attendanceType == 1){ - ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时删除员工钥匙', (isAllData) { + ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时删除员工钥匙'.tr, (isAllData) { logic.deletStaff(staffListItem.staffId!, (isAllData ? 1 : 0)); }); }else{ - showIosTipViewDialog(staffListItem.staffId!, context); + ShowTipView().showIosTipWithContentDialog("确定要删除员工吗?".tr, () { + logic.deletStaff(staffListItem.staffId!, 0); + }); + // showIosTipViewDialog(staffListItem.staffId!, context); } }, backgroundColor: Colors.red, foregroundColor: Colors.white, - label: '删除', + label: '删除'.tr, padding: EdgeInsets.only(left: 5.w, right: 5.w), ), ], @@ -150,7 +153,7 @@ class _CheckingInStaffListPageState extends State { borderRadius: BorderRadius.circular(5.w), color: AppColors.openPassageModeColor, ), - child: Text("打卡方式无效", style: TextStyle(fontSize: 18.sp, color: AppColors.appBarIconColor)), + child: Text("打卡方式无效".tr, style: TextStyle(fontSize: 18.sp, color: AppColors.appBarIconColor)), ), ), ], @@ -187,23 +190,23 @@ class _CheckingInStaffListPageState extends State { return title; } - void showIosTipViewDialog(int staffId, BuildContext context) { - showDialog( - context: context, - builder: (BuildContext context) { - return ShowIosTipView( - title: "提示", - tipTitle: "确定要删除员工吗?", - sureClick: () async { - Get.back(); - logic.deletStaff(staffId, 0); - }, - cancelClick: () { - Get.back(); - }, - ); - }, - ); - } + // void showIosTipViewDialog(int staffId, BuildContext context) { + // showDialog( + // context: context, + // builder: (BuildContext context) { + // return ShowIosTipView( + // title: "提示", + // tipTitle: "确定要删除员工吗?", + // sureClick: () async { + // Get.back(); + // logic.deletStaff(staffId, 0); + // }, + // cancelClick: () { + // Get.back(); + // }, + // ); + // }, + // ); + // } } diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInStaffDetail/checkingInStaffDetail_page.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInStaffDetail/checkingInStaffDetail_page.dart index c637a394..74692b67 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInStaffDetail/checkingInStaffDetail_page.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInStaffDetail/checkingInStaffDetail_page.dart @@ -26,7 +26,7 @@ class _CheckingInStaffDetailPageState extends State { return Scaffold( backgroundColor: AppColors.mainBackgroundColor, appBar: TitleAppBar( - barTitle: "员工信息", + barTitle: "员工信息".tr, haveBack: true, backgroundColor: AppColors.mainColor, actionsList: [ @@ -64,9 +64,10 @@ class _CheckingInStaffDetailPageState extends State { child: Row( children: [ Container( - height: 50.h, - padding: EdgeInsets.only(left: 20.w), - child: Text("${state.staffListItemData.value.reason}," "打卡方式无效", style: TextStyle(fontSize: 22.sp, color: AppColors.openPassageModeColor))) + width: 1.sw, + // height: 50.h, + padding: EdgeInsets.only(left: 20.w, right: 20.w, top: 10.h), + child: Text("${state.staffListItemData.value.reason},${"打卡方式无效".tr}", style: TextStyle(fontSize: 22.sp, color: AppColors.openPassageModeColor))) ], ), )), @@ -79,6 +80,7 @@ class _CheckingInStaffDetailPageState extends State { // "getKeyInfosData": state.getKeyInfosData.value, "companyId": state.companyId.value, "staffId": state.staffListItemData.value.staffId, + "staffName": state.staffListItemData.value.staffName, }); }), ], diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInStaffDetail/checkingInStaffDetail_state.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInStaffDetail/checkingInStaffDetail_state.dart index aa1eeca8..87edc79b 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInStaffDetail/checkingInStaffDetail_state.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInStaffDetail/checkingInStaffDetail_state.dart @@ -23,13 +23,13 @@ class CheckingInStaffDetailState{ attendanceType.value = "APP"; break; case 2: - attendanceType.value = "密码"; + attendanceType.value = "密码".tr; break; case 3: - attendanceType.value = "卡"; + attendanceType.value = "卡".tr; break; case 4: - attendanceType.value = "指纹"; + attendanceType.value = "指纹".tr; break; } } diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart index d2d34a79..de207dc2 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart @@ -1,6 +1,4 @@ -import 'dart:ffi'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_state.dart'; @@ -12,10 +10,7 @@ import 'package:star_lock/tools/baseGetXController.dart'; import '../../../../../tools/custom_bottom_sheet.dart'; import '../../../../../tools/dateTool.dart'; import '../../../../../tools/eventBusEventManage.dart'; -import '../../../../../tools/jh_pop_menus.dart'; -import '../../../../../tools/showDeleteAdministratorIsHaveAllDataWidget.dart'; import '../../../../../tools/showTipView.dart'; -import '../../../../../translations/trans_lib.dart'; typedef BlockIsHaveAllDataCallback = void Function(bool isAllData); @@ -54,7 +49,7 @@ class ElectronicKeyDetailLogic extends BaseGetXController { startTime:int.parse(state.starTime.value), endTime:int.parse(state.endTime.value), isOnlyManageSelf: state.onlyManageYouCreatesUser.value ? 1 : 0, - remoteEnable: state.isRemoteUnlock.value ? 1 : 0); + remoteEnable: state.isRemoteUnlock.value ? 1 : 2); if (entity.errorCode!.codeIsSuccessful) { // if(updateType == 1){ // state.onlyManageYouCreatesUser.value = !state.onlyManageYouCreatesUser.value; diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart index 7d6d65a1..b38e9a3e 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart @@ -3,13 +3,12 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart'; -import 'package:star_lock/tools/jh_pop_menus.dart'; import '../../../../../appRouters.dart'; import '../../../../../app_settings/app_colors.dart'; +import '../../../../../common/XSConstantMacro/XSConstantMacro.dart'; import '../../../../../tools/commonItem.dart'; import '../../../../../tools/dateTool.dart'; -import '../../../../../tools/showIosTipView.dart'; import '../../../../../tools/showTFView.dart'; import '../../../../../tools/submitBtn.dart'; import '../../../../../tools/titleAppBar.dart'; @@ -62,9 +61,9 @@ class _ElectronicKeyDetailPageState extends State { allHeight: 70.h, // rightTitle:"2023.09.19 11:27\n2023.09.25 11:27", rightTitle: logic.getKeyTypeShowDateTime(), - isHaveDirection: state.keyType.value == 3 ? false : true, + isHaveDirection: state.itemData.value.keyStatus! == XSConstantMacro.keyStatusExpired ? false : state.keyType.value == 3 ? false : true , isHaveLine: true, - action: () async { + action: state.itemData.value.keyStatus! == XSConstantMacro.keyStatusExpired ? null :() async { if(state.keyType.value == 2 || state.keyType.value == 1){ // 限时/永久 var data = await Get.toNamed(Routers.electronicKeyDetailChangeDate, arguments: { diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_state.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_state.dart index 7d9ba9a6..0b22d526 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_state.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_state.dart @@ -30,7 +30,7 @@ class ElectronicKeyDetailState { changeNameController.text = itemData.value.keyName!; keyName.value = itemData.value.keyName!; - isRemoteUnlock.value = itemData.value.remoteEnable! == 0 ? false : true; + isRemoteUnlock.value = itemData.value.remoteEnable! == 2 ? false : true; onlyManageYouCreatesUser.value = itemData.value.isOnlyManageSelf! == 0 ? false : true; starDate.value = itemData.value.startDate!.toString(); diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart index 89c0d306..939a9ef7 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart @@ -1,3 +1,4 @@ + import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -8,11 +9,11 @@ import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/electr import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart'; import 'package:star_lock/tools/noData.dart'; import 'package:star_lock/tools/storage.dart'; + import '../../../../appRouters.dart'; import '../../../../app_settings/app_colors.dart'; import '../../../../tools/EasyRefreshTool.dart'; import '../../../../tools/keySearchWidget.dart'; -import '../../../../tools/showIosTipView.dart'; import '../../../../tools/submitBtn.dart'; import '../../../../tools/titleAppBar.dart'; import '../../../../translations/trans_lib.dart'; @@ -63,7 +64,7 @@ class _ElectronicKeyListPageState extends State { // 获取是否是演示模式 演示模式不获取接口 var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); if (isDemoMode == false) { - _showDialog(context); + _showDialog(); } else { logic.showToast("演示模式"); } @@ -314,9 +315,9 @@ class _ElectronicKeyListPageState extends State { } //是否重置弹窗 - void _showDialog(widgetContext) { + void _showDialog() { showCupertinoDialog( - context: widgetContext, + context: Get.context!, builder: (context) { return CupertinoAlertDialog( title: const Text('该锁的电子钥匙都将被删除'), 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 7fac8cbe..83223d80 100644 --- a/star_lock/lib/main/lockDetail/fingerprint/addFingerprint/addFingerprint_logic.dart +++ b/star_lock/lib/main/lockDetail/fingerprint/addFingerprint/addFingerprint_logic.dart @@ -95,17 +95,23 @@ class AddFingerprintLogic extends BaseGetXController { case 0x07: //无权限 print("${reply.commandType!.typeValue} 用户无权限"); - + showToast("添加指纹失败", something: (){ + Get.back(); + }); break; case 0x09: // 权限校验错误 print("${reply.commandType!.typeValue} 权限校验错误"); - + showToast("添加指纹失败", something: (){ + Get.back(); + }); break; default: //失败 print("${reply.commandType!.typeValue} 失败"); - + showToast("添加指纹失败", something: (){ + Get.back(); + }); break; } } @@ -276,8 +282,8 @@ class AddFingerprintLogic extends BaseGetXController { var token = await Storage.getStringList(saveBlueToken); List getTokenList = changeStringListToIntList(token!); - print("openDoorTokenPubToken:$getTokenList state.startDate.value:${state.startDate.value}"); + Get.log("state.isAdministrator.value:${state.isAdministrator.value}"); IoSenderManage.senderAddFingerprintCommand( keyID:"1", userID:await Storage.getUid(), diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart index b6e3d0ee..992889d3 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart @@ -112,7 +112,7 @@ class LockDetailLogic extends BaseGetXController { var tokenData = reply.data.sublist(2, 6); var saveStrList = changeIntListToStringList(tokenData); Storage.setStringList(saveBlueToken, saveStrList); - Get.log("openDoorToken:$tokenData"); + // Get.log("openDoorToken:$tokenData"); IoSenderManage.senderOpenLock( keyID: BlueManage().connectDeviceName, @@ -129,20 +129,20 @@ class LockDetailLogic extends BaseGetXController { break; case 0x07: //无权限 - print("${reply.commandType}用户无权限"); + Get.log("${reply.commandType}用户无权限"); break; case 0x09: // 权限校验错误 - print("${reply.commandType}校验错误"); + Get.log("${reply.commandType}校验错误"); break; case 0x16: // 正在开锁中... - print("${reply.commandType}正在开锁中..."); + Get.log("${reply.commandType}正在开锁中..."); state.openLockBtnState.value = 0; eventBus.fire(RefreshLockDetailInfoDataEvent()); - showToast("正在开锁中...", something: () { + showToast("正在开锁中...".tr, something: () { cancelBlueConnetctToastTimer(); }); break; @@ -318,7 +318,7 @@ class LockDetailLogic extends BaseGetXController { switch (status) { case 0x00: //成功 - print("添加用户数据解析成功"); + Get.log("添加用户数据解析成功"); cancelBlueConnetctToastTimer(); state.lockUserNo = reply.data[47]; _updateLockUserNo(); @@ -657,9 +657,6 @@ class LockDetailLogic extends BaseGetXController { keyId: state.keyInfos.value.keyId.toString(), lockUserNo: state.lockUserNo.toString()); if (entity.errorCode!.codeIsSuccessful) { - // state.keyInfos.value.lockUserNo = state.lockUserNo; - // state.bottomBtnisEable.value = true; - // print("state.bottomBtnisEable.value:${state.bottomBtnisEable.value} state.keyInfos.value.lockUserNo:${state.keyInfos.value.lockUserNo}"); eventBus.fire(RefreshLockDetailInfoDataEvent()); SchedulerBinding.instance.addPostFrameCallback((_) { eventBus.fire(RefreshLockListInfoDataEvent()); @@ -772,11 +769,10 @@ class LockDetailLogic extends BaseGetXController { state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusExpired || state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusDeleted || state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusReset) { - text = - "你的钥匙${XSConstantMacro.getKeyStatusStr(state.keyInfos.value.keyStatus!)}"; + text = "${"你的钥匙".tr}${XSConstantMacro.getKeyStatusStr(state.keyInfos.value.keyStatus!)}"; } else { text = state.isOpenPassageMode.value == 1 - ? "常开模式启动!长按闭锁" + ? "常开模式启动!长按闭锁".tr : TranslationLoader.lanKeys!.clickUnlockAndHoldDownClose!.tr; } return text; diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart index 698473e7..62ded510 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart @@ -152,7 +152,7 @@ class _LockDetailPageState extends State mainAxisAlignment: MainAxisAlignment.center, children: [ Text( - "钥匙将在${DateTool().compareTimeGetDaysFromNow(state.keyInfos.value.endDate!)}天后失效", + "${"钥匙将在".tr}${DateTool().compareTimeGetDaysFromNow(state.keyInfos.value.endDate!)}${"天后失效".tr}", style: TextStyle( color: const Color(0xffCBA74B), fontSize: 24.sp)) ], @@ -234,7 +234,7 @@ class _LockDetailPageState extends State GestureDetector( onTap: () { // logic.getStarLockStatus(); - ShowTipView().showSureAlertDialog("锁更新时间:${DateTool().dateToYMDHNString(state + ShowTipView().showSureAlertDialog("${"锁更新时间:".tr}${DateTool().dateToYMDHNString(state .keyInfos.value.electricQuantityDate! .toString())}"); }, @@ -297,7 +297,7 @@ class _LockDetailPageState extends State : null, onLongPressStart: state.openDoorBtnisUneable.value == true ? (details) { - Get.log("长按闭锁"); + // Get.log("长按闭锁"); setState(() { startUnLock(); }); @@ -504,7 +504,7 @@ class _LockDetailPageState extends State // '开门器', state.bottomBtnisUneable.value, () {})); // 新增配件 - showWidgetArr.add(bottomItem('images/main/icon_main_addLock.png', '新增配件', + showWidgetArr.add(bottomItem('images/main/icon_main_addLock.png', '新增配件'.tr, state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () { Navigator.pushNamed(context, Routers.accessoriesListPage); })); @@ -760,7 +760,7 @@ class _LockDetailPageState extends State ? (bottomBtnisEable ? onClick : () { - logic.showToast("请在锁旁边完成第一次开锁"); + logic.showToast("请在锁旁边完成第一次开锁".tr); }) : null, child: Container( @@ -934,7 +934,6 @@ class _LockDetailPageState extends State // print("state.isOpenLockNeedOnline.value:${state.isOpenLockNeedOnline.value}"); if (state.isOpenLockNeedOnline.value == 0) { // 不需要联网 - print("开锁开锁开锁开锁开锁开锁开锁开锁"); state.openDoorModel = 1; logic.openDoorAction(); } else { @@ -958,7 +957,6 @@ class _LockDetailPageState extends State // 电子钥匙lockUserNo为0 要先添加用户 logic.addUserConnectBlue(); } else { - print("闭锁闭锁闭锁闭锁闭锁闭锁闭锁闭锁"); state.openDoorModel = 32; logic.openDoorAction(); } diff --git a/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_page.dart b/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_page.dart index bd429acc..412839fa 100644 --- a/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_page.dart +++ b/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_page.dart @@ -69,15 +69,20 @@ class _LockOperatingRecordPageState extends State { ), body: Column( children: [ - Container( - padding: EdgeInsets.all(20.h), - child: Text( - TranslationLoader.lanKeys!.lockOperatingRecordTip!.tr, - textAlign: TextAlign.start, - style: TextStyle(fontSize: 20.sp), - ), - ), - _searchWidget(), + (state.keyInfos.value.isLockOwner == 1 || state.keyInfos.value.keyRight == 1) ? + Column( + children: [ + Container( + padding: EdgeInsets.all(20.h), + child: Text( + TranslationLoader.lanKeys!.lockOperatingRecordTip!.tr, + textAlign: TextAlign.start, + style: TextStyle(fontSize: 20.sp), + ), + ), + _searchWidget(), + ], + ) : Container(), SizedBox(height: 10.h), Expanded(child: _buildMainUI()), ], diff --git a/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_state.dart b/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_state.dart index 5942df9f..43ef9b49 100644 --- a/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_state.dart +++ b/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_state.dart @@ -1,3 +1,4 @@ +import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart'; @@ -6,6 +7,8 @@ import '../../lockMian/entity/lockListInfo_entity.dart'; class LockOperatingRecordState { final keyInfos = LockListInfoItemEntity().obs; final lockOperatingRecordListData = [].obs; + final TextEditingController searchController = TextEditingController(); + LockOperatingRecordState() { keyInfos.value = Get.arguments["keyInfo"]; } diff --git a/star_lock/lib/main/lockDetail/lockSet/basicInformation/adminOpenLockPassword/adminOpenLockPassword_logic.dart b/star_lock/lib/main/lockDetail/lockSet/basicInformation/adminOpenLockPassword/adminOpenLockPassword_logic.dart index b75eca91..0af1bb98 100644 --- a/star_lock/lib/main/lockDetail/lockSet/basicInformation/adminOpenLockPassword/adminOpenLockPassword_logic.dart +++ b/star_lock/lib/main/lockDetail/lockSet/basicInformation/adminOpenLockPassword/adminOpenLockPassword_logic.dart @@ -8,6 +8,7 @@ import 'package:star_lock/blue/io_type.dart'; import '../../../../../blue/blue_manage.dart'; import '../../../../../blue/io_protocol/io_changeAdministratorPassword.dart'; import '../../../../../blue/io_protocol/io_readAdminPassword.dart'; +import '../../../../../blue/io_protocol/io_senderCustomPasswords.dart'; import '../../../../../blue/io_reply.dart'; import '../../../../../blue/io_tool/io_tool.dart'; import '../../../../../blue/io_tool/manager_event_bus.dart'; @@ -25,7 +26,7 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{ late StreamSubscription _replySubscription; void _initReplySubscription() { _replySubscription = EventBusManager().eventBus!.on().listen((reply) { - if (reply is ChangeAdministratorPasswordReply) { + if (reply is SenderCustomPasswordsReply) {// ChangeAdministratorPasswordReply _replyChangeAdministratorPassword(reply); } @@ -66,7 +67,7 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{ List getPrivateKeyList = changeStringListToIntList(privateKey!); IoSenderManage.senderCustomPasswordsCommand( - keyID: "1", + keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(), userID: await Storage.getUid(), pwdNo: 254, pwd:state.changePwdController.text, @@ -251,7 +252,7 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{ // token: getTokenList); IoSenderManage.senderCustomPasswordsCommand( - keyID: "1", + keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(), userID: await Storage.getUid(), pwdNo: 254, pwd:state.changePwdController.text, diff --git a/star_lock/lib/main/lockDetail/lockSet/basicInformation/basicInformation/basicInformation_page.dart b/star_lock/lib/main/lockDetail/lockSet/basicInformation/basicInformation/basicInformation_page.dart index f236ea0b..8b2ec10d 100644 --- a/star_lock/lib/main/lockDetail/lockSet/basicInformation/basicInformation/basicInformation_page.dart +++ b/star_lock/lib/main/lockDetail/lockSet/basicInformation/basicInformation/basicInformation_page.dart @@ -74,18 +74,18 @@ class _BasicInformationPageState extends State { allHeight: 70.h, isHaveLine: true)), Obx(() => Visibility( - visible: state.lockBasicInfo.value.keyType == 4 ? true : false, + visible: (state.lockBasicInfo.value.keyType ?? 0) == 4 ? true : false, child: CommonItem( leftTitel: "有效日".tr, - rightTitle: state.lockBasicInfo.value!.weekDays!.join(",").toString(), + rightTitle: (state.lockBasicInfo.value.weekDays ?? []).join(",").toString(), allHeight: 70.h, isHaveLine: true), )), Obx(() => Visibility( - visible: state.lockBasicInfo.value.keyType == 4 ? true : false, + visible: (state.lockBasicInfo.value.keyType ?? 0) == 4 ? true : false, child: CommonItem( leftTitel: "有效时间", - rightTitle: "${DateTool().dateToHNString(state.lockBasicInfo.value.startDate.toString())}-${DateTool().dateToHNString(state.lockBasicInfo.value.endDate.toString())}", + rightTitle: "${DateTool().dateToHNString((state.lockBasicInfo.value.startDate ?? 0).toString())}-${DateTool().dateToHNString((state.lockBasicInfo.value.endDate ?? 0).toString())}", allHeight: 70.h, isHaveLine: true), )), diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart index 538a59a5..eb53a760 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart @@ -57,8 +57,8 @@ class PasswordKeyDetailLogic extends BaseGetXController { 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; + String starHour = "${state.itemData.value.hoursStart}"; + String endHour = "${state.itemData.value.hoursEnd}"; switch (getPwdType) { case 1: diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart index 9f9b225d..ca72942e 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart @@ -1,5 +1,6 @@ import 'dart:async'; +import 'package:get/get.dart'; import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart'; import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_state.dart'; import 'package:star_lock/network/api_repository.dart'; @@ -26,7 +27,6 @@ class PasswordKeyListLogic extends BaseGetXController { } else { if (entity.data!.itemList!.isNotEmpty) { state.itemDataList.value.addAll(entity.data!.itemList!); - print("state.itemDataList.value.length:${state.itemDataList.value.length}"); pageNo++; } } @@ -40,7 +40,7 @@ class PasswordKeyListLogic extends BaseGetXController { .keyboardPwdReset(state.keyInfo.value.lockId.toString()); if (entity.errorCode!.codeIsSuccessful) { // print("重置电子钥匙成功啦啦啦啦啦"); - showToast("重置成功", something: (){ + showToast("重置成功".tr, something: (){ pageNo = 1; mockNetworkDataRequest(); }); @@ -53,7 +53,7 @@ class PasswordKeyListLogic extends BaseGetXController { PasswordKeyEntity entity = await ApiRepository.to .deleteKeyboardPwd(lockId, keyboardPwdId, deleteType); if (entity.errorCode!.codeIsSuccessful) { - showToast("删除成功", something: (){ + showToast("删除成功".tr, something: (){ pageNo = 1; mockNetworkDataRequest(); }); @@ -74,70 +74,70 @@ class PasswordKeyListLogic extends BaseGetXController { switch (getPwdType) { case 1: //单次 1 只能在开始时间后6小时内使用一次 - useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} 单次'; + useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} ${"单次".tr}'; break; case 2: //永久 2 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效 - useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} 永久 ${indexEntity.isCustom! == 1? "自定义" : ""}'; + useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} ${"永久".tr} ${indexEntity.isCustom! == 1? "自定义".tr : ""}'; break; case 3: //限期 3 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效 useDateStr = - '${startDateStr.toLocal().toString().substring(0, 16)} - ${endDateStr.toLocal().toString().substring(0, 16)} 限时 ${indexEntity.isCustom! == 1? "自定义" : ""}'; + '${startDateStr.toLocal().toString().substring(0, 16)} - ${endDateStr.toLocal().toString().substring(0, 16)} ${"限时".tr} ${indexEntity.isCustom! == 1? "自定义".tr : ""}'; break; case 4: //删除 4 在锁上使用后会删除之前在锁上使用过的密码 - useDateStr = '${startDateStr.toLocal().toString().substring(0, 16)} 清空码'; + useDateStr = '${startDateStr.toLocal().toString().substring(0, 16)} ${"清空码".tr}'; break; case 5: //周未循环 5 在周未开始和结束时间指定时间段内有效 useDateStr = - '${startDateStr.toLocal().toString().substring(0, 16)} 周末$starHour:00-$endHour:00 循环'; + '${endDateStr.toLocal().toString().substring(0, 16)} ${"周末".tr}$starHour:00-$endHour:00 ${"循环".tr}'; break; case 6: //每日循环 6 每天开始和结束时间指定时间段内有效 useDateStr = - '${sendDateStr.toLocal().toString().substring(0, 16)} 周日$starHour:00-$endHour:00 循环'; + '${endDateStr.toLocal().toString().substring(0, 16)} ${"周日".tr}$starHour:00-$endHour:00 ${"循环"}'; break; case 7: //工作日循环 7 工作日开始和结束时间指定的时间段内有效 useDateStr = - '${sendDateStr.toLocal().toString().substring(0, 16)} 工作日$starHour:00-$endHour:00 循环'; + '${endDateStr.toLocal().toString().substring(0, 16)} ${"工作日".tr}$starHour:00-$endHour:00 ${"循环".tr}'; break; case 8: //周一循环 8 每周一开始和结束时间指定时间段内有效 useDateStr = - '${sendDateStr.toLocal().toString().substring(0, 16)} 周一$starHour:00-$endHour:00 循环'; + '${endDateStr.toLocal().toString().substring(0, 16)} ${"周一".tr}$starHour:00-$endHour:00 ${"循环".tr}'; break; case 9: //周二循环 9 每周二开始和结束时间指定时间段内有效 useDateStr = - '${sendDateStr.toLocal().toString().substring(0, 16)} 周二$starHour:00-$endHour:00 循环'; + '${endDateStr.toLocal().toString().substring(0, 16)} ${"周二".tr}$starHour:00-$endHour:00 ${"循环".tr}'; break; case 10: //周三循环 10 每周三开始和结束时间指定时间段内有效 useDateStr = - '${sendDateStr.toLocal().toString().substring(0, 16)} 周三$starHour:00-$endHour:00 循环'; + '${endDateStr.toLocal().toString().substring(0, 16)} ${"周三".tr}$starHour:00-$endHour:00 ${"循环".tr}'; break; case 11: //周四循环 11 每周四开始和结束时间指定时间段内有效 useDateStr = - '${sendDateStr.toLocal().toString().substring(0, 16)} 周四$starHour:00-$endHour:00 循环'; + '${endDateStr.toLocal().toString().substring(0, 16)} ${"周四".tr}$starHour:00-$endHour:00 ${"循环".tr}'; break; case 12: //周五循环 12 每周五开始和结束时间指定时间段内有效 useDateStr = - '${sendDateStr.toLocal().toString().substring(0, 16)} 周五$starHour:00-$endHour:00 循环'; + '${endDateStr.toLocal().toString().substring(0, 16)} ${"周五".tr}$starHour:00-$endHour:00 ${"循环".tr}'; break; case 13: //周六循环 13 每周六开始和结束时间指定时间段内有效 useDateStr = - '${sendDateStr.toLocal().toString().substring(0, 16)} 周六$starHour:00-$endHour:00 循环'; + '${endDateStr.toLocal().toString().substring(0, 16)} ${"周六".tr}$starHour:00-$endHour:00 ${"循环".tr}'; break; case 14: //周天循环 14 每周日开始和结束时间指定时间段内有效 useDateStr = - '${sendDateStr.toLocal().toString().substring(0, 16)} 周天$starHour:00-$endHour:00 循环'; + '${endDateStr.toLocal().toString().substring(0, 16)} ${"周天".tr}$starHour:00-$endHour:00 ${"循环".tr}'; break; default: diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart index 7c76daba..a05c49bf 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart @@ -11,8 +11,8 @@ import '../../../../appRouters.dart'; import '../../../../app_settings/app_colors.dart'; import '../../../../tools/EasyRefreshTool.dart'; import '../../../../tools/keySearchWidget.dart'; -import '../../../../tools/left_slide_actions.dart'; import '../../../../tools/showIosTipView.dart'; +import '../../../../tools/showTipView.dart'; import '../../../../tools/submitBtn.dart'; import '../../../../tools/titleAppBar.dart'; import '../../../../translations/trans_lib.dart'; @@ -61,9 +61,12 @@ class _PasswordKeyListPageState extends State { onPressed: () async { var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); if (isDemoMode == false) { - _showDialog(context); + ShowTipView().showIosTipWithContentDialog('该锁的密码都将被删除'.tr, () { + logic.resetPasswordKeyListRequest(); + setState(() {}); + }); } else { - logic.showToast("演示模式"); + logic.showToast("演示模式".tr); } }, ), @@ -134,11 +137,14 @@ class _PasswordKeyListPageState extends State { children: [ SlidableAction( onPressed: (BuildContext context){ - showIosTipViewDialog(context, passwordKeyListItem); + ShowTipView().showIosTipWithContentDialog("确定要删除吗?".tr, () { + logic.deletePwdRequest(passwordKeyListItem.lockId.toString(), + passwordKeyListItem.keyboardPwdId.toString(), 1); + }); }, backgroundColor: Colors.red, foregroundColor: Colors.white, - label: '删除', + label: '删除'.tr, padding: EdgeInsets.only(left: 5.w, right: 5.w), ), ], @@ -164,26 +170,6 @@ class _PasswordKeyListPageState extends State { )); } - void showIosTipViewDialog( - BuildContext context, PasswordKeyListItem passwordKeyListItem) { - showDialog( - context: context, - builder: (BuildContext context) { - return ShowIosTipView( - title: "提示", - tipTitle: "确定要删除吗?", - sureClick: () { - Get.back(); - logic.deletePwdRequest(passwordKeyListItem.lockId.toString(), - passwordKeyListItem.keyboardPwdId.toString(), 1); - }, - cancelClick: () { - Get.back(); - }, - ); - }); - } - Widget _electronicKeyItem(int itemIndex, String lockTypeIcon, String lockTypeTitle, String useDateStr, Function()? action) { PasswordKeyListItem passwordKeyListItem = state.itemDataList[itemIndex]; @@ -220,7 +206,7 @@ class _PasswordKeyListPageState extends State { ), ), SizedBox(width: 10.w), - passwordKeyListItem.keyboardPwdStatus == 2 ? Text('已过期', style: TextStyle(color: Colors.red, fontSize: 20.sp),) : Container(), + passwordKeyListItem.keyboardPwdStatus == 2 ? Text('已过期'.tr, style: TextStyle(color: Colors.red, fontSize: 20.sp),) : Container(), // SizedBox(width: 15.w) ], ), @@ -249,31 +235,4 @@ class _PasswordKeyListPageState extends State { ); } - //是否重置弹窗 - void _showDialog(widgetContext) { - showCupertinoDialog( - context: widgetContext, - builder: (context) { - return CupertinoAlertDialog( - title: const Text('该锁的密码都将被删除'), - actions: [ - CupertinoDialogAction( - child: Text(TranslationLoader.lanKeys!.cancel!.tr), - onPressed: () { - Navigator.of(context).pop(); - }, - ), - CupertinoDialogAction( - child: Text(TranslationLoader.lanKeys!.reset!.tr), - onPressed: () { - Navigator.of(context).pop(); - logic.resetPasswordKeyListRequest(); - setState(() {}); - }, - ), - ], - ); - }, - ); - } } 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 f2c6b546..58625660 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 @@ -1,6 +1,7 @@ import 'dart:async'; import 'package:flutter_blue_plus/flutter_blue_plus.dart'; +import 'package:get/get.dart'; import 'package:star_lock/blue/io_type.dart'; import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_state.dart'; import 'package:star_lock/network/api_repository.dart'; @@ -13,6 +14,7 @@ import '../../../../blue/io_tool/io_tool.dart'; import '../../../../blue/io_tool/manager_event_bus.dart'; import '../../../../blue/sender_manage.dart'; import '../../../../tools/baseGetXController.dart'; +import '../../../../tools/dateTool.dart'; import '../../../../tools/storage.dart'; class PasswordKeyPerpetualLogic extends BaseGetXController { @@ -37,15 +39,37 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { */ //获取密码请求 Future getKeyboardPwdRequest() async { - String getFailureDateTime = '0'; - String getEffectiveDateTime = '0'; + var startDate = DateTool().dateToTimestamp(state.beginTime.value, 1); + var endDate = DateTool().dateToTimestamp(state.endTime.value, 1); String lockId = state.keyInfo.value.lockId.toString(); String getKeyType = state.widgetType.value.toString(); + + if (state.nameController.text.isEmpty) { + showToast("请输入姓名"); + return; + } + + //循环密码 + if (state.widgetType.value == 4) { + if (startDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) { + showToast("生效时间不能小于当前时间"); + return; + } + } if (state.widgetType.value == 0) { //永久 getKeyType = '2'; } else if (state.widgetType.value == 1) { //限时 + if (startDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) { + showToast("生效时间不能小于当前时间"); + return; + } + + if (startDate >= endDate) { + showToast("失效时间要大于生效时间"); + return; + } getKeyType = '3'; } else if (state.widgetType.value == 2) { //单次 @@ -54,6 +78,12 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { //自定义 } else if (state.widgetType.value == 4) { //循环 + //限时 + if (endDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) { + showToast("结束时间不能小于当前时间"); + return; + } + if (state.loopModeStr.value == '周末') { getKeyType = '5'; } else if (state.loopModeStr.value == '每日') { @@ -79,21 +109,12 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { //清空码 getKeyType = '4'; } - - if (state.widgetType.value != 0 && - state.widgetType.value != 2 && - state.widgetType.value != 5) { - getFailureDateTime = - state.failureDateTime.value.millisecondsSinceEpoch.toString(); - getEffectiveDateTime = - state.effectiveDateTime.value.millisecondsSinceEpoch.toString(); - } var entity = await ApiRepository.to.getPasswordKey( - endDate: getFailureDateTime, + endDate: endDate.toString(), keyboardPwdName: state.nameController.text, keyboardPwdType: getKeyType, lockId: lockId, - startDate: getEffectiveDateTime, + startDate: startDate.toString(), startHours: state.loopStartHours.value, endHours: state.loopEndHours.value, isCoerced: 1); @@ -115,21 +136,15 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { //自定义密码请求 Future addKeyboardPwdRequest() async { - String getFailureDateTime = '0'; String getEffectiveDateTime = '0'; + String getFailureDateTime = '0'; String lockId = state.keyInfo.value.lockId.toString(); - String getKeyType = '3'; + String getKeyType = '2'; //是否为永久 if (state.isPermanent.value == false) { getKeyType = '3'; - getFailureDateTime = DateTime.parse(state.selectFailureDate.value) - .millisecondsSinceEpoch - .toString(); - getEffectiveDateTime = DateTime.parse(state.selectEffectiveDate.value) - .millisecondsSinceEpoch - .toString(); - } else { - getKeyType = '2'; + getEffectiveDateTime = DateTool().dateToTimestamp(state.beginTime.value, 1).toString(); + getFailureDateTime = DateTool().dateToTimestamp(state.endTime.value, 1).toString(); } var entity = await ApiRepository.to.addPasswordKey( lockId, @@ -155,7 +170,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { } } - late DateTime getStartDateTime; + // late DateTime getStartDateTime; // 监听设备返回的数据 late StreamSubscription _replySubscription; void _initReplySubscription() { @@ -195,8 +210,8 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { pwdNo: state.isAdministrator.value == true ? 254 : 1, pwd:state.pwdController.text, useCountLimit: 0xff, - startTime: state.effectiveDateTime.value.millisecondsSinceEpoch~/1000, - endTime: state.failureDateTime.value.millisecondsSinceEpoch~/1000, + startTime: DateTool().dateToTimestamp(state.beginTime.value, 1)~/1000, + endTime: DateTool().dateToTimestamp(state.endTime.value, 1)~/1000, needAuthor: 1, signKey: signKeyDataList, privateKey: getPrivateKeyList, @@ -222,12 +237,46 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { }); } - void getStartDate(DateTime startDate) { - getStartDateTime = startDate; - } + // void getStartDate(DateTime startDate) { + // getStartDateTime = startDate; + // } // 设置自定义密码 Future senderCustomPasswords() async { + + if (state.nameController.text.isEmpty) { + showToast("请输入姓名"); + return; + } + if (state.pwdController.text.isEmpty) { + showToast("请输入密码"); + return; + } + + var startDate = DateTool().dateToTimestamp(state.beginTime.value, 1); + var endDate = DateTool().dateToTimestamp(state.endTime.value, 1); + //非永久 须有时限 + if (state.isPermanent.value == false) { + if (startDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) { + showToast("生效时间不能小于当前时间"); + return; + } + + if (endDate < startDate) { + showToast("失效时间需大于生效时间"); + return; + } + }else{ + startDate = 0; + endDate = 0; + } + + if (state.pwdController.text.length < 6 || state.pwdController.text.length > 9) { + showToast("请输入6-9位数字密码"); + return; + } + Get.log("startDate:$startDate endDate:$endDate"); + if(state.sureBtnState.value == 1){ return; } @@ -248,16 +297,16 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { var token = await Storage.getStringList(saveBlueToken); List getTokenList = changeStringListToIntList(token!); - print("openDoorTokenPubToken:$getTokenList"); + // Get.log("state.isAdministrator.value:${state.isAdministrator.value}"); IoSenderManage.senderCustomPasswordsCommand( keyID: "1", userID: await Storage.getUid(), pwdNo: state.isAdministrator.value == true ? 254 : 1, pwd: state.pwdController.text, useCountLimit: 0xff, - startTime: state.effectiveDateTime.value.millisecondsSinceEpoch~/1000, - endTime: state.failureDateTime.value.millisecondsSinceEpoch~/1000, + startTime:state.isPermanent.value == false ? startDate ~/ 1000 : 0, + endTime: state.isPermanent.value == false ? endDate ~/ 1000 : 0, needAuthor: 1, signKey: signKeyDataList, privateKey: getPrivateKeyList, @@ -289,17 +338,17 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { case 1: //限时 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效 useDateStr = - '类型:限时\n有效期:${state.selectEffectiveDate.value} -- ${state.selectFailureDate.value}'; + '类型:限时\n有效期:${state.beginTime.value} -- ${state.endTime.value}'; break; case 2: //单次 只能在开始时间后6小时内使用一次 useDateStr = - '类型:单次\n有效期:${state.selectEffectiveDate.value} -- ${state.selectFailureDate.value}'; + '类型:单次\n有效期:${state.beginTime.value} -- ${state.endTime.value}'; break; case 3: //自定义 if (state.isPermanent.value == false) { - '类型:自定义-限时\n有效期:${state.selectEffectiveDate.value} -- ${state.selectFailureDate.value}'; + '类型:自定义-限时\n有效期:${state.beginTime.value} -- ${state.endTime.value}'; } else { useDateStr = '类型:自定义-永久'; } 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 47f606e5..5701396d 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 @@ -1,4 +1,4 @@ -import 'package:date_format/date_format.dart'; + import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -18,6 +18,7 @@ import '../../../../tools/NativeInteractionTool.dart'; import '../../../../tools/appRouteObserver.dart'; import '../../../../tools/commonItem.dart'; +import '../../../../tools/dateTool.dart'; import '../../../../tools/submitBtn.dart'; import '../../../../translations/trans_lib.dart'; import '../../../lockMian/entity/lockListInfo_entity.dart'; @@ -194,50 +195,33 @@ class _PasswordKeyPerpetualPageState extends State wit children: [ CommonItem( leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr, - rightTitle: state.selectEffectiveDate.value, + rightTitle: state.beginTime.value, isHaveLine: true, isHaveDirection: true, action: () { - Pickers.showDatePicker(context, mode: DateMode.YMDH, - onConfirm: (p) { + Pickers.showDatePicker(context, mode: state.widgetType.value == 3 ? DateMode.YMDHM:DateMode.YMDH, onConfirm: (p) { if (state.widgetType.value == 3) { // 自定义 - state.effectiveDateTime.value = DateTime.parse('${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}'); - state.selectEffectiveDate.value = formatDate(state.effectiveDateTime.value, [yyyy, '-', mm, '-', dd, ' ', HH, ':', nn]); //默认为当前时间 + state.beginTime.value = DateTool().getYMDHNDateString(p, 1); } else { - state.effectiveDateTime.value = DateTime.parse('${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}'); - state.selectEffectiveDate.value = "${formatDate(state.effectiveDateTime.value, [yyyy, '-', mm, '-', dd, ' ', HH])}:00"; //默认为当前时间 + state.beginTime.value = DateTool().getYMDHNDateString(p, 4); } + Get.log("beginTime:${state.beginTime.value}"); }); }), CommonItem( leftTitel: TranslationLoader.lanKeys!.failureTime!.tr, - rightTitle: state.selectFailureDate.value, + rightTitle: state.endTime.value, isHaveDirection: true, action: () { - Pickers.showDatePicker(context, mode: DateMode.YMDH, - onConfirm: (p) { - if (state.widgetType.value == 3) { - // 自定义 - state.failureDateTime.value = DateTime.parse( - '${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}'); - state.selectFailureDate.value = formatDate( - state.failureDateTime.value, - [yyyy, '-', mm, '-', dd, ' ', HH, ':', nn]); //默认为当前时间 - } else { - 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"; - } + Pickers.showDatePicker(context, mode: DateMode.YMDH, onConfirm: (p) { + if (state.widgetType.value == 3) { + // 自定义 + state.endTime.value = DateTool().getYMDHNDateString(p, 1); + } else { + state.endTime.value = DateTool().getYMDHNDateString(p, 4); + } + Get.log("endTime:${state.endTime.value}"); }); }), Container(height: 10.h), @@ -304,24 +288,12 @@ class _PasswordKeyPerpetualPageState extends State wit }), CommonItem( leftTitel: '结束日期', - rightTitle: state.selectFailureDate.value, + rightTitle: state.endTime.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"; + Pickers.showDatePicker(context, mode: DateMode.YMDH, onConfirm: (p) { + state.endTime.value = DateTool().getYMDHNDateString(p, 4); }); }), CommonItem( @@ -331,23 +303,8 @@ class _PasswordKeyPerpetualPageState extends State wit isHaveDirection: true, action: () { Pickers.showDatePicker(context, mode: DateMode.H, onConfirm: (p) { - DateTime selectedDateTime = DateTime( - DateTime.now().year, - DateTime.now().month, - DateTime.now().day, - p.hour!, - ); - - if (isValidDateTime(selectedDateTime)) { - state.effectiveDateTime.value = selectedDateTime; - state.loopEffectiveDate.value = - "${formatDate(state.effectiveDateTime.value, [HH])}:00"; - state.loopStartHours.value = p.hour!; - // state.selectEffectiveDate.value = - // formatDate(state.effectiveDateTime.value, [HH]); - } else { - // 处理日期不合法的情况,可以使用默认值或者其他策略 - } + state.loopEffectiveDate.value = DateTool().getYMDHNDateString(p, 5); + state.loopStartHours.value = p.hour!; }); }), CommonItem( @@ -356,21 +313,8 @@ class _PasswordKeyPerpetualPageState extends State wit isHaveDirection: true, action: () { Pickers.showDatePicker(context, mode: DateMode.H, onConfirm: (p) { - DateTime selectedDateTime = DateTime( - DateTime.now().year, - DateTime.now().month, - DateTime.now().day, - p.hour!, - ); - - if (isValidDateTime(selectedDateTime)) { - state.failureDateTime.value = selectedDateTime; - state.loopFailureDate.value = - "${formatDate(state.failureDateTime.value, [HH])}:00"; - state.loopEndHours.value = p.hour!; - } else { - // 处理日期不合法的情况,可以使用默认值或者其他策略 - } + state.loopFailureDate.value = DateTool().getYMDHNDateString(p, 5); + state.loopEndHours.value = p.hour!; }); }), ], @@ -417,71 +361,10 @@ class _PasswordKeyPerpetualPageState extends State wit onClick: () async { var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); if (isDemoMode == false) { - DateTime startDateTime = DateTime( - state.effectiveDateTime.value.year, - state.effectiveDateTime.value.month, - state.effectiveDateTime.value.day, - state.effectiveDateTime.value.hour); - DateTime endDateTime = DateTime( - state.failureDateTime.value.year, - state.failureDateTime.value.month, - state.failureDateTime.value.day, - state.failureDateTime.value.hour); - //自定义密码 if (state.widgetType.value == 3) { - logic.getStartDate(state.effectiveDateTime.value); - if (state.nameController.text.isEmpty) { - logic.showToast("请输入姓名"); - return; - } - if (state.pwdController.text.isEmpty) { - logic.showToast("请输入密码"); - return; - } - //非永久 须有时限 - if (state.isPermanent.value == false) { - if (!startDateTime.isBefore(endDateTime) || - startDateTime.isAtSameMomentAs(endDateTime)) { - logic.showToast("失效时间需大于生效时间"); - return; - } - } - - if (state.pwdController.text.length < 6 || state.pwdController.text.length > 9) { - logic.showToast("请输入6-9位数字密码"); - return; - } - logic.senderCustomPasswords(); } else { - if (state.nameController.text.isEmpty) { - logic.showToast("请输入姓名"); - return; - } - - //限时 - if (state.widgetType.value == 1) { - if (!startDateTime.isBefore(endDateTime) || - startDateTime.isAtSameMomentAs(endDateTime)) { - logic.showToast("失效时间需大于生效时间"); - return; - } - } - //循环密码 - if (state.widgetType.value == 4) { - if (!startDateTime.isBefore(endDateTime) || - startDateTime.isAtSameMomentAs(endDateTime)) { - logic.showToast("结束时间需大于当前时间"); - return; - } - if (state.loopEndHours.value <= - state.loopStartHours.value) { - logic.showToast("失效时间需大于生效时间"); - return; - } - } - logic.getKeyboardPwdRequest(); } } else { diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_state.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_state.dart index 27f63f7e..162d4dd7 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_state.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_state.dart @@ -2,6 +2,7 @@ import 'package:date_format/date_format.dart'; import 'package:flutter/widgets.dart'; import 'package:get/get.dart'; import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart'; +import 'package:star_lock/tools/dateTool.dart'; class PasswordKeyPerpetualState { final TextEditingController nameController = TextEditingController(); @@ -14,14 +15,11 @@ class PasswordKeyPerpetualState { var pwdNameStr = ''; final isAdministrator = false.obs;// 是否是管理员 - final effectiveDateTime = DateTime.now().obs; - final failureDateTime = DateTime.now().obs; + var beginTime = DateTool().getNowDateWithType(3).obs; //默认为当前时间 开始时间 + var endTime = DateTool().getNowDateWithType(3).obs;//默认为当前时间 结束时间 - var selectEffectiveDate = "${formatDate(DateTime.now(), [yyyy,'-',mm,'-', dd, ' ', HH,])}:00".obs; //生效时间 - var selectFailureDate = "${formatDate(DateTime.now(), [yyyy, '-', mm, '-', dd, ' ', HH,])}:00".obs; //失效时间 - - var loopEffectiveDate = "${formatDate(DateTime.now(), [HH])}:00".obs; //生效时间 - var loopFailureDate = "${formatDate(DateTime.now(), [HH])}:00".obs; //失效时间 + var loopEffectiveDate = DateTool().getNowDateWithType(7).obs; //生效时间 + var loopFailureDate = DateTool().getNowDateWithType(7).obs; //失效时间 var loopStartHours = DateTime.now().hour.obs; var loopEndHours = DateTime.now().hour.obs; var loopModeStr = '周末'.obs; //循环模式 diff --git a/star_lock/lib/mine/mall/lockMall_page.dart b/star_lock/lib/mine/mall/lockMall_page.dart index 8270ac89..7e31f3eb 100644 --- a/star_lock/lib/mine/mall/lockMall_page.dart +++ b/star_lock/lib/mine/mall/lockMall_page.dart @@ -56,7 +56,7 @@ class _LockMallPageState extends State { } String getWebTitle() { - String webTitleStr = TranslationLoader.lanKeys!.shoppingCart!.tr; + String webTitleStr = "配件商城".tr; state.mallWebView.getTitle().then((result) { webTitleStr = result!; }); diff --git a/star_lock/lib/mine/mine/safeVerify/safeVerify_logic.dart b/star_lock/lib/mine/mine/safeVerify/safeVerify_logic.dart index c64c4273..ac48e88e 100644 --- a/star_lock/lib/mine/mine/safeVerify/safeVerify_logic.dart +++ b/star_lock/lib/mine/mine/safeVerify/safeVerify_logic.dart @@ -50,7 +50,7 @@ class SafeVerifyLogic extends BaseGetXController { //删除账号请求 Future deleteAccountRequest() async { LoginEntity entity = - await ApiRepository.to.deleteAccount("1", state.verificationCode.value); + await ApiRepository.to.deleteAccount(state.channel.value, state.verificationCode.value); if (entity.errorCode!.codeIsSuccessful) { showToast("验证成功,账号已删除"); //删除账号成功, @@ -83,7 +83,7 @@ class SafeVerifyLogic extends BaseGetXController { ///初始化本地数据 void initLoginData() async { final data = await Storage.getString(saveUserLoginData); - // print("getLoginData:$data"); + print("getLoginData:$data"); if (data != null && data.isNotEmpty) { state.loginData.value = LoginData.fromJson(jsonDecode(data)); bool mobileIsNotEmpty = state.loginData.value.mobile != null && state.loginData.value.mobile!.isNotEmpty; diff --git a/star_lock/lib/mine/mine/safeVerify/safeVerify_page.dart b/star_lock/lib/mine/mine/safeVerify/safeVerify_page.dart index d9803312..e35b1286 100644 --- a/star_lock/lib/mine/mine/safeVerify/safeVerify_page.dart +++ b/star_lock/lib/mine/mine/safeVerify/safeVerify_page.dart @@ -67,19 +67,41 @@ class _SafeVerifyPageState extends State { SizedBox( height: 30.h, ), - Obx(() => SizedBox( - width: 200.w, - child: SubmitBtn( - btnName: state.btnText.value, - onClick: state.canResend.value ? () { - logic.sendValidationCode(); - } : null, + Obx(() => GestureDetector( + onTap: (){ + if(state.canResend.value){ + logic.sendValidationCode(); + } + }, + child: Container( + padding: EdgeInsets.only(left:20.w, right: 20.w, top: 10.h, bottom: 10.h), + // height: 60.h, + width: 200.w, + decoration: BoxDecoration( + color: AppColors.mainColor, + borderRadius: BorderRadius.circular(10.h), + // borderRadius: BorderRadius.circular(30.w) + ), + child:Text(state.btnText.value, + textAlign: TextAlign.center, + style: TextStyle( + color: Colors.white, + fontSize: 22.sp)), + // SubmitBtn( + // btnName: state.btnText.value, + // onClick: state.canResend.value ? () { + // logic.sendValidationCode(); + // } : null, + // ), ), - )), + )), SizedBox( height: 60.h, ), - Obx(() => Padding( + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Obx(() => Padding( padding: EdgeInsets.only(left: 60.w, right: 60.w), child: Text( '请点击获取验证码,验证码将发送到${state.accountStr.value}', @@ -87,6 +109,41 @@ class _SafeVerifyPageState extends State { color: AppColors.darkGrayTextColor, fontSize: 22.sp), ), )), + SizedBox(height: 10.h), + Obx(() => Visibility( + visible: state.isToggle.value, + child: GestureDetector( + onTap: (){ + if(state.channel.value == '1'){ + // 手机号切换为邮箱 + state.channel.value = '2'; + state.accountStr.value = state.loginData.value.email!; + }else{ + // 邮箱切换为手机号 + state.channel.value = '1'; + state.accountStr.value = state.loginData.value.mobile!; + } + }, + child: Container( + margin: EdgeInsets.only(left: 60.w, right: 60.w), + padding: EdgeInsets.only(left:10.w, right: 10.w, top: 5.h, bottom: 5.h), + // height: 60.h, + width: 100.w, + decoration: BoxDecoration( + color: AppColors.mainColor, + borderRadius: BorderRadius.circular(10.h), + // borderRadius: BorderRadius.circular(30.w) + ), + child:Text("切换", + textAlign: TextAlign.center, + style: TextStyle( + color: Colors.white, + fontSize: 22.sp)), + ), + ), + )), + ], + ), SizedBox( height: 120.h, ), diff --git a/star_lock/lib/mine/mine/starLockMine_logic.dart b/star_lock/lib/mine/mine/starLockMine_logic.dart index 8be5466a..4d7336bd 100644 --- a/star_lock/lib/mine/mine/starLockMine_logic.dart +++ b/star_lock/lib/mine/mine/starLockMine_logic.dart @@ -1,5 +1,6 @@ import 'dart:async'; +import 'package:get/get.dart'; import 'package:star_lock/login/login/entity/LoginEntity.dart'; import 'package:star_lock/network/api_repository.dart'; @@ -30,8 +31,9 @@ class StarLockMineLogic extends BaseGetXController { final data = await Storage.getString(saveUserLoginData); if (data != null && data.isNotEmpty) { state.userNickName.value = (await Storage.getNickname())!; - state.userMobile.value = (await Storage.getMobile())!; + state.userMobile.value = (await Storage.getMobile())! ?? ''; state.userEmail.value = (await Storage.getEmail())!; + Get.log("userNickName:${state.userNickName.value} userMobile:${state.userMobile.value} userEmail:${state.userEmail.value}"); } } diff --git a/star_lock/lib/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_logic.dart b/star_lock/lib/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_logic.dart index fccb428c..1d440985 100644 --- a/star_lock/lib/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_logic.dart +++ b/star_lock/lib/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_logic.dart @@ -8,6 +8,9 @@ import 'package:star_lock/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneO import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/tools/baseGetXController.dart'; +import '../../../tools/eventBusEventManage.dart'; +import '../../../tools/storage.dart'; + class MineBindPhoneOrEmailLogic extends BaseGetXController { final MineBindPhoneOrEmailState state = MineBindPhoneOrEmailState(); @@ -48,8 +51,13 @@ class MineBindPhoneOrEmailLogic extends BaseGetXController { state.verificationCode.value, state.unbindToken.value); if (entity.errorCode!.codeIsSuccessful) { - showToast("邮箱绑定成功"); - Get.until((route) => route.settings.name == Routers.minePersonInfoPage); + showToast("邮箱绑定成功", something: () async { + final loginData = await Storage.getLoginData(); + loginData!.email = state.inputAccount.value; + Storage.saveLoginData(loginData); + eventBus.fire(MineInfoChangeRefreshUI()); + Get.until((route) => route.settings.name == Routers.minePersonInfoPage); + }); } } @@ -61,8 +69,13 @@ class MineBindPhoneOrEmailLogic extends BaseGetXController { state.verificationCode.value, state.unbindToken.value); if (entity.errorCode!.codeIsSuccessful) { - showToast("手机绑定成功"); - Get.until((route) => route.settings.name == Routers.minePersonInfoPage); + showToast("手机绑定成功", something: () async { + final loginData = await Storage.getLoginData(); + loginData!.mobile = state.inputAccount.value; + Storage.saveLoginData(loginData); + eventBus.fire(MineInfoChangeRefreshUI()); + Get.until((route) => route.settings.name == Routers.minePersonInfoPage); + }); } } diff --git a/star_lock/lib/mine/mineSet/mineSet/mineSet_logic.dart b/star_lock/lib/mine/mineSet/mineSet/mineSet_logic.dart index 60f15a49..00d381f8 100644 --- a/star_lock/lib/mine/mineSet/mineSet/mineSet_logic.dart +++ b/star_lock/lib/mine/mineSet/mineSet/mineSet_logic.dart @@ -44,7 +44,7 @@ class MineSetLogic extends BaseGetXController { ExpireLockListEntity entity = await ApiRepository.to .setAlertMode('1', state.isPrompTone.value == true ? '1' : '2'); if (entity.errorCode!.codeIsSuccessful) { - showToast("设置成功"); + showToast("设置成功".tr); userSettingsInfoRequest(); } } @@ -78,7 +78,7 @@ class MineSetLogic extends BaseGetXController { ExpireLockListEntity entity = await ApiRepository.to .setTouchUnlockFlag(state.isTouchUnlock.value == true ? '1' : '2'); if (entity.errorCode!.codeIsSuccessful) { - showToast("设置成功"); + showToast("设置成功".tr); userSettingsInfoRequest(); } } diff --git a/star_lock/lib/mine/mineSet/mineSet/mineSet_page.dart b/star_lock/lib/mine/mineSet/mineSet/mineSet_page.dart index 899022bb..ceadd090 100644 --- a/star_lock/lib/mine/mineSet/mineSet/mineSet_page.dart +++ b/star_lock/lib/mine/mineSet/mineSet/mineSet_page.dart @@ -11,6 +11,7 @@ import 'package:star_lock/mine/mineSet/mineSet/mineSet_logic.dart'; import '../../../appRouters.dart'; import '../../../app_settings/app_colors.dart'; import '../../../tools/commonItem.dart'; +import '../../../tools/showTipView.dart'; import '../../../tools/submitBtn.dart'; import '../../../tools/titleAppBar.dart'; import '../../../translations/trans_lib.dart'; @@ -212,7 +213,7 @@ class _MineSetPageState extends State with WidgetsBindingObserver { isHaveLine: true, isHaveDirection: true, action: () { - logic.showToast("功能暂未开放"); + logic.showToast("功能暂未开放".tr); }), F.isLite ? Container() @@ -222,7 +223,7 @@ class _MineSetPageState extends State with WidgetsBindingObserver { isHaveLine: true, isHaveDirection: true, action: () { - logic.showToast("功能暂未开放"); + logic.showToast("功能暂未开放".tr); }), F.isLite ? Container() @@ -232,7 +233,7 @@ class _MineSetPageState extends State with WidgetsBindingObserver { isHaveLine: false, isHaveDirection: true, action: () { - logic.showToast("功能暂未开放"); + logic.showToast("功能暂未开放".tr); }), // CommonItem(leftTitel:TranslationLoader.lanKeys!.valueAddedServices!.tr, rightTitle:"", isHaveDirection: true, action: (){ // @@ -272,7 +273,10 @@ class _MineSetPageState extends State with WidgetsBindingObserver { isDelete: true, onClick: () { //退出登录 - showLoginOutAlertTipDialog(); + ShowTipView().showIosTipWithContentDialog("确定要退出吗?".tr, (){ + logic.userLogoutRequest(); + }); + // showLoginOutAlertTipDialog(); }), Container( padding: EdgeInsets.only(right: 30.w, top: 30.h), @@ -287,7 +291,10 @@ class _MineSetPageState extends State with WidgetsBindingObserver { color: AppColors.darkGrayTextColor, fontSize: 18.sp), ), onPressed: () { - _showDialog(context); + ShowTipView().showIosTipWithContentDialog(TranslationLoader.lanKeys!.deleteAccountTips!.tr, (){ + //安全验证 + Get.toNamed(Routers.safeVerifyPage); + }); }, ), ], @@ -317,9 +324,9 @@ class _MineSetPageState extends State with WidgetsBindingObserver { CupertinoDialogAction( child: Text(TranslationLoader.lanKeys!.sure!.tr), onPressed: () { - Navigator.of(context).pop(); + Get.back(); //安全验证 - Navigator.pushNamed(context, Routers.safeVerifyPage); + Get.toNamed(Routers.safeVerifyPage); setState(() {}); }, ), @@ -329,32 +336,32 @@ class _MineSetPageState extends State with WidgetsBindingObserver { ); } - void showLoginOutAlertTipDialog() { - showCupertinoDialog( - context: context, - builder: (context) { - return CupertinoAlertDialog( - title: const Text("提示"), - content: const Text('确定要退出吗?'), - actions: [ - CupertinoDialogAction( - child: Text(TranslationLoader.lanKeys!.cancel!.tr), - onPressed: () { - Get.back(); - }, - ), - CupertinoDialogAction( - child: const Text("退出"), - onPressed: () { - Get.back(); - logic.userLogoutRequest(); - }, - ), - ], - ); - }, - ); - } + // void showLoginOutAlertTipDialog() { + // showCupertinoDialog( + // context: context, + // builder: (context) { + // return CupertinoAlertDialog( + // title: const Text("提示"), + // content: const Text('确定要退出吗?'), + // actions: [ + // CupertinoDialogAction( + // child: Text(TranslationLoader.lanKeys!.cancel!.tr), + // onPressed: () { + // Get.back(); + // }, + // ), + // CupertinoDialogAction( + // child: const Text("退出"), + // onPressed: () { + // Get.back(); + // logic.userLogoutRequest(); + // }, + // ), + // ], + // ); + // }, + // ); + // } CupertinoSwitch _isPrompToneSwitch() { return CupertinoSwitch( diff --git a/star_lock/lib/tools/baseGetXController.dart b/star_lock/lib/tools/baseGetXController.dart index 3ff31cf5..cd945e1a 100644 --- a/star_lock/lib/tools/baseGetXController.dart +++ b/star_lock/lib/tools/baseGetXController.dart @@ -170,7 +170,7 @@ class BaseGetXController extends GetxController { String useDateStr = ''; if (keyType == XSConstantMacro.keyTypeTime) { //限期 - useDateStr = "${DateTool().dateToYMDHNString(startDate.toString())}-${DateTool().dateToYMDHNString(endDate.toString())}"; + useDateStr = "${DateTool().dateToYMDHNString(startDate.toString())}-${DateTool().dateToYMDHNString(endDate.toString())} 限时"; } else if (keyType == XSConstantMacro.keyTypeLong) { //永久 // DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); @@ -183,7 +183,7 @@ class BaseGetXController extends GetxController { useDateStr = '单次'; } else if (keyType == XSConstantMacro.keyTypeLoop) { //循环 - useDateStr = "${DateTool().dateToYMDString(startDate.toString())}-${DateTool().dateToYMDString(endDate.toString())}"; + useDateStr = "${DateTool().dateToYMDString(startDate.toString())}-${DateTool().dateToYMDString(endDate.toString())} 循环"; } return useDateStr; diff --git a/star_lock/lib/tools/commonItem.dart b/star_lock/lib/tools/commonItem.dart index 73ba0b7a..2db30478 100644 --- a/star_lock/lib/tools/commonItem.dart +++ b/star_lock/lib/tools/commonItem.dart @@ -42,7 +42,7 @@ class CommonItem extends StatelessWidget { left: 20.w, right: 10.w), // , top: 20.w, bottom: 20.w child: Row( children: [ - SizedBox(width: 20.w), + // SizedBox(width: 20.w), SizedBox( // width: isHaveRightWidget! ? 100.w : 300.w, child: Text(leftTitel!, style: TextStyle(fontSize: 22.sp))), @@ -69,7 +69,7 @@ class CommonItem extends StatelessWidget { isHaveRightWidget! ? rightWidget! : SizedBox( - width: rightTitle!.isNotEmpty ? 260.w : 0.1.w, + // width: rightTitle!.isNotEmpty ? 260.w : 0.1.w, child: Text( rightTitle ?? "", textAlign: TextAlign.right, diff --git a/star_lock/lib/tools/dateTool.dart b/star_lock/lib/tools/dateTool.dart index 14690227..fc3e714b 100644 --- a/star_lock/lib/tools/dateTool.dart +++ b/star_lock/lib/tools/dateTool.dart @@ -7,25 +7,59 @@ import 'pickers/time_picker/model/pduration.dart'; class DateTool { /// 获取当前年月日时分秒 - // String getNowDateYMDHM(){ - // // 获取当前时间对象 - // DateTime now = DateTime.now(); - // //获取当前时间的年 - // int year = now.year; - // //获取当前时间的月 - // int month = now.month; - // //获取当前时间的日 - // int day = now.day; - // //获取当前时间的时 - // int hour = now.hour; - // //获取当前时间的分 - // int minute = now.minute; - // //获取当前时间的秒 - // int millisecond = now.millisecond; - // - // // print("组合 $year-$month-$day $hour:$minute:$millisecond"); - // return "$year-$month-$day $hour:$minute"; - // } + String getNowDateWithType(int type){ + var dateStr = ''; + // 获取当前时间对象 + DateTime now = DateTime.now(); + //获取当前时间的年 + int year = now.year; + //获取当前时间的月 + int month = now.month; + //获取当前时间的日 + int day = now.day; + //获取当前时间的时 + int hour = now.hour; + //获取当前时间的分 + int minute = now.minute; + //获取当前时间的秒 + int millisecond = now.millisecond; + + switch(type){ + case 1: + // 年月日时分秒 + dateStr = '$year-${month.toString().padLeft(2, '0')}-${day.toString().padLeft(2, '0')} ${hour.toString().padLeft(2, '0')}:${minute.toString().padLeft(2, '0')}:${millisecond.toString().padLeft(2, '0')}'; + break; + case 2: + // 年月日时分 + dateStr = '$year-${month.toString().padLeft(2, '0')}-${day.toString().padLeft(2, '0')} ${hour.toString().padLeft(2, '0')}:${minute.toString().padLeft(2, '0')}'; + break; + case 3: + // 年月日时整点 + dateStr = '$year-${month.toString().padLeft(2, '0')}-${day.toString().padLeft(2, '0')} ${hour.toString().padLeft(2, '0')}:00'; + break; + case 4: + // 年月日 + dateStr = '$year-${month.toString().padLeft(2, '0')}-${day.toString().padLeft(2, '0')}'; + break; + case 5: + // 时分秒 + dateStr = '${hour.toString().padLeft(2, '0')}:${minute.toString().padLeft(2, '0')}:${millisecond.toString().padLeft(2, '0')}'; + break; + case 6: + // 时分 + dateStr = '${hour.toString().padLeft(2, '0')}:${minute.toString().padLeft(2, '0')}'; + break; + case 7: + // 小时整点 + dateStr = '${hour.toString().padLeft(2, '0')}:00'; + break; + default: + dateStr = '$year-${month.toString().padLeft(2, '0')}-${day.toString().padLeft(2, '0')} ${hour.toString().padLeft(2, '0')}:${minute.toString().padLeft(2, '0')}:${millisecond.toString().padLeft(2, '0')}'; + break; + } + // print("组合 $year-$month-$day $hour:$minute:$millisecond"); + return dateStr; + } /// 将时间戳传化为年月日时分秒 (年.月.日 时:分) // String dateToYMDHNStringWithDot(String timestamp){ @@ -47,7 +81,7 @@ class DateTool { var dateStr = ''; switch(type){ case 1: - // 年月日时分(2023-01-01 12:00) + // 年月日时分(2023-01-01 12:48) dateStr = '$year-${month!.toString().padLeft(2, '0')}-${day.toString().padLeft(2, '0')} ${hour.toString().padLeft(2, '0')}:${minute.toString().padLeft(2, '0')}'; break; case 2: @@ -55,9 +89,17 @@ class DateTool { dateStr = '$year-${month!.toString().padLeft(2, '0')}-${day.toString().padLeft(2, '0')}'; break; case 3: - // 时分(12:00) + // 时分(12:05) dateStr = '${hour.toString().padLeft(2, '0')}:${minute.toString().padLeft(2, '0')}'; break; + case 4: + // 年月日时分(2023-01-01 12:00)整点 + dateStr = '$year-${month!.toString().padLeft(2, '0')}-${day.toString().padLeft(2, '0')} ${hour.toString().padLeft(2, '0')}:00'; + break; + case 5: + // 时分(12:00)整点 + dateStr = '${hour.toString().padLeft(2, '0')}:00'; + break; default: dateStr = '$year-${month!.toString().padLeft(2, '0')}-${day.toString().padLeft(2, '0')} ${hour.toString().padLeft(2, '0')}:${minute.toString().padLeft(2, '0')}'; break; diff --git a/star_lock/lib/tools/showTipView.dart b/star_lock/lib/tools/showTipView.dart index 6b882d50..a6cd16dd 100644 --- a/star_lock/lib/tools/showTipView.dart +++ b/star_lock/lib/tools/showTipView.dart @@ -12,6 +12,7 @@ typedef BlockIsHaveAllDataCallback = void Function(bool isAllData); class ShowTipView { + // 只有一个确定按钮 void showSureAlertDialog(String contentStr) { showCupertinoDialog( context: Get.context!, @@ -31,14 +32,14 @@ class ShowTipView { ); } - // 授权管理员调用删除数据 + // 授权管理员调用是否删除数据 void showDeleteAdministratorIsHaveAllDataDialog(String contentStr, BlockIsHaveAllDataCallback blockIsHaveAllDataCallback) { bool selet = false; showDialog( context: Get.context!, builder: (BuildContext context) { return CupertinoAlertDialog( - title: const Text("提示"), + title: Text("提示".tr), content: SizedBox( // height: 100.h, child: ShowDeleteAdministratorIsHaveAllDataWidget( @@ -68,6 +69,7 @@ class ShowTipView { ); } + // 有取消和确定按钮 void showIosTipWithContentDialog(String contentStr, Function sureClick) { showCupertinoDialog( context: Get.context!, diff --git a/star_lock/lib/tools/storage.dart b/star_lock/lib/tools/storage.dart index df6026e9..daaf3551 100644 --- a/star_lock/lib/tools/storage.dart +++ b/star_lock/lib/tools/storage.dart @@ -160,7 +160,7 @@ class Storage { static Future getMobile() async { LoginData? loginData = await getLoginData(); String? mobile = loginData!.mobile; - return mobile; + return mobile??''; } static Future getEmail() async { diff --git a/star_lock/lib/translations/lanKeyEntity.dart b/star_lock/lib/translations/lanKeyEntity.dart index 8646be21..a781a0e8 100644 --- a/star_lock/lib/translations/lanKeyEntity.dart +++ b/star_lock/lib/translations/lanKeyEntity.dart @@ -198,7 +198,6 @@ class LanKeyEntity { this.videoIntercomDoorLock, this.NFCPassiveLock, this.addDevice, - this.shoppingCart, this.gateway, this.message, this.supportStaff, @@ -662,7 +661,6 @@ class LanKeyEntity { videoIntercomDoorLock = json['videoIntercomDoorLock']; NFCPassiveLock = json['NFCPassiveLock']; addDevice = json['addDevice']; - shoppingCart = json['shoppingCart']; gateway = json['gateway']; message = json['message']; supportStaff = json['supportStaff']; @@ -1149,7 +1147,6 @@ class LanKeyEntity { String? videoIntercomDoorLock; String? NFCPassiveLock; String? addDevice; - String? shoppingCart; String? gateway; String? message; String? supportStaff; @@ -1632,7 +1629,6 @@ class LanKeyEntity { map['videoIntercomDoorLock'] = videoIntercomDoorLock; map['NFCPassiveLock'] = NFCPassiveLock; map['addDevice'] = addDevice; - map['shoppingCart'] = shoppingCart; map['gateway'] = gateway; map['message'] = message; map['supportStaff'] = supportStaff;