更新短信条数不准确问题修复
This commit is contained in:
parent
f9738cdcf7
commit
5c0e5deba2
@ -66,12 +66,10 @@ class NewSMSTemplateLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 更新短信条数的函数
|
// 更新短信条数的函数
|
||||||
void updateSmsCost(String template) {
|
int calculateSmsCost() {
|
||||||
state.smsCost.value = calculateSmsCost(template);
|
final String smsText =
|
||||||
}
|
'${state.templateOneTf.text}\n${state.currentTemplate.value.template}\n${state.templateTwoTf.text}';
|
||||||
|
final int smsCount = smsText.length;
|
||||||
int calculateSmsCost(String template) {
|
|
||||||
final int smsCount = template.length;
|
|
||||||
if (smsCount <= 70) {
|
if (smsCount <= 70) {
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -184,7 +184,7 @@ class _NewSMSTemplatePageState extends State<NewSMSTemplatePage> {
|
|||||||
bottom: 25.h,
|
bottom: 25.h,
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
'预计产生短信条数:${state.smsCost.value}',
|
'预计产生短信条数:${logic.calculateSmsCost()}',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
fontSize: 20.sp,
|
fontSize: 20.sp,
|
||||||
@ -234,9 +234,7 @@ class _NewSMSTemplatePageState extends State<NewSMSTemplatePage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
onChanged: (String value) {
|
onChanged: (String value) {
|
||||||
setState(() {
|
setState(logic.calculateSmsCost);
|
||||||
logic.updateSmsCost(controller.text); // 更新短信条数
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,7 +37,6 @@ class NewSMSTemplateState {
|
|||||||
RxInt selectedTemplateIndex = 0.obs; //选中的模板
|
RxInt selectedTemplateIndex = 0.obs; //选中的模板
|
||||||
RxBool isShowDate = false.obs; //是否显示日期
|
RxBool isShowDate = false.obs; //是否显示日期
|
||||||
RxInt channelType = 0.obs; //1:短信 2:邮件
|
RxInt channelType = 0.obs; //1:短信 2:邮件
|
||||||
RxInt smsCost = 0.obs; //短信条数
|
|
||||||
RxString preContent = ''.obs; //预览内容
|
RxString preContent = ''.obs; //预览内容
|
||||||
RxBool isUpdate = false.obs; //是否是修改模板
|
RxBool isUpdate = false.obs; //是否是修改模板
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user