1,新增获取邮件模版列表API对接及逻辑处理
2,新增获取默认邮件模版(电子钥匙、密码类型)API对接
This commit is contained in:
parent
9ed5160617
commit
9158ce71e7
@ -863,6 +863,7 @@
|
|||||||
"六": "Sat",
|
"六": "Sat",
|
||||||
"日": "Sun",
|
"日": "Sun",
|
||||||
"新建短信模版":"New SMS template",
|
"新建短信模版":"New SMS template",
|
||||||
|
"新建邮件模版":"New email template",
|
||||||
"自定义短信模版":"Custom SMS template",
|
"自定义短信模版":"Custom SMS template",
|
||||||
"自定义邮件模版":"Custom email template",
|
"自定义邮件模版":"Custom email template",
|
||||||
"名称":"Name",
|
"名称":"Name",
|
||||||
|
|||||||
@ -895,6 +895,7 @@
|
|||||||
"六":"六",
|
"六":"六",
|
||||||
"日":"日",
|
"日":"日",
|
||||||
"新建短信模版":"新建短信模版",
|
"新建短信模版":"新建短信模版",
|
||||||
|
"新建邮件模版":"新建邮件模版",
|
||||||
"自定义短信模版":"自定义短信模版",
|
"自定义短信模版":"自定义短信模版",
|
||||||
"自定义邮件模版":"自定义邮件模版",
|
"自定义邮件模版":"自定义邮件模版",
|
||||||
"名称":"名称",
|
"名称":"名称",
|
||||||
|
|||||||
@ -863,6 +863,7 @@
|
|||||||
"六": "六",
|
"六": "六",
|
||||||
"日": "日",
|
"日": "日",
|
||||||
"新建短信模版":"新建短信模版",
|
"新建短信模版":"新建短信模版",
|
||||||
|
"新建邮件模版":"新建邮件模版",
|
||||||
"自定义短信模版":"自定义短信模版",
|
"自定义短信模版":"自定义短信模版",
|
||||||
"自定义邮件模版":"自定义邮件模版",
|
"自定义邮件模版":"自定义邮件模版",
|
||||||
"名称":"名称",
|
"名称":"名称",
|
||||||
|
|||||||
@ -111,13 +111,9 @@ class _ValueAddedServicesNoteAndEmailDetailPageState
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (type == 1) {
|
Navigator.pushNamed(
|
||||||
Navigator.pushNamed(
|
context, Routers.customSMSTemplateListPage,
|
||||||
context, Routers.customSMSTemplateListPage);
|
arguments: <String, int>{'type': type});
|
||||||
} else {
|
|
||||||
Navigator.pushNamed(context,
|
|
||||||
Routers.valueAddedServicesListEmailTemplatePage);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
child: Row(
|
child: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
|||||||
@ -46,6 +46,8 @@ class SMSTemplateData {
|
|||||||
String? tips = '';
|
String? tips = '';
|
||||||
int? id;
|
int? id;
|
||||||
String? name;
|
String? name;
|
||||||
|
int? type;
|
||||||
|
bool? isUpdate = false;
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
|||||||
@ -14,12 +14,11 @@ class NewSMSTemplateLogic extends BaseGetXController {
|
|||||||
|
|
||||||
//获取默认模板-- 1:电子钥匙 2:密码
|
//获取默认模板-- 1:电子钥匙 2:密码
|
||||||
Future<void> getDefaultTemplate() async {
|
Future<void> getDefaultTemplate() async {
|
||||||
final NewSMSTemplateEntity entity =
|
final NewSMSTemplateEntity entity = await ApiRepository.to
|
||||||
await ApiRepository.to.getDefaultTemplate(type: 1);
|
.getDefaultTemplate(type: state.currentTemplate.value.type ?? 0);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
state.templateList.value = entity.dataList ?? <SMSTemplateData>[];
|
state.templateList.value = entity.dataList ?? <SMSTemplateData>[];
|
||||||
if (state.templateList.isNotEmpty) {
|
if (state.templateList.isNotEmpty) {
|
||||||
// state.templateTypeText.value = state.templateList[0].name ?? '';
|
|
||||||
state.currentTemplate.value = state.templateList.firstWhere(
|
state.currentTemplate.value = state.templateList.firstWhere(
|
||||||
(SMSTemplateData element) =>
|
(SMSTemplateData element) =>
|
||||||
element.name == state.templateList[0].name,
|
element.name == state.templateList[0].name,
|
||||||
@ -29,14 +28,14 @@ class NewSMSTemplateLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取默认模板-- 1:电子钥匙 2:密码
|
//新建模板-- 1:电子钥匙 2:密码
|
||||||
Future<void> addSMSTemplate() async {
|
Future<void> addSMSTemplate() async {
|
||||||
if (state.templateNameTf.text.isEmpty) {
|
if (state.templateNameTf.text.isEmpty) {
|
||||||
showToast('请输入模板名称');
|
showToast('请输入模板名称');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final LoginEntity entity = await ApiRepository.to.addSMSTemplate(
|
final LoginEntity entity = await ApiRepository.to.addTemplateService(
|
||||||
type: 1,
|
type: state.templateType.value,
|
||||||
name: state.templateNameTf.text,
|
name: state.templateNameTf.text,
|
||||||
fixedKey: state.currentTemplate.value.fixedKey ?? '',
|
fixedKey: state.currentTemplate.value.fixedKey ?? '',
|
||||||
contentType: state.currentTemplate.value.contentType ?? 0,
|
contentType: state.currentTemplate.value.contentType ?? 0,
|
||||||
@ -200,7 +199,7 @@ class NewSMSTemplateLogic extends BaseGetXController {
|
|||||||
Future<void> onReady() async {
|
Future<void> onReady() async {
|
||||||
super.onReady();
|
super.onReady();
|
||||||
|
|
||||||
if (state.isUpdate.value == false) {
|
if (state.currentTemplate.value.isUpdate == false) {
|
||||||
getDefaultTemplate();
|
getDefaultTemplate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,7 +28,7 @@ class _NewSMSTemplatePageState extends State<NewSMSTemplatePage> {
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
barTitle: '新建短信模版'.tr,
|
barTitle: state.templateType.value == 1 ? '新建短信模版'.tr : '新建邮件模版'.tr,
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor,
|
backgroundColor: AppColors.mainColor,
|
||||||
),
|
),
|
||||||
@ -46,7 +46,7 @@ class _NewSMSTemplatePageState extends State<NewSMSTemplatePage> {
|
|||||||
child: SubmitBtn(
|
child: SubmitBtn(
|
||||||
btnName: TranslationLoader.lanKeys!.save!.tr,
|
btnName: TranslationLoader.lanKeys!.save!.tr,
|
||||||
onClick: () {
|
onClick: () {
|
||||||
if (state.isUpdate.value == true) {
|
if (state.currentTemplate.value.isUpdate == true) {
|
||||||
logic.updateTemplateInfo();
|
logic.updateTemplateInfo();
|
||||||
} else {
|
} else {
|
||||||
logic.addSMSTemplate();
|
logic.addSMSTemplate();
|
||||||
|
|||||||
@ -9,10 +9,10 @@ class NewSMSTemplateState {
|
|||||||
final Map map = Get.arguments;
|
final Map map = Get.arguments;
|
||||||
currentTemplate.value = map['currentTemplate'];
|
currentTemplate.value = map['currentTemplate'];
|
||||||
currentTemplate.refresh();
|
currentTemplate.refresh();
|
||||||
isUpdate.value = true;
|
|
||||||
templateNameTf.text = currentTemplate.value.name ?? '';
|
templateNameTf.text = currentTemplate.value.name ?? '';
|
||||||
templateOneTf.text = currentTemplate.value.regards ?? '';
|
templateOneTf.text = currentTemplate.value.regards ?? '';
|
||||||
templateTwoTf.text = currentTemplate.value.tips ?? '';
|
templateTwoTf.text = currentTemplate.value.tips ?? '';
|
||||||
|
templateType.value = currentTemplate.value.type ?? 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ class NewSMSTemplateState {
|
|||||||
final TextStyle highStyle =
|
final TextStyle highStyle =
|
||||||
TextStyle(color: const Color(0xFFEEDFA8), fontSize: 20.sp);
|
TextStyle(color: const Color(0xFFEEDFA8), fontSize: 20.sp);
|
||||||
|
|
||||||
//默认样式
|
//默认样式
|
||||||
final TextStyle defaultStyle =
|
final TextStyle defaultStyle =
|
||||||
TextStyle(color: Colors.black, fontSize: 20.sp);
|
TextStyle(color: Colors.black, fontSize: 20.sp);
|
||||||
|
|
||||||
@ -30,9 +30,7 @@ class NewSMSTemplateState {
|
|||||||
|
|
||||||
RxBool isVip = false.obs;
|
RxBool isVip = false.obs;
|
||||||
RxList<SMSTemplateData> templateList = <SMSTemplateData>[].obs;
|
RxList<SMSTemplateData> templateList = <SMSTemplateData>[].obs;
|
||||||
// RxString templateTypeText = '电子钥匙'.tr.obs;
|
|
||||||
// RxString templateContentText = ''.obs; //模版内容
|
|
||||||
Rx<SMSTemplateData> currentTemplate = SMSTemplateData().obs;
|
Rx<SMSTemplateData> currentTemplate = SMSTemplateData().obs;
|
||||||
RxBool isShowDate = false.obs;
|
RxBool isShowDate = false.obs;
|
||||||
RxBool isUpdate = false.obs;
|
RxInt templateType = 0.obs;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,7 +21,9 @@ class CustomSMSTemplateListLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
final CustomSMSTemplateListEntity entity = await ApiRepository.to
|
final CustomSMSTemplateListEntity entity = await ApiRepository.to
|
||||||
.getSMSTemplateList(
|
.getSMSTemplateList(
|
||||||
type: 1, pageNo: pageNo, pageSize: int.parse(pageSize));
|
type: state.type.value,
|
||||||
|
pageNo: pageNo,
|
||||||
|
pageSize: int.parse(pageSize));
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
state.smsTemplateList.value =
|
state.smsTemplateList.value =
|
||||||
entity.data?.list ?? <CustomSMSTemplateItem>[];
|
entity.data?.list ?? <CustomSMSTemplateItem>[];
|
||||||
|
|||||||
@ -41,7 +41,7 @@ class _CustomSMSTemplateListPageState extends State<CustomSMSTemplateListPage> {
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
barTitle: '自定义短信模版'.tr,
|
barTitle: state.type.value == 1 ? '自定义短信模版'.tr : '自定义邮件模版'.tr,
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor),
|
backgroundColor: AppColors.mainColor),
|
||||||
body: EasyRefreshTool(
|
body: EasyRefreshTool(
|
||||||
@ -65,7 +65,15 @@ class _CustomSMSTemplateListPageState extends State<CustomSMSTemplateListPage> {
|
|||||||
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
|
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
|
||||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||||
onClick: () async {
|
onClick: () async {
|
||||||
final result = await Get.toNamed(Routers.newSMSTemplatePage);
|
final SMSTemplateData templateData = SMSTemplateData();
|
||||||
|
templateData.type = state.type.value;
|
||||||
|
templateData.isUpdate = false;
|
||||||
|
templateData.typeName =
|
||||||
|
templateData.contentType == 1 ? '电子钥匙' : '密码';
|
||||||
|
final result = await Get.toNamed(Routers.newSMSTemplatePage,
|
||||||
|
arguments: <String, SMSTemplateData>{
|
||||||
|
'currentTemplate': templateData
|
||||||
|
});
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
logic.getSMSTemplateListRequest(isRefresh: true);
|
logic.getSMSTemplateListRequest(isRefresh: true);
|
||||||
}
|
}
|
||||||
@ -195,6 +203,8 @@ class _CustomSMSTemplateListPageState extends State<CustomSMSTemplateListPage> {
|
|||||||
templateData.template = itemData.template;
|
templateData.template = itemData.template;
|
||||||
templateData.contentType = itemData.contentType;
|
templateData.contentType = itemData.contentType;
|
||||||
templateData.typeName = templateData.contentType == 1 ? '电子钥匙' : '密码';
|
templateData.typeName = templateData.contentType == 1 ? '电子钥匙' : '密码';
|
||||||
|
templateData.type = itemData.type;
|
||||||
|
templateData.isUpdate = true;
|
||||||
final result = await Get.toNamed(Routers.newSMSTemplatePage,
|
final result = await Get.toNamed(Routers.newSMSTemplatePage,
|
||||||
arguments: <String, SMSTemplateData>{
|
arguments: <String, SMSTemplateData>{
|
||||||
'currentTemplate': templateData
|
'currentTemplate': templateData
|
||||||
|
|||||||
@ -4,6 +4,11 @@ import 'package:get/get.dart';
|
|||||||
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_entity.dart';
|
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_entity.dart';
|
||||||
|
|
||||||
class CustomSMSTemplateListState {
|
class CustomSMSTemplateListState {
|
||||||
|
CustomSMSTemplateListState() {
|
||||||
|
if (Get.arguments != null) {
|
||||||
|
type.value = Get.arguments['type'];
|
||||||
|
}
|
||||||
|
}
|
||||||
//高亮样式
|
//高亮样式
|
||||||
final TextStyle highStyle =
|
final TextStyle highStyle =
|
||||||
TextStyle(color: const Color(0xFFEEDFA8), fontSize: 20.sp);
|
TextStyle(color: const Color(0xFFEEDFA8), fontSize: 20.sp);
|
||||||
@ -14,4 +19,5 @@ class CustomSMSTemplateListState {
|
|||||||
|
|
||||||
RxBool isVip = false.obs;
|
RxBool isVip = false.obs;
|
||||||
RxList<CustomSMSTemplateItem> smsTemplateList = <CustomSMSTemplateItem>[].obs;
|
RxList<CustomSMSTemplateItem> smsTemplateList = <CustomSMSTemplateItem>[].obs;
|
||||||
|
RxInt type = 0.obs;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -243,12 +243,12 @@ abstract class Api {
|
|||||||
final String getNoticeTemplateURL = '/key/getNoticeTemplate'; //获取短信或者邮箱模板
|
final String getNoticeTemplateURL = '/key/getNoticeTemplate'; //获取短信或者邮箱模板
|
||||||
final String appGetAppInfoURL = '/app/getAppInfo'; //获取APP基本信息
|
final String appGetAppInfoURL = '/app/getAppInfo'; //获取APP基本信息
|
||||||
final String appGetFwVersionURL = '/app/getFwVersion'; //获取固件信息
|
final String appGetFwVersionURL = '/app/getFwVersion'; //获取固件信息
|
||||||
final String smsTemplateListURL = '/v2/service/listSmsTemplate'; //获取短信模板列表
|
final String smsTemplateListURL = '/v2/service/listTemplate'; //获取短信模板列表
|
||||||
final String emailTemplateListURL =
|
final String emailTemplateListURL =
|
||||||
'/v2/service/listEmailTemplate'; //获取邮件模板列表
|
'/v2/service/listEmailTemplate'; //获取邮件模板列表
|
||||||
final String getDefaultTemplateURL =
|
final String getDefaultTemplateURL =
|
||||||
'/v2/service/getDefaultTemplate'; //获取默认模板
|
'/v2/service/getDefaultTemplate'; //获取默认模板
|
||||||
final String addSMSTemplateURL = '/v2/service/addSmsTemplate'; //添加短信模板
|
final String addTemplateServiceURL = '/v2/service/addTemplate'; //添加短信模板
|
||||||
final String keydetail = ' /key/detail'; //获取钥匙详情
|
final String keydetail = ' /key/detail'; //获取钥匙详情
|
||||||
final String updateTemplateInfoURL = '/v2/service/update'; //更新模板信息
|
final String updateTemplateInfoURL = '/v2/service/update'; //更新模板信息
|
||||||
final String deleteTemplateURL = '/v2/service/delete'; //删除模板
|
final String deleteTemplateURL = '/v2/service/delete'; //删除模板
|
||||||
|
|||||||
@ -614,8 +614,13 @@ class ApiProvider extends BaseProvider {
|
|||||||
post(deleteElectronicKeyURL.toUrl,
|
post(deleteElectronicKeyURL.toUrl,
|
||||||
jsonEncode({'uid': uid, 'includeUnderlings': includeUnderlings}));
|
jsonEncode({'uid': uid, 'includeUnderlings': includeUnderlings}));
|
||||||
|
|
||||||
Future<Response> updateAdministrator(String uid, String keyName,
|
Future<Response> updateAdministrator(
|
||||||
String endDate, String startDate, int isOnlyManageSelf, int keyType) =>
|
String uid,
|
||||||
|
String keyName,
|
||||||
|
String endDate,
|
||||||
|
String startDate,
|
||||||
|
int isOnlyManageSelf,
|
||||||
|
int keyType) =>
|
||||||
post(
|
post(
|
||||||
updateAdministratorURL.toUrl,
|
updateAdministratorURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
@ -2185,10 +2190,10 @@ class ApiProvider extends BaseProvider {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// 添加短信模板
|
// 添加短信模板
|
||||||
Future<Response<dynamic>> addSMSTemplate(int type, String name,
|
Future<Response<dynamic>> addTemplateService(int type, String name,
|
||||||
int contentType, String regards, String tips, String fixedKey) =>
|
int contentType, String regards, String tips, String fixedKey) =>
|
||||||
post(
|
post(
|
||||||
addSMSTemplateURL.toUrl,
|
addTemplateServiceURL.toUrl,
|
||||||
jsonEncode(<String, dynamic>{
|
jsonEncode(<String, dynamic>{
|
||||||
'type': type,
|
'type': type,
|
||||||
'name': name,
|
'name': name,
|
||||||
|
|||||||
@ -644,14 +644,14 @@ class ApiRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//更新授权管理员
|
//更新授权管理员
|
||||||
Future<AdministratorDetailEntity> updateAdministrator(
|
Future<AdministratorDetailEntity> updateAdministrator({
|
||||||
{required String uid,
|
required String uid,
|
||||||
required String keyName,
|
required String keyName,
|
||||||
required String endDate,
|
required String endDate,
|
||||||
required String startDate,
|
required String startDate,
|
||||||
required int isOnlyManageSelf,
|
required int isOnlyManageSelf,
|
||||||
required int keyType,
|
required int keyType,
|
||||||
}) async {
|
}) async {
|
||||||
final res = await apiProvider.updateAdministrator(
|
final res = await apiProvider.updateAdministrator(
|
||||||
uid, keyName, endDate, startDate, isOnlyManageSelf, keyType);
|
uid, keyName, endDate, startDate, isOnlyManageSelf, keyType);
|
||||||
return AdministratorDetailEntity.fromJson(res.body);
|
return AdministratorDetailEntity.fromJson(res.body);
|
||||||
@ -2209,14 +2209,14 @@ class ApiRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 添加短信模板
|
// 添加短信模板
|
||||||
Future<LoginEntity> addSMSTemplate(
|
Future<LoginEntity> addTemplateService(
|
||||||
{required int type,
|
{required int type,
|
||||||
required String name,
|
required String name,
|
||||||
required int contentType,
|
required int contentType,
|
||||||
required String regards,
|
required String regards,
|
||||||
required String tips,
|
required String tips,
|
||||||
required String fixedKey}) async {
|
required String fixedKey}) async {
|
||||||
final Response<dynamic> res = await apiProvider.addSMSTemplate(
|
final Response<dynamic> res = await apiProvider.addTemplateService(
|
||||||
type, name, contentType, regards, tips, fixedKey);
|
type, name, contentType, regards, tips, fixedKey);
|
||||||
return LoginEntity.fromJson(res.body);
|
return LoginEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user