This commit is contained in:
魏少阳 2024-04-23 15:19:24 +08:00
commit c505fcd2f3
15 changed files with 211 additions and 268 deletions

View File

@ -627,6 +627,7 @@
"请将您的手指按下": "Please press your finger",
"根据提示,抬起手指后再进行下一次指纹采集": "According to the prompt, lift your finger and then collect the fingerprint again",
"添加成功": "Add success",
"更新成功": "Update success",
"搜索": "Search",
"重置后,该锁的卡都将被删除哦,确认要重置吗?": "After resetting, the card of the lock will be deleted, do you want to reset?",
"已失效": "Invalid",

View File

@ -626,6 +626,7 @@
"请将您的手指按下": "请将您的手指按下",
"根据提示,抬起手指后再进行下一次指纹采集": "根据提示,抬起手指后再进行下一次指纹采集",
"添加成功": "添加成功",
"更新成功": "更新成功",
"搜索": "搜索",
"重置后,该锁的卡都将被删除哦,确认要重置吗?": "重置后,该锁的卡都将被删除哦,确认要重置吗?",
"已失效": "已失效",

View File

@ -628,6 +628,7 @@
"请将您的手指按下": "请将您的手指按下",
"根据提示,抬起手指后再进行下一次指纹采集": "根据提示,抬起手指后再进行下一次指纹采集",
"添加成功": "添加成功",
"更新成功": "更新成功",
"搜索": "搜索",
"重置后,该锁的卡都将被删除哦,确认要重置吗?": "重置后,该锁的卡都将被删除哦,确认要重置吗?",
"已失效": "已失效",

View File

