提交 13c95356 authored 作者: 祁增奎's avatar 祁增奎

bug fix

上级 ed1682c0
......@@ -6,17 +6,11 @@ import 'package:fluttertoast/fluttertoast.dart';
import '../utils/code_send_enum.dart';
class CLXCodeManageLogic extends GetxController {
CLXCodeManageLogic(
{this.maxLength = 6,
this.isFirstResponsed = false,
this.countdownTime = 60});
CLXCodeManageLogic({this.maxLength = 6, this.isFirstResponsed = false});
/// 验证码长度
final int maxLength;
/// 倒计时时间
final int countdownTime;
/// 是否是成为第一响应者
final bool isFirstResponsed;
......@@ -27,7 +21,7 @@ class CLXCodeManageLogic extends GetxController {
final TextEditingController codeInoutCtrl = TextEditingController();
/// 倒计时
RxInt countdown = 0.obs;
RxInt countdown = 60.obs;
/// 定时器
Timer? timer;
......@@ -64,7 +58,6 @@ class CLXCodeManageLogic extends GetxController {
super.onInit();
codeInoutCtrl.addListener(_verifyCodeInput);
countdown.value = countdownTime;
if (isFirstResponsed) {
codeInoutFocus.requestFocus();
......@@ -91,7 +84,7 @@ class CLXCodeManageLogic extends GetxController {
/// 发送短信验证码
sendSmsCode() async {
if (countdown.value != countdownTime) {
if (countdown.value != 60) {
return;
}
final result = await getSmsVerificationCode?.call();
......@@ -103,7 +96,7 @@ class CLXCodeManageLogic extends GetxController {
/// 发送语音验证码
sendVoiceCode() async {
if (countdown.value != countdownTime) {
if (countdown.value != 60) {
return;
}
final result = await obtainVoiceVerificationCode?.call();
......@@ -130,7 +123,7 @@ class CLXCodeManageLogic extends GetxController {
if (countdown.value == 0) {
timer.cancel();
codeSendBtn.value = '';
countdown.value = countdownTime;
countdown.value = 60;
handleCodeSendType(isSmsSend: isSmsSend);
handleTipInfo();
} else {
......@@ -183,7 +176,6 @@ class CLXCodeManageLogic extends GetxController {
/// 处理提示信息
handleTipInfo() {
/// 如果输入框内容不为空,则不展示提示信息
isShowTip.value =
codeInoutCtrl.text.isEmpty && countdown.value == countdownTime;
isShowTip.value = codeInoutCtrl.text.isEmpty && countdown.value == 60;
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论