1,通过个人手机短信发送密码给用户,Android端差异化处理

2,授权管理员模块发送成功后,通过邮件、短信发送给用户
This commit is contained in:
Daisy 2024-06-13 17:35:14 +08:00
parent 74393a3d64
commit a524642a88
6 changed files with 36 additions and 21 deletions

View File

@ -359,11 +359,13 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
btnName:
state.emailOrPhoneController.text.contains('@') ? '邮件通知' : '短信通知',
onClick: () {
if (state.emailOrPhoneController.text.contains('@')) {
Get.toNamed(Routers.sendEmailNotificationPage);
} else {
logic.sendMsg(isPhone: true);
}
Get.toNamed(Routers.sendEmailNotificationPage,
arguments: <String, Object?>{
'receiver': state.emailOrPhoneController.text,
'channelType':
state.emailOrPhoneController.text.contains('@') ? 2 : 1,
'keyId': logic.keyId
});
},
),
SizedBox(

View File

@ -416,12 +416,6 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
SizedBox(
height: 10.h,
),
// OutLineBtn(
// btnName: '分享'.tr,
// onClick: () {
// _openModalBottomSheet();
// },
// ),
if (logic.emailOrPhone != null)
OutLineBtn(
btnName: logic.state.userNameType.value == 1 ? '短信通知' : '邮件通知',

View File

@ -54,15 +54,32 @@ class SendEmailNotificationLogic extends BaseGetXController {
}
}
//
Future<void> sendPersonalSMSOrEmail() async {
if (state.receiverController.text.isEmpty &&
state.getReceiver.value.isEmpty) {
showToast('请输入接收者');
return;
}
if (state.channelType.value == 1) {
Uri smsUri;
//
final String phoneNumber = state.getReceiver.value.isEmpty
? state.receiverController.text
: state.getReceiver.value;
final String message = state.templateContentController.text;
final Uri smsUri =
Uri.parse('sms:$phoneNumber&body=${Uri.encodeComponent(message)}');
if (Platform.isAndroid) {
smsUri = Uri(
scheme: 'sms',
path: phoneNumber,
query: 'body=${Uri.encodeComponent(message)}',
);
} else {
smsUri =
Uri.parse('sms:$phoneNumber&body=${Uri.encodeComponent(message)}');
}
if (await canLaunchUrl(smsUri)) {
await launchUrl(smsUri);

View File

@ -72,6 +72,8 @@ class AddAuthorizedAdministratorLogic extends BaseGetXController {
if (entity.errorCode!.codeIsSuccessful) {
state.isSendSuccess.value = true;
state.isCreateUser.value = false;
state.getKeyId.value = entity.data!.keyId ?? 0;
// Toast.show(msg: "添加成功");
eventBus.fire(AuthorizedAdministratorListPageRefreshUI());

View File

@ -478,14 +478,13 @@ class _AddAuthorizedAdministratorPageState
btnName:
state.emailOrPhoneController.text.contains('@') ? '邮件通知' : '短信通知',
onClick: () {
if (state.emailOrPhoneController.text.contains('@')) {
Get.toNamed(Routers.sendEmailNotificationPage);
} else {
// _openModalBottomSheet();
NativeInteractionTool()
.loadNativeShare(shareText: state.pwdShareStr);
}
// Get.toNamed(state.emailOrPhoneController.text.contains("@")? Routers.sendEmailNotificationPage:Routers.sendEmailNotificationPage);
Get.toNamed(Routers.sendEmailNotificationPage,
arguments: <String, Object?>{
'receiver': state.emailOrPhoneController.text,
'channelType':
state.emailOrPhoneController.text.contains('@') ? 2 : 1,
'keyId': state.getKeyId.value
});
},
),
SizedBox(

View File

@ -34,4 +34,5 @@ class AddAuthorizedAdministratorState {
final Rx<LockListInfoItemEntity> keyInfo = LockListInfoItemEntity().obs;
String pwdShareStr = '您好,您的授权管理员生成成功';
RxInt getKeyId = 0.obs;
}