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( await ApiRepository.to.updateLockNoticeSettingAccount(
lockNoticeSettingAccountId: state.familyData.value.id!, lockNoticeSettingAccountId: state.familyData.value.id!,
settingValue: { settingValue: {
'openDoorId': state.familyData.value.settingValue!.openDoorId!, 'openDoorId': state.isDetail.value
'openDoorType': state.familyData.value.settingValue!.openDoorType!, ? state.lockUserKeys.value.currentOpenDoorID
'remark': state.changeNameController.text, : 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, 'noticeWay': state.familyData.value.settingValue!.noticeWayList,
}, },
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
showToast('更新成功'.tr); showToast('更新成功'.tr);
state.lockUserKeys.value.currentKeyName = state.changeNameController.text; if (!state.isDetail.value) {
Get.back(result: true); 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, isHaveDirection: true,
action: () { action: () {
// //
Get.toNamed(Routers.lockUserPage, arguments: <String, int>{ Get.toNamed(Routers.lockUserPage, arguments: {
'getLockId': state.getLockId.value 'getLockId': state.getLockId.value,
'openDoorId': state.openDoorId.value,
})?.then((val) { })?.then((val) {
if (val != null) { if (val != null) {
state.lockUserKeys.value = val; state.lockUserKeys.value = val;
if (state.isDetail.value) {
logic.updateLockNoticeSetting();
}
} }
}); });
})), })),
@ -169,7 +174,7 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
); );
} }
// //
void showCupertinoAlertDialog() { void showCupertinoAlertDialog() {
showDialog( showDialog(
context: context, context: context,
@ -179,6 +184,10 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
'${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}', '${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}',
tipTitle: '请输入'.tr, tipTitle: '请输入'.tr,
controller: state.changeNameController, controller: state.changeNameController,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(50),
],
sureClick: () { sureClick: () {
// //
if (state.changeNameController.text.isNotEmpty) { 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'; import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/openDoorNotify/openDoorNotify_entity.dart';
class AddFamilyState { 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() { AddFamilyState() {
Map map = Get.arguments; final Map map = Get.arguments;
if (map['lockId'] != null) { if (map['lockId'] != null) {
getLockId.value = map['lockId']; getLockId.value = map['lockId'];
} }
@ -31,6 +18,19 @@ class AddFamilyState {
familyData.value = map['itemData']; familyData.value = map['itemData'];
lockUserKeys.value.currentKeyName = lockUserKeys.value.currentKeyName =
familyData.value.settingValue!.remark!; 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/common/XSConstantMacro/XSConstantMacro.dart';
import 'package:star_lock/main/lockDetail/messageWarn/lockUser/lockUser_entity.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/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/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/dateTool.dart'; import 'package:star_lock/tools/dateTool.dart';
@ -73,6 +74,17 @@ class LockUserLogic extends BaseGetXController {
state.lockUserList.addAll(data5.lockUserList!); state.lockUserList.addAll(data5.lockUserList!);
state.lockUserList.refresh(); 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; final LockUserState state = Get.find<LockUserLogic>().state;
@override @override
initState() { void initState() {
super.initState(); super.initState();
logic.getLockKeysList(); logic.getLockKeysList();
@ -86,7 +86,7 @@ class _LockUserPageState extends State<LockUserPage> {
if (selectIndex == i) { if (selectIndex == i) {
item.isCurrentSelect = true; item.isCurrentSelect = true;
} else { } else {
item.isCurrentSelect = true; item.isCurrentSelect = false;
} }
} }
setState(() { setState(() {
@ -144,13 +144,13 @@ class _LockUserPageState extends State<LockUserPage> {
], ],
), ),
), ),
Image.asset( Obx(() => Image.asset(
state.isSelectIndex.value == selectIndex state.isSelectIndex.value == selectIndex
? 'images/icon_round_select.png' ? 'images/icon_round_select.png'
: 'images/icon_round_unSelect.png', : 'images/icon_round_unSelect.png',
width: 30.w, width: 30.w,
height: 30.w, height: 30.w,
), )),
SizedBox(width: 20.h), 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'; import 'package:star_lock/main/lockDetail/messageWarn/lockUser/lockUser_entity.dart';
class LockUserState { class LockUserState {
TextEditingController searchController = TextEditingController(); /// //
var isSelectUser = false.obs;
var isSelectIndex = 0.obs;
var getLockId = 0.obs;
var lockUserList = <LockUserListKeys>[].obs; //
LockUserState() { LockUserState() {
Map map = Get.arguments; final Map map = Get.arguments;
if (map['getLockId'] != null) { if (map['getLockId'] != null) {
getLockId.value = map['getLockId']; 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 @override
void initState() { void initState() {
super.initState(); super.initState();
logic.lockNoticeSettingAccountList(); logic.lockNoticeSettingAccountList();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: AppColors.mainBackgroundColor, backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar( appBar: TitleAppBar(
barTitle: '家人到家'.tr, barTitle: '家人到家'.tr,
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor, backgroundColor: AppColors.mainColor,
), ),
body: Column( body: Column(
children: [ children: [
_topTipsWidget(), _topTipsWidget(),
SizedBox( SizedBox(height: 20.h),
height: 20.h, Expanded(
child: Obx(
() => state.openDoorNotifyList.value.isNotEmpty
? _buildMainUI()
: NoData(),
), ),
Expanded( ),
child: Obx(() => state.openDoorNotifyList.value.isNotEmpty AddBottomWhiteBtn(
? _buildMainUI() btnName: '添加家人'.tr,
: NoData())), onClick: () {
AddBottomWhiteBtn( Get.toNamed(Routers.addFamilyPage, arguments: {
btnName: '添加家人'.tr, 'lockId': state.getLockId.value,
onClick: () { 'isDetail': false,
Get.toNamed(Routers.addFamilyPage, arguments: { })?.then((value) {
'lockId': state.getLockId.value, if (value != null) {
'isDetail': false logic.lockNoticeSettingAccountList();
})?.then((value) { }
if (value != null) { });
logic.lockNoticeSettingAccountList(); },
} ),
}); SizedBox(height: 64.h),
}, ],
), ),
SizedBox( );
height: 64.h,
)
],
));
} }
Widget _topTipsWidget() { Widget _topTipsWidget() {
return Container( return Container(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w), margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
child: Text( child: Text(
'若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择。'.tr, '若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择。'.tr,
style: TextStyle(color: AppColors.darkGrayTextColor, fontSize: 20.sp), style: TextStyle(
)); color: AppColors.darkGrayTextColor,
fontSize: 20.sp,
),
),
);
} }
Widget _buildMainUI() { Widget _buildMainUI() {
@ -99,11 +102,9 @@ class _OpenDoorNotifyPageState extends State<OpenDoorNotifyPage> {
Get.toNamed(Routers.addFamilyPage, arguments: { Get.toNamed(Routers.addFamilyPage, arguments: {
'itemData': itemData, 'itemData': itemData,
'lockId': state.getLockId.value, 'lockId': state.getLockId.value,
'isDetail': true 'isDetail': true,
})?.then((value) { })?.then((value) {
if (value != null) { logic.lockNoticeSettingAccountList();
logic.lockNoticeSettingAccountList();
}
}); });
}, },
child: Container( child: Container(
@ -111,33 +112,30 @@ class _OpenDoorNotifyPageState extends State<OpenDoorNotifyPage> {
height: 90.h, height: 90.h,
child: Row( child: Row(
children: [ children: [
SizedBox( SizedBox(width: 30.w),
width: 30.w,
),
Image.asset( Image.asset(
'images/controls_user.png', 'images/controls_user.png',
width: 60.w, width: 60.w,
height: 60.w, height: 60.w,
), ),
SizedBox( SizedBox(width: 20.w),
width: 20.w,
),
Expanded( Expanded(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Row( Row(
children: [ children: [
Text(
itemData.settingValue!.remark ?? '',
style: TextStyle(
fontSize: 24.sp, color: AppColors.blackColor),
),
SizedBox(width: 10.w),
Expanded( Expanded(
child: SizedBox( child: Text(
width: 20.w, itemData.settingValue!.remark ?? '',
)) style: TextStyle(
fontSize: 24.sp,
color: AppColors.blackColor,
),
overflow: TextOverflow.ellipsis,
),
),
], ],
), ),
SizedBox(height: 10.h), SizedBox(height: 10.h),
@ -147,8 +145,9 @@ class _OpenDoorNotifyPageState extends State<OpenDoorNotifyPage> {
Text( Text(
logic.getKeyTypeStr(itemData), logic.getKeyTypeStr(itemData),
style: TextStyle( style: TextStyle(
fontSize: 18.sp, fontSize: 18.sp,
color: AppColors.placeholderTextColor), color: AppColors.placeholderTextColor,
),
), ),
], ],
), ),