1,预计产生短信条数,短信和邮件差异化处理
2,模板内容没有对应的,已参考通通锁修改 3,列表和点开详情,只有自己输入的内容已修改
This commit is contained in:
parent
d4437f0ed9
commit
30d8e8d525
@ -186,8 +186,6 @@ import 'mine/mineSet/lockUserManage/lockUserManageList/lockUserManageList_page.d
|
|||||||
import 'mine/mineSet/lockUserManage/ownedKeyList/ownedKeyList_page.dart';
|
import 'mine/mineSet/lockUserManage/ownedKeyList/ownedKeyList_page.dart';
|
||||||
import 'mine/supportStaff/supportStaff_page.dart';
|
import 'mine/supportStaff/supportStaff_page.dart';
|
||||||
import 'mine/valueAddedServices/valueAddedServicesBuy/valueAddedServicesBuy_page.dart';
|
import 'mine/valueAddedServices/valueAddedServicesBuy/valueAddedServicesBuy_page.dart';
|
||||||
import 'mine/valueAddedServices/valueAddedServicesEmailTemplate/valueAddedServicesAddEmailTemplate/valueAddedServicesAddEmailTemplate_page.dart';
|
|
||||||
import 'mine/valueAddedServices/valueAddedServicesEmailTemplate/valueAddedServicesListEmailTemplate/valueAddedServicesListEmailTemplate_page.dart';
|
|
||||||
import 'mine/valueAddedServices/valueAddedServicesHighFunction/valueAddedServicesHighFunction_page.dart';
|
import 'mine/valueAddedServices/valueAddedServicesHighFunction/valueAddedServicesHighFunction_page.dart';
|
||||||
import 'mine/valueAddedServices/valueAddedServicesList/valueAddedServicesList_page.dart';
|
import 'mine/valueAddedServices/valueAddedServicesList/valueAddedServicesList_page.dart';
|
||||||
import 'mine/valueAddedServices/valueAddedServicesNoteAndEmailDetail/valueAddedServicesNoteAndEmailDetail_page.dart';
|
import 'mine/valueAddedServices/valueAddedServicesNoteAndEmailDetail/valueAddedServicesNoteAndEmailDetail_page.dart';
|
||||||
@ -364,8 +362,6 @@ abstract class Routers {
|
|||||||
'/NewSMSTemplatePage'; // 增值服务-自定义短信模版
|
'/NewSMSTemplatePage'; // 增值服务-自定义短信模版
|
||||||
static const String valueAddedServicesListEmailTemplatePage =
|
static const String valueAddedServicesListEmailTemplatePage =
|
||||||
'/ValueAddedServicesListEmailTemplatePage'; // 增值服务-邮箱模版列表
|
'/ValueAddedServicesListEmailTemplatePage'; // 增值服务-邮箱模版列表
|
||||||
static const String valueAddedServicesAddEmailTemplatePage =
|
|
||||||
'/ValueAddedServicesAddEmailTemplatePage'; // 增值服务-自定义邮箱模版
|
|
||||||
static const String valueAddedServicesBuyAndUseRecordManagePage =
|
static const String valueAddedServicesBuyAndUseRecordManagePage =
|
||||||
'/ValueAddedServicesBuyAndUseRecordManagePage'; // 增值服务-购买使用记录
|
'/ValueAddedServicesBuyAndUseRecordManagePage'; // 增值服务-购买使用记录
|
||||||
|
|
||||||
@ -886,14 +882,6 @@ abstract class AppRouters {
|
|||||||
name: Routers.newSMSTemplatePage,
|
name: Routers.newSMSTemplatePage,
|
||||||
page: () => const NewSMSTemplatePage(),
|
page: () => const NewSMSTemplatePage(),
|
||||||
),
|
),
|
||||||
GetPage<dynamic>(
|
|
||||||
name: Routers.valueAddedServicesListEmailTemplatePage,
|
|
||||||
page: () => const ValueAddedServicesListEmailTemplatePage(),
|
|
||||||
),
|
|
||||||
GetPage<dynamic>(
|
|
||||||
name: Routers.valueAddedServicesAddEmailTemplatePage,
|
|
||||||
page: () => const ValueAddedServicesAddEmailTemplatePage(),
|
|
||||||
),
|
|
||||||
GetPage<dynamic>(
|
GetPage<dynamic>(
|
||||||
name: Routers.lockScreenPage,
|
name: Routers.lockScreenPage,
|
||||||
page: () => const LockScreenPage(),
|
page: () => const LockScreenPage(),
|
||||||
|
|||||||
@ -1,329 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
||||||
import 'package:get/get.dart';
|
|
||||||
|
|
||||||
import '../../../../app_settings/app_colors.dart';
|
|
||||||
import '../../../../tools/commonItem.dart';
|
|
||||||
import '../../../../tools/showBottomSheetTool.dart';
|
|
||||||
import '../../../../tools/submitBtn.dart';
|
|
||||||
import '../../../../tools/titleAppBar.dart';
|
|
||||||
import '../../../../translations/trans_lib.dart';
|
|
||||||
|
|
||||||
//高亮样式
|
|
||||||
final TextStyle highStyle =
|
|
||||||
TextStyle(color: const Color(0xFFEEDFA8), fontSize: 20.sp);
|
|
||||||
|
|
||||||
//默认样式
|
|
||||||
final TextStyle defaultStyle = TextStyle(color: Colors.black, fontSize: 20.sp);
|
|
||||||
|
|
||||||
//预览样式封装-密码
|
|
||||||
InlineSpan emailPasswardSpan = TextSpan(children: [
|
|
||||||
TextSpan(
|
|
||||||
text:
|
|
||||||
'${TranslationLoader.lanKeys!.hello!.tr},${TranslationLoader.lanKeys!.yourRoomIs!.tr}:',
|
|
||||||
style: defaultStyle),
|
|
||||||
TextSpan(
|
|
||||||
text: '{${TranslationLoader.lanKeys!.roomName!.tr}', style: highStyle),
|
|
||||||
TextSpan(
|
|
||||||
text: ',${TranslationLoader.lanKeys!.theCodeToOpenTheDoorIs!.tr}:',
|
|
||||||
style: defaultStyle),
|
|
||||||
TextSpan(
|
|
||||||
text: '{${TranslationLoader.lanKeys!.password!.tr}}', style: highStyle),
|
|
||||||
TextSpan(
|
|
||||||
text: '。${TranslationLoader.lanKeys!.periodValidity!.tr}:',
|
|
||||||
style: defaultStyle),
|
|
||||||
TextSpan(
|
|
||||||
text: '{${TranslationLoader.lanKeys!.periodValidity!.tr}}',
|
|
||||||
style: highStyle),
|
|
||||||
TextSpan(
|
|
||||||
text: '。${TranslationLoader.lanKeys!.templateTip1!.tr}。',
|
|
||||||
style: defaultStyle),
|
|
||||||
]);
|
|
||||||
|
|
||||||
//预览样式封装-密码提示
|
|
||||||
InlineSpan emailPasswardTipSpan = TextSpan(children: [
|
|
||||||
TextSpan(
|
|
||||||
text: TranslationLoader.lanKeys!.templateTip4!.tr, style: defaultStyle),
|
|
||||||
TextSpan(
|
|
||||||
text: '{${TranslationLoader.lanKeys!.roomName!.tr}}', style: highStyle),
|
|
||||||
TextSpan(text: '、', style: defaultStyle),
|
|
||||||
TextSpan(
|
|
||||||
text: '{${TranslationLoader.lanKeys!.password!.tr}}', style: highStyle),
|
|
||||||
TextSpan(text: TranslationLoader.lanKeys!.and!.tr, style: defaultStyle),
|
|
||||||
TextSpan(
|
|
||||||
text: '{${TranslationLoader.lanKeys!.periodValidity!.tr}}',
|
|
||||||
style: highStyle),
|
|
||||||
TextSpan(
|
|
||||||
text: TranslationLoader.lanKeys!.willBeReplacedWithTheActualValue!.tr,
|
|
||||||
style: defaultStyle),
|
|
||||||
]);
|
|
||||||
|
|
||||||
String emaiPasswardStr =
|
|
||||||
"${TranslationLoader.lanKeys!.hello!.tr},${TranslationLoader.lanKeys!.yourRoomIs!.tr}:{${TranslationLoader.lanKeys!.roomName!.tr}},${TranslationLoader.lanKeys!.theCodeToOpenTheDoorIs!.tr}:{${TranslationLoader.lanKeys!.password!.tr}}。${TranslationLoader.lanKeys!.periodValidity!.tr}:{${TranslationLoader.lanKeys!.periodValidity!.tr}}。${TranslationLoader.lanKeys!.templateTip1!.tr}";
|
|
||||||
|
|
||||||
//预览样式封装-电子钥匙
|
|
||||||
InlineSpan emailElectronicKeySpan = TextSpan(children: [
|
|
||||||
TextSpan(
|
|
||||||
text: TranslationLoader.lanKeys!.templateTip2!.tr, style: defaultStyle),
|
|
||||||
TextSpan(text: 'https://abc.com/bcd', style: highStyle)
|
|
||||||
]);
|
|
||||||
|
|
||||||
//预览样式封装-电子钥匙提示
|
|
||||||
InlineSpan emailElectronicKeyTipSpan = TextSpan(children: [
|
|
||||||
TextSpan(
|
|
||||||
text: TranslationLoader.lanKeys!.templateTip4!.tr, style: defaultStyle),
|
|
||||||
TextSpan(
|
|
||||||
text: '{${TranslationLoader.lanKeys!.downloadLink!.tr}',
|
|
||||||
style: highStyle),
|
|
||||||
TextSpan(
|
|
||||||
text: TranslationLoader.lanKeys!.willBeReplacedWithTheActualValue!.tr,
|
|
||||||
style: defaultStyle),
|
|
||||||
]);
|
|
||||||
|
|
||||||
String emailElectronicKeyStr =
|
|
||||||
"${TranslationLoader.lanKeys!.templateTip2!.tr}\n{${TranslationLoader.lanKeys!.downloadLink!.tr}}";
|
|
||||||
|
|
||||||
class ValueAddedServicesAddEmailTemplatePage extends StatefulWidget {
|
|
||||||
const ValueAddedServicesAddEmailTemplatePage({Key? key}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<ValueAddedServicesAddEmailTemplatePage> createState() =>
|
|
||||||
_ValueAddedServicesAddEmailTemplatePageState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _ValueAddedServicesAddEmailTemplatePageState
|
|
||||||
extends State<ValueAddedServicesAddEmailTemplatePage> {
|
|
||||||
final _templateOneTf = TextEditingController();
|
|
||||||
final _templateNameTf = TextEditingController();
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
_templateOneTf.text = emailElectronicKeyStr;
|
|
||||||
|
|
||||||
return Scaffold(
|
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
|
||||||
appBar: TitleAppBar(
|
|
||||||
barTitle: TranslationLoader.lanKeys!.customMailTemplate!.tr,
|
|
||||||
haveBack: true,
|
|
||||||
backgroundColor: AppColors.mainColor),
|
|
||||||
body: ListView(
|
|
||||||
children: [
|
|
||||||
_buildEditTopInfo(),
|
|
||||||
SizedBox(
|
|
||||||
height: 10.h,
|
|
||||||
),
|
|
||||||
_buildEditTemplate(),
|
|
||||||
SizedBox(
|
|
||||||
height: 10.h,
|
|
||||||
),
|
|
||||||
_buildpreview(),
|
|
||||||
SizedBox(height: 42.h),
|
|
||||||
SubmitBtn(
|
|
||||||
btnName: TranslationLoader.lanKeys!.save!.tr,
|
|
||||||
borderRadius: 10.w,
|
|
||||||
margin: EdgeInsets.only(
|
|
||||||
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
|
|
||||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
|
||||||
onClick: () {
|
|
||||||
// Navigator.pushNamed(context, Routers.sendElectronicKeyManagePage);
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildEditTopInfo() {
|
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
CommonItem(
|
|
||||||
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
|
||||||
rightTitle: "",
|
|
||||||
isHaveLine: true,
|
|
||||||
isHaveRightWidget: true,
|
|
||||||
rightWidget: getTFWidget(
|
|
||||||
_templateNameTf, TranslationLoader.lanKeys!.pleaseEnter!.tr)),
|
|
||||||
CommonItem(
|
|
||||||
leftTitel: TranslationLoader.lanKeys!.type!.tr,
|
|
||||||
rightTitle: TranslationLoader.lanKeys!.password!.tr,
|
|
||||||
isHaveLine: false,
|
|
||||||
action: () {
|
|
||||||
_showSelectTemplateType();
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildEditTemplate() {
|
|
||||||
return Container(
|
|
||||||
color: Colors.white,
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.only(
|
|
||||||
left: 25.w, top: 25.h, bottom: 25.h, right: 25.w),
|
|
||||||
child: Text(
|
|
||||||
TranslationLoader.lanKeys!.templateContent!.tr,
|
|
||||||
style:
|
|
||||||
TextStyle(fontSize: 28.sp, fontWeight: FontWeight.w600),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
margin: EdgeInsets.only(left: 25.w, right: 25.w, bottom: 25.h),
|
|
||||||
height: 100,
|
|
||||||
child: TextField(
|
|
||||||
maxLines: 8,
|
|
||||||
// maxLength:1000,
|
|
||||||
textAlign: TextAlign.start,
|
|
||||||
controller: _templateOneTf,
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.black,
|
|
||||||
fontSize: 28.sp,
|
|
||||||
),
|
|
||||||
decoration: InputDecoration(
|
|
||||||
contentPadding: EdgeInsets.only(
|
|
||||||
top: 20.h, left: 20.w, right: 20.w, bottom: 20.h),
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
///设置边框四个角的弧度
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(20.h)),
|
|
||||||
|
|
||||||
///用来配置边框的样式
|
|
||||||
borderSide: const BorderSide(
|
|
||||||
///设置边框的颜色
|
|
||||||
color: Color(0xffB2B2B2),
|
|
||||||
|
|
||||||
///设置边框的粗细
|
|
||||||
width: 0.5,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
///用来配置输入框获取焦点时的颜色
|
|
||||||
focusedBorder: OutlineInputBorder(
|
|
||||||
///设置边框四个角的弧度
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(20.h)),
|
|
||||||
|
|
||||||
///用来配置边框的样式
|
|
||||||
borderSide: const BorderSide(
|
|
||||||
///设置边框的颜色
|
|
||||||
color: Color(0xffB2B2B2),
|
|
||||||
|
|
||||||
///设置边框的粗细
|
|
||||||
width: 1,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
padding: EdgeInsets.only(
|
|
||||||
top: 20.h, left: 20.w, right: 20.w, bottom: 20.h),
|
|
||||||
margin: EdgeInsets.only(left: 15.w, right: 15.w, bottom: 15.h),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: const Color(0xFFFbF9EC),
|
|
||||||
borderRadius: BorderRadius.circular(10.h)),
|
|
||||||
child: RichText(text: emailElectronicKeyTipSpan),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildpreview() {
|
|
||||||
return Column(
|
|
||||||
// mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
color: Colors.white,
|
|
||||||
margin: EdgeInsets.only(bottom: 20.h),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
Column(
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.only(
|
|
||||||
left: 25.w,
|
|
||||||
top: 25.h,
|
|
||||||
bottom: 25.h,
|
|
||||||
right: 25.w),
|
|
||||||
child: Text(
|
|
||||||
TranslationLoader.lanKeys!.preview!.tr,
|
|
||||||
style: TextStyle(fontSize: 20.sp),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
margin: EdgeInsets.only(
|
|
||||||
left: 25.w, right: 25.w, bottom: 20.h),
|
|
||||||
padding: EdgeInsets.only(
|
|
||||||
left: 20.w, top: 20.h, right: 20.w, bottom: 20.h),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: const Color(0xFFF5F5F5),
|
|
||||||
borderRadius: BorderRadius.circular(10.h),
|
|
||||||
),
|
|
||||||
child: RichText(text: emailElectronicKeySpan),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
))
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget getTFWidget(TextEditingController tfController, String tfStr) {
|
|
||||||
return Container(
|
|
||||||
height: 50.h,
|
|
||||||
width: 500.w,
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: TextField(
|
|
||||||
//输入框一行
|
|
||||||
maxLines: 1,
|
|
||||||
controller: tfController,
|
|
||||||
autofocus: false,
|
|
||||||
textAlign: TextAlign.end,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
//输入里面输入文字内边距设置
|
|
||||||
contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
|
|
||||||
hintText: tfStr,
|
|
||||||
//不需要输入框下划线
|
|
||||||
border: InputBorder.none,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _showSelectTemplateType() {
|
|
||||||
var list = [
|
|
||||||
TranslationLoader.lanKeys!.electronicKey!.tr,
|
|
||||||
TranslationLoader.lanKeys!.password!.tr
|
|
||||||
];
|
|
||||||
ShowBottomSheetTool().showSingleRowPicker(
|
|
||||||
//上下文
|
|
||||||
context,
|
|
||||||
//默认的索引
|
|
||||||
normalIndex: 0,
|
|
||||||
title: TranslationLoader.lanKeys!.type!.tr,
|
|
||||||
cancelTitle: TranslationLoader.lanKeys!.cancel!.tr,
|
|
||||||
sureTitle: TranslationLoader.lanKeys!.sure!.tr,
|
|
||||||
//要显示的列表
|
|
||||||
//可自定义数据适配器
|
|
||||||
//adapter: PickerAdapter(),
|
|
||||||
data: list,
|
|
||||||
//选择事件的回调
|
|
||||||
clickCallBack: (int index, var str) {});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,164 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
||||||
import 'package:get/get.dart';
|
|
||||||
|
|
||||||
import '../../../../appRouters.dart';
|
|
||||||
import '../../../../app_settings/app_colors.dart';
|
|
||||||
import '../../../../tools/submitBtn.dart';
|
|
||||||
import '../../../../tools/titleAppBar.dart';
|
|
||||||
import '../../../../translations/trans_lib.dart';
|
|
||||||
import '../valueAddedServicesAddEmailTemplate/valueAddedServicesAddEmailTemplate_page.dart';
|
|
||||||
|
|
||||||
class ValueAddedServicesListEmailTemplatePage extends StatefulWidget {
|
|
||||||
const ValueAddedServicesListEmailTemplatePage({Key? key}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<ValueAddedServicesListEmailTemplatePage> createState() =>
|
|
||||||
_ValueAddedServicesListEmailTemplatePageState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _ValueAddedServicesListEmailTemplatePageState
|
|
||||||
extends State<ValueAddedServicesListEmailTemplatePage> {
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Scaffold(
|
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
|
||||||
appBar: TitleAppBar(
|
|
||||||
barTitle: '自定义邮件模版'.tr,
|
|
||||||
haveBack: true,
|
|
||||||
backgroundColor: AppColors.mainColor),
|
|
||||||
body: Column(
|
|
||||||
children: [
|
|
||||||
_topTipWidget(),
|
|
||||||
Expanded(child: _buildMainUI()),
|
|
||||||
SubmitBtn(
|
|
||||||
btnName: TranslationLoader.lanKeys!.creatingANewTemplate!.tr,
|
|
||||||
borderRadius: 20.w,
|
|
||||||
margin: EdgeInsets.only(
|
|
||||||
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
|
|
||||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
|
||||||
onClick: () {
|
|
||||||
Navigator.pushNamed(
|
|
||||||
context, Routers.valueAddedServicesAddEmailTemplatePage);
|
|
||||||
}),
|
|
||||||
SizedBox(
|
|
||||||
height: 64.h,
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _topTipWidget() {
|
|
||||||
return Container(
|
|
||||||
margin: EdgeInsets.only(top: 20.w, left: 20.w, right: 20.w),
|
|
||||||
padding:
|
|
||||||
EdgeInsets.only(top: 20.h, left: 20.w, right: 20.w, bottom: 20.h),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.white, borderRadius: BorderRadius.circular(5)),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
Text(TranslationLoader.lanKeys!.customTemplatesTip!.tr),
|
|
||||||
SizedBox(
|
|
||||||
height: 15.h,
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
padding: EdgeInsets.only(
|
|
||||||
top: 15.h, left: 15.w, right: 15.w, bottom: 15.h),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: const Color(0xFFFbF9EC),
|
|
||||||
borderRadius: BorderRadius.circular(10.h)),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
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(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"${TranslationLoader.lanKeys!.currentState!.tr}:${TranslationLoader.lanKeys!.onTrial!.tr}",
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 20.sp, fontWeight: FontWeight.w600),
|
|
||||||
),
|
|
||||||
Text(TranslationLoader.lanKeys!.unHaveOpenedTip2!.tr,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 20.sp, fontWeight: FontWeight.w600))
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
Navigator.pushNamed(
|
|
||||||
context, Routers.valueAddedServicesHighFunctionPage);
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
width: 100.w,
|
|
||||||
height: 50.h,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: const Color(0xFFCAB68D),
|
|
||||||
borderRadius: BorderRadius.circular(35.h)),
|
|
||||||
child: Center(
|
|
||||||
child: Text(
|
|
||||||
TranslationLoader.lanKeys!.goToTheOpen!.tr,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.white, fontSize: 20.sp)))),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildMainUI() {
|
|
||||||
return ListView.builder(
|
|
||||||
itemCount: 10,
|
|
||||||
itemBuilder: (c, index) {
|
|
||||||
return _valueAddedServicesListSMSTemplateItem(
|
|
||||||
'images/icon_lock.png', "张三", () {
|
|
||||||
// Navigator.pushNamed(context, Routers.valueAddedServicesAddSMSTemplatePage);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _valueAddedServicesListSMSTemplateItem(
|
|
||||||
String title, String content, Function() action) {
|
|
||||||
return GestureDetector(
|
|
||||||
onTap: action,
|
|
||||||
child: Container(
|
|
||||||
// height: 100.h,
|
|
||||||
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.circular(10.w),
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.only(left: 30.h, top: 30.h, bottom: 20.h),
|
|
||||||
child: Text(
|
|
||||||
"101",
|
|
||||||
style: TextStyle(fontSize: 32.sp, fontWeight: FontWeight.w500),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
margin: EdgeInsets.only(left: 25.w, right: 25.w, bottom: 25.h),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: const Color(0xFFF5F5F5),
|
|
||||||
borderRadius: BorderRadius.circular(10.h),
|
|
||||||
),
|
|
||||||
child: Padding(
|
|
||||||
padding: EdgeInsets.only(
|
|
||||||
left: 20.w, top: 20.h, right: 20.w, bottom: 20.h),
|
|
||||||
child: RichText(text: emailElectronicKeySpan)),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,6 +1,13 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
class NewSMSTemplateEntity {
|
class NewSMSTemplateEntity {
|
||||||
NewSMSTemplateEntity(
|
NewSMSTemplateEntity({
|
||||||
{this.errorCode, this.description, this.errorMsg, this.dataList});
|
this.errorCode,
|
||||||
|
this.description,
|
||||||
|
this.errorMsg,
|
||||||
|
this.dataList,
|
||||||
|
});
|
||||||
|
|
||||||
NewSMSTemplateEntity.fromJson(Map<String, dynamic> json) {
|
NewSMSTemplateEntity.fromJson(Map<String, dynamic> json) {
|
||||||
errorCode = json['errorCode'];
|
errorCode = json['errorCode'];
|
||||||
description = json['description'];
|
description = json['description'];
|
||||||
@ -12,6 +19,7 @@ class NewSMSTemplateEntity {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int? errorCode;
|
int? errorCode;
|
||||||
String? description;
|
String? description;
|
||||||
String? errorMsg;
|
String? errorMsg;
|
||||||
@ -30,18 +38,29 @@ class NewSMSTemplateEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class SMSTemplateData {
|
class SMSTemplateData {
|
||||||
SMSTemplateData(
|
SMSTemplateData({
|
||||||
{this.contentType, this.typeName, this.template, this.fixedKey});
|
this.contentType,
|
||||||
|
this.typeName,
|
||||||
|
this.template,
|
||||||
|
this.fixedKey,
|
||||||
|
this.templatePreviewCode,
|
||||||
|
});
|
||||||
|
|
||||||
SMSTemplateData.fromJson(Map<String, dynamic> json) {
|
SMSTemplateData.fromJson(Map<String, dynamic> json) {
|
||||||
contentType = json['content_type'];
|
contentType = json['content_type'];
|
||||||
typeName = json['typeName'];
|
typeName = json['typeName'];
|
||||||
template = json['template'];
|
template = json['template'];
|
||||||
fixedKey = json['fixed_key'];
|
fixedKey = json['fixed_key'];
|
||||||
|
templatePreviewCode = json['template_preview_code'] != null
|
||||||
|
? jsonEncode(json['template_preview_code'])
|
||||||
|
: null;
|
||||||
}
|
}
|
||||||
|
|
||||||
int? contentType;
|
int? contentType;
|
||||||
String? typeName;
|
String? typeName;
|
||||||
String? template;
|
String? template;
|
||||||
String? fixedKey;
|
String? fixedKey;
|
||||||
|
String? templatePreviewCode; // Changed to String
|
||||||
String? regards = '';
|
String? regards = '';
|
||||||
String? tips = '';
|
String? tips = '';
|
||||||
int? id;
|
int? id;
|
||||||
@ -55,6 +74,28 @@ class SMSTemplateData {
|
|||||||
data['typeName'] = typeName;
|
data['typeName'] = typeName;
|
||||||
data['template'] = template;
|
data['template'] = template;
|
||||||
data['fixed_key'] = fixedKey;
|
data['fixed_key'] = fixedKey;
|
||||||
|
if (templatePreviewCode != null) {
|
||||||
|
data['template_preview_code'] = jsonDecode(templatePreviewCode!);
|
||||||
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// New method to replace template variables with values from templatePreviewCode
|
||||||
|
String generatePreview() {
|
||||||
|
if (template == null || templatePreviewCode == null) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Decode the templatePreviewCode string back to a map
|
||||||
|
final Map<String, String> previewCodeMap =
|
||||||
|
Map<String, String>.from(jsonDecode(templatePreviewCode!));
|
||||||
|
|
||||||
|
String previewTemplate = template!;
|
||||||
|
previewCodeMap.forEach((String key, String value) {
|
||||||
|
previewTemplate = previewTemplate.replaceAll(
|
||||||
|
key, value + (value.length > 2 ? '\n' : ''));
|
||||||
|
});
|
||||||
|
|
||||||
|
return previewTemplate;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -94,6 +94,27 @@ class NewSMSTemplateLogic extends BaseGetXController {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isPreview) {
|
||||||
|
if (state.currentTemplate.value.generatePreview().isNotEmpty) {
|
||||||
|
textSpans.add(
|
||||||
|
TextSpan(
|
||||||
|
text: state.currentTemplate.value.generatePreview(),
|
||||||
|
style: state.defaultStyle,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
textSpans.addAll(_buildDefaultTemplate(isPreview));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
textSpans.addAll(_buildDefaultTemplate(isPreview));
|
||||||
|
}
|
||||||
|
|
||||||
|
return textSpans;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<TextSpan> _buildDefaultTemplate(bool isPreview) {
|
||||||
|
final List<TextSpan> textSpans = <TextSpan>[];
|
||||||
// 将模板分割为文本片段
|
// 将模板分割为文本片段
|
||||||
final List<String> textFragments = state.currentTemplate.value.template
|
final List<String> textFragments = state.currentTemplate.value.template
|
||||||
?.split(RegularExpression.urlRegExp) ??
|
?.split(RegularExpression.urlRegExp) ??
|
||||||
@ -129,7 +150,6 @@ class NewSMSTemplateLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果是预览模式,添加预览模板的文本
|
|
||||||
if (isPreview) {
|
if (isPreview) {
|
||||||
textSpans.add(
|
textSpans.add(
|
||||||
TextSpan(
|
TextSpan(
|
||||||
@ -209,10 +229,30 @@ class NewSMSTemplateLogic extends BaseGetXController {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//短信模版才需要加默认模版
|
//短信模版才需要加默认模版
|
||||||
if (state.templateType == 1 ||
|
if ((state.templateType.value == 1) ||
|
||||||
(state.templateType == 2 && isPreview == false)) {
|
(state.templateType.value == 2 && isPreview == false)) {
|
||||||
|
if (isPreview) {
|
||||||
|
if (state.currentTemplate.value.generatePreview().isNotEmpty) {
|
||||||
|
textSpans.add(
|
||||||
|
TextSpan(
|
||||||
|
text: state.currentTemplate.value.generatePreview(),
|
||||||
|
style: state.defaultStyle,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
// 在预览模式下,添加预览模板的文本
|
||||||
|
if (isPreview) {
|
||||||
|
textSpans.add(
|
||||||
|
TextSpan(
|
||||||
|
text: '\n${state.templateTwoTf.text}',
|
||||||
|
style: state.defaultStyle,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return textSpans;
|
||||||
|
}
|
||||||
// 定义匹配 ${} 包围的变量的正则表达式
|
// 定义匹配 ${} 包围的变量的正则表达式
|
||||||
final RegExp variableRegExp = RegExp(r'\$\{([^}]+)\}');
|
final RegExp variableRegExp = RegExp(r'\$\{([^}]+)\}');
|
||||||
|
|
||||||
@ -281,8 +321,8 @@ class NewSMSTemplateLogic extends BaseGetXController {
|
|||||||
Future<void> onReady() async {
|
Future<void> onReady() async {
|
||||||
super.onReady();
|
super.onReady();
|
||||||
|
|
||||||
if (state.currentTemplate.value.isUpdate == false) {
|
// if (state.currentTemplate.value.isUpdate == false) {
|
||||||
getDefaultTemplate();
|
getDefaultTemplate();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,7 +29,13 @@ class _NewSMSTemplatePageState extends State<NewSMSTemplatePage> {
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
barTitle: state.templateType.value == 1 ? '新建短信模版'.tr : '新建邮件模版'.tr,
|
barTitle: state.isUpdate.value == false
|
||||||
|
? state.templateType.value == 1
|
||||||
|
? '新建短信模版'.tr
|
||||||
|
: '新建邮件模版'.tr
|
||||||
|
: state.templateType.value == 1
|
||||||
|
? '编辑短信模版'.tr
|
||||||
|
: '编辑邮件模版'.tr,
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor,
|
backgroundColor: AppColors.mainColor,
|
||||||
),
|
),
|
||||||
@ -75,15 +81,15 @@ class _NewSMSTemplatePageState extends State<NewSMSTemplatePage> {
|
|||||||
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Obx(
|
Obx(() => state.isUpdate.value == false
|
||||||
() => CommonItem(
|
? CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.type!.tr,
|
leftTitel: TranslationLoader.lanKeys!.type!.tr,
|
||||||
rightTitle: state.currentTemplate.value.typeName ?? '',
|
rightTitle: state.currentTemplate.value.typeName ?? '',
|
||||||
isHaveLine: false,
|
isHaveLine: false,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: _showSelectTemplateType,
|
action: _showSelectTemplateType,
|
||||||
),
|
)
|
||||||
),
|
: Container()),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -113,6 +119,7 @@ class _NewSMSTemplatePageState extends State<NewSMSTemplatePage> {
|
|||||||
Obx(() => Container(
|
Obx(() => Container(
|
||||||
width: 1.sw - 50.w,
|
width: 1.sw - 50.w,
|
||||||
margin: EdgeInsets.only(left: 25.w, right: 25.w),
|
margin: EdgeInsets.only(left: 25.w, right: 25.w),
|
||||||
|
padding: EdgeInsets.only(bottom: 20.h),
|
||||||
child: _buildTemplateWithType(isPreview: false),
|
child: _buildTemplateWithType(isPreview: false),
|
||||||
)),
|
)),
|
||||||
SizedBox(height: 10.h),
|
SizedBox(height: 10.h),
|
||||||
@ -152,6 +159,8 @@ class _NewSMSTemplatePageState extends State<NewSMSTemplatePage> {
|
|||||||
),
|
),
|
||||||
Obx(() => Container(
|
Obx(() => Container(
|
||||||
width: 1.sw - 50.w,
|
width: 1.sw - 50.w,
|
||||||
|
// margin: EdgeInsets.only(left: 25.w, right: 25.w, bottom: 20.h),
|
||||||
|
// padding: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 20.h),
|
||||||
margin: EdgeInsets.only(left: 25.w, right: 25.w),
|
margin: EdgeInsets.only(left: 25.w, right: 25.w),
|
||||||
padding: EdgeInsets.only(left: 20.w, right: 20.w, top: 10.h),
|
padding: EdgeInsets.only(left: 20.w, right: 20.w, top: 10.h),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@ -160,20 +169,25 @@ class _NewSMSTemplatePageState extends State<NewSMSTemplatePage> {
|
|||||||
),
|
),
|
||||||
child: _buildTemplateWithType(isPreview: true),
|
child: _buildTemplateWithType(isPreview: true),
|
||||||
)),
|
)),
|
||||||
Padding(
|
if (state.templateType.value == 1)
|
||||||
padding: EdgeInsets.only(
|
Padding(
|
||||||
left: 25.w,
|
padding: EdgeInsets.only(
|
||||||
top: 25.h,
|
left: 25.w,
|
||||||
bottom: 25.h,
|
top: 25.h,
|
||||||
),
|
bottom: 25.h,
|
||||||
child: Text(
|
|
||||||
'预计产生短信条数:${state.smsCost.value}',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.grey,
|
|
||||||
fontSize: 20.sp,
|
|
||||||
),
|
),
|
||||||
),
|
child: Text(
|
||||||
),
|
'预计产生短信条数:${state.smsCost.value}',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.grey,
|
||||||
|
fontSize: 20.sp,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
else
|
||||||
|
SizedBox(
|
||||||
|
height: 20.h,
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -13,6 +13,7 @@ class NewSMSTemplateState {
|
|||||||
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;
|
templateType.value = currentTemplate.value.type ?? 0;
|
||||||
|
isUpdate.value = map['isUpdate'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,4 +35,6 @@ class NewSMSTemplateState {
|
|||||||
RxBool isShowDate = false.obs; //是否显示日期
|
RxBool isShowDate = false.obs; //是否显示日期
|
||||||
RxInt templateType = 0.obs; //1:短信 2:邮件
|
RxInt templateType = 0.obs; //1:短信 2:邮件
|
||||||
RxInt smsCost = 0.obs; //短信条数
|
RxInt smsCost = 0.obs; //短信条数
|
||||||
|
RxString preContent = ''.obs; //预览内容
|
||||||
|
RxBool isUpdate = false.obs; //是否是修改模板
|
||||||
}
|
}
|
||||||
|
|||||||
@ -72,8 +72,9 @@ class _CustomSMSTemplateListPageState extends State<CustomSMSTemplateListPage> {
|
|||||||
templateData.typeName =
|
templateData.typeName =
|
||||||
templateData.contentType == 1 ? '电子钥匙' : '密码';
|
templateData.contentType == 1 ? '电子钥匙' : '密码';
|
||||||
final result = await Get.toNamed(Routers.newSMSTemplatePage,
|
final result = await Get.toNamed(Routers.newSMSTemplatePage,
|
||||||
arguments: <String, SMSTemplateData>{
|
arguments: {
|
||||||
'currentTemplate': templateData
|
'currentTemplate': templateData,
|
||||||
|
'isUpdate': false
|
||||||
});
|
});
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
logic.getSMSTemplateListRequest(isRefresh: true);
|
logic.getSMSTemplateListRequest(isRefresh: true);
|
||||||
@ -207,9 +208,7 @@ class _CustomSMSTemplateListPageState extends State<CustomSMSTemplateListPage> {
|
|||||||
templateData.type = itemData.type;
|
templateData.type = itemData.type;
|
||||||
templateData.isUpdate = true;
|
templateData.isUpdate = true;
|
||||||
final result = await Get.toNamed(Routers.newSMSTemplatePage,
|
final result = await Get.toNamed(Routers.newSMSTemplatePage,
|
||||||
arguments: <String, SMSTemplateData>{
|
arguments: {'currentTemplate': templateData, 'isUpdate': true});
|
||||||
'currentTemplate': templateData
|
|
||||||
});
|
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
logic.getSMSTemplateListRequest(isRefresh: true);
|
logic.getSMSTemplateListRequest(isRefresh: true);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user