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