60 lines
1.8 KiB
Dart
60 lines
1.8 KiB
Dart
import 'package:flutter/material.dart';
|
||
import 'package:get/get.dart';
|
||
import 'package:star_lock/translations/trans_lib.dart';
|
||
|
||
class MineBindPhoneOrEmailState {
|
||
final TextEditingController accountController = TextEditingController();
|
||
final TextEditingController codeController = TextEditingController();
|
||
|
||
static int currentTimeMillis() {
|
||
return DateTime.now().millisecondsSinceEpoch;
|
||
}
|
||
|
||
var countryCode = '86'.obs;
|
||
var countryName = '中国'.obs;
|
||
|
||
var countryId = '9'.obs;
|
||
var codeType = '4'.obs; //1注册,2找回密码,3绑定手机号,4解绑手机(换绑),5删除账号,6 绑定邮箱,7解绑邮箱(换绑)
|
||
var channel = '1'.obs; //短信通道 1 短信,2 邮箱
|
||
var verificationCode = ''.obs;
|
||
var xWidth = ''.obs; // 滑动验证码滑动位置
|
||
var canSub = false.obs;
|
||
var date = currentTimeMillis().toString().obs;
|
||
var inputAccount = ''.obs; //新账号
|
||
var unbindToken = ''.obs; //解绑的Token
|
||
|
||
var accountIsOK = false.obs;
|
||
bool get codeIsOK => verificationCode.value.isNotEmpty;
|
||
|
||
var canResend = false.obs;
|
||
var btnText = ''.obs;
|
||
var totalSeconds = 120;
|
||
var currentSecond = 120;
|
||
|
||
MineBindPhoneOrEmailState() {
|
||
Map map = Get.arguments;
|
||
if (map["unbindToken"] != null) {
|
||
unbindToken.value = map["unbindToken"];
|
||
}
|
||
channel.value = map["isFrom"];
|
||
//短信通道 1 短信,2 邮箱
|
||
//短信类型 1注册,2找回密码,3绑定手机号,4解绑(换绑),5删除账号,6 绑定邮箱
|
||
if (channel.value == "1") {
|
||
codeType.value = "3";
|
||
} else {
|
||
codeType.value = "6";
|
||
}
|
||
|
||
resetResend();
|
||
}
|
||
|
||
void resetResend() {
|
||
canResend.value = totalSeconds == currentSecond;
|
||
btnText.value = !canResend.value
|
||
? '$currentSecond s'
|
||
: btnText.value = TranslationLoader.lanKeys!.getVerificationCode!.tr;
|
||
}
|
||
|
||
void onClose() {}
|
||
}
|