修复密码模块bug
This commit is contained in:
parent
f314d6fe05
commit
d05f40370c
@ -62,8 +62,8 @@
|
||||
"getPasswordTip1":"密码在24小时内至少要使用过一次,否则将无效",
|
||||
"getPasswordTip2":"限时密码可以再有下期内不限次数使用 \n密码在生效后的24小时内至少要使用过一次,否则将失效",
|
||||
"getPasswordTip3":"密码有限期为6个小时,只能使用一次",
|
||||
"getPasswordTip4":"可在锁旁边通过手机蓝牙添加,也可以通过网关远程添加",
|
||||
"getPasswordTip5":"密码在生效后的24小时内至少要使用过一次,否则将失效",
|
||||
"getPasswordTip4":"手动输入6-9位数字作为密码。可在锁旁边通过手机蓝牙添加,也可以通过网关远程添加",
|
||||
"getPasswordTip5":"限时密码可以再有下期内不限次数使用 \n密码在生效后的24小时内至少要使用过一次,否则将失效",
|
||||
"getPasswordTip6":"密码有效期为24小时,在锁上输入后,将使之前使用过的密码都失效",
|
||||
"getTip":"获取",
|
||||
"addTip":"添加",
|
||||
|
||||
@ -63,8 +63,8 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
|
||||
hintText: TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr,
|
||||
keyboardType: TextInputType.number,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(RegExp('[0-9]')),
|
||||
LengthLimitingTextInputFormatter(20),
|
||||
// FilteringTextInputFormatter.allow(RegExp('[0-9]')),
|
||||
LengthLimitingTextInputFormatter(30),
|
||||
]),
|
||||
SizedBox(height: 10.h),
|
||||
LoginInput(
|
||||
|
||||
@ -215,8 +215,8 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
||||
hintText: TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr,
|
||||
keyboardType: TextInputType.number,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(RegExp('[0-9]')),
|
||||
LengthLimitingTextInputFormatter(20),
|
||||
// FilteringTextInputFormatter.allow(RegExp('[0-9]')),
|
||||
LengthLimitingTextInputFormatter(30),
|
||||
]),
|
||||
SizedBox(height: 10.w),
|
||||
LoginInput(
|
||||
|
||||
@ -41,6 +41,7 @@ class _AddCardManageTabbarState extends State<AddCardManageTabbar> with SingleTi
|
||||
length: _itemTabs.length,
|
||||
initialIndex: widget.initialIndex);
|
||||
_tabController.addListener(() {
|
||||
|
||||
if (_tabController.animation!.value==_tabController.index){
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
}
|
||||
@ -96,8 +97,7 @@ class _AddCardManageTabbarState extends State<AddCardManageTabbar> with SingleTi
|
||||
return Expanded(
|
||||
child: TabBarView(
|
||||
controller: _tabController,
|
||||
children: _itemTabs
|
||||
.map((ItemView item) => AddCardPage(
|
||||
children: _itemTabs.map((ItemView item) => AddCardPage(
|
||||
seletType: item.seletType,
|
||||
lockId: widget.lockId,
|
||||
fromType: widget.fromType,
|
||||
|
||||
@ -317,6 +317,7 @@ class _AddCardPageState extends State<AddCardPage> {
|
||||
FilteringTextInputFormatter.deny('\n'),
|
||||
LengthLimitingTextInputFormatter(18),
|
||||
],
|
||||
style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||
controller: state.nameController,
|
||||
autofocus: false,
|
||||
textAlign: TextAlign.end,
|
||||
|
||||
@ -37,7 +37,7 @@ class _CheckingInSetPageState extends State<CheckingInSetPage> {
|
||||
children: [
|
||||
Obx(() => CommonItem(
|
||||
leftTitel:
|
||||
"${TranslationLoader.lanKeys!.company!.tr}${TranslationLoader.lanKeys!.name!.tr}",
|
||||
"公司名称",
|
||||
// rightTitle: state.companyName.value ?? "",
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: getTFWidget(),
|
||||
@ -136,12 +136,12 @@ class _CheckingInSetPageState extends State<CheckingInSetPage> {
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return ShowTFView(
|
||||
title: "请输入公司名字",
|
||||
title: "修改公司名字",
|
||||
tipTitle: "",
|
||||
controller: state.changeNameController,
|
||||
sureClick: () {
|
||||
if(state.changeNameController.text.isEmpty){
|
||||
logic.showToast("请输入公司姓名");
|
||||
logic.showToast("请输入公司名字");
|
||||
return;
|
||||
}
|
||||
Get.back();
|
||||
@ -173,10 +173,10 @@ class _CheckingInSetPageState extends State<CheckingInSetPage> {
|
||||
FilteringTextInputFormatter.deny('\n'),
|
||||
LengthLimitingTextInputFormatter(30),
|
||||
],
|
||||
style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||
controller: state.nameController,
|
||||
autofocus: false,
|
||||
enabled: false,
|
||||
style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||
textAlign: TextAlign.end,
|
||||
decoration: InputDecoration(
|
||||
//输入里面输入文字内边距设置
|
||||
|
||||
@ -257,6 +257,7 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
||||
FilteringTextInputFormatter.deny('\n'),
|
||||
LengthLimitingTextInputFormatter(30),
|
||||
],
|
||||
style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||
controller: tf,
|
||||
autofocus: false,
|
||||
textAlign: TextAlign.end,
|
||||
|
||||
@ -297,6 +297,7 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> {
|
||||
FilteringTextInputFormatter.deny('\n'),
|
||||
LengthLimitingTextInputFormatter(18),
|
||||
],
|
||||
style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||
controller: state.nameController,
|
||||
autofocus: false,
|
||||
textAlign: TextAlign.end,
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_setSupportFunctionsWithParameters.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import '../../../../blue/blue_manage.dart';
|
||||
@ -46,6 +47,7 @@ class AutomaticBlockingLogic extends BaseGetXController{
|
||||
showToast("操作成功", something: (){
|
||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
|
||||
Get.back();
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -213,6 +215,18 @@ class AutomaticBlockingLogic extends BaseGetXController{
|
||||
});
|
||||
}
|
||||
|
||||
void ifCanNext() {
|
||||
if(((state.isOpen.value != (state.lockSetInfoData.value.lockSettingInfo!.autoLock! == 1 ? true : false)) &&
|
||||
(state.autoLockTime.value != state.lockSetInfoData.value.lockSettingInfo!.autoLockSecond!.toString()) &&
|
||||
(state.isJustForShow.value == false)) || ((state.isOpen.value = true) && (state.lockSetInfoData.value.lockSettingInfo!.autoLock! == 1) &&
|
||||
(state.autoLockTime.value != state.lockSetInfoData.value.lockSettingInfo!.autoLockSecond!.toString()) &&
|
||||
(state.isJustForShow.value == false))){
|
||||
state.canNext.value = true;
|
||||
}else{
|
||||
state.canNext.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
|
||||
@ -34,20 +34,25 @@ class _AutomaticBlockingPageState extends State<AutomaticBlockingPage> with Rout
|
||||
haveBack: true,
|
||||
actionsList: [
|
||||
Obx(() => TextButton(
|
||||
onPressed: state.canNext.value == false ? null :() {
|
||||
// if(state.isJustForShow.value == true){
|
||||
// return;
|
||||
// }
|
||||
// if(state.isCustomLockTime.value == true && state.timeController.text.isEmpty){
|
||||
// logic.showToast("请输入自定义时间");
|
||||
// return;
|
||||
// }
|
||||
|
||||
if(state.isOpen.value == false){
|
||||
showDeletAlertTipDialog(context);
|
||||
}else{
|
||||
logic.sendAutoLock();
|
||||
}
|
||||
},
|
||||
child: Text(
|
||||
state.isJustForShow.value == true ? "" : TranslationLoader.lanKeys!.save!.tr,
|
||||
state.canNext.value == false ? "" : TranslationLoader.lanKeys!.save!.tr,
|
||||
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||
),
|
||||
onPressed: () {
|
||||
if(state.isJustForShow.value == true){
|
||||
return;
|
||||
}
|
||||
if(state.isCustomLockTime.value == true && state.timeController.text.isEmpty){
|
||||
logic.showToast("请输入自定义时间");
|
||||
return;
|
||||
}
|
||||
logic.sendAutoLock();
|
||||
},
|
||||
)),
|
||||
],
|
||||
backgroundColor: AppColors.mainColor),
|
||||
@ -55,97 +60,106 @@ class _AutomaticBlockingPageState extends State<AutomaticBlockingPage> with Rout
|
||||
children: [
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.automaticBlocking!.tr,
|
||||
rightTitle: "${state.autoLockTime}s",
|
||||
isHaveLine: false,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget:
|
||||
SizedBox(width: 60.w, height: 50.h, child: _switch())),),
|
||||
Container(height: 10.h,),
|
||||
Builder(builder: (context) {
|
||||
return Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.delayTime!.tr,
|
||||
rightTitle: state.isCustomLockTime.value == true ? "自定义" : "${state.autoLockTime.value}s",
|
||||
isHaveLine: false,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
if(state.isJustForShow.value == true){
|
||||
return;
|
||||
}
|
||||
var list = [
|
||||
"5",
|
||||
"10",
|
||||
"15",
|
||||
"30",
|
||||
"60",
|
||||
TranslationLoader.lanKeys!.custom!.tr
|
||||
];
|
||||
ShowBottomSheetTool().showSingleRowPicker(
|
||||
//上下文
|
||||
context,
|
||||
//默认的索引
|
||||
normalIndex: 0,
|
||||
title: TranslationLoader.lanKeys!.time!.tr,
|
||||
cancelTitle: TranslationLoader.lanKeys!.cancel!.tr,
|
||||
sureTitle: TranslationLoader.lanKeys!.sure!.tr,
|
||||
//要显示的列表
|
||||
//可自定义数据适配器
|
||||
//adapter: PickerAdapter(),
|
||||
data: list,
|
||||
//选择事件的回调
|
||||
clickCallBack: (int index, var str) {
|
||||
if(index != 5){
|
||||
state.isCustomLockTime.value = false;
|
||||
state.autoLockTime.value = str.toString();
|
||||
}else{
|
||||
state.isCustomLockTime.value = true;
|
||||
Visibility(
|
||||
visible: state.isOpen.value == true ? true : false,
|
||||
child: Column(
|
||||
children: [
|
||||
Container(height: 10.h,),
|
||||
Builder(builder: (context) {
|
||||
return Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.delayTime!.tr,
|
||||
rightTitle: state.isCustomLockTime.value == true ? "自定义" : (state.autoLockTime.value.isNotEmpty && state.autoLockTime.value != "0") ? "${state.autoLockTime}s" : "",
|
||||
isHaveLine: false,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
if(state.isJustForShow.value == true){
|
||||
return;
|
||||
}
|
||||
});
|
||||
}));
|
||||
}),
|
||||
Container(
|
||||
height: 10.h,
|
||||
),
|
||||
Obx(() => Visibility(
|
||||
visible: state.isCustomLockTime.value,
|
||||
child: Container(
|
||||
color: Colors.white,
|
||||
padding: EdgeInsets.only(
|
||||
left: 30.w, top: 10.w, right: 30.w, bottom: 10.w),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.time!.tr}(S)",
|
||||
style: TextStyle(fontSize: 24.sp),
|
||||
),
|
||||
],
|
||||
),
|
||||
Obx(() => TextField(
|
||||
//输入框一行
|
||||
maxLines: 1,
|
||||
controller: state.timeController,
|
||||
keyboardType: TextInputType.number,
|
||||
autofocus: false,
|
||||
readOnly: state.isJustForShow.value == true ? true : false,
|
||||
decoration: InputDecoration(
|
||||
//输入里面输入文字内边距设置
|
||||
contentPadding:
|
||||
const EdgeInsets.only(top: 12.0, bottom: 8.0),
|
||||
hintText:
|
||||
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.time!.tr}(S)",
|
||||
hintStyle: TextStyle(fontSize: 24.sp),
|
||||
//不需要输入框下划线
|
||||
border: InputBorder.none,
|
||||
var list = [
|
||||
"5",
|
||||
"10",
|
||||
"15",
|
||||
"30",
|
||||
"60",
|
||||
TranslationLoader.lanKeys!.custom!.tr
|
||||
];
|
||||
ShowBottomSheetTool().showSingleRowPicker(
|
||||
//上下文
|
||||
context,
|
||||
//默认的索引
|
||||
normalIndex: 0,
|
||||
title: TranslationLoader.lanKeys!.time!.tr,
|
||||
cancelTitle: TranslationLoader.lanKeys!.cancel!.tr,
|
||||
sureTitle: TranslationLoader.lanKeys!.sure!.tr,
|
||||
//要显示的列表
|
||||
//可自定义数据适配器
|
||||
//adapter: PickerAdapter(),
|
||||
data: list,
|
||||
//选择事件的回调
|
||||
clickCallBack: (int index, var str) {
|
||||
if(index != 5){
|
||||
state.isCustomLockTime.value = false;
|
||||
state.autoLockTime.value = str.toString();
|
||||
}else{
|
||||
state.isCustomLockTime.value = true;
|
||||
}
|
||||
logic.ifCanNext();
|
||||
});
|
||||
}));
|
||||
}),
|
||||
Container(height: 10.h),
|
||||
Obx(() => Visibility(
|
||||
visible: state.isCustomLockTime.value,
|
||||
child: Container(
|
||||
color: Colors.white,
|
||||
padding: EdgeInsets.only(
|
||||
left: 30.w, top: 10.w, right: 30.w, bottom: 10.w),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.time!.tr}(S)",
|
||||
style: TextStyle(fontSize: 24.sp),
|
||||
),
|
||||
],
|
||||
),
|
||||
Obx(() => TextField(
|
||||
//输入框一行
|
||||
maxLines: 1,
|
||||
controller: state.timeController,
|
||||
keyboardType: TextInputType.number,
|
||||
autofocus: false,
|
||||
readOnly: state.isJustForShow.value == true ? true : false,
|
||||
onChanged: (value) {
|
||||
state.autoLockTime.value = value;
|
||||
logic.ifCanNext();
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
//输入里面输入文字内边距设置
|
||||
contentPadding:
|
||||
const EdgeInsets.only(top: 12.0, bottom: 8.0),
|
||||
hintText:
|
||||
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.time!.tr}(S)",
|
||||
hintStyle: TextStyle(fontSize: 24.sp),
|
||||
//不需要输入框下划线
|
||||
border: InputBorder.none,
|
||||
),
|
||||
)),
|
||||
Container(
|
||||
height: 0.5.h,
|
||||
color: Colors.grey,
|
||||
),
|
||||
],
|
||||
),
|
||||
)),
|
||||
Container(
|
||||
height: 0.5.h,
|
||||
color: Colors.grey,
|
||||
),
|
||||
],
|
||||
),
|
||||
))),
|
||||
))),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.all(30.w),
|
||||
child: Row(
|
||||
@ -169,17 +183,44 @@ class _AutomaticBlockingPageState extends State<AutomaticBlockingPage> with Rout
|
||||
trackColor: CupertinoColors.systemGrey5,
|
||||
thumbColor: CupertinoColors.white,
|
||||
value: state.isOpen.value,
|
||||
onChanged: (value) {
|
||||
onChanged: state.isJustForShow.value == true ? null : (value){
|
||||
setState(() {
|
||||
state.isOpen.value = value;
|
||||
if(state.isOpen.value == false){
|
||||
state.autoLockTime.value = "0";
|
||||
state.autoLockTime.value = "";
|
||||
}
|
||||
logic.ifCanNext();
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
void showDeletAlertTipDialog(BuildContext 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.sendAutoLock();
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
|
||||
@ -11,13 +11,15 @@ class AutomaticBlockingState {
|
||||
|
||||
var isJustForShow = false.obs;// 是否只是作为展示作用,因为普通用户只是展示,不可修改
|
||||
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||
var sureBtnState = 0.obs;// 0普通状态(可用) 1连接中(不可用)
|
||||
var sureBtnState = 0.obs;// 0可点击 1 不可点击
|
||||
|
||||
var isOpen = false.obs;// 是否开启自动落锁
|
||||
var autoLockTime = "5".obs;
|
||||
var isCustomLockTime = false.obs;// 自定义
|
||||
final TextEditingController timeController = TextEditingController();
|
||||
|
||||
var canNext = false.obs;// 是否可以点击下一步
|
||||
|
||||
AutomaticBlockingState() {
|
||||
var map = Get.arguments;
|
||||
lockSetInfoData.value = map["lockSetInfoData"];
|
||||
@ -29,6 +31,7 @@ class AutomaticBlockingState {
|
||||
if(lockBasicInfo.value.isLockOwner == 1 || lockBasicInfo.value.keyRight == 1){
|
||||
isJustForShow.value = false;
|
||||
}else{
|
||||
// 普通用户只用来展示
|
||||
isJustForShow.value = true;
|
||||
}
|
||||
|
||||
|
||||
@ -121,7 +121,12 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
|
||||
print("indexList:$indexList");
|
||||
var pwd = indexList.sublist(1, 11);
|
||||
var pwdStr = utf8String(pwd);
|
||||
print("pwd:$pwd pwdStr:$pwdStr");
|
||||
print("pwd:$pwd pwdStr:$pwdStr state.adminPwd.value:${state.adminPwd.value}");
|
||||
|
||||
// if(pwdStr == state.adminPwd.value){
|
||||
// showToast("");
|
||||
// return;
|
||||
// }
|
||||
state.adminPwd.value = pwdStr;
|
||||
addLockAdminPassword(false);
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ class _AdminOpenLockPasswordPageState extends State<AdminOpenLockPasswordPage> {
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return ShowTFView(
|
||||
title: "管理员密码",
|
||||
title: "修改密码",
|
||||
tipTitle: "请输入",
|
||||
keyboardType: TextInputType.number,
|
||||
inputFormatters: [
|
||||
|
||||
@ -75,7 +75,12 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
|
||||
allHeight: 70.h,
|
||||
isHaveLine: false),
|
||||
SizedBox(height: 10.h),
|
||||
CommonItem(
|
||||
Visibility(
|
||||
visible: (state.lockBasicInfo.value.isLockOwner == 1 ||
|
||||
state.lockBasicInfo.value.keyRight == 1)
|
||||
? true
|
||||
: false,
|
||||
child: CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.lockName!.tr,
|
||||
rightTitle: state.lockBasicInfo.value.lockAlias,
|
||||
isHaveLine: true,
|
||||
@ -90,7 +95,7 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
|
||||
state.lockBasicInfo.value = data["lockBasicInfo"];
|
||||
});
|
||||
}
|
||||
}),
|
||||
})),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.lockGrouping!.tr,
|
||||
rightTitle: state.lockBasicInfo.value.groupName,
|
||||
|
||||
@ -16,9 +16,12 @@ class EditLockNameLogic extends BaseGetXController{
|
||||
lockId: state.lockSetInfoData.value.lockId.toString(),
|
||||
lockName:state.changeLockNameController.text);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("修改成功");
|
||||
state.lockBasicInfo.value.lockAlias = state.changeLockNameController.text;
|
||||
eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(3, state.lockBasicInfo.value.lockAlias!));
|
||||
showToast("修改成功", something: (){
|
||||
state.lockBasicInfo.value.lockAlias = state.changeLockNameController.text;
|
||||
eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(3, state.lockBasicInfo.value.lockAlias!));
|
||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||
});
|
||||
|
||||
Get.back(result: {
|
||||
"lockBasicInfo":state.lockBasicInfo.value
|
||||
});
|
||||
|
||||
@ -23,11 +23,12 @@ class UploadElectricQuantityLogic extends BaseGetXController {
|
||||
Future<void> uploadElectricQuantityRequest(String electricQuantity) async {
|
||||
KeyOperationRecordEntity entity = await ApiRepository.to.uploadElectricQuantity(electricQuantity, state.lockSetInfoData.value.lockId.toString());
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
|
||||
eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(0, electricQuantity));
|
||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||
|
||||
showToast("锁电量更新成功");
|
||||
showToast("锁电量更新成功", something: (){
|
||||
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
|
||||
eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(0, electricQuantity));
|
||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -41,4 +41,15 @@ class CheckInCreatCompanyLogic extends BaseGetXController{
|
||||
showToast("设置成功");
|
||||
}
|
||||
}
|
||||
|
||||
void ifCanNext() {
|
||||
if(state.companyNameController.text.isNotEmpty &&
|
||||
state.weekDays.value.isNotEmpty &&
|
||||
state.beginTimeTimestamp.value.isNotEmpty &&
|
||||
state.endTimeTimestamp.value.isNotEmpty) {
|
||||
state.canNext.value = true;
|
||||
}else{
|
||||
state.canNext.value = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -55,12 +55,11 @@ class _CheckInCreatCompanyPageState extends State<CheckInCreatCompanyPage> {
|
||||
});
|
||||
|
||||
if(data != null) {
|
||||
setState(() {
|
||||
state.beginTime.value = data["beginTime"];
|
||||
state.endTime.value = data["endTime"];
|
||||
state.beginTimeTimestamp.value = data["beginTimeTimestamp"];
|
||||
state.endTimeTimestamp.value = data["endTimeTimestamp"];
|
||||
});
|
||||
logic.ifCanNext();
|
||||
}
|
||||
})),
|
||||
Obx(() => CommonItem(
|
||||
@ -77,26 +76,26 @@ class _CheckInCreatCompanyPageState extends State<CheckInCreatCompanyPage> {
|
||||
"checkingInSetInfo": CheckingInSetInfo(),
|
||||
});
|
||||
if(data != null) {
|
||||
setState(() {
|
||||
state.isCustom.value = data["attendanceType"];
|
||||
state.weekDays.value = data["weekDays"];
|
||||
state.weekDaysStr.value = state.weekDays.value.join(",");
|
||||
});
|
||||
logic.ifCanNext();
|
||||
}
|
||||
})),
|
||||
SizedBox(
|
||||
height: 30.h,
|
||||
),
|
||||
SubmitBtn(
|
||||
Obx(() => SubmitBtn(
|
||||
btnName: TranslationLoader.lanKeys!.sure!.tr,
|
||||
borderRadius: 20.w,
|
||||
fontSize: 32.sp,
|
||||
isDelete: false,
|
||||
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 20.w),
|
||||
padding: EdgeInsets.only(top: 20.w, bottom: 20.w),
|
||||
onClick: () {
|
||||
isDisabled: state.canNext.value,
|
||||
onClick: state.canNext.value ? (){
|
||||
logic.setCheckInCreateCompany();
|
||||
}),
|
||||
}: null)),
|
||||
],
|
||||
),
|
||||
);
|
||||
@ -117,8 +116,12 @@ class _CheckInCreatCompanyPageState extends State<CheckInCreatCompanyPage> {
|
||||
FilteringTextInputFormatter.deny('\n'),
|
||||
LengthLimitingTextInputFormatter(30),
|
||||
],
|
||||
style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||
autofocus: false,
|
||||
textAlign: TextAlign.end,
|
||||
onChanged: (value) {
|
||||
logic.ifCanNext();
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
//输入里面输入文字内边距设置
|
||||
// contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
|
||||
|
||||
@ -19,6 +19,8 @@ class CheckInCreatCompanyState{
|
||||
var endTime = "".obs;// 结束时间
|
||||
var beginTimeTimestamp = "".obs;// 开始时间时间戳
|
||||
var endTimeTimestamp = "".obs;// 结束时间时间戳
|
||||
|
||||
var canNext = false.obs;// 是否可以点击下一步
|
||||
CheckInCreatCompanyState() {
|
||||
var map = Get.arguments;
|
||||
lockSetInfoData.value = map["lockSetInfoData"];
|
||||
|
||||
@ -680,10 +680,11 @@ class LockSetLogic extends BaseGetXController {
|
||||
void initLoadDataAction(BlockSetStateCallback blockSetStateCallback) {
|
||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||
_passCurrentLockInformationEvent = eventBus.on<PassCurrentLockInformationEvent>().listen((event) {
|
||||
state.lockSetInfoData.value = event.lockSetInfoData;
|
||||
state.isAttendance.value = state.lockSetInfoData.value.lockSettingInfo!.attendance!;
|
||||
// state.lockSetInfoData.value = event.lockSetInfoData;
|
||||
// state.isAttendance.value = state.lockSetInfoData.value.lockSettingInfo!.attendance!;
|
||||
// print("22222event.lockSetInfoData.lockSettingInfo!.autoLockSecond:${event.lockSetInfoData.lockSettingInfo!.autoLockSecond}");
|
||||
blockSetStateCallback();
|
||||
// blockSetStateCallback();
|
||||
getLockSettingInfoData();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -216,8 +216,8 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
|
||||
visible: state.lockFeature.value.autoLock == 1 ? true : false,
|
||||
child: CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.automaticBlocking!.tr,
|
||||
rightTitle: (state.lockSettingInfo.value.autoLock ?? 0) > 0
|
||||
? "${state.lockSetInfoData.value.lockSettingInfo!.autoLockSecond ?? 0}s"
|
||||
rightTitle: state.lockSettingInfo.value.autoLock! > 0
|
||||
? "${state.lockSetInfoData.value.lockSettingInfo!.autoLockSecond}s"
|
||||
: TranslationLoader.lanKeys!.closed!.tr,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
@ -285,8 +285,8 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
|
||||
SizedBox(height: 10.h),
|
||||
// 常开模式
|
||||
Obx(() => Visibility(
|
||||
visible: state.lockFeature.value.passageMode == 1 ? true : false,
|
||||
// visible:true,
|
||||
// visible: state.lockFeature.value.passageMode == 1 ? true : false,
|
||||
visible:true,
|
||||
child: CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.normallyOpenMode!.tr,
|
||||
rightTitle: (state.lockSettingInfo.value.passageMode ?? 0) == 1
|
||||
|
||||
@ -31,6 +31,7 @@ class LockSoundSetLogic extends BaseGetXController {
|
||||
state.lockSetInfoData.value.lockSettingInfo!.lockSound = state.isOpenLockSound.value == true ? 1 :0;
|
||||
state.lockSetInfoData.value.lockSettingInfo!.lockSoundVolume = state.lockSoundLevel.value;
|
||||
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
|
||||
ifCanNext();
|
||||
showToast("操作成功");
|
||||
}
|
||||
}
|
||||
@ -197,6 +198,14 @@ class LockSoundSetLogic extends BaseGetXController {
|
||||
});
|
||||
}
|
||||
|
||||
void ifCanNext() {
|
||||
if((state.lockSoundLevel.value != state.lockSetInfoData.value.lockSettingInfo!.lockSoundVolume!) || (state.isOpenLockSound.value != (state.lockSetInfoData.value.lockSettingInfo!.lockSound == 1 ? true : false))){
|
||||
state.canNext.value = true;
|
||||
}else{
|
||||
state.canNext.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
|
||||
@ -73,7 +73,7 @@ class _LockSoundSetPageState extends State<LockSoundSetPage> with RouteAware {
|
||||
.lanKeys!.pleaseSeletLockVolume!.tr,
|
||||
rightTitle: "",
|
||||
isHaveLine: true),
|
||||
CommonItem(
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.low!.tr,
|
||||
rightTitle: "",
|
||||
isHaveLine: true,
|
||||
@ -83,6 +83,7 @@ class _LockSoundSetPageState extends State<LockSoundSetPage> with RouteAware {
|
||||
setState(() {
|
||||
state.lockSoundLevel.value = 1;
|
||||
});
|
||||
logic.ifCanNext();
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
@ -93,17 +94,18 @@ class _LockSoundSetPageState extends State<LockSoundSetPage> with RouteAware {
|
||||
),
|
||||
],
|
||||
),
|
||||
)),
|
||||
CommonItem(
|
||||
))),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.lower!.tr,
|
||||
rightTitle: "",
|
||||
isHaveLine: true,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
// setState(() {
|
||||
state.lockSoundLevel.value = 2;
|
||||
});
|
||||
// });
|
||||
logic.ifCanNext();
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
@ -114,17 +116,18 @@ class _LockSoundSetPageState extends State<LockSoundSetPage> with RouteAware {
|
||||
),
|
||||
],
|
||||
),
|
||||
)),
|
||||
CommonItem(
|
||||
))),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.medium!.tr,
|
||||
rightTitle: "",
|
||||
isHaveLine: true,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
// setState(() {
|
||||
state.lockSoundLevel.value = 3;
|
||||
});
|
||||
// });
|
||||
logic.ifCanNext();
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
@ -135,17 +138,18 @@ class _LockSoundSetPageState extends State<LockSoundSetPage> with RouteAware {
|
||||
),
|
||||
],
|
||||
),
|
||||
)),
|
||||
CommonItem(
|
||||
))),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.higher!.tr,
|
||||
rightTitle: "",
|
||||
isHaveLine: true,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
state.lockSoundLevel.value = 4;
|
||||
});
|
||||
// setState(() {
|
||||
state.lockSoundLevel.value = 4;
|
||||
// });
|
||||
logic.ifCanNext();
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
@ -156,17 +160,18 @@ class _LockSoundSetPageState extends State<LockSoundSetPage> with RouteAware {
|
||||
),
|
||||
],
|
||||
),
|
||||
)),
|
||||
CommonItem(
|
||||
))),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.high!.tr,
|
||||
rightTitle: "",
|
||||
isHaveLine: true,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
state.lockSoundLevel.value = 5;
|
||||
});
|
||||
// setState(() {
|
||||
state.lockSoundLevel.value = 5;
|
||||
// });
|
||||
logic.ifCanNext();
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
@ -177,7 +182,7 @@ class _LockSoundSetPageState extends State<LockSoundSetPage> with RouteAware {
|
||||
),
|
||||
],
|
||||
),
|
||||
)),
|
||||
))),
|
||||
],
|
||||
),
|
||||
)),
|
||||
@ -185,9 +190,10 @@ class _LockSoundSetPageState extends State<LockSoundSetPage> with RouteAware {
|
||||
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 30.w),
|
||||
child: SubmitBtn(
|
||||
btnName: TranslationLoader.lanKeys!.save!.tr,
|
||||
onClick: () {
|
||||
isDisabled: state.canNext.value,
|
||||
onClick: state.canNext.value ? (){
|
||||
logic.sendLockSound();
|
||||
}),
|
||||
}: null),
|
||||
),
|
||||
],
|
||||
)));
|
||||
@ -203,6 +209,7 @@ class _LockSoundSetPageState extends State<LockSoundSetPage> with RouteAware {
|
||||
setState(() {
|
||||
state.isOpenLockSound.value = value;
|
||||
});
|
||||
logic.ifCanNext();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@ class LockSoundSetState {
|
||||
var lockSoundLevel = 0.obs;// 音量等级
|
||||
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||
var sureBtnState = 0.obs;// 0普通状态(可用) 1连接中(不可用)
|
||||
var canNext = false.obs;// 是否可以点击下一步
|
||||
|
||||
LockSoundSetState() {
|
||||
var map = Get.arguments;
|
||||
|
||||
@ -47,12 +47,13 @@ class NormallyOpenModeLogic extends BaseGetXController{
|
||||
passageModeConfig: passageModeConfig,
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||
showToast("操作成功", something: (){
|
||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||
|
||||
state.lockSetInfoData.value.lockSettingInfo!.passageMode = state.isOpenNormallyOpenMode.value == true ? 1:0;
|
||||
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
|
||||
eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(2, state.lockSetInfoData.value.lockSettingInfo!.passageMode!.toString()));
|
||||
showToast("操作成功");
|
||||
state.lockSetInfoData.value.lockSettingInfo!.passageMode = state.isOpenNormallyOpenMode.value == true ? 1:0;
|
||||
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
|
||||
eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(2, state.lockSetInfoData.value.lockSettingInfo!.passageMode!.toString()));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -186,6 +186,10 @@ class _NormallyOpenModePageState extends State<NormallyOpenModePage> with RouteA
|
||||
}
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
if(state.isJustForShow.value == true){
|
||||
return;
|
||||
}
|
||||
|
||||
if (state.weekDays.value.contains(index)) {
|
||||
state.weekDays.value.remove(index);
|
||||
} else {
|
||||
@ -235,6 +239,10 @@ class _NormallyOpenModePageState extends State<NormallyOpenModePage> with RouteA
|
||||
rightWidget: GestureDetector(
|
||||
onTap: () {
|
||||
// 选择全天模式
|
||||
if(state.isJustForShow.value == true){
|
||||
return;
|
||||
}
|
||||
|
||||
if (state.isAllDay.value == 1) {
|
||||
state.isAllDay.value = 0;
|
||||
} else {
|
||||
@ -274,6 +282,10 @@ class _NormallyOpenModePageState extends State<NormallyOpenModePage> with RouteA
|
||||
isHaveDirection: true,
|
||||
isHaveLine: true,
|
||||
action: () {
|
||||
if(state.isJustForShow.value == true){
|
||||
return;
|
||||
}
|
||||
|
||||
Pickers.showDatePicker(context, mode: DateMode.HM,
|
||||
onConfirm: (p) {
|
||||
setState(() {
|
||||
@ -289,6 +301,10 @@ class _NormallyOpenModePageState extends State<NormallyOpenModePage> with RouteA
|
||||
rightTitle: state.endTime.value,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
if(state.isJustForShow.value == true){
|
||||
return;
|
||||
}
|
||||
|
||||
Pickers.showDatePicker(context, mode: DateMode.HM,
|
||||
onConfirm: (p) {
|
||||
setState(() {
|
||||
@ -312,7 +328,7 @@ class _NormallyOpenModePageState extends State<NormallyOpenModePage> with RouteA
|
||||
trackColor: CupertinoColors.systemGrey5,
|
||||
thumbColor: CupertinoColors.white,
|
||||
value: state.isOpenNormallyOpenMode.value,
|
||||
onChanged: (value) {
|
||||
onChanged: state.isJustForShow.value == true ? null : (value) {
|
||||
setState(() {
|
||||
state.isOpenNormallyOpenMode.value = value;
|
||||
});
|
||||
|
||||
@ -141,7 +141,7 @@ class _WirelessKeyboardPageState extends State<WirelessKeyboardPage> {
|
||||
context: widgetContext,
|
||||
builder: (context) {
|
||||
return CupertinoAlertDialog(
|
||||
title: const Text('该锁的电子钥匙都将被删除'),
|
||||
title: const Text('该锁的无线键盘都将被删除'),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
||||
|
||||
@ -3,7 +3,6 @@ import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
|
||||
import '../../../appRouters.dart';
|
||||
import '../../../app_settings/app_colors.dart';
|
||||
@ -358,8 +357,10 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
|
||||
// ic卡
|
||||
if (state.keyInfos.value.lockFeature!.icCard == 1) {
|
||||
showWidgetArr.add(bottomItem('images/main/icon_main_icCard.png',
|
||||
TranslationLoader.lanKeys!.card!.tr, () {
|
||||
showWidgetArr.add(bottomItem('images/main/icon_main_icCard.png', TranslationLoader.lanKeys!.card!.tr, () {
|
||||
// logic.showToast("普通用户第一次需要在锁旁边操作哦。", something: () {
|
||||
// logic.showEasyLoading();
|
||||
// });
|
||||
Get.toNamed(Routers.cardListPage, arguments: {
|
||||
"lockId": widget.lockListInfoItemEntity.lockId,
|
||||
});
|
||||
|
||||
@ -3,6 +3,7 @@ import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyDetail/password
|
||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/eventBusEventManage.dart';
|
||||
|
||||
class PasswordKeyDetailLogic extends BaseGetXController {
|
||||
final PasswordKeyDetailState state = PasswordKeyDetailState();
|
||||
@ -20,21 +21,108 @@ class PasswordKeyDetailLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
//更新密码请求
|
||||
Future<void> updatePwdRequest() async {
|
||||
Future<void> updatePwdRequest(int changType) async {
|
||||
PasswordKeyEntity entity = await ApiRepository.to.updatePasswordKey(
|
||||
lockId: state.itemData.value.lockId!,
|
||||
keyboardPwdId: state.itemData.value.keyboardPwdId.toString(),
|
||||
keyboardPwdName: state.inputNameController.text,
|
||||
newKeyboardPwd: state.inputPwdController.text,
|
||||
startDate: state.startDate.value,
|
||||
endDate: state.endDate.value,
|
||||
startDate: state.itemData.value.startDate!,
|
||||
endDate: state.itemData.value.endDate!,
|
||||
changeType: state.changeType.value,
|
||||
hoursStart: state.hoursStart.value,
|
||||
hoursEnd: state.hoursEnd.value,
|
||||
isCoerced: state.isCoerced.value);
|
||||
hoursStart: state.itemData.value.hoursStart!,
|
||||
hoursEnd: state.itemData.value.hoursEnd!,
|
||||
isCoerced: state.itemData.value.isCoerced!.toString());
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("修改成功");
|
||||
if(changType == 1){
|
||||
// 修改名字
|
||||
state.keyboardPwdName.value = state.inputNameController.text;
|
||||
}else if(changType == 2){
|
||||
// 修改密码
|
||||
state.keyboardPwd.value = state.inputPwdController.text;
|
||||
}
|
||||
print("state.itemData.value.keyboardPwd:${state.itemData.value.keyboardPwd} state.itemData.value.keyboardPwdName:${state.itemData.value.keyboardPwdName}");
|
||||
Get.back();
|
||||
eventBus.fire(GetPasswordListRefreshUI());
|
||||
}
|
||||
}
|
||||
|
||||
//使用期限
|
||||
String getUseDateStr() {
|
||||
int? getPwdType = state.itemData.value.keyboardPwdType;
|
||||
String useDateStr = '';
|
||||
DateTime startDateStr =
|
||||
DateTime.fromMillisecondsSinceEpoch(state.itemData.value.startDate!);
|
||||
DateTime endDateStr =
|
||||
DateTime.fromMillisecondsSinceEpoch(state.itemData.value.endDate!);
|
||||
int starHour = startDateStr.hour;
|
||||
int endHour = endDateStr.hour;
|
||||
|
||||
switch (getPwdType) {
|
||||
case 1:
|
||||
//单次 1 只能在开始时间后6小时内使用一次
|
||||
useDateStr =
|
||||
'${startDateStr.toLocal().toString().substring(0, 16)}\n${endDateStr.toLocal().toString().substring(0, 16)}';
|
||||
break;
|
||||
case 2:
|
||||
//永久 2 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效
|
||||
useDateStr = '永久';
|
||||
break;
|
||||
case 3:
|
||||
//限期 3 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效
|
||||
useDateStr =
|
||||
'${startDateStr.toLocal().toString().substring(0, 16)}\n${endDateStr.toLocal().toString().substring(0, 16)}';
|
||||
break;
|
||||
case 4:
|
||||
//删除 4 在锁上使用后会删除之前在锁上使用过的密码
|
||||
useDateStr =
|
||||
'${startDateStr.toLocal().toString().substring(0, 16)}\n${endDateStr.toLocal().toString().substring(0, 16)}';
|
||||
break;
|
||||
case 5:
|
||||
//周未循环 5 在周未开始和结束时间指定时间段内有效
|
||||
useDateStr = '周末 $starHour:00-$endHour:00';
|
||||
break;
|
||||
case 6:
|
||||
//每日循环 6 每天开始和结束时间指定时间段内有效
|
||||
useDateStr = '周日 $starHour:00-$endHour:00';
|
||||
break;
|
||||
case 7:
|
||||
//工作日循环 7 工作日开始和结束时间指定的时间段内有效
|
||||
useDateStr = '工作日 $starHour:00-$endHour:00';
|
||||
break;
|
||||
case 8:
|
||||
//周一循环 8 每周一开始和结束时间指定时间段内有效
|
||||
useDateStr = '周一 $starHour:00-$endHour:00';
|
||||
break;
|
||||
case 9:
|
||||
//周二循环 9 每周二开始和结束时间指定时间段内有效
|
||||
useDateStr = '周二 $starHour:00-$endHour:00';
|
||||
break;
|
||||
case 10:
|
||||
//周三循环 10 每周三开始和结束时间指定时间段内有效
|
||||
useDateStr = '周三 $starHour:00-$endHour:00';
|
||||
break;
|
||||
case 11:
|
||||
//周四循环 11 每周四开始和结束时间指定时间段内有效
|
||||
useDateStr = '周四 $starHour:00-$endHour:00';
|
||||
break;
|
||||
case 12:
|
||||
//周五循环 12 每周五开始和结束时间指定时间段内有效
|
||||
useDateStr = '周五 $starHour:00-$endHour:00';
|
||||
break;
|
||||
case 13:
|
||||
//周六循环 13 每周六开始和结束时间指定时间段内有效
|
||||
useDateStr = '周六 $starHour:00-$endHour:00';
|
||||
break;
|
||||
case 14:
|
||||
//周天循环 14 每周日开始和结束时间指定时间段内有效
|
||||
useDateStr = '周天 $starHour:00-$endHour:00';
|
||||
break;
|
||||
|
||||
default:
|
||||
}
|
||||
return useDateStr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -50,53 +50,45 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
||||
body: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
CommonItem(
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.password!.tr,
|
||||
rightTitle: state.inputPwdController.text.isNotEmpty
|
||||
? state.inputPwdController.text
|
||||
: state.itemData.value.keyboardPwd,
|
||||
rightTitle: state.keyboardPwd.value,
|
||||
isHaveDirection: (state.itemData.value.keyboardPwdType == 1 ||
|
||||
state.itemData.value.keyboardPwdType == 4)
|
||||
state.itemData.value.keyboardPwdType == 4)
|
||||
? false
|
||||
: true,
|
||||
isHaveLine: true,
|
||||
action: () {
|
||||
if (state.itemData.value.keyboardPwdType == 1 ||
|
||||
state.itemData.value.keyboardPwdType == 4) {
|
||||
if (state.itemData.value.keyboardPwdType == 1 || state.itemData.value.keyboardPwdType == 4) {
|
||||
return;
|
||||
} else {
|
||||
showCupertinoAlertDialog(
|
||||
context, state.inputPwdController);
|
||||
showCupertinoAlertDialog(context, state.inputPwdController);
|
||||
}
|
||||
}),
|
||||
CommonItem(
|
||||
})),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
||||
rightTitle: state.inputNameController.text.isNotEmpty
|
||||
? state.inputNameController.text
|
||||
: state.itemData.value.keyboardPwdName,
|
||||
rightTitle: state.keyboardPwdName.value,
|
||||
isHaveDirection: true,
|
||||
isHaveLine: true,
|
||||
action: () {
|
||||
showCupertinoAlertDialog(
|
||||
context, state.inputNameController);
|
||||
}),
|
||||
})),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||
rightTitle: getUseDateStr(),
|
||||
isHaveDirection: true,
|
||||
leftTitel: "有效期",
|
||||
rightTitle: logic.getUseDateStr(),
|
||||
isHaveDirection: ((state.itemData.value.keyboardPwdType! > 3 &&
|
||||
state.itemData.value.keyboardPwdType! < 15) || state.itemData.value.keyboardPwdType! == 1) ? false : true,
|
||||
allHeight:
|
||||
state.itemData.value.keyboardPwdType == 3 ? 90.h : 65.h,
|
||||
action: () {
|
||||
if (state.itemData.value.keyboardPwdType! > 4 &&
|
||||
state.itemData.value.keyboardPwdType! < 15) {
|
||||
if ((state.itemData.value.keyboardPwdType! > 3 &&
|
||||
state.itemData.value.keyboardPwdType! < 15 ) || state.itemData.value.keyboardPwdType! == 1) {
|
||||
return;
|
||||
}
|
||||
Navigator.pushNamed(
|
||||
context, Routers.passwordKeyDetailChangeDatePage,
|
||||
Get.toNamed(Routers.passwordKeyDetailChangeDatePage,
|
||||
arguments: {
|
||||
'itemData': state.itemData.value,
|
||||
'lockId': state.itemData.value.lockId,
|
||||
'pwdId': state.itemData.value.keyboardPwdId.toString()
|
||||
});
|
||||
}),
|
||||
Container(height: 10.h),
|
||||
@ -204,88 +196,10 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
||||
));
|
||||
}
|
||||
|
||||
//使用期限
|
||||
String getUseDateStr() {
|
||||
int? getPwdType = state.itemData.value.keyboardPwdType;
|
||||
String useDateStr = '';
|
||||
DateTime startDateStr =
|
||||
DateTime.fromMillisecondsSinceEpoch(state.itemData.value.startDate!);
|
||||
DateTime endDateStr =
|
||||
DateTime.fromMillisecondsSinceEpoch(state.itemData.value.endDate!);
|
||||
int starHour = startDateStr.hour;
|
||||
int endHour = endDateStr.hour;
|
||||
|
||||
switch (getPwdType) {
|
||||
case 1:
|
||||
//单次 1 只能在开始时间后6小时内使用一次
|
||||
useDateStr =
|
||||
'${startDateStr.toLocal().toString().substring(0, 16)}\n${endDateStr.toLocal().toString().substring(0, 16)}';
|
||||
break;
|
||||
case 2:
|
||||
//永久 2 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效
|
||||
useDateStr = '永久';
|
||||
break;
|
||||
case 3:
|
||||
//限期 3 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效
|
||||
useDateStr =
|
||||
'${startDateStr.toLocal().toString().substring(0, 16)}\n${endDateStr.toLocal().toString().substring(0, 16)}';
|
||||
break;
|
||||
case 4:
|
||||
//删除 4 在锁上使用后会删除之前在锁上使用过的密码
|
||||
useDateStr =
|
||||
'${startDateStr.toLocal().toString().substring(0, 16)}\n${endDateStr.toLocal().toString().substring(0, 16)}';
|
||||
break;
|
||||
case 5:
|
||||
//周未循环 5 在周未开始和结束时间指定时间段内有效
|
||||
useDateStr = '周末 $starHour:00-$endHour:00';
|
||||
break;
|
||||
case 6:
|
||||
//每日循环 6 每天开始和结束时间指定时间段内有效
|
||||
useDateStr = '周日 $starHour:00-$endHour:00';
|
||||
break;
|
||||
case 7:
|
||||
//工作日循环 7 工作日开始和结束时间指定的时间段内有效
|
||||
useDateStr = '工作日 $starHour:00-$endHour:00';
|
||||
break;
|
||||
case 8:
|
||||
//周一循环 8 每周一开始和结束时间指定时间段内有效
|
||||
useDateStr = '周一 $starHour:00-$endHour:00';
|
||||
break;
|
||||
case 9:
|
||||
//周二循环 9 每周二开始和结束时间指定时间段内有效
|
||||
useDateStr = '周二 $starHour:00-$endHour:00';
|
||||
break;
|
||||
case 10:
|
||||
//周三循环 10 每周三开始和结束时间指定时间段内有效
|
||||
useDateStr = '周三 $starHour:00-$endHour:00';
|
||||
break;
|
||||
case 11:
|
||||
//周四循环 11 每周四开始和结束时间指定时间段内有效
|
||||
useDateStr = '周四 $starHour:00-$endHour:00';
|
||||
break;
|
||||
case 12:
|
||||
//周五循环 12 每周五开始和结束时间指定时间段内有效
|
||||
useDateStr = '周五 $starHour:00-$endHour:00';
|
||||
break;
|
||||
case 13:
|
||||
//周六循环 13 每周六开始和结束时间指定时间段内有效
|
||||
useDateStr = '周六 $starHour:00-$endHour:00';
|
||||
break;
|
||||
case 14:
|
||||
//周天循环 14 每周日开始和结束时间指定时间段内有效
|
||||
useDateStr = '周天 $starHour:00-$endHour:00';
|
||||
break;
|
||||
|
||||
default:
|
||||
}
|
||||
return useDateStr;
|
||||
}
|
||||
|
||||
//发送时间
|
||||
String getSenderDate(PasswordKeyListItem indexEntity) {
|
||||
String senderDate = '';
|
||||
DateTime dateStr =
|
||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!);
|
||||
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!);
|
||||
senderDate = dateStr.toLocal().toString().substring(0, 16);
|
||||
return senderDate;
|
||||
}
|
||||
@ -299,13 +213,15 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
||||
title: inputController == state.inputNameController
|
||||
? "${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}"
|
||||
: "${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.password!.tr}",
|
||||
tipTitle:
|
||||
inputController.text.isNotEmpty ? inputController.text : "请输入",
|
||||
tipTitle: inputController.text.isNotEmpty ? inputController.text : "请输入",
|
||||
controller: inputController,
|
||||
keyboardType: inputController == state.inputNameController
|
||||
? TextInputType.text
|
||||
: TextInputType.number,
|
||||
sureClick: () {
|
||||
//发送编辑钥匙名称请求
|
||||
if (inputController.text.isNotEmpty) {
|
||||
logic.updatePwdRequest();
|
||||
logic.updatePwdRequest(inputController == state.inputNameController ? 1 : 2);
|
||||
}
|
||||
},
|
||||
cancelClick: () {
|
||||
@ -321,7 +237,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
||||
context: context,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadiusDirectional.circular(10)),
|
||||
constraints: BoxConstraints(maxHeight: 260.h),
|
||||
constraints: BoxConstraints(maxHeight: 270.h),
|
||||
builder: (BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
|
||||
@ -6,16 +6,25 @@ class PasswordKeyDetailState {
|
||||
final itemData = PasswordKeyListItem().obs;
|
||||
final TextEditingController inputPwdController = TextEditingController();
|
||||
final TextEditingController inputNameController = TextEditingController();
|
||||
final changeType = '1'
|
||||
.obs; //1-通过APP走蓝牙修改,不传默认1,必需先通过APP SDK蓝牙修改后调用该接口 2-通过网关或WiFi锁修改,如果是WiFi锁或有连接网关,则可以传2,直接调用该接口修改生效
|
||||
final isCoerced = '1'.obs; //胁迫指纹:1;非胁迫指纹:2(胁迫指纹开锁触发报警)
|
||||
final hoursStart = 0.obs;
|
||||
final hoursEnd = 0.obs;
|
||||
final startDate = 0.obs;
|
||||
final endDate = 0.obs;
|
||||
final changeType = '1'.obs; //1-通过APP走蓝牙修改,不传默认1,必需先通过APP SDK蓝牙修改后调用该接口 2-通过网关或WiFi锁修改,如果是WiFi锁或有连接网关,则可以传2,直接调用该接口修改生效
|
||||
final keyboardPwd = ''.obs;
|
||||
final keyboardPwdName = ''.obs;
|
||||
// final hoursStart = 0.obs;
|
||||
// final hoursEnd = 0.obs;
|
||||
// final startDate = 0.obs;
|
||||
// final endDate = 0.obs;
|
||||
|
||||
PasswordKeyDetailState() {
|
||||
Map map = Get.arguments;
|
||||
itemData.value = map["itemData"];
|
||||
// isCoerced.value = itemData.value.isCoerced!.toString();
|
||||
keyboardPwd.value = itemData.value.keyboardPwd!;
|
||||
keyboardPwdName.value = itemData.value.keyboardPwdName!;
|
||||
inputNameController.text = itemData.value.keyboardPwdName!;
|
||||
inputPwdController.text = itemData.value.keyboardPwd!;
|
||||
// startDate.value = itemData.value.startDate!;
|
||||
// endDate.value = itemData.value.endDate!;
|
||||
// hoursStart.value = itemData.value.hoursStart!;
|
||||
// hoursEnd.value = itemData.value.hoursEnd!;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,27 +4,30 @@ import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/pass
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
|
||||
class PasswordKeyDetailChangeDateLogic extends BaseGetXController {
|
||||
final PasswordKeyDetailChangeDateState state =
|
||||
PasswordKeyDetailChangeDateState();
|
||||
import '../../../../tools/eventBusEventManage.dart';
|
||||
|
||||
class PasswordKeyDetailChangeDateLogic extends BaseGetXController {
|
||||
final PasswordKeyDetailChangeDateState state = PasswordKeyDetailChangeDateState();
|
||||
//更新密码请求
|
||||
Future<void> updatePwdRequest() async {
|
||||
PasswordKeyEntity entity = await ApiRepository.to.updatePasswordKey(
|
||||
lockId: state.itemData.value.lockId!,
|
||||
keyboardPwdId: state.pwdId.value.toString(),
|
||||
keyboardPwdName: state.inputNameController.text,
|
||||
newKeyboardPwd: state.inputPwdController.text,
|
||||
startDate: state.startDate.value,
|
||||
endDate: state.endDate.value,
|
||||
changeType: state.changeType.value,
|
||||
hoursStart: state.hoursStart.value,
|
||||
hoursEnd: state.hoursEnd.value,
|
||||
isCoerced: state.isCoerced.value);
|
||||
keyboardPwdId: state.itemData.value.keyboardPwdId.toString(),
|
||||
keyboardPwdName: state.itemData.value.keyboardPwdName!,
|
||||
newKeyboardPwd: state.itemData.value.keyboardPwd!,
|
||||
startDate: state.itemData.value.startDate!,
|
||||
endDate: state.itemData.value.endDate!,
|
||||
changeType: '1',
|
||||
hoursStart: state.itemData.value.hoursStart!,
|
||||
hoursEnd: state.itemData.value.hoursEnd!,
|
||||
isCoerced: "1");
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("修改成功", something: (){
|
||||
eventBus.fire(GetPasswordListRefreshUI());
|
||||
Get.back();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -39,9 +39,9 @@ class _PasswordKeyDetailChangeDatePage
|
||||
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||
),
|
||||
onPressed: () {
|
||||
if (state.lockId.value != 0 && state.pwdId.value.isNotEmpty) {
|
||||
// if (state.lockId.value != 0 && state.pwdId.value.isNotEmpty) {
|
||||
logic.updatePwdRequest();
|
||||
}
|
||||
// }
|
||||
},
|
||||
),
|
||||
],
|
||||
@ -75,12 +75,12 @@ class _PasswordKeyDetailChangeDatePage
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDH,
|
||||
onConfirm: (p) {
|
||||
state.selectEffectiveDate.value =
|
||||
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
||||
state.effectiveDateTime =
|
||||
DateTime.parse(state.selectEffectiveDate.value);
|
||||
// state.effectiveDateTime = DateTime.parse(state.selectEffectiveDate.value);
|
||||
state.itemData.value.startDate = DateTime.parse(state.selectEffectiveDate.value).millisecondsSinceEpoch; //更新开始时间
|
||||
});
|
||||
})),
|
||||
Obx(() => CommonItem(
|
||||
@ -90,12 +90,12 @@ class _PasswordKeyDetailChangeDatePage
|
||||
: getEndDate,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDH,
|
||||
onConfirm: (p) {
|
||||
state.selectFailureDate.value =
|
||||
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
||||
state.failureDateTime =
|
||||
DateTime.parse(state.selectFailureDate.value);
|
||||
// state.failureDateTime = DateTime.parse(state.selectFailureDate.value);
|
||||
state.itemData.value.endDate = DateTime.parse(state.selectFailureDate.value).millisecondsSinceEpoch; //更新结束时间
|
||||
});
|
||||
})),
|
||||
],
|
||||
|
||||
@ -4,25 +4,24 @@ import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKe
|
||||
|
||||
class PasswordKeyDetailChangeDateState {
|
||||
final itemData = PasswordKeyListItem().obs;
|
||||
final TextEditingController inputPwdController = TextEditingController();
|
||||
final TextEditingController inputNameController = TextEditingController();
|
||||
final changeType = '1'
|
||||
.obs; //1-通过APP走蓝牙修改,不传默认1,必需先通过APP SDK蓝牙修改后调用该接口 2-通过网关或WiFi锁修改,如果是WiFi锁或有连接网关,则可以传2,直接调用该接口修改生效
|
||||
final isCoerced = '1'.obs; //胁迫指纹:1;非胁迫指纹:2(胁迫指纹开锁触发报警)
|
||||
final hoursStart = 0.obs;
|
||||
final hoursEnd = 0.obs;
|
||||
final startDate = 0.obs;
|
||||
final endDate = 0.obs;
|
||||
final pwdId = ''.obs;
|
||||
final lockId = 0.obs;
|
||||
final fromType = ''.obs;
|
||||
// final TextEditingController inputPwdController = TextEditingController();
|
||||
// final TextEditingController inputNameController = TextEditingController();
|
||||
// final changeType = '1'.obs; //1-通过APP走蓝牙修改,不传默认1,必需先通过APP SDK蓝牙修改后调用该接口 2-通过网关或WiFi锁修改,如果是WiFi锁或有连接网关,则可以传2,直接调用该接口修改生效
|
||||
// final isCoerced = '1'.obs; //胁迫指纹:1;非胁迫指纹:2(胁迫指纹开锁触发报警)
|
||||
// final hoursStart = 0.obs;
|
||||
// final hoursEnd = 0.obs;
|
||||
// final startDate = 0.obs;
|
||||
// final endDate = 0.obs;
|
||||
// final pwdId = ''.obs;
|
||||
// final lockId = 0.obs;
|
||||
// final fromType = ''.obs;
|
||||
final selectEffectiveDate = ''.obs; //生效时间
|
||||
final selectFailureDate = ''.obs; //失效时间
|
||||
DateTime effectiveDateTime = DateTime.now();
|
||||
DateTime failureDateTime = DateTime.now();
|
||||
final endDay = ''.obs;
|
||||
final startDay = ''.obs;
|
||||
final weekDays = [].obs;
|
||||
// DateTime effectiveDateTime = DateTime.now();
|
||||
// DateTime failureDateTime = DateTime.now();
|
||||
// final endDay = ''.obs;
|
||||
// final startDay = ''.obs;
|
||||
// final weekDays = [].obs;
|
||||
|
||||
PasswordKeyDetailChangeDateState() {
|
||||
Map map = Get.arguments;
|
||||
@ -30,11 +29,11 @@ class PasswordKeyDetailChangeDateState {
|
||||
if ((map["itemData"] != null)) {
|
||||
itemData.value = map["itemData"];
|
||||
}
|
||||
if ((map["pwdId"] != null)) {
|
||||
pwdId.value = map["pwdId"];
|
||||
}
|
||||
if ((map["lockId"] != null)) {
|
||||
lockId.value = map["lockId"];
|
||||
}
|
||||
// if ((map["pwdId"] != null)) {
|
||||
// pwdId.value = map["pwdId"];
|
||||
// }
|
||||
// if ((map["lockId"] != null)) {
|
||||
// lockId.value = map["lockId"];
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,6 +79,9 @@ class PasswordKeyListItem {
|
||||
int? keyboardPwdId;
|
||||
int? sendDate;
|
||||
String? validTimeStr;
|
||||
int? isCoerced;
|
||||
int? hoursStart;
|
||||
int? hoursEnd;
|
||||
|
||||
PasswordKeyListItem(
|
||||
{this.apiUserId,
|
||||
@ -94,7 +97,10 @@ class PasswordKeyListItem {
|
||||
this.senderUsername,
|
||||
this.keyboardPwdId,
|
||||
this.sendDate,
|
||||
this.validTimeStr});
|
||||
this.validTimeStr,
|
||||
this.isCoerced,
|
||||
this.hoursStart,
|
||||
this.hoursEnd});
|
||||
|
||||
PasswordKeyListItem.fromJson(Map<String, dynamic> json) {
|
||||
apiUserId = json['apiUserId'];
|
||||
@ -111,6 +117,9 @@ class PasswordKeyListItem {
|
||||
keyboardPwdId = json['keyboardPwdId'];
|
||||
sendDate = json['sendDate'];
|
||||
validTimeStr = json['validTimeStr'];
|
||||
isCoerced = json['isCoerced'];
|
||||
hoursStart = json['hoursStart'];
|
||||
hoursEnd = json['hoursEnd'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
@ -129,6 +138,9 @@ class PasswordKeyListItem {
|
||||
data['keyboardPwdId'] = keyboardPwdId;
|
||||
data['sendDate'] = sendDate;
|
||||
data['validTimeStr'] = validTimeStr;
|
||||
data['isCoerced'] = isCoerced;
|
||||
data['hoursStart'] = hoursStart;
|
||||
data['hoursEnd'] = hoursEnd;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,11 @@
|
||||
import 'dart:async';
|
||||
|
||||
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';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
|
||||
import '../../../../tools/eventBusEventManage.dart';
|
||||
import '../passwordKey_perpetual/passwordKeyEntity.dart';
|
||||
|
||||
class PasswordKeyListLogic extends BaseGetXController {
|
||||
@ -43,10 +46,105 @@ class PasswordKeyListLogic extends BaseGetXController {
|
||||
}
|
||||
}
|
||||
|
||||
//使用期限
|
||||
String getUseDateStr(PasswordKeyListItem indexEntity) {
|
||||
int? getPwdType = indexEntity.keyboardPwdType;
|
||||
String useDateStr = '';
|
||||
DateTime sendDateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!);
|
||||
DateTime startDateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
|
||||
DateTime endDateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
|
||||
int starHour = startDateStr.hour;
|
||||
int endHour = endDateStr.hour;
|
||||
|
||||
// print("sendDateStr.toLocal().toString():${sendDateStr.toLocal().toString()}");
|
||||
switch (getPwdType) {
|
||||
case 1:
|
||||
//单次 1 只能在开始时间后6小时内使用一次
|
||||
useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} 单次';
|
||||
break;
|
||||
case 2:
|
||||
//永久 2 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效
|
||||
useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} 永久 ${indexEntity.isCustom! == 1? "自定义" : ""}';
|
||||
break;
|
||||
case 3:
|
||||
//限期 3 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效
|
||||
useDateStr =
|
||||
'${startDateStr.toLocal().toString().substring(0, 16)} - ${endDateStr.toLocal().toString().substring(0, 16)} 限时 ${indexEntity.isCustom! == 1? "自定义" : ""}';
|
||||
break;
|
||||
case 4:
|
||||
//删除 4 在锁上使用后会删除之前在锁上使用过的密码
|
||||
useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} 清空码';
|
||||
break;
|
||||
case 5:
|
||||
//周未循环 5 在周未开始和结束时间指定时间段内有效
|
||||
useDateStr =
|
||||
'${sendDateStr.toLocal().toString().substring(0, 16)} 周末$starHour:00-$endHour:00 循环';
|
||||
break;
|
||||
case 6:
|
||||
//每日循环 6 每天开始和结束时间指定时间段内有效
|
||||
useDateStr =
|
||||
'${sendDateStr.toLocal().toString().substring(0, 16)} 周日$starHour:00-$endHour:00 循环';
|
||||
break;
|
||||
case 7:
|
||||
//工作日循环 7 工作日开始和结束时间指定的时间段内有效
|
||||
useDateStr =
|
||||
'${sendDateStr.toLocal().toString().substring(0, 16)} 工作日$starHour:00-$endHour:00 循环';
|
||||
break;
|
||||
case 8:
|
||||
//周一循环 8 每周一开始和结束时间指定时间段内有效
|
||||
useDateStr =
|
||||
'${sendDateStr.toLocal().toString().substring(0, 16)} 周一$starHour:00-$endHour:00 循环';
|
||||
break;
|
||||
case 9:
|
||||
//周二循环 9 每周二开始和结束时间指定时间段内有效
|
||||
useDateStr =
|
||||
'${sendDateStr.toLocal().toString().substring(0, 16)} 周二$starHour:00-$endHour:00 循环';
|
||||
break;
|
||||
case 10:
|
||||
//周三循环 10 每周三开始和结束时间指定时间段内有效
|
||||
useDateStr =
|
||||
'${sendDateStr.toLocal().toString().substring(0, 16)} 周三$starHour:00-$endHour:00 循环';
|
||||
break;
|
||||
case 11:
|
||||
//周四循环 11 每周四开始和结束时间指定时间段内有效
|
||||
useDateStr =
|
||||
'${sendDateStr.toLocal().toString().substring(0, 16)} 周四$starHour:00-$endHour:00 循环';
|
||||
break;
|
||||
case 12:
|
||||
//周五循环 12 每周五开始和结束时间指定时间段内有效
|
||||
useDateStr =
|
||||
'${sendDateStr.toLocal().toString().substring(0, 16)} 周五$starHour:00-$endHour:00 循环';
|
||||
break;
|
||||
case 13:
|
||||
//周六循环 13 每周六开始和结束时间指定时间段内有效
|
||||
useDateStr =
|
||||
'${sendDateStr.toLocal().toString().substring(0, 16)} 周六$starHour:00-$endHour:00 循环';
|
||||
break;
|
||||
case 14:
|
||||
//周天循环 14 每周日开始和结束时间指定时间段内有效
|
||||
useDateStr =
|
||||
'${sendDateStr.toLocal().toString().substring(0, 16)} 周天$starHour:00-$endHour:00 循环';
|
||||
break;
|
||||
|
||||
default:
|
||||
}
|
||||
return useDateStr;
|
||||
}
|
||||
|
||||
/// 刷新密码列表
|
||||
StreamSubscription? _getPasswordListRefreshUIEvent;
|
||||
void _getPasswordListRefreshUIAction() {
|
||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||
_getPasswordListRefreshUIEvent = eventBus.on<GetPasswordListRefreshUI>().listen((event) {
|
||||
mockNetworkDataRequest();
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
_getPasswordListRefreshUIAction();
|
||||
}
|
||||
|
||||
@override
|
||||
@ -58,5 +156,7 @@ class PasswordKeyListLogic extends BaseGetXController {
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
super.onClose();
|
||||
_getPasswordListRefreshUIEvent?.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@ -129,44 +129,6 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
||||
// _refreshController.refreshCompleted();
|
||||
// }
|
||||
|
||||
Widget _searchWidget() {
|
||||
return Container(
|
||||
height: 60.h,
|
||||
margin: EdgeInsets.only(top: 20.w, left: 20.w, right: 10.w),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white, borderRadius: BorderRadius.circular(5)),
|
||||
child: TextField(
|
||||
//输入框一行
|
||||
maxLines: 1,
|
||||
// controller: _controller,
|
||||
autofocus: false,
|
||||
controller: state.searchController,
|
||||
onSubmitted: (value) {
|
||||
logic.mockNetworkDataRequest();
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
//输入里面输入文字内边距设置
|
||||
contentPadding: const EdgeInsets.only(
|
||||
top: 18.0, left: -19.0, right: -15.0, bottom: 2),
|
||||
hintText: TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||
hintStyle: TextStyle(fontSize: 22.sp, height: 3.0),
|
||||
//不需要输入框下划线
|
||||
border: InputBorder.none,
|
||||
//左边图标设置
|
||||
icon: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 20.h, bottom: 20.h, right: 20.w, left: 10.w),
|
||||
child: Image.asset(
|
||||
'images/main/icon_main_search.png',
|
||||
width: 40.w,
|
||||
height: 40.w,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMainUI(itemData) {
|
||||
List<PasswordKeyListItem> getItemData = itemData;
|
||||
return ListView.separated(
|
||||
@ -176,7 +138,7 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
||||
String useDateStr = ''; //使用期限
|
||||
|
||||
//使用期限
|
||||
useDateStr = getUseDateStr(passwordKeyListItem);
|
||||
useDateStr = logic.getUseDateStr(passwordKeyListItem);
|
||||
|
||||
if (index < getItemData.length) {
|
||||
return LeftSlideActions(
|
||||
@ -188,8 +150,7 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
||||
decoration: const BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(1)),
|
||||
),
|
||||
child: _electronicKeyItem(index, 'images/icon_password.png',
|
||||
passwordKeyListItem.keyboardPwdName!, useDateStr, () {
|
||||
child: _electronicKeyItem(index, 'images/icon_password.png', passwordKeyListItem.keyboardPwdName!, useDateStr, () {
|
||||
Navigator.pushNamed(context, Routers.passwordKeyDetailPage,
|
||||
arguments: {"itemData": passwordKeyListItem}).then((val) {
|
||||
if (val != null) {
|
||||
@ -253,93 +214,6 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
||||
});
|
||||
}
|
||||
|
||||
//使用期限
|
||||
String getUseDateStr(PasswordKeyListItem indexEntity) {
|
||||
int? getPwdType = indexEntity.keyboardPwdType;
|
||||
String useDateStr = '';
|
||||
DateTime sendDateStr =
|
||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!);
|
||||
DateTime startDateStr =
|
||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
|
||||
DateTime endDateStr =
|
||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
|
||||
int starHour = startDateStr.hour;
|
||||
int endHour = endDateStr.hour;
|
||||
|
||||
switch (getPwdType) {
|
||||
case 1:
|
||||
//单次 1 只能在开始时间后6小时内使用一次
|
||||
useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} 单次';
|
||||
break;
|
||||
case 2:
|
||||
//永久 2 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效
|
||||
useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} 永久';
|
||||
break;
|
||||
case 3:
|
||||
//限期 3 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效
|
||||
useDateStr =
|
||||
'${startDateStr.toLocal().toString().substring(0, 16)} - ${endDateStr.toLocal().toString().substring(0, 16)} 限时';
|
||||
break;
|
||||
case 4:
|
||||
//删除 4 在锁上使用后会删除之前在锁上使用过的密码
|
||||
useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} 清空码';
|
||||
break;
|
||||
case 5:
|
||||
//周未循环 5 在周未开始和结束时间指定时间段内有效
|
||||
useDateStr =
|
||||
'${sendDateStr.toLocal().toString().substring(0, 16)} 周末$starHour:00-$endHour:00 循环';
|
||||
break;
|
||||
case 6:
|
||||
//每日循环 6 每天开始和结束时间指定时间段内有效
|
||||
useDateStr =
|
||||
'${sendDateStr.toLocal().toString().substring(0, 16)} 周日$starHour:00-$endHour:00 循环';
|
||||
break;
|
||||
case 7:
|
||||
//工作日循环 7 工作日开始和结束时间指定的时间段内有效
|
||||
useDateStr =
|
||||
'${sendDateStr.toLocal().toString().substring(0, 16)} 工作日$starHour:00-$endHour:00 循环';
|
||||
break;
|
||||
case 8:
|
||||
//周一循环 8 每周一开始和结束时间指定时间段内有效
|
||||
useDateStr =
|
||||
'${sendDateStr.toLocal().toString().substring(0, 16)} 周一$starHour:00-$endHour:00 循环';
|
||||
break;
|
||||
case 9:
|
||||
//周二循环 9 每周二开始和结束时间指定时间段内有效
|
||||
useDateStr =
|
||||
'${sendDateStr.toLocal().toString().substring(0, 16)} 周二$starHour:00-$endHour:00 循环';
|
||||
break;
|
||||
case 10:
|
||||
//周三循环 10 每周三开始和结束时间指定时间段内有效
|
||||
useDateStr =
|
||||
'${sendDateStr.toLocal().toString().substring(0, 16)} 周三$starHour:00-$endHour:00 循环';
|
||||
break;
|
||||
case 11:
|
||||
//周四循环 11 每周四开始和结束时间指定时间段内有效
|
||||
useDateStr =
|
||||
'${sendDateStr.toLocal().toString().substring(0, 16)} 周四$starHour:00-$endHour:00 循环';
|
||||
break;
|
||||
case 12:
|
||||
//周五循环 12 每周五开始和结束时间指定时间段内有效
|
||||
useDateStr =
|
||||
'${sendDateStr.toLocal().toString().substring(0, 16)} 周五$starHour:00-$endHour:00 循环';
|
||||
break;
|
||||
case 13:
|
||||
//周六循环 13 每周六开始和结束时间指定时间段内有效
|
||||
useDateStr =
|
||||
'${sendDateStr.toLocal().toString().substring(0, 16)} 周六$starHour:00-$endHour:00 循环';
|
||||
break;
|
||||
case 14:
|
||||
//周天循环 14 每周日开始和结束时间指定时间段内有效
|
||||
useDateStr =
|
||||
'${sendDateStr.toLocal().toString().substring(0, 16)} 周天$starHour:00-$endHour:00 循环';
|
||||
break;
|
||||
|
||||
default:
|
||||
}
|
||||
return useDateStr;
|
||||
}
|
||||
|
||||
Widget _electronicKeyItem(int itemIndex, String lockTypeIcon,
|
||||
String lockTypeTitle, String useDateStr, Function()? action) {
|
||||
PasswordKeyListItem passwordKeyListItem = state.itemDataList[itemIndex];
|
||||
@ -352,17 +226,9 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
||||
color: Colors.white,
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 30.w,
|
||||
),
|
||||
Image.asset(
|
||||
lockTypeIcon,
|
||||
width: 60.w,
|
||||
height: 60.w,
|
||||
),
|
||||
SizedBox(
|
||||
width: 20.w,
|
||||
),
|
||||
SizedBox(width: 30.w),
|
||||
Image.asset(lockTypeIcon, width: 60.w, height: 60.w,),
|
||||
SizedBox(width: 20.w,),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
@ -370,25 +236,20 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
lockTypeTitle,
|
||||
style: TextStyle(
|
||||
fontSize: 24.sp, color: AppColors.blackColor),
|
||||
),
|
||||
Expanded(
|
||||
child: SizedBox(
|
||||
width: 20.w,
|
||||
)),
|
||||
passwordKeyListItem.keyboardPwdStatus == 2
|
||||
? Text(
|
||||
'已失效',
|
||||
style:
|
||||
TextStyle(color: Colors.red, fontSize: 20.sp),
|
||||
)
|
||||
: Container(),
|
||||
SizedBox(
|
||||
width: 20.w,
|
||||
)
|
||||
child: Text(
|
||||
lockTypeTitle,
|
||||
style: TextStyle(
|
||||
fontSize: 24.sp, color: AppColors.blackColor),
|
||||
),
|
||||
),
|
||||
// Expanded(
|
||||
// child: SizedBox(
|
||||
// width: 20.w,
|
||||
// )),
|
||||
SizedBox(width: 10.w),
|
||||
passwordKeyListItem.keyboardPwdStatus == 2 ? Text('已失效', style: TextStyle(color: Colors.red, fontSize: 20.sp),) : Container(),
|
||||
SizedBox(width: 15.w)
|
||||
],
|
||||
),
|
||||
SizedBox(height: 5.h),
|
||||
@ -420,7 +281,7 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
||||
context: widgetContext,
|
||||
builder: (context) {
|
||||
return CupertinoAlertDialog(
|
||||
title: const Text('该锁的电子钥匙都将被删除'),
|
||||
title: const Text('该锁的密码都将被删除'),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
||||
|
||||
@ -21,9 +21,7 @@ class PasswordKeyManageTabbarPage extends StatefulWidget {
|
||||
_PasswordKeyManageTabbarPageState();
|
||||
}
|
||||
|
||||
class _PasswordKeyManageTabbarPageState
|
||||
extends State<PasswordKeyManageTabbarPage>
|
||||
with SingleTickerProviderStateMixin {
|
||||
class _PasswordKeyManageTabbarPageState extends State<PasswordKeyManageTabbarPage> with SingleTickerProviderStateMixin {
|
||||
late TabController _tabController;
|
||||
|
||||
final List<ItemView> _itemTabs = <ItemView>[
|
||||
@ -43,16 +41,23 @@ class _PasswordKeyManageTabbarPageState
|
||||
vsync: this,
|
||||
length: _itemTabs.length,
|
||||
initialIndex: widget.initialIndex);
|
||||
_tabController.addListener(handleTabIndex);
|
||||
|
||||
_tabController.addListener(() {
|
||||
// print("_tabController.animation!.value:${_tabController.animation!.value} _tabController.index:${_tabController.index}");
|
||||
if (_tabController.animation!.value==_tabController.index){
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
}
|
||||
});
|
||||
// _tabController.addListener(handleTabIndex);
|
||||
}
|
||||
|
||||
int handleTabIndex() {
|
||||
// 获取当前选定的标签索引
|
||||
int currentIndex = _tabController.index;
|
||||
// 根据索引可以得知用户点击了哪个 item
|
||||
eventBus.fire(GetPasswordTypeUpdateIndex(currentIndex));
|
||||
return currentIndex;
|
||||
}
|
||||
// int handleTabIndex() {
|
||||
// // 获取当前选定的标签索引
|
||||
// int currentIndex = _tabController.index;
|
||||
// // 根据索引可以得知用户点击了哪个 item
|
||||
// eventBus.fire(GetPasswordTypeUpdateIndex(currentIndex));
|
||||
// return currentIndex;
|
||||
// }
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -68,6 +73,9 @@ class _PasswordKeyManageTabbarPageState
|
||||
TabBar _tabBar() {
|
||||
return TabBar(
|
||||
controller: _tabController,
|
||||
onTap: (index){
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
},
|
||||
tabs: _itemTabs.map((ItemView item) => _tab(item)).toList(),
|
||||
isScrollable: true,
|
||||
indicatorColor: Colors.red,
|
||||
@ -108,9 +116,8 @@ class _PasswordKeyManageTabbarPageState
|
||||
return Expanded(
|
||||
child: TabBarView(
|
||||
controller: _tabController,
|
||||
children: _itemTabs
|
||||
.map((ItemView item) => PasswordKeyPerpetualPage(
|
||||
type: _tabController.index.toString(),
|
||||
children: _itemTabs.map((ItemView item) => PasswordKeyPerpetualPage(
|
||||
type: item.type,
|
||||
getKeyInfo: widget.keyInfo,
|
||||
))
|
||||
.toList(),
|
||||
|
||||
@ -19,13 +19,13 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
||||
final PasswordKeyPerpetualState state = PasswordKeyPerpetualState();
|
||||
|
||||
/// 收到点击密码类型更新
|
||||
StreamSubscription? getPasswordTypeUpdateIndexEvent;
|
||||
void getPasswordTypeUpdateIndexAction() {
|
||||
getPasswordTypeUpdateIndexEvent =
|
||||
eventBus.on<GetPasswordTypeUpdateIndex>().listen((event) {
|
||||
state.widgetType.value = event.passwordType;
|
||||
});
|
||||
}
|
||||
// StreamSubscription? getPasswordTypeUpdateIndexEvent;
|
||||
// void getPasswordTypeUpdateIndexAction() {
|
||||
// getPasswordTypeUpdateIndexEvent =
|
||||
// eventBus.on<GetPasswordTypeUpdateIndex>().listen((event) {
|
||||
// state.widgetType.value = event.passwordType;
|
||||
// });
|
||||
// }
|
||||
|
||||
/**
|
||||
单次 1 只能在开始时间后6小时内使用一次
|
||||
@ -112,9 +112,13 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print('获取密码成功');
|
||||
state.isSendSuccess.value = true;
|
||||
state.sendSucceedType.value = state.widgetType.value;
|
||||
state.nameController.text = "";
|
||||
state.pwdController.text = "";
|
||||
if (entity.data != null) {
|
||||
state.getPwdStr.value = entity.data!.keyboardPwd!;
|
||||
}
|
||||
eventBus.fire(GetPasswordListRefreshUI());
|
||||
} else {
|
||||
showToast('${entity.errorMsg}');
|
||||
}
|
||||
@ -145,13 +149,17 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
||||
getKeyType,
|
||||
getEffectiveDateTime,
|
||||
getFailureDateTime,
|
||||
'0');
|
||||
'1');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print('获取密码成功');
|
||||
state.isSendSuccess.value = true;
|
||||
state.sendSucceedType.value = state.widgetType.value;
|
||||
state.nameController.text = "";
|
||||
state.pwdController.text = "";
|
||||
if (entity.data != null) {
|
||||
state.getPwdStr.value = entity.data!.keyboardPwd!;
|
||||
}
|
||||
eventBus.fire(GetPasswordListRefreshUI());
|
||||
} else {
|
||||
showToast('${entity.errorMsg}');
|
||||
}
|
||||
@ -188,13 +196,11 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||
|
||||
print('得到的开始时间时间戳$getStartDate');
|
||||
|
||||
IoSenderManage.senderCustomPasswordsCommand(
|
||||
keyID: "1",
|
||||
userID: await Storage.getUid(),
|
||||
pwdNo: 1,
|
||||
pwd: "123456",
|
||||
pwd:state.pwdController.text,
|
||||
useCountLimit: 0xff,
|
||||
startTime: 0x11223344,
|
||||
endTime: 0x11223344,
|
||||
@ -263,7 +269,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
||||
super.onReady();
|
||||
|
||||
_initReplySubscription();
|
||||
getPasswordTypeUpdateIndexAction();
|
||||
// getPasswordTypeUpdateIndexAction();
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@ -42,27 +42,32 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
||||
super.initState();
|
||||
|
||||
initData();
|
||||
// state.isSendSuccess.value = false;
|
||||
}
|
||||
|
||||
void initData() {
|
||||
if (!state.isInitialized.value) {
|
||||
state.isInitialized.value = true;
|
||||
state.keyInfo.value = widget.getKeyInfo;
|
||||
}
|
||||
// if (!state.isInitialized.value) {
|
||||
// state.isInitialized.value = true;
|
||||
// state.keyInfo.value = widget.getKeyInfo;
|
||||
// }
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
state.keyInfo.value = widget.getKeyInfo;
|
||||
state.widgetType.value = int.parse(widget.type);
|
||||
print("state.widgetType.value:${state.widgetType.value}");
|
||||
|
||||
return SingleChildScrollView(
|
||||
child: Obx(() => indexChangeWidget()),
|
||||
);
|
||||
}
|
||||
|
||||
Widget indexChangeWidget() {
|
||||
if (state.isSendSuccess.value == true) {
|
||||
if (state.isSendSuccess.value == true && state.sendSucceedType.value.toString() == widget.type) {
|
||||
return sendElectronicKeySucceed();
|
||||
} else {
|
||||
switch (state.widgetType.value) {
|
||||
switch (int.parse(widget.type)) {
|
||||
case 0:
|
||||
{
|
||||
// 永久
|
||||
@ -132,7 +137,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||
state.nameController),
|
||||
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip5!.tr)
|
||||
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip2!.tr)
|
||||
],
|
||||
);
|
||||
}
|
||||
@ -185,24 +190,11 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
||||
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.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]); //默认为当前时间
|
||||
} 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.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"; //默认为当前时间
|
||||
}
|
||||
});
|
||||
}),
|
||||
@ -263,7 +255,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
||||
return Column(
|
||||
children: [
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.recursiveDevice!.tr,
|
||||
leftTitel: "有效日",
|
||||
rightTitle: state.loopModeStr.value,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
@ -393,7 +385,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
||||
height: 20.h,
|
||||
),
|
||||
SubmitBtn(
|
||||
btnName: TranslationLoader.lanKeys!.getPassword!.tr,
|
||||
btnName: widget.type == "3" ? "设置密码":TranslationLoader.lanKeys!.getPassword!.tr,
|
||||
onClick: () async {
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if (isDemoMode == false) {
|
||||
@ -512,7 +504,9 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
||||
btnName: '完成',
|
||||
onClick: () {
|
||||
state.isSendSuccess.value = false;
|
||||
Navigator.pop(context, true);
|
||||
state.nameController.text = "";
|
||||
state.pwdController.text = "";
|
||||
// Navigator.pop(context, true);
|
||||
}),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
@ -547,8 +541,10 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
||||
maxLines: 1,
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
FilteringTextInputFormatter.deny('\n'),
|
||||
LengthLimitingTextInputFormatter(18),
|
||||
LengthLimitingTextInputFormatter(editController == state.nameController ? 18 : 9),
|
||||
],
|
||||
keyboardType: editController == state.nameController ? TextInputType.text: TextInputType.number,
|
||||
style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||
controller: editController,
|
||||
autofocus: false,
|
||||
textAlign: TextAlign.end,
|
||||
|
||||
@ -7,7 +7,7 @@ class PasswordKeyPerpetualState {
|
||||
final TextEditingController nameController = TextEditingController();
|
||||
final TextEditingController pwdController = TextEditingController();
|
||||
|
||||
final isInitialized = false.obs;
|
||||
// final isInitialized = false.obs;
|
||||
final isSendSuccess = false.obs; //是否发送成功
|
||||
final isPermanent = true.obs; //是否永久
|
||||
var getPwdStr = ''.obs;
|
||||
@ -44,5 +44,6 @@ class PasswordKeyPerpetualState {
|
||||
var loopModeStr = '周末'.obs; //循环模式
|
||||
|
||||
final widgetType = 0.obs;
|
||||
final sendSucceedType = 0.obs;
|
||||
final keyInfo = LockListInfoItemEntity().obs;
|
||||
}
|
||||
|
||||
@ -283,6 +283,7 @@ class _AddRemoteControlPageState extends State<AddRemoteControlPage> {
|
||||
FilteringTextInputFormatter.deny('\n'),
|
||||
LengthLimitingTextInputFormatter(18),
|
||||
],
|
||||
style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||
controller: state.nameController,
|
||||
autofocus: false,
|
||||
textAlign: TextAlign.end,
|
||||
|
||||
@ -299,18 +299,24 @@ class LockFeature {
|
||||
class LockSetting {
|
||||
int? attendance;
|
||||
int? appUnlockOnline;
|
||||
|
||||
LockSetting({this.attendance, this.appUnlockOnline});
|
||||
int? remoteUnlock;
|
||||
LockSetting({
|
||||
this.attendance,
|
||||
this.appUnlockOnline,
|
||||
this.remoteUnlock,
|
||||
});
|
||||
|
||||
LockSetting.fromJson(Map<String, dynamic> json) {
|
||||
attendance = json['attendance'];
|
||||
appUnlockOnline = json['appUnlockOnline'];
|
||||
remoteUnlock = json['remoteUnlock'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['attendance'] = attendance;
|
||||
data['appUnlockOnline'] = appUnlockOnline;
|
||||
data['remoteUnlock'] = remoteUnlock;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,11 +163,26 @@ class _LockListPageState extends State<LockListPage> {
|
||||
SizedBox(width: 30.w),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 5.h,
|
||||
),
|
||||
SizedBox(height: 5.h),
|
||||
Visibility(
|
||||
visible: keyInfo.remoteEnable == 1 ? true : false,
|
||||
visible: keyInfo.passageMode == 1 ? true : false,
|
||||
child:Row(
|
||||
children: [
|
||||
SizedBox(width: 30.w),
|
||||
Container(
|
||||
padding: EdgeInsets.only(right: 5.w, left: 5.w),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5.w),
|
||||
color: AppColors.openPassageModeColor,
|
||||
),
|
||||
child: Text("常开模式开启", style: TextStyle(fontSize: 18.sp, color: AppColors.appBarIconColor)),
|
||||
),
|
||||
|
||||
],
|
||||
)),
|
||||
SizedBox(height: 5.h),
|
||||
Visibility(
|
||||
visible: keyInfo.lockSetting!.remoteUnlock == 1 ? true : false,
|
||||
child:Row(
|
||||
children: [
|
||||
SizedBox(width: 30.w),
|
||||
|
||||
@ -37,7 +37,7 @@ class _AbountPageState extends State<AbountPage> {
|
||||
),
|
||||
SizedBox(height: 20.h),
|
||||
Text(
|
||||
"星锁 1.0.0.07(preRelease-20240118-1)",
|
||||
"星锁 1.0.0.08(preRelease-20240123)",
|
||||
style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor),
|
||||
),
|
||||
SizedBox(
|
||||
|
||||
@ -71,7 +71,7 @@ abstract class Api {
|
||||
final String getLockVersionInfoUrl = '/room/update'; // 获取锁当前版本信息
|
||||
final String openCheckingInURL = '/attendanceCompany/isExistenceCompany'; // 开启考勤获取是否有公司
|
||||
final String setCheckInCreateCompanyURL = '/attendanceCompany/add'; // 设置考勤时创建公司
|
||||
final String deleteCompanyURL = '/vacation/delete'; // 删除公司
|
||||
final String deleteCompanyURL = '/attendanceCompany/delete'; // 删除公司
|
||||
|
||||
final String getAttendanceRecordListByDateURL =
|
||||
'/attendanceRecord/listByDate'; // 获取考勤列表-早到榜日榜
|
||||
|
||||
@ -4,6 +4,7 @@ import 'dart:async';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/appRouters.dart';
|
||||
import 'package:star_lock/blue/blue_manage.dart';
|
||||
|
||||
import '../common/XSConstantMacro/XSConstantMacro.dart';
|
||||
import 'manager/client_manager.dart';
|
||||
@ -83,13 +84,14 @@ class BaseGetXController extends GetxController{
|
||||
}
|
||||
|
||||
void showBlueConnetctToast() {
|
||||
showToast("连接设备失败,请确保在设备附近,设备未被连接,设备已打开");
|
||||
bool isContains = BlueManage().connectDeviceName!.contains("T9A");
|
||||
showToast("连接设备失败,请确保在设备附近,设备未被连接,设备已打开${isContains == true ? "。如果是全自动锁,请使屏幕变亮" : ""}");
|
||||
}
|
||||
|
||||
void showToast(String status,{Function? something}) {
|
||||
EasyLoading.showToast(status,duration: 1000.milliseconds);
|
||||
EasyLoading.showToast(status,duration: 2000.milliseconds);
|
||||
if(something != null) {
|
||||
delay(duration: 1100.milliseconds,something: something);
|
||||
delay(duration: 2100.milliseconds,something: something);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -79,3 +79,8 @@ class GetPasswordTypeUpdateIndex {
|
||||
int passwordType;
|
||||
GetPasswordTypeUpdateIndex(this.passwordType);
|
||||
}
|
||||
|
||||
/// 刷新密码列表
|
||||
class GetPasswordListRefreshUI {
|
||||
GetPasswordListRefreshUI();
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../app_settings/app_colors.dart';
|
||||
import '../translations/trans_lib.dart';
|
||||
|
||||
class KeySearchWidget extends StatelessWidget {
|
||||
@ -50,6 +51,7 @@ class KeySearchWidget extends StatelessWidget {
|
||||
FilteringTextInputFormatter.deny('\n'),
|
||||
LengthLimitingTextInputFormatter(18),
|
||||
],
|
||||
style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||
controller: editingController,
|
||||
autofocus: false,
|
||||
textAlign: TextAlign.start,
|
||||
|
||||
@ -17,7 +17,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
# In Windows, build-name is used as the major, minor, and patch parts
|
||||
# of the product and file versions while build-number is used as the build suffix.
|
||||
version: 1.0.0+8
|
||||
version: 1.0.0+9
|
||||
|
||||
environment:
|
||||
sdk: '>=2.12.0 <3.0.0'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user