1,新增开门通知家人详情逻辑处理及数据展示
2,新增删除家人接口对接及对应处理 3,开门通知模块部分代码重构
This commit is contained in:
parent
c7bf28ec0f
commit
edcf16114f
@ -1,5 +1,6 @@
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/messageWarn/addFamily/addFamily_state.dart';
|
import 'package:star_lock/main/lockDetail/messageWarn/addFamily/addFamily_state.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/openDoorNotify/openDoorNotify_entity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/messageWarn/notificationMode/notificationMode_data.dart';
|
import 'package:star_lock/main/lockDetail/messageWarn/notificationMode/notificationMode_data.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';
|
||||||
@ -7,6 +8,7 @@ import 'package:star_lock/tools/baseGetXController.dart';
|
|||||||
class AddFamilyLogic extends BaseGetXController {
|
class AddFamilyLogic extends BaseGetXController {
|
||||||
final AddFamilyState state = AddFamilyState();
|
final AddFamilyState state = AddFamilyState();
|
||||||
|
|
||||||
|
//添加开门通知
|
||||||
void addLockNoticeSetting() async {
|
void addLockNoticeSetting() async {
|
||||||
var entity = await ApiRepository.to.addLockNoticeSetting(
|
var entity = await ApiRepository.to.addLockNoticeSetting(
|
||||||
lockId: state.getLockId.value,
|
lockId: state.getLockId.value,
|
||||||
@ -27,6 +29,18 @@ class AddFamilyLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//删除开门通知
|
||||||
|
void deleteLockNoticeSetting() async {
|
||||||
|
var entity = await ApiRepository.to.deleteLockNoticeSettingAccount(
|
||||||
|
lockNoticeSettingAccountId: state.familyData.value.id!,
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
showToast('删除成功'.tr);
|
||||||
|
Get.back(result: true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取到家人信息的请求数组
|
||||||
List getEmailAndSMSAccountList(bool isEmail) {
|
List getEmailAndSMSAccountList(bool isEmail) {
|
||||||
List list = [];
|
List list = [];
|
||||||
List accountList = [];
|
List accountList = [];
|
||||||
@ -78,6 +92,7 @@ class AddFamilyLogic extends BaseGetXController {
|
|||||||
return phoneListStr;
|
return phoneListStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//检查按钮是否可用
|
||||||
bool checkBtnDisable() {
|
bool checkBtnDisable() {
|
||||||
if ((state.emailListStr.value.isEmpty ||
|
if ((state.emailListStr.value.isEmpty ||
|
||||||
state.phontListStr.value.isEmpty) ||
|
state.phontListStr.value.isEmpty) ||
|
||||||
@ -88,4 +103,65 @@ class AddFamilyLogic extends BaseGetXController {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//当前钥匙类型 1:电子钥匙 2:密码钥匙 3:指纹钥匙 4:卡钥匙 5:人脸钥匙
|
||||||
|
String getKeyTypeStr() {
|
||||||
|
int keyType = state.familyData.value.settingValue!.openDoorType!;
|
||||||
|
switch (keyType) {
|
||||||
|
case 1:
|
||||||
|
return '电子钥匙';
|
||||||
|
case 2:
|
||||||
|
return '密码';
|
||||||
|
case 3:
|
||||||
|
return '指纹';
|
||||||
|
case 4:
|
||||||
|
return '卡';
|
||||||
|
case 5:
|
||||||
|
return '人脸';
|
||||||
|
default:
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//根据列表返回值得到邮箱、手机列表
|
||||||
|
Map<String, List<MsgNoticeModeData>> getAccountsMap() {
|
||||||
|
List<MsgNoticeModeData> mailAccounts = [];
|
||||||
|
List<MsgNoticeModeData> smsAccounts = [];
|
||||||
|
|
||||||
|
if (state.familyData.value.settingValue != null) {
|
||||||
|
for (NoticeWay item
|
||||||
|
in state.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!;
|
||||||
|
mailAccounts.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!;
|
||||||
|
smsAccounts.add(msgNoticeModeData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
'emailReceiverList': mailAccounts,
|
||||||
|
'phoneReceiverList': smsAccounts,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
onInit() {
|
||||||
|
super.onInit();
|
||||||
|
state.emailListStr.value = getEmailListStr(getAccountsMap());
|
||||||
|
state.phontListStr.value = getPhoneListStr(getAccountsMap());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,7 +25,7 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
barTitle: '添加家人'.tr,
|
barTitle: state.isDetail.value ? '家人详情'.tr : '添加家人'.tr,
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor),
|
backgroundColor: AppColors.mainColor),
|
||||||
body: Container(
|
body: Container(
|
||||||
@ -34,8 +34,9 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
|
|||||||
children: [
|
children: [
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: '开门方式'.tr,
|
leftTitel: '开门方式'.tr,
|
||||||
rightTitle:
|
rightTitle: state.isDetail.value
|
||||||
state.lockUserKeys.value.currentKeyTypeStr ?? '请选择'.tr,
|
? logic.getKeyTypeStr()
|
||||||
|
: state.lockUserKeys.value.currentKeyTypeStr ?? '请选择'.tr,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
@ -50,7 +51,9 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
|
|||||||
})),
|
})),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: '家人'.tr,
|
leftTitel: '家人'.tr,
|
||||||
rightTitle: state.lockUserKeys.value.currentKeyName ?? '',
|
rightTitle: state.isDetail.value
|
||||||
|
? state.familyData.value.settingValue?.remark
|
||||||
|
: state.lockUserKeys.value.currentKeyName,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveRightWidget:
|
isHaveRightWidget:
|
||||||
state.lockUserKeys.value.currentKeyName == null
|
state.lockUserKeys.value.currentKeyName == null
|
||||||
@ -99,10 +102,17 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
|
|||||||
height: 40.h,
|
height: 40.h,
|
||||||
)),
|
)),
|
||||||
Obx(() => SubmitBtn(
|
Obx(() => SubmitBtn(
|
||||||
btnName: '保存'.tr,
|
btnName: state.isDetail.value == true ? '删除'.tr : '保存'.tr,
|
||||||
isDisabled: logic.checkBtnDisable(),
|
isDisabled: state.isDetail.value == true
|
||||||
|
? true
|
||||||
|
: logic.checkBtnDisable(),
|
||||||
|
isDelete: state.isDetail.value,
|
||||||
onClick: () {
|
onClick: () {
|
||||||
logic.addLockNoticeSetting();
|
if (state.isDetail.value) {
|
||||||
|
logic.deleteLockNoticeSetting();
|
||||||
|
} else {
|
||||||
|
logic.addLockNoticeSetting();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
)),
|
)),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
@ -145,6 +155,9 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
|
|||||||
// 接受者邮箱输入框
|
// 接受者邮箱输入框
|
||||||
Widget getFamilyWidget(String tfStr) {
|
Widget getFamilyWidget(String tfStr) {
|
||||||
TextEditingController emailController = TextEditingController();
|
TextEditingController emailController = TextEditingController();
|
||||||
|
if (state.isDetail.value) {
|
||||||
|
emailController.text = state.familyData.value.settingValue?.remark ?? '';
|
||||||
|
}
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: 50.h,
|
height: 50.h,
|
||||||
width: 360.w,
|
width: 360.w,
|
||||||
@ -157,6 +170,7 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
|
|||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
autofocus: false,
|
autofocus: false,
|
||||||
textAlign: TextAlign.end,
|
textAlign: TextAlign.end,
|
||||||
|
style: TextStyle(fontSize: 22.sp),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
//输入里面输入文字内边距设置
|
//输入里面输入文字内边距设置
|
||||||
contentPadding: const EdgeInsets.only(top: -12.0, bottom: 0.0),
|
contentPadding: const EdgeInsets.only(top: -12.0, bottom: 0.0),
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import 'package:get/get.dart';
|
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';
|
||||||
|
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/openDoorNotify/openDoorNotify_entity.dart';
|
||||||
|
|
||||||
class AddFamilyState {
|
class AddFamilyState {
|
||||||
var getLockId = 0.obs;
|
var getLockId = 0.obs;
|
||||||
@ -11,11 +12,21 @@ class AddFamilyState {
|
|||||||
|
|
||||||
var openDoorId = 0.obs;
|
var openDoorId = 0.obs;
|
||||||
var openDoorType = 0.obs;
|
var openDoorType = 0.obs;
|
||||||
|
var familyData = DataList().obs;
|
||||||
|
var isDetail = false.obs;
|
||||||
|
|
||||||
AddFamilyState() {
|
AddFamilyState() {
|
||||||
Map map = Get.arguments;
|
Map map = Get.arguments;
|
||||||
if (map['getLockId'] != null) {
|
if (map['lockId'] != null) {
|
||||||
getLockId.value = map['getLockId'];
|
getLockId.value = map['lockId'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (map['isDetail'] != null) {
|
||||||
|
isDetail.value = map['isDetail'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (map['itemData'] != null) {
|
||||||
|
familyData.value = map['itemData'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,15 +1,21 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/openDoorNotify/openDoorNotify_entity.dart';
|
||||||
|
|
||||||
class FamilyDetailsState {
|
class FamilyDetailsState {
|
||||||
TextEditingController changeNameController = TextEditingController(); //修改名称
|
TextEditingController changeNameController = TextEditingController(); //修改名称
|
||||||
var familyName = '我'.obs;
|
var familyName = '我'.obs;
|
||||||
var getLockId = 0.obs;
|
var getLockId = 0.obs;
|
||||||
|
var familyData = DataList().obs;
|
||||||
|
|
||||||
FamilyDetailsState() {
|
FamilyDetailsState() {
|
||||||
Map map = Get.arguments;
|
Map map = Get.arguments;
|
||||||
if (map['lockId'] != null) {
|
if (map['lockId'] != null) {
|
||||||
getLockId.value = map['lockId'];
|
getLockId.value = map['lockId'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (map['itemData'] != null) {
|
||||||
|
familyData.value = map['itemData'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -103,19 +103,19 @@ class SettingValue {
|
|||||||
int? openDoorId;
|
int? openDoorId;
|
||||||
int? openDoorType;
|
int? openDoorType;
|
||||||
String? remark;
|
String? remark;
|
||||||
List<NoticeWay>? noticeWay;
|
List<NoticeWay>? noticeWayList;
|
||||||
|
|
||||||
SettingValue(
|
SettingValue(
|
||||||
{this.openDoorId, this.openDoorType, this.remark, this.noticeWay});
|
{this.openDoorId, this.openDoorType, this.remark, this.noticeWayList});
|
||||||
|
|
||||||
SettingValue.fromJson(Map<String, dynamic> json) {
|
SettingValue.fromJson(Map<String, dynamic> json) {
|
||||||
openDoorId = json['openDoorId'];
|
openDoorId = json['openDoorId'];
|
||||||
openDoorType = json['openDoorType'];
|
openDoorType = json['openDoorType'];
|
||||||
remark = json['remark'];
|
remark = json['remark'];
|
||||||
if (json['noticeWay'] != null) {
|
if (json['noticeWay'] != null) {
|
||||||
noticeWay = <NoticeWay>[];
|
noticeWayList = <NoticeWay>[];
|
||||||
json['noticeWay'].forEach((v) {
|
json['noticeWay'].forEach((v) {
|
||||||
noticeWay!.add(NoticeWay.fromJson(v));
|
noticeWayList!.add(NoticeWay.fromJson(v));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -125,8 +125,8 @@ class SettingValue {
|
|||||||
data['openDoorId'] = openDoorId;
|
data['openDoorId'] = openDoorId;
|
||||||
data['openDoorType'] = openDoorType;
|
data['openDoorType'] = openDoorType;
|
||||||
data['remark'] = remark;
|
data['remark'] = remark;
|
||||||
if (noticeWay != null) {
|
if (noticeWayList != null) {
|
||||||
data['noticeWay'] = noticeWay!.map((v) => v.toJson()).toList();
|
data['noticeWay'] = noticeWayList!.map((v) => v.toJson()).toList();
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,4 +16,23 @@ class OpenDoorNotifyLogic extends BaseGetXController {
|
|||||||
state.openDoorNotifyList.value = entity.data!.list!;
|
state.openDoorNotifyList.value = entity.data!.list!;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//当前钥匙类型 1:电子钥匙 2:密码钥匙 3:指纹钥匙 4:卡钥匙 5:人脸钥匙
|
||||||
|
String getKeyTypeStr(DataList itemData) {
|
||||||
|
int keyType = itemData.settingValue!.openDoorType!;
|
||||||
|
switch (keyType) {
|
||||||
|
case 1:
|
||||||
|
return '电子钥匙';
|
||||||
|
case 2:
|
||||||
|
return '密码';
|
||||||
|
case 3:
|
||||||
|
return '指纹';
|
||||||
|
case 4:
|
||||||
|
return '卡';
|
||||||
|
case 5:
|
||||||
|
return '人脸';
|
||||||
|
default:
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/appRouters.dart';
|
import 'package:star_lock/appRouters.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/openDoorNotify/openDoorNotify_entity.dart';
|
||||||
|
import 'package:star_lock/tools/noData.dart';
|
||||||
|
|
||||||
import '../../../../../app_settings/app_colors.dart';
|
import '../../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../../tools/submitBtn.dart';
|
import '../../../../../tools/submitBtn.dart';
|
||||||
@ -41,13 +43,17 @@ class _OpenDoorNotifyPageState extends State<OpenDoorNotifyPage> {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
height: 20.h,
|
height: 20.h,
|
||||||
),
|
),
|
||||||
Expanded(child: Obx(() => _buildMainUI())),
|
Expanded(
|
||||||
|
child: Obx(() => state.openDoorNotifyList.value.isNotEmpty
|
||||||
|
? _buildMainUI()
|
||||||
|
: NoData())),
|
||||||
AddBottomWhiteBtn(
|
AddBottomWhiteBtn(
|
||||||
btnName: '添加家人'.tr,
|
btnName: '添加家人'.tr,
|
||||||
onClick: () {
|
onClick: () {
|
||||||
Get.toNamed(Routers.addFamilyPage,
|
Get.toNamed(Routers.addFamilyPage, arguments: {
|
||||||
arguments: {'getLockId': state.getLockId.value})
|
'lockId': state.getLockId.value,
|
||||||
?.then((value) {
|
'isDetail': false
|
||||||
|
})?.then((value) {
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
logic.lockNoticeSettingAccountList();
|
logic.lockNoticeSettingAccountList();
|
||||||
}
|
}
|
||||||
@ -76,10 +82,7 @@ class _OpenDoorNotifyPageState extends State<OpenDoorNotifyPage> {
|
|||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
itemCount: state.openDoorNotifyList.length,
|
itemCount: state.openDoorNotifyList.length,
|
||||||
itemBuilder: (c, index) {
|
itemBuilder: (c, index) {
|
||||||
return _electronicKeyItem(
|
return _electronicKeyItem(state.openDoorNotifyList.value[index]);
|
||||||
'images/controls_user.png', '18682150237', '电子钥匙', () {
|
|
||||||
Get.toNamed(Routers.familyDetailsPage);
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
separatorBuilder: (BuildContext context, int index) {
|
separatorBuilder: (BuildContext context, int index) {
|
||||||
return const Divider(
|
return const Divider(
|
||||||
@ -90,10 +93,19 @@ class _OpenDoorNotifyPageState extends State<OpenDoorNotifyPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _electronicKeyItem(String avatarURL, String familyAccount,
|
Widget _electronicKeyItem(DataList itemData) {
|
||||||
String openDoorWay, Function() action) {
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: action,
|
onTap: () {
|
||||||
|
Get.toNamed(Routers.addFamilyPage, arguments: {
|
||||||
|
'itemData': itemData,
|
||||||
|
'lockId': state.getLockId.value,
|
||||||
|
'isDetail': true
|
||||||
|
})?.then((value) {
|
||||||
|
if (value != null) {
|
||||||
|
logic.lockNoticeSettingAccountList();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
height: 90.h,
|
height: 90.h,
|
||||||
@ -103,7 +115,7 @@ class _OpenDoorNotifyPageState extends State<OpenDoorNotifyPage> {
|
|||||||
width: 30.w,
|
width: 30.w,
|
||||||
),
|
),
|
||||||
Image.asset(
|
Image.asset(
|
||||||
avatarURL,
|
'images/controls_user.png',
|
||||||
width: 60.w,
|
width: 60.w,
|
||||||
height: 60.w,
|
height: 60.w,
|
||||||
),
|
),
|
||||||
@ -117,7 +129,7 @@ class _OpenDoorNotifyPageState extends State<OpenDoorNotifyPage> {
|
|||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
familyAccount,
|
itemData.settingValue!.remark ?? '',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 24.sp, color: AppColors.blackColor),
|
fontSize: 24.sp, color: AppColors.blackColor),
|
||||||
),
|
),
|
||||||
@ -133,7 +145,7 @@ class _OpenDoorNotifyPageState extends State<OpenDoorNotifyPage> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
openDoorWay,
|
logic.getKeyTypeStr(itemData),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 18.sp,
|
fontSize: 18.sp,
|
||||||
color: AppColors.placeholderTextColor),
|
color: AppColors.placeholderTextColor),
|
||||||
|
|||||||
@ -1,19 +1,11 @@
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/msgNotification/msgNotification_entity.dart';
|
|
||||||
|
|
||||||
class OpenDoorNotifyState {
|
class OpenDoorNotifyState {
|
||||||
var msgNoticeInfo = MsgNoticeData().obs;
|
|
||||||
var pageNum = 1.obs; //请求页码
|
|
||||||
final pageSize = 20.obs; //请求每页数据条数
|
|
||||||
var itemDataList = [].obs;
|
|
||||||
var getLockId = 0.obs;
|
var getLockId = 0.obs;
|
||||||
var openDoorNotifyList = [].obs;
|
var openDoorNotifyList = [].obs; //开门通知列表
|
||||||
|
|
||||||
OpenDoorNotifyState() {
|
OpenDoorNotifyState() {
|
||||||
Map map = Get.arguments;
|
Map map = Get.arguments;
|
||||||
if (map['msgNoticeInfo'] != null) {
|
|
||||||
msgNoticeInfo.value = map['msgNoticeInfo'];
|
|
||||||
}
|
|
||||||
if (map['lockId'] != null) {
|
if (map['lockId'] != null) {
|
||||||
getLockId.value = map['lockId'];
|
getLockId.value = map['lockId'];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -204,6 +204,8 @@ abstract class Api {
|
|||||||
'/lockNoticeSettingAccount/add'; //添加开门通知
|
'/lockNoticeSettingAccount/add'; //添加开门通知
|
||||||
final String lockNoticeSettingListURL =
|
final String lockNoticeSettingListURL =
|
||||||
'/lockNoticeSettingAccount/list'; //开门通知列表
|
'/lockNoticeSettingAccount/list'; //开门通知列表
|
||||||
|
final String deleteLockNoticeSettingAccountURL =
|
||||||
|
'/lockNoticeSettingAccount/delete'; //删除开门通知
|
||||||
|
|
||||||
final String setWechatPushSwitchURL =
|
final String setWechatPushSwitchURL =
|
||||||
'/user/setMpWechatPushSwitch'; //设置微信公众号推送
|
'/user/setMpWechatPushSwitch'; //设置微信公众号推送
|
||||||
|
|||||||
@ -674,13 +674,12 @@ class ApiProvider extends BaseProvider {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
/// 更新网络信息 配网之后把网络信息提交到服务器保存
|
/// 更新网络信息 配网之后把网络信息提交到服务器保存
|
||||||
Future<Response> updateNetworkInfo(int lockId, String network) =>
|
Future<Response> updateNetworkInfo(int lockId, String network) => post(
|
||||||
post(
|
updateLockSettingUrl.toUrl,
|
||||||
updateLockSettingUrl.toUrl,
|
jsonEncode({
|
||||||
jsonEncode({
|
'lockId': lockId,
|
||||||
'lockId': lockId,
|
'network': network,
|
||||||
'network': network,
|
}));
|
||||||
}));
|
|
||||||
|
|
||||||
// 锁声音
|
// 锁声音
|
||||||
Future<Response> setLockSoundData(
|
Future<Response> setLockSoundData(
|
||||||
@ -1889,6 +1888,14 @@ class ApiProvider extends BaseProvider {
|
|||||||
post(lockNoticeSettingListURL.toUrl,
|
post(lockNoticeSettingListURL.toUrl,
|
||||||
jsonEncode({'lockId': lockId, 'noticeType': noticeType}));
|
jsonEncode({'lockId': lockId, 'noticeType': noticeType}));
|
||||||
|
|
||||||
|
// 删除开门通知
|
||||||
|
Future<Response> deleteLockNoticeSettingAccount(
|
||||||
|
int lockNoticeSettingAccountId) =>
|
||||||
|
post(
|
||||||
|
deleteLockNoticeSettingAccountURL.toUrl,
|
||||||
|
jsonEncode(
|
||||||
|
{'lockNoticeSettingAccountId': lockNoticeSettingAccountId}));
|
||||||
|
|
||||||
// 设置微信公众号推送
|
// 设置微信公众号推送
|
||||||
Future<Response> setMpWechatPushSwitch(int mpWechatPushSwitch) => post(
|
Future<Response> setMpWechatPushSwitch(int mpWechatPushSwitch) => post(
|
||||||
setWechatPushSwitchURL.toUrl,
|
setWechatPushSwitchURL.toUrl,
|
||||||
|
|||||||
@ -714,8 +714,6 @@ class ApiRepository {
|
|||||||
return LoginEntity.fromJson(res.body);
|
return LoginEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 锁声音
|
// 锁声音
|
||||||
Future<LoginEntity> setLockSound({
|
Future<LoginEntity> setLockSound({
|
||||||
required int lockId,
|
required int lockId,
|
||||||
@ -1909,6 +1907,14 @@ class ApiRepository {
|
|||||||
return OpenDoorNotifyEntity.fromJson(res.body);
|
return OpenDoorNotifyEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 删除开门通知
|
||||||
|
Future<OpenDoorNotifyEntity> deleteLockNoticeSettingAccount(
|
||||||
|
{required int lockNoticeSettingAccountId}) async {
|
||||||
|
final res = await apiProvider
|
||||||
|
.deleteLockNoticeSettingAccount(lockNoticeSettingAccountId);
|
||||||
|
return OpenDoorNotifyEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
// 设置微信公众号推送
|
// 设置微信公众号推送
|
||||||
Future<VersionUndateEntity> setMpWechatPushSwitch(
|
Future<VersionUndateEntity> setMpWechatPushSwitch(
|
||||||
{required int mpWechatPushSwitch}) async {
|
{required int mpWechatPushSwitch}) async {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user