2024-10-15 18:32:11 +08:00
|
|
|
|
|
2023-10-09 18:45:10 +08:00
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
import 'package:get/get.dart';
|
|
|
|
|
|
|
2023-10-11 18:24:52 +08:00
|
|
|
|
class MineBindPhoneOrEmailState {
|
2024-08-21 14:12:15 +08:00
|
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
|
}
|
2023-10-09 18:45:10 +08:00
|
|
|
|
final TextEditingController accountController = TextEditingController();
|
|
|
|
|
|
final TextEditingController codeController = TextEditingController();
|
|
|
|
|
|
|
|
|
|
|
|
static int currentTimeMillis() {
|
|
|
|
|
|
return DateTime.now().millisecondsSinceEpoch;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-01 18:54:32 +08:00
|
|
|
|
RxString countryCode = '86'.obs;
|
2024-08-21 14:12:15 +08:00
|
|
|
|
RxString countryName = '中国'.tr.obs;
|
2024-08-01 18:54:32 +08:00
|
|
|
|
|
|
|
|
|
|
RxString countryId = '9'.obs;
|
|
|
|
|
|
RxString codeType = '4'.obs; //1注册,2找回密码,3绑定手机号,4解绑手机(换绑),5删除账号,6 绑定邮箱,7解绑邮箱(换绑)
|
|
|
|
|
|
RxString channel = '1'.obs; //短信通道 1 短信,2 邮箱
|
|
|
|
|
|
RxString verificationCode = ''.obs;
|
|
|
|
|
|
RxString xWidth = ''.obs; // 滑动验证码滑动位置
|
|
|
|
|
|
RxBool canSub = false.obs;
|
|
|
|
|
|
RxString date = currentTimeMillis().toString().obs;
|
|
|
|
|
|
RxString inputAccount = ''.obs; //新账号
|
|
|
|
|
|
RxString unbindToken = ''.obs; //解绑的Token
|
|
|
|
|
|
|
|
|
|
|
|
RxBool accountIsOK = false.obs;
|
2023-10-09 18:45:10 +08:00
|
|
|
|
bool get codeIsOK => verificationCode.value.isNotEmpty;
|
|
|
|
|
|
|
2024-08-01 18:54:32 +08:00
|
|
|
|
RxBool canResend = false.obs;
|
|
|
|
|
|
RxString btnText = ''.obs;
|
|
|
|
|
|
int totalSeconds = 120;
|
|
|
|
|
|
int currentSecond = 120;
|
2023-10-09 18:45:10 +08:00
|
|
|
|
|
|
|
|
|
|
void resetResend() {
|
|
|
|
|
|
canResend.value = totalSeconds == currentSecond;
|
|
|
|
|
|
btnText.value = !canResend.value
|
|
|
|
|
|
? '$currentSecond s'
|
2024-08-01 18:54:32 +08:00
|
|
|
|
: btnText.value = '获取验证码'.tr;
|
2023-10-09 18:45:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void onClose() {}
|
|
|
|
|
|
}
|