@ -22,7 +22,6 @@ import 'package:star_lock/main/lockDetail/lockSet/motorPower/motorPower_page.dar
import 'package:star_lock/main/lockDetail/lockSet/openDoorDirection/openDoorDirection_page.dart';
import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_main_page.dart';
import 'package:star_lock/main/lockDetail/messageWarn/addFamily/addFamily_page.dart';
import 'package:star_lock/main/lockDetail/messageWarn/familyDetails/familyDetails_page.dart';
import 'package:star_lock/main/lockDetail/messageWarn/lockUser/lockUser_page.dart';
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/coerceOpenDoor/coerceFingerprint/coerceFingerprint_page.dart';
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/coerceOpenDoor/coerceFingerprintList/coerceFingerprintList_page.dart';
@ -397,7 +396,6 @@ abstract class Routers {
static const nDaysUnopenedPage = '/nDaysUnopenedPage'; //N天未开门
static const notificationModePage = '/notificationModePage'; //
static const openDoorNotifyPage = '/openDoorNotifyPage'; //
static const familyDetailsPage = '/familyDetailsPage'; //
static const addFamilyPage = '/addFamilyPage'; //
static const lockUserPage = '/lockUserPage'; //
static const catEyeSetPage = '/catEyeSetPage'; //
@ -974,8 +972,6 @@ abstract class AppRouters {
GetPage(
name: Routers.openDoorNotifyPage,
page: () => const OpenDoorNotifyPage()),
GetPage(
name: Routers.familyDetailsPage, page: () => const FamilyDetailsPage()),
GetPage(name: Routers.addFamilyPage, page: () => const AddFamilyPage()),
GetPage(name: Routers.lockUserPage, page: () => const LockUserPage()),
GetPage(name: Routers.catEyeSetPage, page: () => const CatEyeSetPage()),

View File

@ -29,6 +29,24 @@ class AddFamilyLogic extends BaseGetXController {
}
}
//
void updateLockNoticeSetting() async {
var entity = 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,
'noticeWay': state.familyData.value.settingValue!.noticeWayList,
},
);
if (entity.errorCode!.codeIsSuccessful) {
showToast('更新成功'.tr);
state.lockUserKeys.value.currentKeyName = state.changeNameController.text;
Get.back(result: true);
}
}
//
void deleteLockNoticeSetting() async {
var entity = await ApiRepository.to.deleteLockNoticeSettingAccount(

View File

@ -1,10 +1,13 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/appRouters.dart';
import 'package:star_lock/main/lockDetail/messageWarn/addFamily/addFamily_logic.dart';
import 'package:star_lock/tools/commonItem.dart';
import 'package:star_lock/tools/showTFView.dart';
import 'package:star_lock/tools/submitBtn.dart';
import 'package:star_lock/translations/trans_lib.dart';
import '../../../../../app_settings/app_colors.dart';
import '../../../../../tools/titleAppBar.dart';
@ -51,50 +54,56 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
})),
Obx(() => CommonItem(
leftTitel: '家人'.tr,
rightTitle: state.isDetail.value
? state.familyData.value.settingValue?.remark
: state.lockUserKeys.value.currentKeyName,
rightTitle: state.lockUserKeys.value.currentKeyName,
isHaveLine: true,
isHaveRightWidget:
state.lockUserKeys.value.currentKeyName == null
? true
: false,
isHaveRightWidget: state.isDetail.value ? false : true,
isHaveDirection: false,
rightWidget: getFamilyWidget('请输入'.tr),
action: () {
if (state.isDetail.value == true) {
showCupertinoAlertDialog();
}
},
)),
SizedBox(
height: 20.h,
),
Container(
color: Colors.white,
margin: EdgeInsets.only(bottom: 10.h),
child: Column(
children: [
CommonItem(
leftTitel: '提醒方式'.tr,
rightTitle: "",
isHaveLine: false,
isHaveRightWidget: false,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.notificationModePage)?.then((val) {
if (val != null) {
state.emailListStr.value = logic.getEmailListStr(val);
state.phontListStr.value = logic.getPhoneListStr(val);
print(
'emailListStr:${state.emailListStr.value},phontListStr:${state.phontListStr.value}');
}
});
},
),
_buildNotifyContain('APP推送'.tr, '管理员'.tr),
Obx(() => state.emailListStr.value.isNotEmpty
? _buildNotifyContain('邮件提醒'.tr, state.emailListStr.value)
: Container()),
Obx(() => state.phontListStr.value.isNotEmpty
? _buildNotifyContain('短信提醒'.tr, state.phontListStr.value)
: Container()),
],
GestureDetector(
onTap: () {
Get.toNamed(Routers.notificationModePage,
arguments: {'familyData': state.familyData.value})
?.then((val) {
if (val != null) {
state.emailListStr.value = logic.getEmailListStr(val);
state.phontListStr.value = logic.getPhoneListStr(val);
print(
'emailListStr:${state.emailListStr.value},phontListStr:${state.phontListStr.value}');
}
});
},
child: Container(
color: Colors.white,
margin: EdgeInsets.only(bottom: 10.h),
child: Column(
children: [
CommonItem(
leftTitel: '提醒方式'.tr,
rightTitle: "",
isHaveLine: false,
isHaveRightWidget: false,
isHaveDirection: true,
),
_buildNotifyContain('APP推送'.tr, '管理员'.tr),
Obx(() => state.emailListStr.value.isNotEmpty
? _buildNotifyContain(
'邮件提醒'.tr, state.emailListStr.value)
: Container()),
Obx(() => state.phontListStr.value.isNotEmpty
? _buildNotifyContain(
'短信提醒'.tr, state.phontListStr.value)
: Container()),
],
),
),
),
Expanded(
@ -152,12 +161,36 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
);
}
//
//
void showCupertinoAlertDialog() {
showDialog(
context: context,
builder: (BuildContext context) {
return ShowTFView(
title:
"${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}",
tipTitle: "请输入".tr,
controller: state.changeNameController,
sureClick: () {
//
if (state.changeNameController.text.isNotEmpty) {
logic.updateLockNoticeSetting();
} else {
logic.showToast('请输入'.tr);
}
},
cancelClick: () {
Navigator.pop(context);
},
);
},
);
}
//
Widget getFamilyWidget(String tfStr) {
TextEditingController emailController = TextEditingController();
if (state.isDetail.value) {
emailController.text = state.familyData.value.settingValue?.remark ?? '';
}
emailController.text = state.lockUserKeys.value.currentKeyName ?? '';
return SizedBox(
height: 50.h,
width: 360.w,
@ -168,17 +201,35 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
controller: emailController,
//
maxLines: 1,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(30),
],
autofocus: false,
textAlign: TextAlign.end,
style: TextStyle(fontSize: 22.sp),
decoration: InputDecoration(
//
contentPadding: const EdgeInsets.only(top: -12.0, bottom: 0.0),
hintText: tfStr,
hintStyle: TextStyle(fontSize: 22.sp),
//线
border: InputBorder.none,
focusedBorder: const OutlineInputBorder(
borderSide:
BorderSide(width: 0, color: Colors.transparent)),
disabledBorder: const OutlineInputBorder(
borderSide:
BorderSide(width: 0, color: Colors.transparent)),
enabledBorder: const OutlineInputBorder(
borderSide:
BorderSide(width: 0, color: Colors.transparent)),
border: const OutlineInputBorder(
borderSide:
BorderSide(width: 0, color: Colors.transparent)),
contentPadding: const EdgeInsets.symmetric(vertical: 0),
),
style: TextStyle(
fontSize: 22.sp, textBaseline: TextBaseline.alphabetic),
onChanged: (value) {
state.lockUserKeys.value.currentKeyName = value;
state.lockUserKeys.refresh();
},
),
),
],

