diff --git a/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart b/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart index 27ce36ff..d34eec38 100755 --- a/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart +++ b/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart @@ -364,7 +364,8 @@ class _AuthorizedAdminPageState extends State 'receiver': state.emailOrPhoneController.text, 'channelType': state.emailOrPhoneController.text.contains('@') ? 2 : 1, - 'keyId': logic.keyId + 'keyId': logic.keyId, + 'unlockType': 1, }); }, ), @@ -501,18 +502,37 @@ class _AuthorizedAdminPageState extends State ); } - void _openModalBottomSheet() { + Future _openModalBottomSheet() async { showModalBottomSheet( context: context, shape: RoundedRectangleBorder( borderRadius: BorderRadiusDirectional.circular(10)), - constraints: BoxConstraints(maxHeight: 270.h), + constraints: BoxConstraints(maxHeight: 323.h), builder: (BuildContext context) { return Column( children: [ - SizedBox( + Container( + color: Colors.white, + padding: EdgeInsets.only(top: 16.h, bottom: 16.h), width: ScreenUtil().screenWidth, - height: 180.h, + child: Center( + child: Text( + '分享', + style: TextStyle( + fontSize: 24.sp, + color: AppColors.blackColor, + fontWeight: FontWeight.w500), + ), + ), + ), + const Divider( + height: 1, + color: AppColors.greyLineColor, + ), + Container( + width: ScreenUtil().screenWidth, + height: 160.h, + color: Colors.white, child: ListView( scrollDirection: Axis.horizontal, //横向滚动 children: initBottomSheetList()), @@ -521,18 +541,23 @@ class _AuthorizedAdminPageState extends State height: 8.h, color: AppColors.greyBackgroundColor, ), - TextButton( - style: ButtonStyle( - overlayColor: - MaterialStateProperty.all(Colors.white)), - child: Text( - '取消'.tr, - style: TextStyle( - color: Colors.black, fontSize: ScreenUtil().setSp(24)), + Container( + color: Colors.white, + margin: const EdgeInsets.only(bottom: 0, left: 0, right: 0), + width: ScreenUtil().screenWidth, + child: TextButton( + style: ButtonStyle( + overlayColor: + MaterialStateProperty.all(Colors.white)), + child: Text( + '取消'.tr, + style: TextStyle( + color: Colors.black, fontSize: ScreenUtil().setSp(24)), + ), + onPressed: () { + Navigator.pop(context); + }, ), - onPressed: () { - Navigator.pop(context); - }, ) ], ); @@ -600,7 +625,14 @@ class _AuthorizedAdminPageState extends State case 2: //邮件 { - Navigator.pushNamed(context, Routers.sendEmailNotificationPage); + Get.toNamed(Routers.sendEmailNotificationPage, + arguments: { + 'receiver': state.emailOrPhoneController.text, + 'channelType': + state.emailOrPhoneController.text.contains('@') ? 2 : 1, + 'keyId': logic.keyId, + 'unlockType': 1, + }); } break; case 3: diff --git a/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_page.dart b/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_page.dart index 3ee28f49..36c12a05 100755 --- a/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_page.dart +++ b/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_page.dart @@ -424,7 +424,8 @@ class _SendElectronicKeyViewState extends State arguments: { 'receiver': logic.emailOrPhone, 'channelType': logic.state.userNameType.value, - 'keyId': logic.keyId + 'keyId': logic.keyId, + 'unlockType': 1 }); }, ), @@ -582,18 +583,37 @@ class _SendElectronicKeyViewState extends State ); } - Future _openModalBottomSheet() async { + Future _openModalBottomSheet() async { showModalBottomSheet( context: context, shape: RoundedRectangleBorder( borderRadius: BorderRadiusDirectional.circular(10)), - constraints: BoxConstraints(maxHeight: 270.h), + constraints: BoxConstraints(maxHeight: 323.h), builder: (BuildContext context) { return Column( - children: [ - SizedBox( + children: [ + Container( + color: Colors.white, + padding: EdgeInsets.only(top: 16.h, bottom: 16.h), width: ScreenUtil().screenWidth, - height: 180.h, + child: Center( + child: Text( + '分享', + style: TextStyle( + fontSize: 24.sp, + color: AppColors.blackColor, + fontWeight: FontWeight.w500), + ), + ), + ), + const Divider( + height: 1, + color: AppColors.greyLineColor, + ), + Container( + width: ScreenUtil().screenWidth, + height: 160.h, + color: Colors.white, child: ListView( scrollDirection: Axis.horizontal, //横向滚动 children: initBottomSheetList()), @@ -602,18 +622,23 @@ class _SendElectronicKeyViewState extends State height: 8.h, color: AppColors.greyBackgroundColor, ), - TextButton( - style: ButtonStyle( - overlayColor: - MaterialStateProperty.all(Colors.white)), - child: Text( - '取消'.tr, - style: TextStyle( - color: Colors.black, fontSize: ScreenUtil().setSp(24)), + Container( + color: Colors.white, + margin: const EdgeInsets.only(bottom: 0, left: 0, right: 0), + width: ScreenUtil().screenWidth, + child: TextButton( + style: ButtonStyle( + overlayColor: + MaterialStateProperty.all(Colors.white)), + child: Text( + '取消'.tr, + style: TextStyle( + color: Colors.black, fontSize: ScreenUtil().setSp(24)), + ), + onPressed: () { + Navigator.pop(context); + }, ), - onPressed: () { - Navigator.pop(context); - }, ) ], ); @@ -675,7 +700,8 @@ class _SendElectronicKeyViewState extends State break; case 2: //邮件 - Get.toNamed(Routers.sendEmailNotificationPage); + Get.toNamed(Routers.sendEmailNotificationPage, + arguments: {'unlockType': 1}); break; case 3: //更多 diff --git a/lib/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_logic.dart b/lib/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_logic.dart index d35e5e71..2fdfe8d9 100644 --- a/lib/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_logic.dart +++ b/lib/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_logic.dart @@ -13,12 +13,18 @@ class SendEmailNotificationLogic extends BaseGetXController { //获取电子钥匙通知模板 渠道:1短信 2邮箱 Future getKeyNoticeTemplate() async { - final SendEmailNotificationEntity entity = - await ApiRepository.to.getKeyNoticeTemplate( - lockId: CommonDataManage().currentKeyInfo.lockId ?? 0, - keyId: state.getKeyId.value, - channelType: state.channelType.value, - ); + final SendEmailNotificationEntity entity; + if (state.unlockType.value == 1) { + entity = await ApiRepository.to.getKeyNoticeTemplate( + lockId: CommonDataManage().currentKeyInfo.lockId ?? 0, + keyId: state.getKeyId.value, + channelType: state.channelType.value); + } else { + entity = await ApiRepository.to.getPwdNoticeTemplate( + lockId: CommonDataManage().currentKeyInfo.lockId ?? 0, + keyboardPwdId: state.getKeyId.value, + channelType: state.channelType.value); + } if (entity.errorCode!.codeIsSuccessful) { state.emailTemplateList.value = entity.data?.list ?? []; @@ -37,17 +43,32 @@ class SendEmailNotificationLogic extends BaseGetXController { showToast('请输入接收者'); return; } - final SendEmailNotificationEntity entity = - await ApiRepository.to.keyNoticeSubmit( - receiverName: state.getReceiver.value.isEmpty - ? state.receiverController.text - : state.getReceiver.value, - lockId: CommonDataManage().currentKeyInfo.lockId ?? 0, - keyId: state.getKeyId.value, - channelType: state.channelType.value, - openDoorType: 1, - templateType: state.currentNotifyItem.value.type ?? '', - ); + final SendEmailNotificationEntity entity; + if (state.unlockType.value == 1) { + entity = await ApiRepository.to.keyNoticeSubmit( + receiverName: state.getReceiver.value.isEmpty + ? state.receiverController.text + : state.getReceiver.value, + lockId: CommonDataManage().currentKeyInfo.lockId ?? 0, + keyId: state.getKeyId.value, + channelType: state.channelType.value, + openDoorType: state.unlockType.value, + templateType: state.currentNotifyItem.value.type ?? '', + countryCode: state.countryCode.value, + ); + } else { + entity = await ApiRepository.to.pwdNoticeSubmit( + receiverName: state.getReceiver.value.isEmpty + ? state.receiverController.text + : state.getReceiver.value, + lockId: CommonDataManage().currentKeyInfo.lockId ?? 0, + keyboardPwdId: state.getKeyId.value, + channelType: state.channelType.value, + openDoorType: state.unlockType.value, + templateType: state.currentNotifyItem.value.type ?? '', + countryCode: state.countryCode.value, + ); + } if (entity.errorCode!.codeIsSuccessful) { showToast('发送成功'); Get.back(); diff --git a/lib/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_page.dart b/lib/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_page.dart index fe5b42dd..efd97a26 100755 --- a/lib/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_page.dart +++ b/lib/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_page.dart @@ -1,5 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; +import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/appRouters.dart'; @@ -82,52 +84,77 @@ class _SendEmailNotificationPageState extends State { }, )), Container( - height: 360.h, + // height: 360.h, color: Colors.white, padding: EdgeInsets.only( left: 20.w, right: 20.w, top: 20.h, bottom: 20.h), - child: TextField( - maxLines: 8, - maxLength: 1000, - textAlign: TextAlign.start, - controller: state.templateContentController, - style: TextStyle( - color: Colors.black, - fontSize: 22.sp, - ), - decoration: InputDecoration( - border: OutlineInputBorder( - ///设置边框四个角的弧度 - borderRadius: BorderRadius.all(Radius.circular(20.h)), + child: Column( + children: [ + TextField( + maxLines: 8, + maxLength: 1000, + textAlign: TextAlign.start, + controller: state.templateContentController, + style: TextStyle( + color: Colors.black, + fontSize: 22.sp, + ), + decoration: InputDecoration( + border: OutlineInputBorder( + ///设置边框四个角的弧度 + borderRadius: BorderRadius.all(Radius.circular(20.h)), - ///用来配置边框的样式 - borderSide: const BorderSide( - ///设置边框的颜色 - color: Color(0xffB2B2B2), + ///用来配置边框的样式 + borderSide: const BorderSide( + ///设置边框的颜色 + color: Color(0xffB2B2B2), - ///设置边框的粗细 - width: 0.5, + ///设置边框的粗细 + width: 0.5, + ), + ), + + ///用来配置输入框获取焦点时的颜色 + focusedBorder: OutlineInputBorder( + ///设置边框四个角的弧度 + borderRadius: BorderRadius.all(Radius.circular(20.h)), + + ///用来配置边框的样式 + borderSide: const BorderSide( + ///设置边框的颜色 + color: Color(0xffB2B2B2), + + ///设置边框的粗细 + width: 1, + ), + ), ), ), - - ///用来配置输入框获取焦点时的颜色 - focusedBorder: OutlineInputBorder( - ///设置边框四个角的弧度 - borderRadius: BorderRadius.all(Radius.circular(20.h)), - - ///用来配置边框的样式 - borderSide: const BorderSide( - ///设置边框的颜色 - color: Color(0xffB2B2B2), - - ///设置边框的粗细 - width: 1, - ), - ), - ), + SizedBox(height: 10.h), + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + GestureDetector( + onTap: () { + Clipboard.setData(ClipboardData( + text: state.templateContentController.text)); + EasyLoading.showToast('复制成功'.tr); + }, + child: Container( + margin: EdgeInsets.only(left: 20.w, top: 0), + child: const Icon( + Icons.copy, + color: Colors.blue, + ), + ), + ) + ], + ) + ], ), ), - Container(height: 40.h), + _buildNewTemplateBtn(), + SizedBox(height: 40.h), SubmitBtn( btnName: '发送'.tr, fontSize: 28.sp, @@ -144,7 +171,42 @@ class _SendEmailNotificationPageState extends State { ], ), ), - ); } + ); + } + + Widget _buildNewTemplateBtn() { + return GestureDetector( + child: Container( + height: 60.h, + margin: EdgeInsets.only(left: 0.w, right: 0.w), + color: Colors.white, + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + 'images/icon_btn_add.png', + width: 28.w, + height: 28.w, + ), + SizedBox( + width: 6.w, + ), + Text( + '新建模版', + style: TextStyle( + color: AppColors.mainColor, + fontSize: 24.sp, + fontWeight: FontWeight.bold), + ) + ], + ), + ), + onTap: () { + Get.toNamed(Routers.newSMSTemplatePage); + }, + ); + } Widget _buildReceiverItemWidget() { return Container( @@ -165,7 +227,7 @@ class _SendEmailNotificationPageState extends State { mainAxisAlignment: MainAxisAlignment.end, children: [ Obx(() => Text( - '+${state.countryCode.value}', + '+${state.countryCode.value.toString()}', style: TextStyle( color: AppColors.darkGrayTextColor, fontSize: 20.sp), @@ -183,7 +245,7 @@ class _SendEmailNotificationPageState extends State { await Get.toNamed(Routers.selectCountryRegionPage); if (result != null) { result as Map; - state.countryCode.value = result['code']; + state.countryCode.value = int.parse(result['code']); state.countryName.value = result['countryName']; } }, @@ -191,6 +253,32 @@ class _SendEmailNotificationPageState extends State { else Container(), getReceiverTFWidget(), + Container( + width: 32.w, + height: 32.w, + decoration: const BoxDecoration( + color: Colors.white, + image: DecorationImage( + image: AssetImage('images/icon_addressBook.png'), + fit: BoxFit.fill), + ), + alignment: Alignment.center, + child: InkWell( + onTap: () async { + final Contact? currentContact = + await logic.state.contactPicker.selectContact(); + logic.state.contact = currentContact!; + if (currentContact.phoneNumbers!.isNotEmpty) { + logic.state.receiverController.text = currentContact + .phoneNumbers![0] + .replaceAll(RegExp(r'\s+\b|\b\s'), ''); + } + // if (currentContact.fullName!.isNotEmpty) { + // logic.state.keyNameController.text = currentContact.fullName!; + // } + }, + ), + ) ], ), ); @@ -210,7 +298,7 @@ class _SendEmailNotificationPageState extends State { maxLines: 1, inputFormatters: [ FilteringTextInputFormatter.deny('\n'), - LengthLimitingTextInputFormatter(30), + LengthLimitingTextInputFormatter(50), ], autofocus: false, textAlign: TextAlign.end, diff --git a/lib/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_state.dart b/lib/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_state.dart index c8ee4630..f253f513 100644 --- a/lib/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_state.dart +++ b/lib/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_state.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart'; import 'package:get/get.dart'; import 'package:star_lock/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_entity.dart'; @@ -12,6 +13,10 @@ class SendEmailNotificationState { getKeyId.value = Get.arguments['keyId']; } + if (Get.arguments['unlockType'] != null) { + unlockType.value = Get.arguments['unlockType']; + } + if (Get.arguments['channelType'] != null) { channelType.value = Get.arguments['channelType']; updateNotifyTypeText(); @@ -29,8 +34,11 @@ class SendEmailNotificationState { [].obs; Rx currentNotifyItem = EmailNotificationItem().obs; RxInt getKeyId = 0.obs; //获取钥匙成功得到的keyId - RxString countryCode = '86'.obs; + RxInt countryCode = 86.obs; RxString countryName = '中国'.obs; + late Contact contact; + final FlutterContactPicker contactPicker = FlutterContactPicker(); + RxInt unlockType = 0.obs; //开锁方式 1:电子钥匙 2:密码 Future updateNotifyTypeText() async { if (channelType.value == 1) { diff --git a/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart b/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart index 9a75f793..10976c4b 100755 --- a/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart +++ b/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart @@ -47,7 +47,7 @@ class _PasswordKeyDetailPageState extends State height: 30.h, width: 30.w, ), - onPressed: openModalBottomSheet, + onPressed: _openModalBottomSheet, ), ], ), @@ -393,18 +393,37 @@ class _PasswordKeyDetailPageState extends State ); } - Future openModalBottomSheet() async { + Future _openModalBottomSheet() async { showModalBottomSheet( context: context, shape: RoundedRectangleBorder( borderRadius: BorderRadiusDirectional.circular(10)), - constraints: BoxConstraints(maxHeight: 270.h), + constraints: BoxConstraints(maxHeight: 323.h), builder: (BuildContext context) { return Column( children: [ - SizedBox( + Container( + color: Colors.white, + padding: EdgeInsets.only(top: 16.h, bottom: 16.h), + width: ScreenUtil().screenWidth, + child: Center( + child: Text( + '分享', + style: TextStyle( + fontSize: 24.sp, + color: AppColors.blackColor, + fontWeight: FontWeight.w500), + ), + ), + ), + const Divider( + height: 1, + color: AppColors.greyLineColor, + ), + Container( width: ScreenUtil().screenWidth, height: 160.h, + color: Colors.white, child: ListView( scrollDirection: Axis.horizontal, //横向滚动 children: initBottomSheetList()), @@ -413,18 +432,23 @@ class _PasswordKeyDetailPageState extends State height: 8.h, color: AppColors.greyBackgroundColor, ), - TextButton( - style: ButtonStyle( - overlayColor: - MaterialStateProperty.all(Colors.white)), - child: Text( - '取消'.tr, - style: TextStyle( - color: Colors.black, fontSize: ScreenUtil().setSp(24)), + Container( + color: Colors.white, + margin: const EdgeInsets.only(bottom: 0, left: 0, right: 0), + width: ScreenUtil().screenWidth, + child: TextButton( + style: ButtonStyle( + overlayColor: + MaterialStateProperty.all(Colors.white)), + child: Text( + '取消'.tr, + style: TextStyle( + color: Colors.black, fontSize: ScreenUtil().setSp(24)), + ), + onPressed: () { + Navigator.pop(context); + }, ), - onPressed: () { - Navigator.pop(context); - }, ) ], ); @@ -486,7 +510,8 @@ class _PasswordKeyDetailPageState extends State arguments: { 'receiver': '', 'channelType': itemIndex == 1 ? 1 : 2, - 'keyId': CommonDataManage().currentKeyInfo.keyId, + 'keyId': state.itemData.value.keyboardPwdId, + 'unlockType': 2 }); break; case 3: //更多 diff --git a/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart b/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart index e7e632c1..4b1357b2 100755 --- a/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart +++ b/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart @@ -146,6 +146,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { state.pwdController.text = ''; if (entity.data != null) { state.getPwdStr.value = entity.data!.keyboardPwd!; + state.getPwdID.value = entity.data!.keyboardPwdId!; } eventBus.fire(GetPasswordListRefreshUI()); } diff --git a/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart b/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart index e39af607..aa13b173 100755 --- a/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart +++ b/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart @@ -1,6 +1,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:flutter/widgets.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; @@ -660,13 +661,32 @@ class _PasswordKeyPerpetualPageState extends State context: context, shape: RoundedRectangleBorder( borderRadius: BorderRadiusDirectional.circular(10)), - constraints: BoxConstraints(maxHeight: 270.h), + constraints: BoxConstraints(maxHeight: 323.h), builder: (BuildContext context) { return Column( children: [ - SizedBox( + Container( + color: Colors.white, + padding: EdgeInsets.only(top: 16.h, bottom: 16.h), + width: ScreenUtil().screenWidth, + child: Center( + child: Text( + '分享', + style: TextStyle( + fontSize: 24.sp, + color: AppColors.blackColor, + fontWeight: FontWeight.w500), + ), + ), + ), + const Divider( + height: 1, + color: AppColors.greyLineColor, + ), + Container( width: ScreenUtil().screenWidth, height: 160.h, + color: Colors.white, child: ListView( scrollDirection: Axis.horizontal, //横向滚动 children: initBottomSheetList()), @@ -675,18 +695,23 @@ class _PasswordKeyPerpetualPageState extends State height: 8.h, color: AppColors.greyBackgroundColor, ), - TextButton( - style: ButtonStyle( - overlayColor: - MaterialStateProperty.all(Colors.white)), - child: Text( - '取消'.tr, - style: TextStyle( - color: Colors.black, fontSize: ScreenUtil().setSp(24)), + Container( + color: Colors.white, + margin: const EdgeInsets.only(bottom: 0, left: 0, right: 0), + width: ScreenUtil().screenWidth, + child: TextButton( + style: ButtonStyle( + overlayColor: + MaterialStateProperty.all(Colors.white)), + child: Text( + '取消'.tr, + style: TextStyle( + color: Colors.black, fontSize: ScreenUtil().setSp(24)), + ), + onPressed: () { + Navigator.pop(context); + }, ), - onPressed: () { - Navigator.pop(context); - }, ) ], ); @@ -805,7 +830,8 @@ class _PasswordKeyPerpetualPageState extends State arguments: { 'receiver': '', 'channelType': itemIndex == 1 ? 1 : 2, - 'keyId': CommonDataManage().currentKeyInfo.keyId, + 'keyId': state.getPwdID.value, + 'unlockType': 2 }); break; case 3: //更多 diff --git a/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_state.dart b/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_state.dart index bf798e78..3e4d1162 100755 --- a/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_state.dart +++ b/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_state.dart @@ -4,7 +4,6 @@ import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart'; import 'package:star_lock/tools/dateTool.dart'; class PasswordKeyPerpetualState { - PasswordKeyPerpetualState() { Map map = Get.arguments; if (map['keyInfo'] != null) { @@ -30,7 +29,8 @@ class PasswordKeyPerpetualState { RxInt loopEndHours = DateTime.now().hour.obs; RxString loopModeStr = '周末'.obs; //循环模式 - RxString customBeginTime = DateTool().getNowDateWithType(2).obs; //默认为当前时间 开始时间 + RxString customBeginTime = + DateTool().getNowDateWithType(2).obs; //默认为当前时间 开始时间 RxString customEndTime = DateTool().getNowDateWithType(2).obs; //默认为当前时间 结束时间 final RxInt widgetType = 0.obs; @@ -42,4 +42,5 @@ class PasswordKeyPerpetualState { RxInt pwdNumber = 0.obs; // 密码编号 late TabController tabController; + RxInt getPwdID = 0.obs; // 获取密码ID } diff --git a/lib/mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator/addAuthorizedAdministrator_page.dart b/lib/mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator/addAuthorizedAdministrator_page.dart index 25a34e80..21d8d2d7 100755 --- a/lib/mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator/addAuthorizedAdministrator_page.dart +++ b/lib/mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator/addAuthorizedAdministrator_page.dart @@ -70,7 +70,8 @@ class _AddAuthorizedAdministratorPageState : state.lockIdList.value.length.toString(), isHaveDirection: true, action: () async { - final result = await Get.toNamed(Routers.massSendLockGroupListPage, + final result = await Get.toNamed( + Routers.massSendLockGroupListPage, arguments: { 'keyLimits': '1', 'lockIdList': state.lockIdList.value @@ -94,7 +95,8 @@ class _AddAuthorizedAdministratorPageState isHaveRightWidget: true, isTipsImg: true, tipsImgAction: () { - ShowTipView().showSureAlertDialog('授权管理员只能查看和管理自己下发的钥匙、密码等权限'.tr); + ShowTipView() + .showSureAlertDialog('授权管理员只能查看和管理自己下发的钥匙、密码等权限'.tr); }, rightWidget: SizedBox( width: 60.w, @@ -128,7 +130,8 @@ class _AddAuthorizedAdministratorPageState : state.lockIdList.value.length.toString(), isHaveDirection: true, action: () async { - final result = await Get.toNamed(Routers.massSendLockGroupListPage, + final result = await Get.toNamed( + Routers.massSendLockGroupListPage, arguments: { 'keyLimits': '1', 'lockIdList': state.lockIdList.value @@ -153,7 +156,8 @@ class _AddAuthorizedAdministratorPageState isHaveRightWidget: true, isTipsImg: true, tipsImgAction: () { - ShowTipView().showSureAlertDialog('授权管理员只能查看和管理自己下发的钥匙、密码等权限'.tr); + ShowTipView() + .showSureAlertDialog('授权管理员只能查看和管理自己下发的钥匙、密码等权限'.tr); }, rightWidget: SizedBox( width: 60.w, @@ -217,7 +221,8 @@ class _AddAuthorizedAdministratorPageState } // 接受者信息输入框 - Widget getTFWidget(bool isHaveBtn, String tfStr, TextEditingController editController) { + Widget getTFWidget( + bool isHaveBtn, String tfStr, TextEditingController editController) { return SizedBox( height: 65.h, width: 300.w, @@ -487,7 +492,8 @@ class _AddAuthorizedAdministratorPageState 'receiver': state.emailOrPhoneController.text, 'channelType': state.emailOrPhoneController.text.contains('@') ? 2 : 1, - 'keyId': state.getKeyId.value + 'keyId': state.getKeyId.value, + 'unlockType': 1 }); }, ), @@ -576,7 +582,13 @@ class _AddAuthorizedAdministratorPageState case 2: //邮件 { - Navigator.pushNamed(context, Routers.sendEmailNotificationPage); + Navigator.pushNamed(context, Routers.sendEmailNotificationPage, + arguments: { + 'receiver': state.emailOrPhoneController.text, + 'channelType': 2, + 'keyId': state.getKeyId.value, + 'unlockType': 1 + }); } break; case 3: diff --git a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_logic.dart b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_logic.dart index 68776f5e..a2b4da49 100644 --- a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_logic.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_logic.dart @@ -20,7 +20,7 @@ class CustomSMSTemplateListLogic extends BaseGetXController { } final CustomSMSTemplateListEntity entity = await ApiRepository.to .getSMSTemplateList( - type: state.type.value, + channelType: state.type.value, pageNo: pageNo, pageSize: int.parse(pageSize)); if (entity.errorCode!.codeIsSuccessful) { diff --git a/lib/network/api.dart b/lib/network/api.dart index 0d7f2d05..92da7292 100755 --- a/lib/network/api.dart +++ b/lib/network/api.dart @@ -255,7 +255,7 @@ abstract class Api { final String checkIpURL = '/checkIp/ip'; final String keyNoticeTemplateURL = '/key/getNoticeTemplate'; //获取电子钥匙通知模板 - final String keyNoticeSubmitURL = '/key/noticeSubmit'; //发送短信、邮件通知 + final String keyNoticeSubmitURL = '/v2/key/noticeSubmit'; //发送短信、邮件通知 final String lockUpdateLockInfo = '/lock/updateLockInfo'; //更新锁固件版本 final String exportLockRecordsURL = '/lockRecords/export'; //导出锁操作记录 } diff --git a/lib/network/api_provider.dart b/lib/network/api_provider.dart index 2f4688d9..ecaa8e66 100755 --- a/lib/network/api_provider.dart +++ b/lib/network/api_provider.dart @@ -2199,11 +2199,11 @@ class ApiProvider extends BaseProvider { // 获取短信模板列表 Future> getSMSTemplateList( - int type, int pageNo, int pageSize) => + int channelType, int pageNo, int pageSize) => post( smsTemplateListURL.toUrl, jsonEncode({ - 'type': type, + 'channelType': channelType, 'pageNo': pageNo, 'pageSize': pageSize }), @@ -2258,13 +2258,31 @@ class ApiProvider extends BaseProvider { jsonEncode({ 'lockId': lockId, 'keyId': keyId, - 'channelType': channelType + 'channelType': channelType, }), isUnShowLoading: true, ); - Future> keyNoticeSubmit(String receiverName, int lockId, - int keyId, int channelType, int openDoorType, String templateType) => + Future> getPwdNoticeTemplate( + int lockId, int keyboardPwdId, int channelType) => + post( + keyNoticeTemplateURL.toUrl, + jsonEncode({ + 'lockId': lockId, + 'keyboardPwdId': keyboardPwdId, + 'channelType': channelType, + }), + isUnShowLoading: true, + ); + + Future> keyNoticeSubmit( + String receiverName, + int lockId, + int keyId, + int channelType, + int openDoorType, + String templateType, + int countryCode) => post( keyNoticeSubmitURL.toUrl, jsonEncode({ @@ -2274,6 +2292,29 @@ class ApiProvider extends BaseProvider { 'channelType': channelType, 'openDoorType': openDoorType, 'templateType': templateType, + 'countryCode': countryCode + }), + isUnShowLoading: true, + ); + + Future> pwdNoticeSubmit( + String receiverName, + int lockId, + int keyboardPwdId, + int channelType, + int openDoorType, + String templateType, + int countryCode) => + post( + keyNoticeSubmitURL.toUrl, + jsonEncode({ + 'receiverName': receiverName, + 'lockId': lockId, + 'keyboardPwdId': keyboardPwdId, + 'channelType': channelType, + 'openDoorType': openDoorType, + 'templateType': templateType, + 'countryCode': countryCode }), isUnShowLoading: true, ); diff --git a/lib/network/api_repository.dart b/lib/network/api_repository.dart index 6e31f07e..877aeacd 100755 --- a/lib/network/api_repository.dart +++ b/lib/network/api_repository.dart @@ -2224,9 +2224,11 @@ class ApiRepository { // 获取短信模板列表 Future getSMSTemplateList( - {required int type, required int pageNo, required int pageSize}) async { + {required int channelType, + required int pageNo, + required int pageSize}) async { final Response res = - await apiProvider.getSMSTemplateList(type, pageNo, pageSize); + await apiProvider.getSMSTemplateList(channelType, pageNo, pageSize); return CustomSMSTemplateListEntity.fromJson(res.body); } @@ -2277,17 +2279,54 @@ class ApiRepository { return SendEmailNotificationEntity.fromJson(res.body); } - // 发送短信、邮件通知 - Future keyNoticeSubmit({ - required String receiverName, + // 获取密码通知模板 + Future getPwdNoticeTemplate({ required int lockId, - required int keyId, + required int keyboardPwdId, required int channelType, - required int openDoorType, - required String templateType, }) async { + final Response res = await apiProvider.getPwdNoticeTemplate( + lockId, keyboardPwdId, channelType); + return SendEmailNotificationEntity.fromJson(res.body); + } + + // 电子钥匙发送短信、邮件通知 + Future keyNoticeSubmit( + {required String receiverName, + required int lockId, + required int keyId, + required int channelType, + required int openDoorType, + required String templateType, + required int countryCode}) async { final Response res = await apiProvider.keyNoticeSubmit( - receiverName, lockId, keyId, channelType, openDoorType, templateType); + receiverName, + lockId, + keyId, + channelType, + openDoorType, + templateType, + countryCode); + return SendEmailNotificationEntity.fromJson(res.body); + } + + // 密码发送短信、邮件通知 + Future pwdNoticeSubmit( + {required String receiverName, + required int lockId, + required int keyboardPwdId, + required int channelType, + required int openDoorType, + required String templateType, + required int countryCode}) async { + final Response res = await apiProvider.pwdNoticeSubmit( + receiverName, + lockId, + keyboardPwdId, + channelType, + openDoorType, + templateType, + countryCode); return SendEmailNotificationEntity.fromJson(res.body); } diff --git a/lib/tools/emailNotifyTypeSelectAlert.dart b/lib/tools/emailNotifyTypeSelectAlert.dart index c7c1afec..70a202e3 100644 --- a/lib/tools/emailNotifyTypeSelectAlert.dart +++ b/lib/tools/emailNotifyTypeSelectAlert.dart @@ -68,8 +68,8 @@ class EmailNotifyTypeSelectAlert extends StatelessWidget { alignment: Alignment.centerLeft, child: Text( isEmail - ? '邮件将从软件平台直接发给用户,请根据需要在软件那里购买邮件数量' - : '短信将从软件平台直接发给用户,请根据需要在软件那里购买短信数量', + ? '邮件将从软件平台直接发给用户,请根据需要在软件里购买邮件数量。' + : '短信将从软件平台直接发给用户,请根据需要在软件里购买短信数量。', style: TextStyle(fontSize: 18.sp), textAlign: TextAlign.left, ),