1.修改姓名提示更新成功,但未刷新;应限制50位。

2.修改提醒方式点确定没有操作成功的提示,实际没有修改成功

3.修改开锁方式点击进去锁用户的勾应在对应的用户上,现勾都是在第一个。

4.家人详情,更改不成功,应有操作成功的提示,选了新的用户应直接刷新。
This commit is contained in:
“DaisyWu” 2024-07-17 17:29:30 +08:00
parent f07618faa2
commit 38dcf47ec0
7 changed files with 136 additions and 99 deletions

View File

@ -50,16 +50,29 @@ class AddFamilyLogic extends BaseGetXController {
await ApiRepository.to.updateLockNoticeSettingAccount(
lockNoticeSettingAccountId: state.familyData.value.id!,
settingValue: {
'openDoorId': state.familyData.value.settingValue!.openDoorId!,
'openDoorType': state.familyData.value.settingValue!.openDoorType!,
'remark': state.changeNameController.text,
'openDoorId': state.isDetail.value
? state.lockUserKeys.value.currentOpenDoorID
: state.familyData.value.settingValue!.openDoorId!,
'openDoorType': state.isDetail.value
? state.lockUserKeys.value.currentKeyType
: state.familyData.value.settingValue!.openDoorType!,
'remark': state.isDetail.value
? state.lockUserKeys.value.currentKeyName
: state.changeNameController.text,
'noticeWay': state.familyData.value.settingValue!.noticeWayList,
},
);
if (entity.errorCode!.codeIsSuccessful) {
showToast('更新成功'.tr);
state.lockUserKeys.value.currentKeyName = state.changeNameController.text;
Get.back(result: true);
if (!state.isDetail.value) {
state.lockUserKeys.value.currentKeyName =
state.changeNameController.text;
state.lockUserKeys.refresh();
Get.back(result: true);
} else {
state.lockUserKeys.refresh();
}
}
}

View File