View File

@ -1,8 +1,10 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/messageWarn/lockUser/lockUser_entity.dart';
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/openDoorNotify/openDoorNotify_entity.dart';
class AddFamilyState {
final TextEditingController changeNameController = TextEditingController();
var getLockId = 0.obs;
var lockUserKeys = LockUserListKeys().obs;
var emailReceiverList = [].obs;
@ -27,6 +29,8 @@ class AddFamilyState {
if (map['itemData'] != null) {
familyData.value = map['itemData'];
lockUserKeys.value.currentKeyName =
familyData.value.settingValue!.remark!;
}
}
}

View File

@ -1,6 +0,0 @@
import 'package:star_lock/main/lockDetail/messageWarn/familyDetails/familyDetails_state.dart';
import 'package:star_lock/tools/baseGetXController.dart';
class FamilyDetailsLogic extends BaseGetXController {
final FamilyDetailsState state = FamilyDetailsState();
}

View File

@ -1,167 +0,0 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/appRouters.dart';
import 'package:star_lock/main/lockDetail/messageWarn/familyDetails/familyDetails_logic.dart';
import 'package:star_lock/tools/commonItem.dart';
import 'package:star_lock/tools/showTFView.dart';
import 'package:star_lock/tools/submitBtn.dart';
import 'package:star_lock/translations/trans_lib.dart';
import '../../../../../app_settings/app_colors.dart';
import '../../../../../tools/titleAppBar.dart';
class FamilyDetailsPage extends StatefulWidget {
const FamilyDetailsPage({Key? key}) : super(key: key);
@override
State<FamilyDetailsPage> createState() => _FamilyDetailsPageState();
}
class _FamilyDetailsPageState extends State<FamilyDetailsPage> {
final logic = Get.put(FamilyDetailsLogic());
final state = Get.find<FamilyDetailsLogic>().state;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: '家人详情',
haveBack: true,
backgroundColor: AppColors.mainColor),
body: Container(
padding: EdgeInsets.all(30.w),
child: Column(
children: [
CommonItem(
leftTitel: '开门方式',
rightTitle: '电子钥匙',
isHaveLine: true,
isHaveDirection: true,
action: () {
//
Get.toNamed(Routers.lockUserPage);
}),
Obx(() => CommonItem(
leftTitel: '家人',
rightTitle: state.familyName.value,
isHaveLine: true,
isHaveRightWidget: false,
isHaveDirection: true,
action: () {
state.changeNameController.text = state.familyName.value;
_showEditNameAlert(context);
},
)),
SizedBox(
height: 20.h,
),
Container(
color: Colors.white,
margin: EdgeInsets.only(bottom: 10.h),
child: Column(
children: [
CommonItem(
leftTitel: '提醒方式'.tr,
rightTitle: "",
isHaveLine: false,
isHaveRightWidget: false,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.notificationModePage);
},
),
Container(
padding: EdgeInsets.only(
left: 10.w, right: 10.w, top: 12.h, bottom: 12.h),
margin: EdgeInsets.only(bottom: 20.h, top: 10.h),
decoration: BoxDecoration(
color: AppColors.mainBackgroundColor,
borderRadius: BorderRadius.circular(6.0.w),
),
child: Text(
'APP推送 管理员',
style: TextStyle(color: Colors.black, fontSize: 20.sp),
),
)
],
),
),
Expanded(
child: SizedBox(
height: 40.h,
)),
SubmitBtn(
btnName: '删除',
isDelete: true,
onClick: () {
_showDialog(context);
},
),
SizedBox(
height: 60.h,
)
],
),
),
);
}
//
void _showDialog(widgetContext) {
showCupertinoDialog(
context: widgetContext,
builder: (context) {
return CupertinoAlertDialog(
title: Text(
'是否删除家人',
style: TextStyle(color: Colors.black, fontSize: 24.sp),
),
content: Text('删除家人后,你将不会收到他到家的消息。',
style: TextStyle(
color: AppColors.darkGrayTextColor, fontSize: 22.sp)),
actions: [
CupertinoDialogAction(
child: Text(
'取消',
style: TextStyle(color: AppColors.mainColor),
),
onPressed: () {
Navigator.of(context).pop();
},
),
CupertinoDialogAction(
child: Text('删除', style: TextStyle(color: AppColors.mainColor)),
onPressed: () {
Navigator.of(context).pop();
},
),
],
);
},
);
}
void _showEditNameAlert(BuildContext context) {
showDialog(
context: context,
builder: (BuildContext context) {
return ShowTFView(
title:
"${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}",
tipTitle: "请输入",
controller: state.changeNameController,
sureClick: () {
Navigator.pop(context);
state.familyName.value = state.changeNameController.text;
},
cancelClick: () {
Navigator.pop(context);
},
);
},
);
}
}

