This commit is contained in:
魏少阳 2024-04-23 09:38:25 +08:00
commit 998bff3ccf
21 changed files with 616 additions and 322 deletions

View File

@ -766,7 +766,8 @@
"亮屏持续时间":"Screen on time",
"逗留警告":"Stay warning",
"异常警告":"Abnormal warning",
"短信提醒":"SMS reminder",
"邮件提醒":"Email reminder",
"关锁":"关锁",
"功能":"功能",
"配件":"配件"

View File

@ -765,6 +765,8 @@
"亮屏持续时间":"亮屏持续时间",
"逗留警告":"逗留警告",
"异常警告":"异常警告",
"短信提醒":"短信提醒",
"邮件提醒":"邮件提醒",
"关锁":"Close Lock",
"功能":"Function",
"配件":"Parts"

View File

@ -768,6 +768,8 @@
"亮屏持续时间":"亮屏持续时间",
"逗留警告":"逗留警告",
"异常警告":"异常警告",
"短信提醒":"短信提醒",
"邮件提醒":"邮件提醒",
"关锁":"关锁",
"功能":"功能",
"配件":"配件"

View File

@ -1,6 +1,91 @@
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/messageWarn/addFamily/addFamily_state.dart';
import 'package:star_lock/main/lockDetail/messageWarn/notificationMode/notificationMode_data.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
class AddFamilyLogic extends BaseGetXController {
final AddFamilyState state = AddFamilyState();
void addLockNoticeSetting() async {
var entity = await ApiRepository.to.addLockNoticeSetting(
lockId: state.getLockId.value,
noticeType: 10,
settingValue: {
'openDoorId': state.lockUserKeys.value.currentOpenDoorID,
'openDoorType': state.lockUserKeys.value.currentKeyType,
'remark': state.lockUserKeys.value.currentKeyName ?? '',
'noticeWay': [
{'type': 'mail', 'accounts': getEmailAndSMSAccountList(true)},
{'type': 'sms', 'accounts': getEmailAndSMSAccountList(false)}
]
},
);
if (entity.errorCode!.codeIsSuccessful) {
showToast('添加成功'.tr);
Get.back(result: true);
}
}
List getEmailAndSMSAccountList(bool isEmail) {
List list = [];
List accountList = [];
isEmail
? accountList = state.emailReceiverList.value
: accountList = state.phoneReceiverList.value;
for (int i = 0; i < accountList.length; i++) {
MsgNoticeModeData item = accountList[i];
Map map = {};
map['countryCode'] = isEmail ? 0 : item.countryCode;
map['account'] = isEmail ? item.receiveEmail : item.receivePhone;
list.add(map);
}
return list;
}
String getEmailListStr(Map val) {
String emailListStr = '';
if (val['emailReceiverList'] != null) {
state.emailReceiverList.value = val['emailReceiverList'];
List emailReceiverList = state.emailReceiverList.value;
for (int i = 0; i < emailReceiverList.length; i++) {
MsgNoticeModeData item = emailReceiverList[i];
emailListStr += item.receiveEmail;
//
if (i < emailReceiverList.length - 1) {
emailListStr += ',';
}
}
}
return emailListStr;
}
String getPhoneListStr(Map val) {
String phoneListStr = '';
if (val['phoneReceiverList'] != null) {
state.phoneReceiverList.value = val['phoneReceiverList'];
List phoneReceiverList = state.phoneReceiverList.value;
for (int i = 0; i < phoneReceiverList.length; i++) {
MsgNoticeModeData item = phoneReceiverList[i];
phoneListStr += item.receivePhone;
//
if (i < phoneReceiverList.length - 1) {
phoneListStr += ',';
}
}
}
return phoneListStr;
}
bool checkBtnDisable() {
if ((state.emailListStr.value.isEmpty ||
state.phontListStr.value.isEmpty) ||
state.lockUserKeys.value.currentKeyTypeStr!.isEmpty ||
state.lockUserKeys.value.currentKeyName!.isEmpty) {
return false;
} else {
return true;
}
}
}

View File

