|
|
@ -1,4 +1,5 @@
|
|
|
|
import 'dart:async';
|
|
|
|
import 'dart:async';
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:bot_toast/bot_toast.dart';
|
|
|
|
import 'package:bot_toast/bot_toast.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/foundation.dart';
|
|
|
|
import 'package:flutter/foundation.dart';
|
|
|
@ -9,6 +10,7 @@ import 'package:project_telephony/ui/login/login_psd_page.dart';
|
|
|
|
import 'package:project_telephony/ui/user/set_password_page.dart';
|
|
|
|
import 'package:project_telephony/ui/user/set_password_page.dart';
|
|
|
|
import 'package:project_telephony/ui/widget/plone_back_button.dart';
|
|
|
|
import 'package:project_telephony/ui/widget/plone_back_button.dart';
|
|
|
|
import 'package:project_telephony/utils/headers.dart';
|
|
|
|
import 'package:project_telephony/utils/headers.dart';
|
|
|
|
|
|
|
|
|
|
|
|
import '../../base/base_style.dart';
|
|
|
|
import '../../base/base_style.dart';
|
|
|
|
import '../../constants/api.dart';
|
|
|
|
import '../../constants/api.dart';
|
|
|
|
import '../../constants/environment/environment.dart';
|
|
|
|
import '../../constants/environment/environment.dart';
|
|
|
@ -75,7 +77,6 @@ class _LoginPageState extends State<LoginPage> {
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
|
|
|
|
|
|
|
return CloudScaffold(
|
|
|
|
return CloudScaffold(
|
|
|
|
systemStyle: const SystemUiOverlayStyle(
|
|
|
|
systemStyle: const SystemUiOverlayStyle(
|
|
|
|
statusBarIconBrightness: Brightness.dark,
|
|
|
|
statusBarIconBrightness: Brightness.dark,
|
|
|
@ -124,7 +125,7 @@ class _LoginPageState extends State<LoginPage> {
|
|
|
|
const Spacer(),
|
|
|
|
const Spacer(),
|
|
|
|
TextButton(
|
|
|
|
TextButton(
|
|
|
|
onPressed: () {
|
|
|
|
onPressed: () {
|
|
|
|
Get.to(()=>const LoginPsdPage());
|
|
|
|
Get.to(() => const LoginPsdPage());
|
|
|
|
},
|
|
|
|
},
|
|
|
|
child: const Text(
|
|
|
|
child: const Text(
|
|
|
|
'密码登录',
|
|
|
|
'密码登录',
|
|
|
@ -155,17 +156,25 @@ class _LoginPageState extends State<LoginPage> {
|
|
|
|
// BotToast.showText(text: "过快");
|
|
|
|
// BotToast.showText(text: "过快");
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_lastTap = DateTime.now();
|
|
|
|
_lastTap = DateTime.now();
|
|
|
|
|
|
|
|
|
|
|
|
var base = await apiClient.request(API.app.login, data: {
|
|
|
|
var base = await apiClient.request(API.app.login, data: {
|
|
|
|
'phone': _phoneController.text,
|
|
|
|
'phone': _phoneController.text,
|
|
|
|
'code': _smsCodeController.text
|
|
|
|
'code': _smsCodeController.text
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
if (base.code == 0) {
|
|
|
|
if (base.code == 0) {
|
|
|
|
await UserTool.userProvider.setToken(base.data['token']);
|
|
|
|
print("1");
|
|
|
|
Get.offAll(const TabNavigator());
|
|
|
|
await UserTool.userProvider.setToken(base.data['token']);
|
|
|
|
if (UserTool.userProvider.userInfo.havePwd == 0) {
|
|
|
|
print("2");
|
|
|
|
Get.to(()=>const SetPasswordPage());
|
|
|
|
Get.offAll(const TabNavigator());
|
|
|
|
}
|
|
|
|
print("3");
|
|
|
|
|
|
|
|
if (UserTool.userProvider.userInfo.havePwd == 0) {
|
|
|
|
|
|
|
|
Get.to(() => const SetPasswordPage());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
CloudToast.show(base.msg);
|
|
|
|
CloudToast.show(base.msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|