View File

@ -1,21 +0,0 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/openDoorNotify/openDoorNotify_entity.dart';
class FamilyDetailsState {
TextEditingController changeNameController = TextEditingController(); //
var familyName = ''.obs;
var getLockId = 0.obs;
var familyData = DataList().obs;
FamilyDetailsState() {
Map map = Get.arguments;
if (map['lockId'] != null) {
getLockId.value = map['lockId'];
}
if (map['itemData'] != null) {
familyData.value = map['itemData'];
}
}
}

View File

@ -210,6 +210,9 @@ class _NotificationModePageState extends State<NotificationModePage> {
MsgNoticeModeData msgData = isEmail
? state.emailReceiverList.value[lineIndex]
: state.phoneReceiverList.value[lineIndex];
msgData.countryCode = state.countryCode.value;
msgData.receiverTF.text =
isEmail ? msgData.receiveEmail : msgData.receivePhone;
return SizedBox(
height: 65.h,
width: 200.w,

View File

@ -1,4 +1,6 @@
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/openDoorNotify/openDoorNotify_entity.dart';
import 'package:star_lock/main/lockDetail/messageWarn/notificationMode/notificationMode_data.dart';
class NotificationModeState {
var emailReceiverList = [].obs;
@ -6,4 +8,34 @@ class NotificationModeState {
var countryName = '中国'.obs;
var countryCode = 86.obs;
var familyData = DataList().obs;
NotificationModeState() {
Map map = Get.arguments;
if (map['familyData'] != null) {
familyData.value = map['familyData'];
if (familyData.value.settingValue != null) {
for (NoticeWay item in familyData.value.settingValue!.noticeWayList!) {
if (item.type == 'mail' && item.accounts != null) {
for (Accounts account in item.accounts!) {
if (account.account != null) {
MsgNoticeModeData msgNoticeModeData = MsgNoticeModeData();
msgNoticeModeData.receiveEmail = account.account!;
emailReceiverList.value.add(msgNoticeModeData);
}
}
} else if (item.type == 'sms' && item.accounts != null) {
for (Accounts account in item.accounts!) {
if (account.account != null && account.countryCode != null) {
MsgNoticeModeData msgNoticeModeData = MsgNoticeModeData();
msgNoticeModeData.receivePhone = account.account!;
msgNoticeModeData.countryCode = account.countryCode!;
phoneReceiverList.value.add(msgNoticeModeData);
}
}
}
}
}
}
}
}

View File

@ -206,6 +206,8 @@ abstract class Api {
'/lockNoticeSettingAccount/list'; //
final String deleteLockNoticeSettingAccountURL =
'/lockNoticeSettingAccount/delete'; //
final String updateLockNoticeSettingAccountURL =
'/lockNoticeSettingAccount/update'; //
final String setWechatPushSwitchURL =
'/user/setMpWechatPushSwitch'; //

View File

@ -1228,18 +1228,17 @@ class ApiProvider extends BaseProvider {
// --
Future<Response> updateFaceValidity(
int faceId,
int lockId,
int startDate,
int endDate,
int startTime,
int endTime,
int faceType,
List weekDay,
String faceName,
String addType,
int isCoerced
) =>
int faceId,
int lockId,
int startDate,
int endDate,
int startTime,
int endTime,
int faceType,
List weekDay,
String faceName,
String addType,
int isCoerced) =>
post(
updateFaceUserInfoURL.toUrl,
jsonEncode({
@ -1250,7 +1249,7 @@ class ApiProvider extends BaseProvider {
'startTime': startTime,
'endTime': endTime,
'faceType': faceType,
"weekDay":weekDay,
"weekDay": weekDay,
'faceName': faceName,
'addType': addType,
"isCoerced": isCoerced,
@ -1914,6 +1913,16 @@ class ApiProvider extends BaseProvider {
jsonEncode(
{'lockNoticeSettingAccountId': lockNoticeSettingAccountId}));
//
Future<Response> updateLockNoticeSettingAccount(
int lockNoticeSettingAccountId, Map settingValue) =>
post(
updateLockNoticeSettingAccountURL.toUrl,
jsonEncode({
'lockNoticeSettingAccountId': lockNoticeSettingAccountId,
'settingValue': settingValue
}));
//
Future<Response> setMpWechatPushSwitch(int mpWechatPushSwitch) => post(
setWechatPushSwitchURL.toUrl,

View File

@ -1388,18 +1388,28 @@ class ApiRepository {
// --
Future<LoginEntity> updateFaceValidity(
{required int faceId,
required int lockId,
required int startDate,
required int endDate,
required int startTime,
required int endTime,
required int faceType,
required List weekDay,
required String faceName,
required String addType,
required int isCoerced}) async {
required int lockId,
required int startDate,
required int endDate,
required int startTime,
required int endTime,
required int faceType,
required List weekDay,
required String faceName,
required String addType,
required int isCoerced}) async {
final res = await apiProvider.updateFaceValidity(
faceId, lockId, startDate, endDate, startTime, endTime, faceType, weekDay, faceName, addType, isCoerced);
faceId,
lockId,
startDate,
endDate,
startTime,
endTime,
faceType,
weekDay,
faceName,
addType,
isCoerced);
return LoginEntity.fromJson(res.body);
}
@ -1922,6 +1932,15 @@ class ApiRepository {
return OpenDoorNotifyEntity.fromJson(res.body);
}
//
Future<OpenDoorNotifyEntity> updateLockNoticeSettingAccount(
{required int lockNoticeSettingAccountId,
required Map settingValue}) async {
final res = await apiProvider.updateLockNoticeSettingAccount(
lockNoticeSettingAccountId, settingValue);
return OpenDoorNotifyEntity.fromJson(res.body);
}
//
Future<VersionUndateEntity> setMpWechatPushSwitch(
{required int mpWechatPushSwitch}) async {