@ -48,11 +48,16 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
isHaveDirection: true,
action: () {
//
Get.toNamed(Routers.lockUserPage, arguments: <String, int>{
'getLockId': state.getLockId.value
Get.toNamed(Routers.lockUserPage, arguments: {
'getLockId': state.getLockId.value,
'openDoorId': state.openDoorId.value,
})?.then((val) {
if (val != null) {
state.lockUserKeys.value = val;
if (state.isDetail.value) {
logic.updateLockNoticeSetting();
}
}
});
})),
@ -169,7 +174,7 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
);
}
//
//
void showCupertinoAlertDialog() {
showDialog(
context: context,
@ -179,6 +184,10 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
'${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}',
tipTitle: '请输入'.tr,
controller: state.changeNameController,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(50),
],
sureClick: () {
//
if (state.changeNameController.text.isNotEmpty) {

View File

@ -4,21 +4,8 @@ import 'package:star_lock/main/lockDetail/messageWarn/lockUser/lockUser_entity.d
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/openDoorNotify/openDoorNotify_entity.dart';
class AddFamilyState {
final TextEditingController changeNameController = TextEditingController();
RxInt getLockId = 0.obs;
Rx<LockUserListKeys> lockUserKeys = LockUserListKeys().obs;
RxList emailReceiverList = [].obs;
var phoneReceiverList = [].obs;
var emailListStr = ''.obs;
var phontListStr = ''.obs;
var openDoorId = 0.obs;
var openDoorType = 0.obs;
var familyData = DataList().obs;
var isDetail = false.obs;
AddFamilyState() {
Map map = Get.arguments;
final Map map = Get.arguments;
if (map['lockId'] != null) {
getLockId.value = map['lockId'];
}
@ -31,6 +18,19 @@ class AddFamilyState {
familyData.value = map['itemData'];
lockUserKeys.value.currentKeyName =
familyData.value.settingValue!.remark!;
openDoorId.value = familyData.value.settingValue!.openDoorId!;
}
}
final TextEditingController changeNameController = TextEditingController();
RxInt getLockId = 0.obs;
Rx<LockUserListKeys> lockUserKeys = LockUserListKeys().obs;
RxList emailReceiverList = [].obs;
RxList phoneReceiverList = [].obs;
RxString emailListStr = ''.obs;
RxString phontListStr = ''.obs;
RxInt openDoorId = 0.obs;
RxInt openDoorType = 0.obs;
Rx<DataList> familyData = DataList().obs;
RxBool isDetail = false.obs;
}

View File

@ -2,6 +2,7 @@ import 'package:get/get.dart';
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
import 'package:star_lock/main/lockDetail/messageWarn/lockUser/lockUser_entity.dart';
import 'package:star_lock/main/lockDetail/messageWarn/lockUser/lockUser_state.dart';
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/msgNotification/msgNotification_entity.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/dateTool.dart';
@ -73,6 +74,17 @@ class LockUserLogic extends BaseGetXController {
state.lockUserList.addAll(data5.lockUserList!);
state.lockUserList.refresh();
if (state.selectedOpenDoorId.value != null) {
for (int i = 0; i < state.lockUserList.length; i++) {
if (state.lockUserList[i].currentOpenDoorID ==
state.selectedOpenDoorId.value) {
state.isSelectIndex.value = i;
state.isSelectIndex.refresh();
break;
}
}
}
}
}

View File

@ -21,7 +21,7 @@ class _LockUserPageState extends State<LockUserPage> {
final LockUserState state = Get.find<LockUserLogic>().state;
@override
initState() {
void initState() {
super.initState();
logic.getLockKeysList();
@ -86,7 +86,7 @@ class _LockUserPageState extends State<LockUserPage> {
if (selectIndex == i) {
item.isCurrentSelect = true;
} else {
item.isCurrentSelect = true;
item.isCurrentSelect = false;
}
}
setState(() {
@ -144,13 +144,13 @@ class _LockUserPageState extends State<LockUserPage> {
],
),
),
Image.asset(
state.isSelectIndex.value == selectIndex
? 'images/icon_round_select.png'
: 'images/icon_round_unSelect.png',
width: 30.w,
height: 30.w,
),
Obx(() => Image.asset(
state.isSelectIndex.value == selectIndex
? 'images/icon_round_select.png'
: 'images/icon_round_unSelect.png',
width: 30.w,
height: 30.w,
)),
SizedBox(width: 20.h),
],
),

View File

@ -3,17 +3,21 @@ import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/messageWarn/lockUser/lockUser_entity.dart';
class LockUserState {
TextEditingController searchController = TextEditingController(); ///
var isSelectUser = false.obs;
var isSelectIndex = 0.obs;
var getLockId = 0.obs;
var lockUserList = <LockUserListKeys>[].obs; //
//
LockUserState() {
Map map = Get.arguments;
final Map map = Get.arguments;
if (map['getLockId'] != null) {
getLockId.value = map['getLockId'];
}
selectedOpenDoorId.value = map['openDoorId'];
}
TextEditingController searchController = TextEditingController(); ///
RxBool isSelectUser = false.obs;
RxInt selectedOpenDoorId = 0.obs;
RxInt isSelectIndex = 0.obs;
RxInt getLockId = 0.obs;
RxList<LockUserListKeys> lockUserList = <LockUserListKeys>[].obs;
}

View File

@ -24,57 +24,60 @@ class _OpenDoorNotifyPageState extends State<OpenDoorNotifyPage> {
@override
void initState() {
super.initState();
logic.lockNoticeSettingAccountList();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: '家人到家'.tr,
haveBack: true,
backgroundColor: AppColors.mainColor,
),
body: Column(
children: [
_topTipsWidget(),
SizedBox(
height: 20.h,
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: '家人到家'.tr,
haveBack: true,
backgroundColor: AppColors.mainColor,
),
body: Column(
children: [
_topTipsWidget(),
SizedBox(height: 20.h),
Expanded(
child: Obx(
() => state.openDoorNotifyList.value.isNotEmpty
? _buildMainUI()
: NoData(),
),
Expanded(
child: Obx(() => state.openDoorNotifyList.value.isNotEmpty
? _buildMainUI()
: NoData())),
AddBottomWhiteBtn(
btnName: '添加家人'.tr,
onClick: () {
Get.toNamed(Routers.addFamilyPage, arguments: {
'lockId': state.getLockId.value,
'isDetail': false
})?.then((value) {
if (value != null) {
logic.lockNoticeSettingAccountList();
}
});
},
),
SizedBox(
height: 64.h,
)
],
));
),
AddBottomWhiteBtn(
btnName: '添加家人'.tr,
onClick: () {
Get.toNamed(Routers.addFamilyPage, arguments: {
'lockId': state.getLockId.value,
'isDetail': false,
})?.then((value) {
if (value != null) {
logic.lockNoticeSettingAccountList();
}
});
},
),
SizedBox(height: 64.h),
],
),
);
}
Widget _topTipsWidget() {
return Container(
alignment: Alignment.centerLeft,
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
child: Text(
'若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择。'.tr,
style: TextStyle(color: AppColors.darkGrayTextColor, fontSize: 20.sp),
));
alignment: Alignment.centerLeft,
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
child: Text(
'若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择。'.tr,
style: TextStyle(
color: AppColors.darkGrayTextColor,
fontSize: 20.sp,
),
),
);
}
Widget _buildMainUI() {
@ -99,11 +102,9 @@ class _OpenDoorNotifyPageState extends State<OpenDoorNotifyPage> {
Get.toNamed(Routers.addFamilyPage, arguments: {
'itemData': itemData,
'lockId': state.getLockId.value,
'isDetail': true
'isDetail': true,
})?.then((value) {
if (value != null) {
logic.lockNoticeSettingAccountList();
}
logic.lockNoticeSettingAccountList();
});
},
child: Container(
@ -111,33 +112,30 @@ class _OpenDoorNotifyPageState extends State<OpenDoorNotifyPage> {
height: 90.h,
child: Row(
children: [
SizedBox(
width: 30.w,
),
SizedBox(width: 30.w),
Image.asset(
'images/controls_user.png',
width: 60.w,
height: 60.w,
),
SizedBox(
width: 20.w,
),
SizedBox(width: 20.w),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Text(
itemData.settingValue!.remark ?? '',
style: TextStyle(
fontSize: 24.sp, color: AppColors.blackColor),
),
SizedBox(width: 10.w),
Expanded(
child: SizedBox(
width: 20.w,
))
child: Text(
itemData.settingValue!.remark ?? '',
style: TextStyle(
fontSize: 24.sp,
color: AppColors.blackColor,
),
overflow: TextOverflow.ellipsis,
),
),
],
),
SizedBox(height: 10.h),
@ -147,8 +145,9 @@ class _OpenDoorNotifyPageState extends State<OpenDoorNotifyPage> {
Text(
logic.getKeyTypeStr(itemData),
style: TextStyle(
fontSize: 18.sp,
color: AppColors.placeholderTextColor),
fontSize: 18.sp,
color: AppColors.placeholderTextColor,
),
),
],
),