新增更新模版信息接口对接且兼容新建模版逻辑
This commit is contained in:
parent
088331a847
commit
2df1d2dacc
@ -357,10 +357,10 @@ abstract class Routers {
|
|||||||
'/ValueAddedServicesHighFunctionPage'; // 增值服务-高级功能
|
'/ValueAddedServicesHighFunctionPage'; // 增值服务-高级功能
|
||||||
static const String valueAddedServicesBuyPage =
|
static const String valueAddedServicesBuyPage =
|
||||||
'/ValueAddedServicesBuyPage'; // 增值服务-购买服务
|
'/ValueAddedServicesBuyPage'; // 增值服务-购买服务
|
||||||
static const String valueAddedServicesListSMSTemplatePage =
|
static const String customSMSTemplateListPage =
|
||||||
'/ValueAddedServicesListSMSTemplatePage'; // 增值服务-短信模版列表
|
'/CustomSMSTemplateListPage'; // 增值服务-短信模版列表
|
||||||
static const String valueAddedServicesAddSMSTemplatePage =
|
static const String newSMSTemplatePage =
|
||||||
'/valueAddedServicesAddSMSTemplatePage'; // 增值服务-自定义短信模版
|
'/NewSMSTemplatePage'; // 增值服务-自定义短信模版
|
||||||
static const String valueAddedServicesListEmailTemplatePage =
|
static const String valueAddedServicesListEmailTemplatePage =
|
||||||
'/ValueAddedServicesListEmailTemplatePage'; // 增值服务-邮箱模版列表
|
'/ValueAddedServicesListEmailTemplatePage'; // 增值服务-邮箱模版列表
|
||||||
static const String valueAddedServicesAddEmailTemplatePage =
|
static const String valueAddedServicesAddEmailTemplatePage =
|
||||||
@ -867,11 +867,11 @@ abstract class AppRouters {
|
|||||||
page: () => const ValueAddedServicesHighFunctionPage(),
|
page: () => const ValueAddedServicesHighFunctionPage(),
|
||||||
),
|
),
|
||||||
GetPage<dynamic>(
|
GetPage<dynamic>(
|
||||||
name: Routers.valueAddedServicesListSMSTemplatePage,
|
name: Routers.customSMSTemplateListPage,
|
||||||
page: () => const CustomSMSTemplateListPage(),
|
page: () => const CustomSMSTemplateListPage(),
|
||||||
),
|
),
|
||||||
GetPage<dynamic>(
|
GetPage<dynamic>(
|
||||||
name: Routers.valueAddedServicesAddSMSTemplatePage,
|
name: Routers.newSMSTemplatePage,
|
||||||
page: () => const NewSMSTemplatePage(),
|
page: () => const NewSMSTemplatePage(),
|
||||||
),
|
),
|
||||||
GetPage<dynamic>(
|
GetPage<dynamic>(
|
||||||
|
|||||||
@ -24,7 +24,7 @@ class _ValueAddedServicesListEmailTemplatePageState
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
barTitle: TranslationLoader.lanKeys!.customMailTemplate!.tr,
|
barTitle: '自定义邮件模版'.tr,
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor),
|
backgroundColor: AppColors.mainColor),
|
||||||
body: Column(
|
body: Column(
|
||||||
|
|||||||
@ -112,8 +112,8 @@ class _ValueAddedServicesNoteAndEmailDetailPageState
|
|||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (type == 1) {
|
if (type == 1) {
|
||||||
Navigator.pushNamed(context,
|
Navigator.pushNamed(
|
||||||
Routers.valueAddedServicesListSMSTemplatePage);
|
context, Routers.customSMSTemplateListPage);
|
||||||
} else {
|
} else {
|
||||||
Navigator.pushNamed(context,
|
Navigator.pushNamed(context,
|
||||||
Routers.valueAddedServicesListEmailTemplatePage);
|
Routers.valueAddedServicesListEmailTemplatePage);
|
||||||
@ -130,9 +130,7 @@ class _ValueAddedServicesNoteAndEmailDetailPageState
|
|||||||
height: 36.w,
|
height: 36.w,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
(type == 1)
|
(type == 1) ? '自定义短信模版'.tr : '自定义邮件模版'.tr,
|
||||||
? '自定义短信模版'.tr
|
|
||||||
: TranslationLoader.lanKeys!.customMailTemplate!.tr,
|
|
||||||
style: TextStyle(fontSize: 24.sp),
|
style: TextStyle(fontSize: 24.sp),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -30,22 +30,27 @@ class NewSMSTemplateEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class SMSTemplateData {
|
class SMSTemplateData {
|
||||||
SMSTemplateData({this.contentType, this.name, this.template, this.fixedKey});
|
SMSTemplateData(
|
||||||
|
{this.contentType, this.typeName, this.template, this.fixedKey});
|
||||||
SMSTemplateData.fromJson(Map<String, dynamic> json) {
|
SMSTemplateData.fromJson(Map<String, dynamic> json) {
|
||||||
contentType = json['content_type'];
|
contentType = json['content_type'];
|
||||||
name = json['name'];
|
typeName = json['typeName'];
|
||||||
template = json['template'];
|
template = json['template'];
|
||||||
fixedKey = json['fixed_key'];
|
fixedKey = json['fixed_key'];
|
||||||
}
|
}
|
||||||
int? contentType;
|
int? contentType;
|
||||||
String? name;
|
String? typeName;
|
||||||
String? template;
|
String? template;
|
||||||
String? fixedKey;
|
String? fixedKey;
|
||||||
|
String? regards = '';
|
||||||
|
String? tips = '';
|
||||||
|
int? id;
|
||||||
|
String? name;
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
data['content_type'] = contentType;
|
data['content_type'] = contentType;
|
||||||
data['name'] = name;
|
data['typeName'] = typeName;
|
||||||
data['template'] = template;
|
data['template'] = template;
|
||||||
data['fixed_key'] = fixedKey;
|
data['fixed_key'] = fixedKey;
|
||||||
return data;
|
return data;
|
||||||
|
|||||||
@ -19,12 +19,11 @@ class NewSMSTemplateLogic extends BaseGetXController {
|
|||||||
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.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.templateTypeText.value,
|
element.name == state.templateList[0].name,
|
||||||
);
|
);
|
||||||
state.templateTypeText.refresh();
|
|
||||||
state.currentTemplate.refresh();
|
state.currentTemplate.refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -45,7 +44,19 @@ class NewSMSTemplateLogic extends BaseGetXController {
|
|||||||
tips: state.templateTwoTf.text);
|
tips: state.templateTwoTf.text);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast('添加成功');
|
showToast('添加成功');
|
||||||
Get.back();
|
Get.back(result: true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> updateTemplateInfo() async {
|
||||||
|
final LoginEntity entity = await ApiRepository.to.updateTemplateInfo(
|
||||||
|
id: state.currentTemplate.value.id ?? 0,
|
||||||
|
name: state.templateNameTf.text,
|
||||||
|
regards: state.templateOneTf.text,
|
||||||
|
tips: state.templateTwoTf.text);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
showToast('修改成功');
|
||||||
|
Get.back(result: true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,5 +199,9 @@ class NewSMSTemplateLogic extends BaseGetXController {
|
|||||||
@override
|
@override
|
||||||
Future<void> onReady() async {
|
Future<void> onReady() async {
|
||||||
super.onReady();
|
super.onReady();
|
||||||
|
|
||||||
|
if (state.isUpdate.value == false) {
|
||||||
|
getDefaultTemplate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,12 +23,6 @@ class _NewSMSTemplatePageState extends State<NewSMSTemplatePage> {
|
|||||||
final NewSMSTemplateLogic logic = Get.put(NewSMSTemplateLogic());
|
final NewSMSTemplateLogic logic = Get.put(NewSMSTemplateLogic());
|
||||||
final NewSMSTemplateState state = Get.find<NewSMSTemplateLogic>().state;
|
final NewSMSTemplateState state = Get.find<NewSMSTemplateLogic>().state;
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
logic.getDefaultTemplate();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@ -52,7 +46,11 @@ class _NewSMSTemplatePageState extends State<NewSMSTemplatePage> {
|
|||||||
child: SubmitBtn(
|
child: SubmitBtn(
|
||||||
btnName: TranslationLoader.lanKeys!.save!.tr,
|
btnName: TranslationLoader.lanKeys!.save!.tr,
|
||||||
onClick: () {
|
onClick: () {
|
||||||
logic.addSMSTemplate();
|
if (state.isUpdate.value == true) {
|
||||||
|
logic.updateTemplateInfo();
|
||||||
|
} else {
|
||||||
|
logic.addSMSTemplate();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -79,7 +77,7 @@ class _NewSMSTemplatePageState extends State<NewSMSTemplatePage> {
|
|||||||
Obx(
|
Obx(
|
||||||
() => CommonItem(
|
() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.type!.tr,
|
leftTitel: TranslationLoader.lanKeys!.type!.tr,
|
||||||
rightTitle: state.templateTypeText.value,
|
rightTitle: state.currentTemplate.value.typeName ?? '',
|
||||||
isHaveLine: false,
|
isHaveLine: false,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: _showSelectTemplateType,
|
action: _showSelectTemplateType,
|
||||||
@ -184,7 +182,7 @@ class _NewSMSTemplatePageState extends State<NewSMSTemplatePage> {
|
|||||||
padding: EdgeInsets.symmetric(horizontal: 25.w, vertical: 10.h),
|
padding: EdgeInsets.symmetric(horizontal: 25.w, vertical: 10.h),
|
||||||
child: Obx(() => RichText(
|
child: Obx(() => RichText(
|
||||||
text: TextSpan(
|
text: TextSpan(
|
||||||
children: state.templateTypeText.value == '电子钥匙'
|
children: state.currentTemplate.value.typeName == '电子钥匙'
|
||||||
? logic.buildElectronicKeySpan(isPreview: isPreview)
|
? logic.buildElectronicKeySpan(isPreview: isPreview)
|
||||||
: logic.buildPasswordSpan(isPreview: isPreview),
|
: logic.buildPasswordSpan(isPreview: isPreview),
|
||||||
),
|
),
|
||||||
@ -213,7 +211,9 @@ class _NewSMSTemplatePageState extends State<NewSMSTemplatePage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
onChanged: (String value) {
|
onChanged: (String value) {
|
||||||
controller.text = value;
|
setState(() {
|
||||||
|
controller.text = value;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -230,6 +230,7 @@ class _NewSMSTemplatePageState extends State<NewSMSTemplatePage> {
|
|||||||
controller: tfController,
|
controller: tfController,
|
||||||
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: 8.0),
|
contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
|
||||||
hintText: tfStr,
|
hintText: tfStr,
|
||||||
@ -245,7 +246,7 @@ class _NewSMSTemplatePageState extends State<NewSMSTemplatePage> {
|
|||||||
|
|
||||||
void _showSelectTemplateType() {
|
void _showSelectTemplateType() {
|
||||||
final List<String> titleList = state.templateList
|
final List<String> titleList = state.templateList
|
||||||
.map((SMSTemplateData template) => template.name ?? '')
|
.map((SMSTemplateData template) => template.typeName ?? '')
|
||||||
.toList();
|
.toList();
|
||||||
ShowBottomSheetTool().showSingleRowPicker(
|
ShowBottomSheetTool().showSingleRowPicker(
|
||||||
context,
|
context,
|
||||||
@ -255,9 +256,8 @@ class _NewSMSTemplatePageState extends State<NewSMSTemplatePage> {
|
|||||||
sureTitle: TranslationLoader.lanKeys!.sure!.tr,
|
sureTitle: TranslationLoader.lanKeys!.sure!.tr,
|
||||||
data: titleList,
|
data: titleList,
|
||||||
clickCallBack: (int index, Object str) {
|
clickCallBack: (int index, Object str) {
|
||||||
state.templateTypeText.value = str.toString();
|
|
||||||
state.templateTypeText.refresh();
|
|
||||||
state.currentTemplate.value = state.templateList[index];
|
state.currentTemplate.value = state.templateList[index];
|
||||||
|
state.currentTemplate.value.typeName = str.toString();
|
||||||
state.currentTemplate.refresh();
|
state.currentTemplate.refresh();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@ -4,6 +4,18 @@ import 'package:get/get.dart';
|
|||||||
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_entity.dart';
|
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_entity.dart';
|
||||||
|
|
||||||
class NewSMSTemplateState {
|
class NewSMSTemplateState {
|
||||||
|
NewSMSTemplateState() {
|
||||||
|
if (Get.arguments != null) {
|
||||||
|
final Map map = Get.arguments;
|
||||||
|
currentTemplate.value = map['currentTemplate'];
|
||||||
|
currentTemplate.refresh();
|
||||||
|
isUpdate.value = true;
|
||||||
|
templateNameTf.text = currentTemplate.value.name ?? '';
|
||||||
|
templateOneTf.text = currentTemplate.value.regards ?? '';
|
||||||
|
templateTwoTf.text = currentTemplate.value.tips ?? '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//高亮样式
|
//高亮样式
|
||||||
final TextStyle highStyle =
|
final TextStyle highStyle =
|
||||||
TextStyle(color: const Color(0xFFEEDFA8), fontSize: 20.sp);
|
TextStyle(color: const Color(0xFFEEDFA8), fontSize: 20.sp);
|
||||||
@ -12,46 +24,15 @@ class NewSMSTemplateState {
|
|||||||
final TextStyle defaultStyle =
|
final TextStyle defaultStyle =
|
||||||
TextStyle(color: Colors.black, fontSize: 20.sp);
|
TextStyle(color: Colors.black, fontSize: 20.sp);
|
||||||
|
|
||||||
//预览样式封装-密码
|
|
||||||
// late InlineSpan passwardSpan = TextSpan(children: <InlineSpan>[
|
|
||||||
// TextSpan(
|
|
||||||
// text:
|
|
||||||
// '${TranslationLoader.lanKeys!.hello!.tr},\n${TranslationLoader.lanKeys!.yourRoomIs!.tr}:',
|
|
||||||
// style: defaultStyle),
|
|
||||||
// TextSpan(text: '201', style: highStyle),
|
|
||||||
// TextSpan(
|
|
||||||
// text: ' ${TranslationLoader.lanKeys!.theCodeToOpenTheDoorIs!.tr}: ',
|
|
||||||
// style: defaultStyle),
|
|
||||||
// TextSpan(text: '332211\n', style: highStyle),
|
|
||||||
// TextSpan(
|
|
||||||
// text: '${TranslationLoader.lanKeys!.periodValidity!.tr}: ',
|
|
||||||
// style: defaultStyle),
|
|
||||||
// TextSpan(text: '2021.12.11 12:00 - 2021.12.12 13:00。\n', style: highStyle),
|
|
||||||
// TextSpan(
|
|
||||||
// text: TranslationLoader.lanKeys!.templateTip1!.tr, style: defaultStyle),
|
|
||||||
// ]);
|
|
||||||
|
|
||||||
//预览样式封装-电子钥匙
|
|
||||||
// late InlineSpan electronicKeySpan = TextSpan(children: <InlineSpan>[
|
|
||||||
// TextSpan(
|
|
||||||
// text:
|
|
||||||
// '${TranslationLoader.lanKeys!.hello!.tr},\n${TranslationLoader.lanKeys!.templateTip2!.tr}',
|
|
||||||
// style: defaultStyle),
|
|
||||||
// TextSpan(text: 'https://abc.com/bcd\n', style: highStyle),
|
|
||||||
// TextSpan(
|
|
||||||
// text: '${TranslationLoader.lanKeys!.templateTip3!.tr}\n',
|
|
||||||
// style: defaultStyle),
|
|
||||||
// TextSpan(text: 'https://abc.com/bcd', style: highStyle),
|
|
||||||
// ]);
|
|
||||||
|
|
||||||
final TextEditingController templateOneTf = TextEditingController();
|
final TextEditingController templateOneTf = TextEditingController();
|
||||||
final TextEditingController templateTwoTf = TextEditingController();
|
final TextEditingController templateTwoTf = TextEditingController();
|
||||||
final TextEditingController templateNameTf = TextEditingController();
|
final TextEditingController templateNameTf = TextEditingController();
|
||||||
|
|
||||||
RxBool isVip = false.obs;
|
RxBool isVip = false.obs;
|
||||||
RxList<SMSTemplateData> templateList = <SMSTemplateData>[].obs;
|
RxList<SMSTemplateData> templateList = <SMSTemplateData>[].obs;
|
||||||
RxString templateTypeText = '电子钥匙'.tr.obs;
|
// RxString templateTypeText = '电子钥匙'.tr.obs;
|
||||||
RxString templateContentText = ''.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;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
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.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_entity.dart';
|
||||||
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_entity.dart';
|
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_entity.dart';
|
||||||
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_logic.dart';
|
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_logic.dart';
|
||||||
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_state.dart';
|
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_state.dart';
|
||||||
@ -53,9 +54,11 @@ class _CustomSMSTemplateListPageState extends State<CustomSMSTemplateListPage> {
|
|||||||
margin: EdgeInsets.only(
|
margin: EdgeInsets.only(
|
||||||
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: () {
|
onClick: () async {
|
||||||
Navigator.pushNamed(
|
final result = await Get.toNamed(Routers.newSMSTemplatePage);
|
||||||
context, Routers.valueAddedServicesAddSMSTemplatePage);
|
if (result != null) {
|
||||||
|
logic.getSMSTemplateListRequest();
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 40.h,
|
height: 40.h,
|
||||||
@ -95,7 +98,6 @@ class _CustomSMSTemplateListPageState extends State<CustomSMSTemplateListPage> {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 1.sw - 15.w * 2 - 40.w * 2 - 140.w,
|
width: 1.sw - 15.w * 2 - 40.w * 2 - 140.w,
|
||||||
// margin: EdgeInsets.only(top:15.h, left: 15.w, right: 15.w, bottom: 15.h),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@ -150,12 +152,24 @@ class _CustomSMSTemplateListPageState extends State<CustomSMSTemplateListPage> {
|
|||||||
Widget _valueAddedServicesListSMSTemplateItem(
|
Widget _valueAddedServicesListSMSTemplateItem(
|
||||||
CustomSMSTemplateItem itemData) {
|
CustomSMSTemplateItem itemData) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () async {
|
||||||
Navigator.pushNamed(
|
final SMSTemplateData templateData = SMSTemplateData();
|
||||||
context, Routers.valueAddedServicesAddSMSTemplatePage);
|
templateData.name = itemData.name;
|
||||||
|
templateData.regards = itemData.regards;
|
||||||
|
templateData.tips = itemData.tips;
|
||||||
|
templateData.id = itemData.id;
|
||||||
|
templateData.template = itemData.template;
|
||||||
|
templateData.contentType = itemData.contentType;
|
||||||
|
templateData.typeName = templateData.contentType == 1 ? '电子钥匙' : '密码';
|
||||||
|
final result = await Get.toNamed(Routers.newSMSTemplatePage,
|
||||||
|
arguments: <String, SMSTemplateData>{
|
||||||
|
'currentTemplate': templateData
|
||||||
|
});
|
||||||
|
if (result != null) {
|
||||||
|
logic.getSMSTemplateListRequest();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
// height: 100.h,
|
|
||||||
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
|
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
|
|||||||
@ -1,9 +1,7 @@
|
|||||||
import 'dart:ui';
|
|
||||||
|
|
||||||
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.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/translations/trans_lib.dart';
|
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_entity.dart';
|
||||||
|
|
||||||
class CustomSMSTemplateListState {
|
class CustomSMSTemplateListState {
|
||||||
//高亮样式
|
//高亮样式
|
||||||
@ -14,42 +12,6 @@ class CustomSMSTemplateListState {
|
|||||||
final TextStyle defaultStyle =
|
final TextStyle defaultStyle =
|
||||||
TextStyle(color: Colors.black, fontSize: 20.sp);
|
TextStyle(color: Colors.black, fontSize: 20.sp);
|
||||||
|
|
||||||
// //预览样式封装-密码
|
|
||||||
// late InlineSpan passwardSpan = TextSpan(children: <InlineSpan>[
|
|
||||||
// TextSpan(
|
|
||||||
// text:
|
|
||||||
// '${TranslationLoader.lanKeys!.hello!.tr},\n${TranslationLoader.lanKeys!.yourRoomIs!.tr}:',
|
|
||||||
// style: defaultStyle),
|
|
||||||
// TextSpan(text: '201', style: highStyle),
|
|
||||||
// TextSpan(
|
|
||||||
// text: ' ${TranslationLoader.lanKeys!.theCodeToOpenTheDoorIs!.tr}: ',
|
|
||||||
// style: defaultStyle),
|
|
||||||
// TextSpan(text: '332211\n', style: highStyle),
|
|
||||||
// TextSpan(
|
|
||||||
// text: '${TranslationLoader.lanKeys!.periodValidity!.tr}: ',
|
|
||||||
// style: defaultStyle),
|
|
||||||
// TextSpan(text: '2021.12.11 12:00 - 2021.12.12 13:00。\n', style: highStyle),
|
|
||||||
// TextSpan(
|
|
||||||
// text: TranslationLoader.lanKeys!.templateTip1!.tr, style: defaultStyle),
|
|
||||||
// ]);
|
|
||||||
|
|
||||||
// //预览样式封装-密码
|
|
||||||
// late InlineSpan electronicKeySpan = TextSpan(children: <InlineSpan>[
|
|
||||||
// TextSpan(
|
|
||||||
// text:
|
|
||||||
// '${TranslationLoader.lanKeys!.hello!.tr},\n${TranslationLoader.lanKeys!.templateTip2!.tr}',
|
|
||||||
// style: defaultStyle),
|
|
||||||
// TextSpan(text: 'https://abc.com/bcd\n', style: highStyle),
|
|
||||||
// TextSpan(
|
|
||||||
// text: '${TranslationLoader.lanKeys!.templateTip3!.tr}\n',
|
|
||||||
// style: defaultStyle),
|
|
||||||
// TextSpan(text: 'https://abc.com/bcd', style: highStyle),
|
|
||||||
// ]);
|
|
||||||
|
|
||||||
// final TextEditingController templateOneTf = TextEditingController();
|
|
||||||
// final TextEditingController templateTwoTf = TextEditingController();
|
|
||||||
// final TextEditingController templateNameTf = TextEditingController();
|
|
||||||
|
|
||||||
RxBool isVip = false.obs;
|
RxBool isVip = false.obs;
|
||||||
RxList smsTemplateList = [].obs;
|
RxList<CustomSMSTemplateItem> smsTemplateList = <CustomSMSTemplateItem>[].obs;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -250,4 +250,5 @@ abstract class Api {
|
|||||||
'/v2/service/getDefaultTemplate'; //获取默认模板
|
'/v2/service/getDefaultTemplate'; //获取默认模板
|
||||||
final String addSMSTemplateURL = '/v2/service/addSmsTemplate'; //添加短信模板
|
final String addSMSTemplateURL = '/v2/service/addSmsTemplate'; //添加短信模板
|
||||||
final String keydetail = ' /key/detail'; //获取钥匙详情
|
final String keydetail = ' /key/detail'; //获取钥匙详情
|
||||||
|
final String updateTemplateInfoURL = '/v2/service/update'; //更新模板信息
|
||||||
}
|
}
|
||||||
|
|||||||
@ -126,15 +126,12 @@ class ApiProvider extends BaseProvider {
|
|||||||
'searchStr': searchStr
|
'searchStr': searchStr
|
||||||
}));
|
}));
|
||||||
|
|
||||||
Future<Response> electronicKey(
|
Future<Response> electronicKey(int lockId, int keyId) => post(
|
||||||
int lockId, int keyId
|
keydetail.toUrl,
|
||||||
) =>
|
jsonEncode({
|
||||||
post(
|
'lockId': lockId.toString(),
|
||||||
keydetail.toUrl,
|
'keyId': keyId.toString(),
|
||||||
jsonEncode({
|
}));
|
||||||
'lockId': lockId.toString(),
|
|
||||||
'keyId': keyId.toString(),
|
|
||||||
}));
|
|
||||||
|
|
||||||
Future<Response> sendElectronicKey(
|
Future<Response> sendElectronicKey(
|
||||||
int createUser,
|
int createUser,
|
||||||
@ -449,13 +446,12 @@ class ApiProvider extends BaseProvider {
|
|||||||
'searchStr': searchStr
|
'searchStr': searchStr
|
||||||
}));
|
}));
|
||||||
|
|
||||||
Future<Response> passwordKey(int lockId, int keyboardPwdId,) =>
|
Future<Response> passwordKey(
|
||||||
post(
|
int lockId,
|
||||||
passwordKeyDetailURL.toUrl,
|
int keyboardPwdId,
|
||||||
jsonEncode({
|
) =>
|
||||||
'lockId': lockId,
|
post(passwordKeyDetailURL.toUrl,
|
||||||
'keyboardPwdId': keyboardPwdId
|
jsonEncode({'lockId': lockId, 'keyboardPwdId': keyboardPwdId}));
|
||||||
}));
|
|
||||||
|
|
||||||
Future<Response> resetPasswordKey(String lockId, String operatorUid) => post(
|
Future<Response> resetPasswordKey(String lockId, String operatorUid) => post(
|
||||||
resetPasswordURL.toUrl,
|
resetPasswordURL.toUrl,
|
||||||
@ -1116,17 +1112,15 @@ class ApiProvider extends BaseProvider {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
// 获取指纹详情
|
// 获取指纹详情
|
||||||
Future<Response> getFingerprintsData(
|
Future<Response> getFingerprintsData(int fingerprintId) => post(
|
||||||
int fingerprintId) =>
|
getFingerprintDetailURL.toUrl,
|
||||||
post(
|
jsonEncode({
|
||||||
getFingerprintDetailURL.toUrl,
|
'fingerprintId': fingerprintId,
|
||||||
jsonEncode({
|
}));
|
||||||
'fingerprintId': fingerprintId,
|
|
||||||
}));
|
|
||||||
|
|
||||||
// 获取指纹列表
|
// 获取指纹列表
|
||||||
Future<Response> getFingerprintsListData(
|
Future<Response> getFingerprintsListData(
|
||||||
String lockId, String pageNo, String pageSize, String searchStr) =>
|
String lockId, String pageNo, String pageSize, String searchStr) =>
|
||||||
post(
|
post(
|
||||||
getFingerprintListURL.toUrl,
|
getFingerprintListURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
@ -2204,6 +2198,19 @@ class ApiProvider extends BaseProvider {
|
|||||||
}),
|
}),
|
||||||
isUnShowLoading: true,
|
isUnShowLoading: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Future<Response<dynamic>> updateTemplateInfo(
|
||||||
|
int id, String name, String regards, String tips) =>
|
||||||
|
post(
|
||||||
|
updateTemplateInfoURL.toUrl,
|
||||||
|
jsonEncode(<String, dynamic>{
|
||||||
|
'id': id,
|
||||||
|
'name': name,
|
||||||
|
'regards': regards,
|
||||||
|
'tips': tips,
|
||||||
|
}),
|
||||||
|
isUnShowLoading: true,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ExtensionString on String {
|
extension ExtensionString on String {
|
||||||
|
|||||||
@ -174,10 +174,9 @@ class ApiRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//获取电子钥匙
|
//获取电子钥匙
|
||||||
Future<ElectronicKeyEntity> electronicKey({
|
Future<ElectronicKeyEntity> electronicKey(
|
||||||
required int lockId,required int keyId
|
{required int lockId, required int keyId}) async {
|
||||||
}) async {
|
final res = await apiProvider.electronicKey(lockId, keyId);
|
||||||
final res = await apiProvider.electronicKey(lockId,keyId);
|
|
||||||
return ElectronicKeyEntity.fromJson(res.body);
|
return ElectronicKeyEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -425,13 +424,11 @@ class ApiRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//密码获取
|
//密码获取
|
||||||
Future<PasswordKeyEntity> passwordKey( int lockId,int keyboardPwdId) async {
|
Future<PasswordKeyEntity> passwordKey(int lockId, int keyboardPwdId) async {
|
||||||
final res = await apiProvider.passwordKey(
|
final res = await apiProvider.passwordKey(lockId, keyboardPwdId);
|
||||||
lockId, keyboardPwdId);
|
|
||||||
return PasswordKeyEntity.fromJson(res.body);
|
return PasswordKeyEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//重置密码钥匙
|
//重置密码钥匙
|
||||||
Future<PasswordKeyListEntity> resetPasswordKey(
|
Future<PasswordKeyListEntity> resetPasswordKey(
|
||||||
String lockId, String operatorUid) async {
|
String lockId, String operatorUid) async {
|
||||||
@ -2221,4 +2218,15 @@ class ApiRepository {
|
|||||||
type, name, contentType, regards, tips, fixedKey);
|
type, name, contentType, regards, tips, fixedKey);
|
||||||
return LoginEntity.fromJson(res.body);
|
return LoginEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 更新模板信息
|
||||||
|
Future<LoginEntity> updateTemplateInfo(
|
||||||
|
{required int id,
|
||||||
|
required String name,
|
||||||
|
required String regards,
|
||||||
|
required String tips}) async {
|
||||||
|
final Response<dynamic> res =
|
||||||
|
await apiProvider.updateTemplateInfo(id, name, regards, tips);
|
||||||
|
return LoginEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user