1,新增邮件类型选择公用组件
2,新增获取电子钥匙通知模版API对接 3,完善电子钥匙发送成功后邮件通知相关页面及逻辑 4,根据后台返回电子钥匙类型显示短信、邮件通知
This commit is contained in:
parent
99b7a443ed
commit
e6592bf06b
@ -29,15 +29,17 @@ class AuthorizedAdminSendEntity {
|
|||||||
class Data {
|
class Data {
|
||||||
int? receiverUid;
|
int? receiverUid;
|
||||||
ReceiverUser? receiverUser;
|
ReceiverUser? receiverUser;
|
||||||
|
int? usernameType;
|
||||||
int? keyId;
|
int? keyId;
|
||||||
|
|
||||||
Data({this.receiverUid, this.receiverUser, this.keyId});
|
Data({this.receiverUid, this.receiverUser, this.usernameType, this.keyId});
|
||||||
|
|
||||||
Data.fromJson(Map<String, dynamic> json) {
|
Data.fromJson(Map<String, dynamic> json) {
|
||||||
receiverUid = json['receiverUid'];
|
receiverUid = json['receiverUid'];
|
||||||
receiverUser = json['receiverUser'] != null
|
receiverUser = json['receiverUser'] != null
|
||||||
? ReceiverUser.fromJson(json['receiverUser'])
|
? ReceiverUser.fromJson(json['receiverUser'])
|
||||||
: null;
|
: null;
|
||||||
|
usernameType = json['usernameType'];
|
||||||
keyId = json['keyId'];
|
keyId = json['keyId'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,6 +49,7 @@ class Data {
|
|||||||
if (receiverUser != null) {
|
if (receiverUser != null) {
|
||||||
data['receiverUser'] = receiverUser!.toJson();
|
data['receiverUser'] = receiverUser!.toJson();
|
||||||
}
|
}
|
||||||
|
data['usernameType'] = usernameType;
|
||||||
data['keyId'] = keyId;
|
data['keyId'] = keyId;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -185,6 +185,7 @@ class SendElectronicKeyViewLogic extends BaseGetXController {
|
|||||||
state.createUser.value = 0;
|
state.createUser.value = 0;
|
||||||
state.isSendSuccess = true;
|
state.isSendSuccess = true;
|
||||||
keyId = entity.data!.keyId;
|
keyId = entity.data!.keyId;
|
||||||
|
state.userNameType.value = entity.data?.usernameType ?? 0;
|
||||||
resetData();
|
resetData();
|
||||||
update();
|
update();
|
||||||
eventBus.fire(ElectronicKeyListRefreshUI());
|
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||||
|
|||||||
@ -424,10 +424,11 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
|
|||||||
// ),
|
// ),
|
||||||
if (logic.emailOrPhone != null)
|
if (logic.emailOrPhone != null)
|
||||||
OutLineBtn(
|
OutLineBtn(
|
||||||
btnName: logic.emailOrPhone!.contains('@') ? '邮件通知' : '短信通知',
|
btnName: logic.state.userNameType.value == 1 ? '短信通知' : '邮件通知',
|
||||||
onClick: () {
|
onClick: () {
|
||||||
if (logic.emailOrPhone!.contains('@')) {
|
if (logic.state.userNameType.value == 2) {
|
||||||
Get.toNamed(Routers.sendEmailNotificationPage);
|
Get.toNamed(Routers.sendEmailNotificationPage,
|
||||||
|
arguments: <String, String?>{'email': logic.emailOrPhone});
|
||||||
} else {
|
} else {
|
||||||
logic.sendMsg(isPhone: true);
|
logic.sendMsg(isPhone: true);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,6 +32,7 @@ class SendElectronicKeyViewState {
|
|||||||
RxInt createUser = 0.obs; //用户未注册时传1 已注册传0
|
RxInt createUser = 0.obs; //用户未注册时传1 已注册传0
|
||||||
bool isDemoMode = false;
|
bool isDemoMode = false;
|
||||||
RxBool isRequireAuth = false.obs; //是否需要实名认证的必填项
|
RxBool isRequireAuth = false.obs; //是否需要实名认证的必填项
|
||||||
|
RxInt userNameType = 0.obs; //1:手机号 2:邮箱
|
||||||
|
|
||||||
final String timeLimitTips = '接收者在有效期内可以不限次数使用'; //限时
|
final String timeLimitTips = '接收者在有效期内可以不限次数使用'; //限时
|
||||||
final String permanentTips = '接收者可以使用此App开关锁'; //永久
|
final String permanentTips = '接收者可以使用此App开关锁'; //永久
|
||||||
|
|||||||
@ -0,0 +1,79 @@
|
|||||||
|
class SendEmailNotificationEntity {
|
||||||
|
SendEmailNotificationEntity(
|
||||||
|
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||||
|
|
||||||
|
SendEmailNotificationEntity.fromJson(Map<String, dynamic> json) {
|
||||||
|
errorCode = json['errorCode'];
|
||||||
|
description = json['description'];
|
||||||
|
errorMsg = json['errorMsg'];
|
||||||
|
data = json['data'] != null
|
||||||
|
? EmailNotificationData.fromJson(json['data'])
|
||||||
|
: null;
|
||||||
|
}
|
||||||
|
int? errorCode;
|
||||||
|
String? description;
|
||||||
|
String? errorMsg;
|
||||||
|
EmailNotificationData? data;
|
||||||
|
|
||||||
|
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 EmailNotificationData {
|
||||||
|
EmailNotificationData({this.list});
|
||||||
|
|
||||||
|
EmailNotificationData.fromJson(Map<String, dynamic> json) {
|
||||||
|
if (json['list'] != null) {
|
||||||
|
list = <EmailNotificationItem>[];
|
||||||
|
json['list'].forEach((v) {
|
||||||
|
list!.add(EmailNotificationItem.fromJson(v));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<EmailNotificationItem>? list;
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
if (list != null) {
|
||||||
|
data['list'] =
|
||||||
|
list!.map((EmailNotificationItem v) => v.toJson()).toList();
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class EmailNotificationItem {
|
||||||
|
EmailNotificationItem(
|
||||||
|
{this.type, this.name, this.template, this.isUse, this.fee});
|
||||||
|
|
||||||
|
EmailNotificationItem.fromJson(Map<String, dynamic> json) {
|
||||||
|
type = json['type'];
|
||||||
|
name = json['name'];
|
||||||
|
template = json['template'];
|
||||||
|
isUse = json['isUse'];
|
||||||
|
fee = json['fee'];
|
||||||
|
}
|
||||||
|
String? type;
|
||||||
|
String? name;
|
||||||
|
String? template;
|
||||||
|
int? isUse;
|
||||||
|
int? fee;
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['type'] = type;
|
||||||
|
data['name'] = name;
|
||||||
|
data['template'] = template;
|
||||||
|
data['isUse'] = isUse;
|
||||||
|
data['fee'] = fee;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
import 'package:get_storage/get_storage.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_entity.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_state.dart';
|
||||||
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import 'package:star_lock/tools/commonDataManage.dart';
|
||||||
|
|
||||||
|
class SendEmailNotificationLogic extends BaseGetXController {
|
||||||
|
final SendEmailNotificationState state = SendEmailNotificationState();
|
||||||
|
|
||||||
|
//获取电子钥匙通知模板 渠道:1短信 2邮箱
|
||||||
|
Future<void> getKeyNoticeTemplate() async {
|
||||||
|
final SendEmailNotificationEntity entity =
|
||||||
|
await ApiRepository.to.getKeyNoticeTemplate(
|
||||||
|
lockId: CommonDataManage().currentKeyInfo.lockId ?? 0,
|
||||||
|
keyId: CommonDataManage().currentKeyInfo.keyId ?? 0,
|
||||||
|
channelType: 2,
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
state.emailTemplateList.value =
|
||||||
|
entity.data?.list ?? <EmailNotificationItem>[];
|
||||||
|
state.emailTemplateList.refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,6 +1,11 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get_utils/get_utils.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/sendEmailNotification/SendEmailNotification_logic.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_state.dart';
|
||||||
|
import 'package:star_lock/tools/emailNotifyTypeSelectAlert.dart';
|
||||||
|
import 'package:star_lock/tools/pickers/pickers.dart';
|
||||||
|
import 'package:star_lock/tools/pickers/style/default_style.dart';
|
||||||
import 'package:star_lock/translations/trans_lib.dart';
|
import 'package:star_lock/translations/trans_lib.dart';
|
||||||
|
|
||||||
import '../../../../app_settings/app_colors.dart';
|
import '../../../../app_settings/app_colors.dart';
|
||||||
@ -12,42 +17,71 @@ class SendEmailNotificationPage extends StatefulWidget {
|
|||||||
const SendEmailNotificationPage({Key? key}) : super(key: key);
|
const SendEmailNotificationPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<SendEmailNotificationPage> createState() => _SendEmailNotificationPageState();
|
State<SendEmailNotificationPage> createState() =>
|
||||||
|
_SendEmailNotificationPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _SendEmailNotificationPageState extends State<SendEmailNotificationPage> {
|
class _SendEmailNotificationPageState extends State<SendEmailNotificationPage> {
|
||||||
final TextEditingController _emailController = TextEditingController();
|
final SendEmailNotificationLogic logic =
|
||||||
|
Get.put(SendEmailNotificationLogic());
|
||||||
|
final SendEmailNotificationState state =
|
||||||
|
Get.find<SendEmailNotificationLogic>().state;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
|
||||||
|
logic.getKeyNoticeTemplate();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
_emailController.text = "亲爱的用户 \n\n你收到电子钥匙,请试用APP(www.baidu.com)或小程序开锁 \n\n星锁";
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
appBar: TitleAppBar(barTitle: "邮件通知", haveBack: true, backgroundColor: AppColors.mainColor),
|
appBar: TitleAppBar(
|
||||||
|
barTitle: '邮件通知',
|
||||||
|
haveBack: true,
|
||||||
|
backgroundColor: AppColors.mainColor),
|
||||||
body: SingleChildScrollView(
|
body: SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.receiver!.tr,
|
leftTitel: TranslationLoader.lanKeys!.receiver!.tr,
|
||||||
rightTitle: "786612630@qq.com",
|
rightTitle: state.getEmail.value,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
),
|
)),
|
||||||
CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: "类型",
|
leftTitel: '类型',
|
||||||
rightTitle: "个人邮件",
|
rightTitle:
|
||||||
isHaveDirection: true,
|
state.emailNotifyType.value == 1 ? '系统邮件' : '个人邮件',
|
||||||
),
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
EmailNotifyTypeSelectAlert.showEmailNotifyTypeSelectAlert(
|
||||||
|
context, (int value) {
|
||||||
|
state.emailNotifyType.value = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
)),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
CommonItem(leftTitel: "模板", rightTitle: "默认模板", isHaveDirection: true, isHaveLine: true),
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: '模板',
|
||||||
|
rightTitle: state.selectEmailTemplate.value,
|
||||||
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () {
|
||||||
|
openBottomItemSheet(context);
|
||||||
|
},
|
||||||
|
)),
|
||||||
Container(
|
Container(
|
||||||
height: 360.h,
|
height: 360.h,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
padding: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.h, bottom: 20.h),
|
padding: EdgeInsets.only(
|
||||||
|
left: 20.w, right: 20.w, top: 20.h, bottom: 20.h),
|
||||||
child: TextField(
|
child: TextField(
|
||||||
maxLines: 8,
|
maxLines: 8,
|
||||||
maxLength: 1000,
|
maxLength: 1000,
|
||||||
textAlign: TextAlign.start,
|
textAlign: TextAlign.start,
|
||||||
controller: _emailController,
|
controller: state.emailController,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
fontSize: 22.sp,
|
fontSize: 22.sp,
|
||||||
@ -86,7 +120,7 @@ class _SendEmailNotificationPageState extends State<SendEmailNotificationPage> {
|
|||||||
),
|
),
|
||||||
Container(height: 40.h),
|
Container(height: 40.h),
|
||||||
SubmitBtn(
|
SubmitBtn(
|
||||||
btnName: '发送',
|
btnName: '发送'.tr,
|
||||||
fontSize: 28.sp,
|
fontSize: 28.sp,
|
||||||
borderRadius: 20.w,
|
borderRadius: 20.w,
|
||||||
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
|
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
|
||||||
@ -97,4 +131,16 @@ class _SendEmailNotificationPageState extends State<SendEmailNotificationPage> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 底部选择pickerView
|
||||||
|
void openBottomItemSheet(BuildContext context) {
|
||||||
|
final List nameList =
|
||||||
|
state.emailTemplateList.map((item) => item.name!).toList();
|
||||||
|
|
||||||
|
Pickers.showSinglePicker(context,
|
||||||
|
data: nameList,
|
||||||
|
pickerStyle: DefaultPickerStyle(), onConfirm: (p, int position) {
|
||||||
|
state.selectEmailTemplate.value = nameList[position];
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,17 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_entity.dart';
|
||||||
|
|
||||||
|
class SendEmailNotificationState {
|
||||||
|
SendEmailNotificationState() {
|
||||||
|
if (Get.arguments['email'] != null) {
|
||||||
|
getEmail.value = Get.arguments['email'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RxString getEmail = ''.obs;
|
||||||
|
final TextEditingController emailController = TextEditingController();
|
||||||
|
RxInt emailNotifyType = 1.obs; //1 代表系统邮件,2 代表个人邮件
|
||||||
|
RxList emailTemplateList = <EmailNotificationItem>[].obs;
|
||||||
|
RxString selectEmailTemplate = '默认模版'.obs;
|
||||||
|
}
|
||||||
@ -254,4 +254,5 @@ abstract class Api {
|
|||||||
final String deleteTemplateURL = '/v2/service/delete'; //删除模板
|
final String deleteTemplateURL = '/v2/service/delete'; //删除模板
|
||||||
|
|
||||||
final String checkIpURL = '/checkIp/ip';
|
final String checkIpURL = '/checkIp/ip';
|
||||||
|
final String keyNoticeTemplateURL = '/key/getNoticeTemplate'; //获取电子钥匙通知模板
|
||||||
}
|
}
|
||||||
|
|||||||
@ -595,8 +595,9 @@ class ApiProvider extends BaseProvider {
|
|||||||
'lockIds': lockIds,
|
'lockIds': lockIds,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
Future<Response> selectLockList(String searchStr) =>
|
Future<Response> selectLockList(String searchStr) => post(
|
||||||
post(selectLockListURL.toUrl, jsonEncode({
|
selectLockListURL.toUrl,
|
||||||
|
jsonEncode({
|
||||||
'searchStr': searchStr,
|
'searchStr': searchStr,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@ -841,7 +842,8 @@ class ApiProvider extends BaseProvider {
|
|||||||
|
|
||||||
// 获取服务器当前时间
|
// 获取服务器当前时间
|
||||||
Future<Response> getServerDatetimeLoadData(bool isUnShowLoading) =>
|
Future<Response> getServerDatetimeLoadData(bool isUnShowLoading) =>
|
||||||
post(getServerDatetimeUrl.toUrl, jsonEncode({}), isUnShowLoading: isUnShowLoading);
|
post(getServerDatetimeUrl.toUrl, jsonEncode({}),
|
||||||
|
isUnShowLoading: isUnShowLoading);
|
||||||
|
|
||||||
// 锁诊断
|
// 锁诊断
|
||||||
Future<Response> setLockDiagnoseData(
|
Future<Response> setLockDiagnoseData(
|
||||||
@ -2227,10 +2229,22 @@ class ApiProvider extends BaseProvider {
|
|||||||
);
|
);
|
||||||
|
|
||||||
Future<Response<dynamic>> checkIpAction(String ip) => post(
|
Future<Response<dynamic>> checkIpAction(String ip) => post(
|
||||||
checkIpURL.toUrl,
|
checkIpURL.toUrl,
|
||||||
jsonEncode(<String, dynamic>{'ip': ip}),
|
jsonEncode(<String, dynamic>{'ip': ip}),
|
||||||
isUnShowLoading: true,
|
isUnShowLoading: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Future<Response<dynamic>> getKeyNoticeTemplate(
|
||||||
|
int lockId, int keyId, int channelType) =>
|
||||||
|
post(
|
||||||
|
keyNoticeTemplateURL.toUrl,
|
||||||
|
jsonEncode(<String, dynamic>{
|
||||||
|
'lockId': lockId,
|
||||||
|
'keyId': keyId,
|
||||||
|
'channelType': channelType
|
||||||
|
}),
|
||||||
|
isUnShowLoading: true,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ExtensionString on String {
|
extension ExtensionString on String {
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity
|
|||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserList_entity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserList_entity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_entity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/face/addFace/addFace_entity.dart';
|
import 'package:star_lock/main/lockDetail/face/addFace/addFace_entity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/fingerprint/fingerprintList/fingerprint_entity.dart';
|
import 'package:star_lock/main/lockDetail/fingerprint/fingerprintList/fingerprint_entity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/lockSet/basicInformation/basicInformation/KeyDetailEntity.dart';
|
import 'package:star_lock/main/lockDetail/lockSet/basicInformation/basicInformation/KeyDetailEntity.dart';
|
||||||
@ -891,8 +892,10 @@ class ApiRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取服务器当前时间
|
// 获取服务器当前时间
|
||||||
Future<GetServerDatetimeEntity> getServerDatetimeData({bool? isUnShowLoading}) async {
|
Future<GetServerDatetimeEntity> getServerDatetimeData(
|
||||||
final res = await apiProvider.getServerDatetimeLoadData(isUnShowLoading ?? true);
|
{bool? isUnShowLoading}) async {
|
||||||
|
final res =
|
||||||
|
await apiProvider.getServerDatetimeLoadData(isUnShowLoading ?? true);
|
||||||
return GetServerDatetimeEntity.fromJson(res.body);
|
return GetServerDatetimeEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2244,4 +2247,15 @@ class ApiRepository {
|
|||||||
final Response<dynamic> res = await apiProvider.checkIpAction(ip);
|
final Response<dynamic> res = await apiProvider.checkIpAction(ip);
|
||||||
return CheckIPEntity.fromJson(res.body);
|
return CheckIPEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取电子钥匙通知模板
|
||||||
|
Future<SendEmailNotificationEntity> getKeyNoticeTemplate({
|
||||||
|
required int lockId,
|
||||||
|
required int keyId,
|
||||||
|
required int channelType,
|
||||||
|
}) async {
|
||||||
|
final Response<dynamic> res =
|
||||||
|
await apiProvider.getKeyNoticeTemplate(lockId, keyId, channelType);
|
||||||
|
return SendEmailNotificationEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
135
lib/tools/emailNotifyTypeSelectAlert.dart
Normal file
135
lib/tools/emailNotifyTypeSelectAlert.dart
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
|
|
||||||
|
class EmailNotifyTypeSelectAlert extends StatelessWidget {
|
||||||
|
const EmailNotifyTypeSelectAlert({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
// 不需要实现,因为这个组件只是为了显示静态方法的对话框
|
||||||
|
|
||||||
|
throw UnimplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void showEmailNotifyTypeSelectAlert(
|
||||||
|
BuildContext context, Function(int) onSelected) {
|
||||||
|
bool isSystemEmailSelected = true; // 默认选中系统邮件
|
||||||
|
showCupertinoDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return StatefulBuilder(
|
||||||
|
builder: (BuildContext context, StateSetter setState) {
|
||||||
|
return CupertinoAlertDialog(
|
||||||
|
title: const Text('类型选择'),
|
||||||
|
content: Column(
|
||||||
|
children: <Widget>[
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
left: 10.w, top: 8.h, bottom: 16.h, right: 10.w),
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child:
|
||||||
|
Text('请选择要使用哪种类型', style: TextStyle(fontSize: 20.sp)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
isSystemEmailSelected = true;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
Image.asset(
|
||||||
|
isSystemEmailSelected
|
||||||
|
? 'images/icon_round_select.png'
|
||||||
|
: 'images/icon_round_unSelect.png',
|
||||||
|
width: 30.w,
|
||||||
|
height: 30.w,
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.only(left: 10.w),
|
||||||
|
child: Text(
|
||||||
|
'系统邮件(推荐)',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 22.sp, fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.only(top: 6.h, left: 10.w, bottom: 10.h),
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child: Text(
|
||||||
|
'邮件将从软件平台直接发给用户,请根据需要在软件那里购买邮件数量',
|
||||||
|
style: TextStyle(fontSize: 18.sp),
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
isSystemEmailSelected = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
Image.asset(
|
||||||
|
!isSystemEmailSelected
|
||||||
|
? 'images/icon_round_select.png'
|
||||||
|
: 'images/icon_round_unSelect.png',
|
||||||
|
width: 30.w,
|
||||||
|
height: 30.w,
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.only(left: 10.w),
|
||||||
|
child: Text(
|
||||||
|
'个人邮件',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 22.sp, fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.only(top: 6.h, left: 10.w),
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child: Text(
|
||||||
|
'邮件将从你的个人邮箱发给用户',
|
||||||
|
style: TextStyle(fontSize: 18.sp),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
actions: <Widget>[
|
||||||
|
CupertinoDialogAction(
|
||||||
|
onPressed: () {
|
||||||
|
final int selectedType =
|
||||||
|
isSystemEmailSelected ? 1 : 2; // 1 代表系统邮件,2 代表个人邮件
|
||||||
|
onSelected(selectedType);
|
||||||
|
Get.back();
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
'确定'.tr,
|
||||||
|
style: TextStyle(color: AppColors.mainColor),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -10,6 +10,8 @@ import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
|||||||
typedef AuthInfoCallback = void Function(String? idCard, String? name);
|
typedef AuthInfoCallback = void Function(String? idCard, String? name);
|
||||||
|
|
||||||
class ShowCupertinoAlertView {
|
class ShowCupertinoAlertView {
|
||||||
|
bool isSystemEmailSelected = true; // 默认选中系统邮件
|
||||||
|
|
||||||
//微信公众号二维码弹窗
|
//微信公众号二维码弹窗
|
||||||
void showQRImageAlert(BuildContext widgetContext, String qrCodeUrl) {
|
void showQRImageAlert(BuildContext widgetContext, String qrCodeUrl) {
|
||||||
showCupertinoModalPopup(
|
showCupertinoModalPopup(
|
||||||
@ -398,4 +400,114 @@ class ShowCupertinoAlertView {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// //邮件通知类型选择弹窗
|
||||||
|
// void emailNotifyTypeSlectAlert() {
|
||||||
|
// showCupertinoDialog(
|
||||||
|
// context: Get.context!,
|
||||||
|
// builder: (BuildContext context) {
|
||||||
|
// return CupertinoAlertDialog(
|
||||||
|
// title: const Text('类型选择'),
|
||||||
|
// content: Column(
|
||||||
|
// children: <Widget>[
|
||||||
|
// Padding(
|
||||||
|
// padding: EdgeInsets.only(
|
||||||
|
// left: 10.w, top: 8.h, bottom: 16.h, right: 10.w),
|
||||||
|
// child: Align(
|
||||||
|
// alignment: Alignment.centerLeft,
|
||||||
|
// child: Text('请选择要使用哪种类型', style: TextStyle(fontSize: 20.sp)),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// GestureDetector(
|
||||||
|
// onTap: () {
|
||||||
|
// setState(() {
|
||||||
|
// isSystemEmailSelected = true;
|
||||||
|
// });
|
||||||
|
// },
|
||||||
|
// child: Row(
|
||||||
|
// mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
// children: <Widget>[
|
||||||
|
// Image.asset(
|
||||||
|
// isSystemEmailSelected
|
||||||
|
// ? 'images/icon_round_select.png'
|
||||||
|
// : 'images/icon_round_unSelect.png',
|
||||||
|
// width: 30.w,
|
||||||
|
// height: 30.w,
|
||||||
|
// ),
|
||||||
|
// Padding(
|
||||||
|
// padding: EdgeInsets.only(left: 10.w),
|
||||||
|
// child: Text(
|
||||||
|
// '系统邮件(推荐)',
|
||||||
|
// style: TextStyle(
|
||||||
|
// fontSize: 22.sp, fontWeight: FontWeight.bold),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// Padding(
|
||||||
|
// padding: EdgeInsets.only(top: 6.h, left: 10.w, bottom: 10.h),
|
||||||
|
// child: Align(
|
||||||
|
// alignment: Alignment.centerLeft,
|
||||||
|
// child: Text(
|
||||||
|
// '邮件将从软件平台直接发给用户,请根据需要在软件那里购买邮件数量',
|
||||||
|
// style: TextStyle(fontSize: 18.sp),
|
||||||
|
// textAlign: TextAlign.left,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// GestureDetector(
|
||||||
|
// onTap: () {
|
||||||
|
// setState(() {
|
||||||
|
// isSystemEmailSelected = false;
|
||||||
|
// });
|
||||||
|
// },
|
||||||
|
// child: Row(
|
||||||
|
// mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
// children: <Widget>[
|
||||||
|
// Image.asset(
|
||||||
|
// !isSystemEmailSelected
|
||||||
|
// ? 'images/icon_round_select.png'
|
||||||
|
// : 'images/icon_round_unSelect.png',
|
||||||
|
// width: 30.w,
|
||||||
|
// height: 30.w,
|
||||||
|
// ),
|
||||||
|
// Padding(
|
||||||
|
// padding: EdgeInsets.only(left: 10.w),
|
||||||
|
// child: Text(
|
||||||
|
// '个人邮件',
|
||||||
|
// style: TextStyle(
|
||||||
|
// fontSize: 22.sp, fontWeight: FontWeight.bold),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// Padding(
|
||||||
|
// padding: EdgeInsets.only(top: 6.h, left: 10.w),
|
||||||
|
// child: Align(
|
||||||
|
// alignment: Alignment.centerLeft,
|
||||||
|
// child: Text(
|
||||||
|
// '邮件将从你的个人邮箱发给用户',
|
||||||
|
// style: TextStyle(fontSize: 18.sp),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// actions: <Widget>[
|
||||||
|
// CupertinoDialogAction(
|
||||||
|
// onPressed: Get.back,
|
||||||
|
// child: Text(
|
||||||
|
// '确定'.tr,
|
||||||
|
// style: TextStyle(color: AppColors.mainColor),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// );
|
||||||
|
// },
|
||||||
|
// );
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user