|
|
|
@ -51,14 +51,14 @@ class _LoginPageState extends State<LoginPage> {
|
|
|
|
|
_phoneController = TextEditingController();
|
|
|
|
|
_smsCodeController = TextEditingController();
|
|
|
|
|
final userProvider = Provider.of<UserProvider>(context, listen: false);
|
|
|
|
|
// var env = const String.fromEnvironment('ENV', defaultValue: 'dev');
|
|
|
|
|
// if (kDebugMode) {
|
|
|
|
|
// print('env :$env');
|
|
|
|
|
// }
|
|
|
|
|
// DevEV.instance.setEnvironment(
|
|
|
|
|
// context,
|
|
|
|
|
// environment: env == 'dev',
|
|
|
|
|
// );
|
|
|
|
|
var env = const String.fromEnvironment('ENV', defaultValue: 'dev');
|
|
|
|
|
if (kDebugMode) {
|
|
|
|
|
print('env :$env');
|
|
|
|
|
}
|
|
|
|
|
DevEV.instance.setEnvironment(
|
|
|
|
|
context,
|
|
|
|
|
environment: env == 'dev',
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@ -121,6 +121,7 @@ class _LoginPageState extends State<LoginPage> {
|
|
|
|
|
border: _phoneController.text.length != 11,
|
|
|
|
|
opacity: _phoneController.text.length == 11 ? 1 : 0.4,
|
|
|
|
|
onTap: () async{
|
|
|
|
|
// DateTime? _lastTap;
|
|
|
|
|
if (_phoneController.text.length < 11) {
|
|
|
|
|
BotToast.showText(text: "请输入手机号");
|
|
|
|
|
}else if(_smsCodeController.text.length < 6){
|
|
|
|
@ -131,14 +132,23 @@ class _LoginPageState extends State<LoginPage> {
|
|
|
|
|
var base = await apiClient.request(API.app.login,
|
|
|
|
|
data: {'phone': _phoneController.text, 'code': _smsCodeController.text});
|
|
|
|
|
if (base.code == 0) {
|
|
|
|
|
print(base.data['token']);
|
|
|
|
|
await UserTool.userProvider.setToken(base.data['token']);
|
|
|
|
|
Get.offAll(() => const TabNavigator());
|
|
|
|
|
} else {
|
|
|
|
|
print("123123${base.data['token']}");
|
|
|
|
|
await UserTool.userProvider.setToken(base.data['token']);
|
|
|
|
|
Get.offAll(const TabNavigator());
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
CloudToast.show(base.msg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// if(_lastTap != null && DateTime.now().difference(_lastTap!).inSeconds < 2){
|
|
|
|
|
// BotToast.showText(text: "点太快");
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// _lastTap = DateTime.now();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
text: "立即登录",
|
|
|
|
|
),
|
|
|
|
|
32.hb,
|
|
|
|
|