|
|
|
@ -40,10 +40,12 @@ class _LoginPageState extends State<LoginPage> {
|
|
|
|
|
int _countDownNum = 59;
|
|
|
|
|
late TextEditingController _phoneController;
|
|
|
|
|
late TextEditingController _smsCodeController;
|
|
|
|
|
late FocusNode _phoneFocusNode ;
|
|
|
|
|
late FocusNode _phoneFocusNode;
|
|
|
|
|
|
|
|
|
|
late FocusNode _smsCodeFocusNode;
|
|
|
|
|
bool _cantSelected = false;
|
|
|
|
|
DateTime? _lastTap;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
@ -121,35 +123,36 @@ class _LoginPageState extends State<LoginPage> {
|
|
|
|
|
blM: false,
|
|
|
|
|
border: _phoneController.text.length != 11,
|
|
|
|
|
opacity: _phoneController.text.length == 11 ? 1 : 0.4,
|
|
|
|
|
onTap: () async{
|
|
|
|
|
onTap: () async {
|
|
|
|
|
// DateTime? _lastTap;
|
|
|
|
|
if (_phoneController.text.length < 11) {
|
|
|
|
|
BotToast.showText(text: "请输入手机号");
|
|
|
|
|
}else if(_smsCodeController.text.length < 6){
|
|
|
|
|
} else if (_smsCodeController.text.length < 6) {
|
|
|
|
|
BotToast.showText(text: "请输入验证码");
|
|
|
|
|
}else if(!_chooseAgreement){
|
|
|
|
|
} else if (!_chooseAgreement) {
|
|
|
|
|
BotToast.showText(text: "请同意并勾选隐私政策");
|
|
|
|
|
}else{
|
|
|
|
|
if(_lastTap != null &&DateTime.now().difference(_lastTap!).inSeconds < 2){
|
|
|
|
|
} else {
|
|
|
|
|
if (_lastTap != null &&
|
|
|
|
|
DateTime.now().difference(_lastTap!).inSeconds < 2) {
|
|
|
|
|
// BotToast.showText(text: "过快");
|
|
|
|
|
return ;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
_lastTap = DateTime.now();
|
|
|
|
|
var base = await apiClient.request(API.app.login,
|
|
|
|
|
data: {'phone': _phoneController.text, 'code': _smsCodeController.text});
|
|
|
|
|
var base = await apiClient.request(API.app.login, data: {
|
|
|
|
|
'phone': _phoneController.text,
|
|
|
|
|
'code': _smsCodeController.text
|
|
|
|
|
});
|
|
|
|
|
if (base.code == 0) {
|
|
|
|
|
print("123123${base.data['token']}");
|
|
|
|
|
await UserTool.userProvider.setToken(base.data['token']);
|
|
|
|
|
// print(a);
|
|
|
|
|
// print("4567899");
|
|
|
|
|
Get.offAll(const TabNavigator());
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
} else {
|
|
|
|
|
CloudToast.show(base.msg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
text: "立即登录",
|
|
|
|
|
),
|
|
|
|
|
32.hb,
|
|
|
|
@ -223,10 +226,12 @@ class _LoginPageState extends State<LoginPage> {
|
|
|
|
|
await apiClient.request(API.app.captcha, data: {
|
|
|
|
|
'phone': _phoneController.text,
|
|
|
|
|
});
|
|
|
|
|
var res= RegExp( r'^((13[0-9])|(14[0-9])|(15[0-9])|(16[0-9])|(17[0-9])|(18[0-9])|(19[0-9]))\d{8}$');
|
|
|
|
|
if((_phoneController.text).isNotEmpty && res.hasMatch(_phoneController.text)){
|
|
|
|
|
var res = RegExp(
|
|
|
|
|
r'^((13[0-9])|(14[0-9])|(15[0-9])|(16[0-9])|(17[0-9])|(18[0-9])|(19[0-9]))\d{8}$');
|
|
|
|
|
if ((_phoneController.text).isNotEmpty &&
|
|
|
|
|
res.hasMatch(_phoneController.text)) {
|
|
|
|
|
_beginCountDown();
|
|
|
|
|
}else{
|
|
|
|
|
} else {
|
|
|
|
|
BotToast.showText(text: "手机号不能为空且手机号格式错误");
|
|
|
|
|
}
|
|
|
|
|
if (_cantSelected) return;
|
|
|
|
@ -308,9 +313,10 @@ class _LoginPageState extends State<LoginPage> {
|
|
|
|
|
final TapGestureRecognizer recognizer = TapGestureRecognizer();
|
|
|
|
|
recognizer.onTap = () {
|
|
|
|
|
if (kDebugMode) {
|
|
|
|
|
Get.to(()=>const ContentAuthorityPage());
|
|
|
|
|
Get.to(() => const ContentAuthorityPage());
|
|
|
|
|
// print("点击协议了");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///跳转到用户协议页面
|
|
|
|
|
};
|
|
|
|
|
return recognizer;
|
|
|
|
@ -336,12 +342,11 @@ class _LoginPageState extends State<LoginPage> {
|
|
|
|
|
: const Icon(CupertinoIcons.checkmark_circle,
|
|
|
|
|
size: 18, color: Colors.blue),
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
RichText(
|
|
|
|
|
text: TextSpan(
|
|
|
|
|
text: "我已阅读并同意",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: BaseStyle.colorcccccc, fontSize: 12 * 2.sp),
|
|
|
|
|
style:
|
|
|
|
|
TextStyle(color: BaseStyle.colorcccccc, fontSize: 12 * 2.sp),
|
|
|
|
|
children: [
|
|
|
|
|
// TextSpan(
|
|
|
|
|
// text: '《用户服务协议》',
|
|
|
|
@ -356,7 +361,9 @@ class _LoginPageState extends State<LoginPage> {
|
|
|
|
|
text: '《短信帮手隐私协议》',
|
|
|
|
|
style: TextStyle(color: kPrimaryColor, fontSize: 12 * 2.sp),
|
|
|
|
|
recognizer: _recognizer(context, 2)),
|
|
|
|
|
]))
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|