@ -74,22 +74,23 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
isHaveRightWidget: false,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.notificationModePage);
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}');
}
});
},
),
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推送'.tr} ${'管理员'.tr}',
style: TextStyle(color: Colors.black, fontSize: 20.sp),
),
)
_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()),
],
),
),
@ -97,11 +98,13 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
child: SizedBox(
height: 40.h,
)),
SubmitBtn(
btnName: '保存'.tr,
isDisabled: false,
onClick: () {},
),
Obx(() => SubmitBtn(
btnName: '保存'.tr,
isDisabled: logic.checkBtnDisable(),
onClick: () {
logic.addLockNoticeSetting();
},
)),
SizedBox(
height: 60.h,
)
@ -111,6 +114,34 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
);
}
Widget _buildNotifyContain(String notifyTitle, String notifyContent) {
return 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, left: 20.w, right: 20.w),
decoration: BoxDecoration(
color: AppColors.mainBackgroundColor,
borderRadius: BorderRadius.circular(6.0.w),
),
child: Row(
children: [
Text(
notifyTitle,
style: TextStyle(color: Colors.black, fontSize: 20.sp),
),
Expanded(
child: SizedBox(
width: 20.w,
)),
Text(notifyContent,
textAlign: TextAlign.end,
style: TextStyle(
color: AppColors.placeholderTextColor, fontSize: 20.sp)),
],
),
);
}
//
Widget getFamilyWidget(String tfStr) {
TextEditingController emailController = TextEditingController();

View File

@ -4,6 +4,13 @@ import 'package:star_lock/main/lockDetail/messageWarn/lockUser/lockUser_entity.d
class AddFamilyState {
var getLockId = 0.obs;
var lockUserKeys = LockUserListKeys().obs;
var emailReceiverList = [].obs;
var phoneReceiverList = [].obs;
var emailListStr = ''.obs;
var phontListStr = ''.obs;
var openDoorId = 0.obs;
var openDoorType = 0.obs;
AddFamilyState() {
Map map = Get.arguments;

View File

@ -64,7 +64,7 @@ class _FamilyDetailsPageState extends State<FamilyDetailsPage> {
child: Column(
children: [
CommonItem(
leftTitel: '提醒方式',
leftTitel: '提醒方式'.tr,
rightTitle: "",
isHaveLine: false,
isHaveRightWidget: false,

View File

@ -60,7 +60,7 @@ class LockUserData {
}
class LockUserListKeys {
// int? id;
int? id;
String? clientId;
int? lockOwnerId;
int? apiUserId;
@ -116,10 +116,10 @@ class LockUserListKeys {
String? currentKeyName; //
bool? isCurrentSelect; //
int? currentDateType; // 1: 2: 3: 4:
int? currentOpenDoorID; //ID
LockUserListKeys(
{
// this.id,
{this.id,
this.clientId,
this.lockOwnerId,
this.apiUserId,
@ -176,7 +176,9 @@ class LockUserListKeys {
this.currentDateType});
LockUserListKeys.fromJson(Map<String, dynamic> json) {
// id = json['id'];
if (json['id'] != null) {
id = json['id'];
}
clientId = json['clientId'];
lockOwnerId = json['lockOwnerId'];
apiUserId = json['apiUserId'];
@ -243,7 +245,9 @@ class LockUserListKeys {
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
// data['id'] = id;
if (id != null) {
data['id'] = id;
}
data['clientId'] = clientId;
data['lockOwnerId'] = lockOwnerId;
data['apiUserId'] = apiUserId;

View File

@ -24,6 +24,7 @@ class LockUserLogic extends BaseGetXController {
element.currentKeyName = element.keyName;
element.isCurrentSelect = false;
element.currentDateType = element.keyType;
element.currentOpenDoorID = element.id;
});
LockUserData data2 = entity.data![1];
data2.lockUserList?.forEach((element) {
@ -33,6 +34,7 @@ class LockUserLogic extends BaseGetXController {
element.currentKeyName = element.keyboardPwdName;
element.isCurrentSelect = false;
element.currentDateType = element.keyboardPwdType;
element.currentOpenDoorID = element.keyboardPwdId;
});
LockUserData data3 = entity.data![2];
data3.lockUserList?.forEach((element) {

View File

@ -46,7 +46,7 @@ class _CoerceFingerprintPageState extends State<CoerceFingerprintPage> {
child: Column(
children: [
CommonItem(
leftTitel: '提醒方式',
leftTitel: '提醒方式'.tr,
rightTitle: "",
isHaveLine: false,
isHaveRightWidget: false,

View File

@ -83,7 +83,7 @@ class _NDaysUnopenedPageState extends State<NDaysUnopenedPage> {
child: Column(
children: [
CommonItem(
leftTitel: '提醒方式',
leftTitel: '提醒方式'.tr,
rightTitle: "",
isHaveLine: false,
isHaveRightWidget: false,

View File

@ -0,0 +1,178 @@
class OpenDoorNotifyEntity {
int? errorCode;
String? description;
String? errorMsg;
Data? data;
OpenDoorNotifyEntity(
{this.errorCode, this.description, this.errorMsg, this.data});
OpenDoorNotifyEntity.fromJson(Map<String, dynamic> json) {
errorCode = json['errorCode'];
description = json['description'];
errorMsg = json['errorMsg'];
data = json['data'] != null ? Data.fromJson(json['data']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['errorCode'] = errorCode;
data['description'] = description;
data['errorMsg'] = errorMsg;
if (this.data != null) {
data['data'] = this.data!.toJson();
}
return data;
}
}
class Data {
List<DataList>? list;
int? total;
int? pageNo;
int? pageSize;
Data({this.list, this.total, this.pageNo, this.pageSize});
Data.fromJson(Map<String, dynamic> json) {
if (json['list'] != null) {
list = <DataList>[];
json['list'].forEach((v) {
list!.add(DataList.fromJson(v));
});
}
total = json['total'];
pageNo = json['pageNo'];
pageSize = json['pageSize'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
if (list != null) {
data['list'] = list!.map((v) => v.toJson()).toList();
}
data['total'] = total;
data['pageNo'] = pageNo;
data['pageSize'] = pageSize;
return data;
}
}
class DataList {
int? id;
int? lockId;
int? noticeType;
SettingValue? settingValue;
String? createdAt;
String? updatedAt;
DataList(
{this.id,
this.lockId,
this.noticeType,
this.settingValue,
this.createdAt,
this.updatedAt});
DataList.fromJson(Map<String, dynamic> json) {
id = json['id'];
lockId = json['lockId'];
noticeType = json['noticeType'];
settingValue = json['settingValue'] != null
? SettingValue.fromJson(json['settingValue'])
: null;
createdAt = json['created_at'];
updatedAt = json['updated_at'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['lockId'] = lockId;
data['noticeType'] = noticeType;
if (settingValue != null) {
data['settingValue'] = settingValue!.toJson();
}
data['created_at'] = createdAt;
data['updated_at'] = updatedAt;
return data;
}
}
class SettingValue {
int? openDoorId;
int? openDoorType;
String? remark;
List<NoticeWay>? noticeWay;
SettingValue(
{this.openDoorId, this.openDoorType, this.remark, this.noticeWay});
SettingValue.fromJson(Map<String, dynamic> json) {
openDoorId = json['openDoorId'];
openDoorType = json['openDoorType'];
remark = json['remark'];
if (json['noticeWay'] != null) {
noticeWay = <NoticeWay>[];
json['noticeWay'].forEach((v) {
noticeWay!.add(NoticeWay.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['openDoorId'] = openDoorId;
data['openDoorType'] = openDoorType;
data['remark'] = remark;
if (noticeWay != null) {
data['noticeWay'] = noticeWay!.map((v) => v.toJson()).toList();
}
return data;
}
}
class NoticeWay {
String? type;
List<Accounts>? accounts;
NoticeWay({this.type, this.accounts});
NoticeWay.fromJson(Map<String, dynamic> json) {
type = json['type'];
if (json['accounts'] != null) {
accounts = <Accounts>[];
json['accounts'].forEach((v) {
accounts!.add(Accounts.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['type'] = type;
if (accounts != null) {
data['accounts'] = accounts!.map((v) => v.toJson()).toList();
}
return data;
}
}
class Accounts {
int? countryCode;
String? account;
Accounts({this.countryCode, this.account});
Accounts.fromJson(Map<String, dynamic> json) {
countryCode = json['countryCode'];
account = json['account'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['countryCode'] = countryCode;
data['account'] = account;
return data;
}
}

View File

@ -1,6 +1,19 @@
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/openDoorNotify/openDoorNotify_entity.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'openDoorNotify_state.dart';
class OpenDoorNotifyLogic extends BaseGetXController {
final OpenDoorNotifyState state = OpenDoorNotifyState();
void lockNoticeSettingAccountList() async {
OpenDoorNotifyEntity entity =
await ApiRepository.to.lockNoticeSettingAccountList(
lockId: state.getLockId.value,
noticeType: 10,
);
if (entity.errorCode!.codeIsSuccessful) {
state.openDoorNotifyList.value = entity.data!.list!;
}
}
}

View File

@ -22,6 +22,8 @@ class _OpenDoorNotifyPageState extends State<OpenDoorNotifyPage> {
@override
void initState() {
super.initState();
logic.lockNoticeSettingAccountList();
}
@override
@ -39,12 +41,17 @@ class _OpenDoorNotifyPageState extends State<OpenDoorNotifyPage> {
SizedBox(
height: 20.h,
),
Expanded(child: _buildMainUI()),
Expanded(child: Obx(() => _buildMainUI())),
AddBottomWhiteBtn(
btnName: '添加家人'.tr,
onClick: () {
Get.toNamed(Routers.addFamilyPage,
arguments: {'getLockId': state.getLockId.value});
arguments: {'getLockId': state.getLockId.value})
?.then((value) {
if (value != null) {
logic.lockNoticeSettingAccountList();
}
});
},
),
SizedBox(
@ -67,7 +74,7 @@ class _OpenDoorNotifyPageState extends State<OpenDoorNotifyPage> {
Widget _buildMainUI() {
return ListView.separated(
shrinkWrap: true,
itemCount: state.msgNoticeInfo.value.openDoorNoticeList?.length ?? 0,
itemCount: state.openDoorNotifyList.length,
itemBuilder: (c, index) {
return _electronicKeyItem(
'images/controls_user.png', '18682150237', '电子钥匙', () {

View File

@ -7,6 +7,7 @@ class OpenDoorNotifyState {
final pageSize = 20.obs; //
var itemDataList = [].obs;
var getLockId = 0.obs;
var openDoorNotifyList = [].obs;
OpenDoorNotifyState() {
Map map = Get.arguments;

View File

@ -0,0 +1,8 @@
import 'package:flutter/material.dart';
class MsgNoticeModeData {
final TextEditingController receiverTF = TextEditingController();
var receiveEmail = '';
var receivePhone = '';
var countryCode = 86;
}

View File

@ -1,7 +1,10 @@
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/msgNotification/msgNotification/msgNotification_entity.dart';
import 'package:star_lock/main/lockDetail/messageWarn/notificationMode/notificationMode_data.dart';
import 'package:star_lock/main/lockDetail/messageWarn/notificationMode/notificationMode_logic.dart';
import 'package:star_lock/tools/commonItem.dart';
import 'package:star_lock/tools/submitBtn.dart';
@ -31,11 +34,11 @@ class _NotificationModePageState extends State<NotificationModePage> {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: '提醒方式',
barTitle: '提醒方式'.tr,
haveBack: true,
backgroundColor: AppColors.mainColor),
body: SingleChildScrollView(
child: _buildMainView(),
child: Obx(() => _buildMainView()),
));
}
@ -43,297 +46,218 @@ class _NotificationModePageState extends State<NotificationModePage> {
return Column(
children: [
CommonItem(
leftTitel: 'APP推送',
rightTitle: '管理员',
leftTitel: 'APP推送'.tr,
rightTitle: '管理员'.tr,
isHaveLine: true,
isHaveDirection: false,
action: () {}),
SizedBox(
height: 10.h,
),
CommonItem(
leftTitel: '邮件提醒',
rightTitle: '',
isHaveLine: true,
isHaveDirection: false,
isHaveRightWidget: true,
rightWidget: state.emailReceiverList.value.length < 3
? Image.asset(
'images/icon_btn_add.png',
width: 32.w,
height: 32.w,
)
: Container(),
action: () {
if (state.emailReceiverList.value.length < 3) {
setState(() {
state.emailReceiverList.value.add(1);
});
}
}),
Obx(() => SizedBox(
height: state.emailReceiverList.value.length * 62.h,
child: ListView.separated(
itemCount: state.emailReceiverList.value.length,
itemBuilder: (BuildContext context, int index) {
return _buildReceiverItem(index, true);
},
separatorBuilder: (BuildContext context, int index) {
return Divider(
height: 1.h,
color: AppColors.greyBackgroundColor,
);
},
),
)),
_buildNotifyWayItem('邮件提醒'.tr, isEmail: true),
_buildListView(isEmail: true),
SizedBox(
height: 10.h,
),
CommonItem(
leftTitel: '短信提醒',
rightTitle: '',
isHaveLine: true,
isHaveDirection: false,
isHaveRightWidget: true,
rightWidget: state.phoneReceiverList.value.length < 3
? Image.asset(
'images/icon_btn_add.png',
width: 32.w,
height: 32.w,
)
: Container(),
action: () {
if (state.phoneReceiverList.value.length < 3) {
setState(() {
state.phoneReceiverList.value.add(1);
});
}
}),
SizedBox(
height: state.phoneReceiverList.value.length * 62.h,
child: ListView.separated(
itemCount: state.phoneReceiverList.value.length,
itemBuilder: (BuildContext context, int index) {
return _buildReceiverItem(index, false);
},
separatorBuilder: (BuildContext context, int index) {
return Divider(
height: 1.h,
color: AppColors.greyBackgroundColor,
);
},
),
),
_buildNotifyWayItem('短信提醒'.tr, isEmail: false),
_buildListView(isEmail: false),
SizedBox(
height: 60.h,
),
SubmitBtn(
btnName: '确定'.tr,
onClick: () {},
onClick: () {
Get.back(result: {
'emailReceiverList': state.emailReceiverList.value,
'phoneReceiverList': state.phoneReceiverList.value
});
},
)
],
);
}
Widget _buildReceiverItem(int index, bool isEmail) {
Widget _buildNotifyWayItem(String title, {required bool isEmail}) {
return CommonItem(
leftTitel: title,
rightTitle: '',
isHaveLine: true,
isHaveDirection: false,
isHaveRightWidget: true,
rightWidget: (!isEmail
? state.phoneReceiverList.value.length < 3
: state.emailReceiverList.value.length < 3)
? Image.asset(
'images/icon_btn_add.png',
width: 32.w,
height: 32.w,
)
: Container(),
action: () {
if (isEmail) {
if (state.emailReceiverList.value.length < 3) {
state.emailReceiverList.value.add(MsgNoticeModeData());
}
state.emailReceiverList.refresh();
} else {
if (state.phoneReceiverList.value.length < 3) {
state.phoneReceiverList.value.add(MsgNoticeModeData());
}
state.phoneReceiverList.refresh();
}
});
}
Widget _buildListView({required bool isEmail}) {
return SizedBox(
height: isEmail
? state.emailReceiverList.value.length * 62.h
: state.phoneReceiverList.value.length * 62.h,
child: ListView.separated(
itemCount: isEmail
? state.emailReceiverList.value.length
: state.phoneReceiverList.value.length,
itemBuilder: (BuildContext context, int index) {
return _buildReceiverItemWidget(index, isEmail: isEmail);
},
separatorBuilder: (BuildContext context, int index) {
return Divider(
height: 1.h,
color: AppColors.greyBackgroundColor,
);
},
),
);
}
Widget _buildReceiverItemWidget(int index, {required bool isEmail}) {
return Container(
padding: EdgeInsets.only(left: 20.w, right: 20.w),
height: 62.h,
color: Colors.white,
child: Row(
children: [
GestureDetector(
child: SizedBox(
// width: 40.w,
child: Row(
children: [
SizedBox(
width: 20.w,
),
Image.asset(
'images/icon_massSend_delete.png',
width: 26.w,
height: 26.w,
)
],
),
),
onTap: () {
setState(() {
if (isEmail) {
state.emailReceiverList.value.removeAt(index);
} else {
state.phoneReceiverList.value.removeAt(index);
}
});
},
),
Expanded(
child: Column(
children: [
massSendReceiverCellWidget(
leftTitel: TranslationLoader.lanKeys!.receiver!.tr,
rightTitle: state.inputEmailStr.value,
isHaveLine: true,
isHaveRightWidget: true,
rightWidget: isEmail
? getEmailTFWidget('请输入Email'.tr, 1)
: getPhoneWidget('请输入手机号'.tr, 1)),
Divider(
color: AppColors.greyLineColor,
indent: 20.w,
endIndent: 20.w,
height: 1,
),
],
))
],
),
);
}
// TextEditingController _receiverController(String getStr) {
// TextEditingController controller = TextEditingController(text: getStr);
// controller.addListener(() {
// state.inputEmailStr.value = controller.text;
// print(controller.text);
// });
// return controller;
// }
//
Widget getEmailTFWidget(String tfStr, int lineIndex) {
TextEditingController emailController = TextEditingController();
return SizedBox(
height: 50.h,
width: 360.w,
child: Row(
children: [
Expanded(
child: TextField(
controller: emailController,
//
maxLines: 1,
autofocus: false,
textAlign: TextAlign.end,
decoration: InputDecoration(
hintText: tfStr,
hintStyle: TextStyle(fontSize: 22.sp),
//线
border: InputBorder.none,
),
),
),
],
),
);
}
//
Widget getPhoneWidget(String tfStr, int lineIndex) {
TextEditingController phoneController = TextEditingController();
return SizedBox(
height: 50.h,
width: 360.w,
child: Row(
children: [
Expanded(
child: GestureDetector(
child: Container(
width: 90.w,
color: Colors.white,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Obx(() => Text(
'+${state.countryCode}',
style: TextStyle(
color: AppColors.darkGrayTextColor,
fontSize: 20.sp),
)),
Image.asset(
'images/icon_grayPullDown.png',
width: 20.w,
height: 20.w,
),
],
),
),
onTap: () async {
var result = await Get.toNamed(Routers.selectCountryRegionPage);
if (result != null) {
result as Map<String, dynamic>;
state.countryCode.value = result['code'];
state.countryName.value = result['countryName'];
onTap: (() {
if (isEmail) {
state.emailReceiverList.value.removeAt(index);
state.emailReceiverList.refresh();
} else {
state.phoneReceiverList.value.removeAt(index);
state.phoneReceiverList.refresh();
}
},
)),
SizedBox(
width: 5.w,
),
SizedBox(
width: 180.w,
child: TextField(
controller: phoneController,
//
maxLines: 1,
autofocus: false,
textAlign: TextAlign.end,
decoration: InputDecoration(
hintText: tfStr,
hintStyle: TextStyle(fontSize: 22.sp),
//线
border: InputBorder.none,
}),
child: Container(
color: Colors.white,
child: Image.asset(
'images/icon_massSend_delete.png',
width: 26.w,
height: 26.w,
),
),
),
SizedBox(
width: 20.w,
),
Text(
TranslationLoader.lanKeys!.receiver!.tr,
style: TextStyle(fontSize: 22.sp),
),
Expanded(child: SizedBox(width: 10.w)),
!isEmail
? GestureDetector(
child: Container(
width: 90.w,
color: Colors.white,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Obx(() => Text(
'+${state.countryCode}',
style: TextStyle(
color: AppColors.darkGrayTextColor,
fontSize: 20.sp),
)),
Image.asset(
'images/icon_grayPullDown.png',
width: 20.w,
height: 20.w,
),
],
),
),
onTap: () async {
var result =
await Get.toNamed(Routers.selectCountryRegionPage);
if (result != null) {
result as Map<String, dynamic>;
state.countryCode.value = result['code'];
state.countryName.value = result['countryName'];
}
},
)
: Container(),
getReceiverTFWidget(isEmail ? '请输入Email'.tr : '请输入手机号', index,
isEmail: isEmail)
],
),
);
}
Widget massSendReceiverCellWidget({
String? leftTitel,
String? rightTitle,
bool? isHaveDirection,
bool? isHaveLine,
bool? isHaveRightWidget,
Widget? rightWidget,
Function()? action,
double? allHeight,
}) {
return Column(
// mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
height: 60.h,
color: Colors.white,
padding: EdgeInsets.only(right: 20.w), // , top: 20.w, bottom: 20.w
child: Row(
children: [
SizedBox(width: 20.w),
Text(leftTitel!, style: TextStyle(fontSize: 22.sp)),
Expanded(child: SizedBox(width: 10.w)),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
isHaveRightWidget!
? rightWidget!
: Text(
rightTitle ?? "",
textAlign: TextAlign.end,
// overflow: TextOverflow.ellipsis,
// maxLines: 1,
style: TextStyle(
fontSize: 22.sp,
color: AppColors.darkGrayTextColor),
)
],
)
],
//
Widget getReceiverTFWidget(String tfStr, int lineIndex,
{required bool isEmail}) {
MsgNoticeModeData msgData = isEmail
? state.emailReceiverList.value[lineIndex]
: state.phoneReceiverList.value[lineIndex];
return SizedBox(
height: 65.h,
width: 200.w,
child: Row(
children: [
Expanded(
child: TextField(
controller: msgData.receiverTF,
//
maxLines: 1,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(30),
],
autofocus: false,
textAlign: TextAlign.end,
decoration: InputDecoration(
hintText: tfStr,
hintStyle: TextStyle(fontSize: 22.sp),
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) {
if (isEmail) {
msgData.receiveEmail = value;
state.emailReceiverList.value[lineIndex] = msgData;
} else {
msgData.receivePhone = value;
state.phoneReceiverList.value[lineIndex] = msgData;
}
},
),
),
)
],
],
),
);
}
}

View File

@ -1,9 +1,9 @@
import 'package:get/get.dart';
class NotificationModeState {
var inputEmailStr = ''.obs; //
var emailReceiverList = [].obs;
var phoneReceiverList = [].obs;
var countryName = '中国'.obs;
var countryCode = '86'.obs;
var countryCode = 86.obs;
}

View File

@ -45,7 +45,8 @@ abstract class Api {
final String passwordKeyGetURL = '/keyboardPwd/get'; //
final String passwordKeyAddURL = '/keyboardPwd/add'; //
final String passwordKeyCheckKeyboardpwdNameURL = '/keyboardPwd/checkKeyboardpwdName'; //
final String passwordKeyCheckKeyboardpwdNameURL =
'/keyboardPwd/checkKeyboardpwdName'; //
final String updatePasswordKeyURL = '/keyboardPwd/update'; //
final String updatePWDNumberURL = '/keyboardPwd/updatePwdUserNo'; //
final String clearOperationRecordURL = '/lockRecords/clear'; //
@ -199,6 +200,10 @@ abstract class Api {
final String updateLockNoticeSettingURL =
'/lockSetting/updateLockNoticeSetting'; //
final String lockKeysListURL = '/lock/lockKeysList'; //
final String addLockNoticeSettingURL =
'/lockNoticeSettingAccount/add'; //
final String lockNoticeSettingListURL =
'/lockNoticeSettingAccount/list'; //
final String setWechatPushSwitchURL =
'/user/setMpWechatPushSwitch'; //

View File

@ -432,12 +432,15 @@ class ApiProvider extends BaseProvider {
}));
//
Future<Response> updatePWDNumber(String lockId, String keyboardPwdId, String pwdUserNo) => post(
updatePWDNumberURL.toUrl,
jsonEncode({
'lockId': lockId,
'keyboardPwdId': keyboardPwdId,
'pwdUserNo': pwdUserNo}));
Future<Response> updatePWDNumber(
String lockId, String keyboardPwdId, String pwdUserNo) =>
post(
updatePWDNumberURL.toUrl,
jsonEncode({
'lockId': lockId,
'keyboardPwdId': keyboardPwdId,
'pwdUserNo': pwdUserNo
}));
Future<Response> addKeyboardPwd(
String lockId,
@ -1888,6 +1891,22 @@ class ApiProvider extends BaseProvider {
Future<Response> getLockKeysList(int lockId) =>
post(lockKeysListURL.toUrl, jsonEncode({'lockId': lockId}));
//
Future<Response> addLockNoticeSetting(
int lockId, int noticeType, Map settingValue) =>
post(
addLockNoticeSettingURL.toUrl,
jsonEncode({
'lockId': lockId,
'noticeType': noticeType,
'settingValue': settingValue
}));
//
Future<Response> lockNoticeSettingAccountList(int lockId, int noticeType) =>
post(lockNoticeSettingListURL.toUrl,
jsonEncode({'lockId': lockId, 'noticeType': noticeType}));
//
Future<Response> setMpWechatPushSwitch(int mpWechatPushSwitch) => post(
setWechatPushSwitchURL.toUrl,

View File

@ -48,6 +48,7 @@ import '../main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
import '../main/lockDetail/lockSet/lockTime/getServerDatetime_entity.dart';
import '../main/lockDetail/lockDetail/lockNetToken_entity.dart';
import '../main/lockDetail/lockOperatingRecord/lockOperatingRecordGetLastRecordTime_entity.dart';
import '../main/lockDetail/messageWarn/msgNotification/openDoorNotify/openDoorNotify_entity.dart';
import '../main/lockMian/entity/lockListInfo_entity.dart';
import '../mine/addLock/saveLock/entity/SaveLockEntity.dart';
import '../mine/message/messageList/messageList_entity.dart';
@ -447,13 +448,10 @@ class ApiRepository {
//
Future<PasswordKeyEntity> updatePWDNumber(
{required String lockId,
required String keyboardPwdId,
required String pwdUserNo}) async {
final res = await apiProvider.updatePWDNumber(
lockId,
keyboardPwdId,
pwdUserNo
);
required String keyboardPwdId,
required String pwdUserNo}) async {
final res =
await apiProvider.updatePWDNumber(lockId, keyboardPwdId, pwdUserNo);
return PasswordKeyEntity.fromJson(res.body);
}
@ -668,11 +666,9 @@ class ApiRepository {
//
Future<PasswordKeyEntity> deleteKeyboardPwd(
{
required String lockId,
required String keyboardPwdId,
required int deleteType
}) async {
{required String lockId,
required String keyboardPwdId,
required int deleteType}) async {
final res =
await apiProvider.deleteKeyboardPwd(lockId, keyboardPwdId, deleteType);
return PasswordKeyEntity.fromJson(res.body);
@ -1361,17 +1357,8 @@ class ApiRepository {
required String addType,
required List weekDay,
required int faceRight}) async {
final res = await apiProvider.addFaceData(
lockId,
faceName,
faceNumber,
faceType,
startDate,
endDate,
featureData,
addType,
weekDay,
faceRight);
final res = await apiProvider.addFaceData(lockId, faceName, faceNumber,
faceType, startDate, endDate, featureData, addType, weekDay, faceRight);
return AddFaceEntity.fromJson(res.body);
}
@ -1911,6 +1898,24 @@ class ApiRepository {
return LockUserEntity.fromJson(res.body);
}
//
Future<MsgNotificationEntity> addLockNoticeSetting(
{required int lockId,
required int noticeType,
required Map settingValue}) async {
final res = await apiProvider.addLockNoticeSetting(
lockId, noticeType, settingValue);
return MsgNotificationEntity.fromJson(res.body);
}
//
Future<OpenDoorNotifyEntity> lockNoticeSettingAccountList(
{required int lockId, required int noticeType}) async {
final res =
await apiProvider.lockNoticeSettingAccountList(lockId, noticeType);
return OpenDoorNotifyEntity.fromJson(res.body);
}
//
Future<VersionUndateEntity> setMpWechatPushSwitch(
{required int mpWechatPushSwitch}) async {